欧洲精品久久久av无码电影,日日噜噜夜夜爽爽,精品无码国产自产拍在线观看蜜,人妻少妇被粗大爽9797pw,羞国产在线拍揄自揄视频,国产白嫩漂亮美女在线观看,天码欧美日本一道免费,av大片在线无码免费

      歡迎來到同城快修-附近家電維修、家電清洗、家電安裝服務(wù)平臺(tái)

      24小時(shí)家電維修熱線:

      400—1558638

      當(dāng)前位置:主頁 > 空調(diào) > 維修資訊 >

      夏普空調(diào)TIMER亮黃燈怎么回事(夏普空調(diào)跳黃燈突然不運(yùn)作)

      發(fā)布日期:2023-01-16 12:30:25 瀏覽:
      夏普空調(diào)TIMER亮黃燈怎么回事(夏普空調(diào)跳黃燈突然不運(yùn)作)

      前沿拓展:


      最近在整理硬盤資料,前幾年收集的不少chm格式的電子書合集,想復(fù)制到手機(jī)上閱讀,發(fā)現(xiàn)格式又不支持,隨即產(chǎn)生了以下作品,寫個(gè)web服務(wù)器,用來解析電子書,然后就可以隨時(shí)隨地不受限制的讀書了。

      先看效果

      程序很簡(jiǎn)單,只有一個(gè)exe,一個(gè)配置文件。

      雙擊運(yùn)行后,把chm文件解壓后的文件和服務(wù)端程序放一起即可。

      這里放首頁文件。

      下面上代碼

      form代碼

      object Form1: TForm1

      Left = 271

      Top = 114

      Caption = &39;MiniWeb By YSINFO&39;

      ClientHeight = 361

      ClientWidth = 795

      Color = clBtnFace

      Font.Charset = DEFAULT_CHARSET

      Font.Color = clWindowText

      Font.Height = 11

      Font.Name = &39;Tahoma&39;

      Font.Style = []

      OnClose = FormClose

      OnCreate = FormCreate

      OnShow = FormShow

      TextHeight = 13

      object Label1: TLabel

      Left = 24

      Top = 48

      Width = 20

      Height = 13

      Caption = &39;Port&39;

      end

      object Label2: TLabel

      Left = 40

      Top = 280

      Width = 545

      Height = 49

      AutoSize = False

      Caption = &39;Label2&39;

      Font.Charset = DEFAULT_CHARSET

      Font.Color = clWindowText

      Font.Height = 13

      Font.Name = &39;Tahoma&39;

      Font.Style = []

      ParentFont = False

      end

      object ButtonStart: TButton

      Left = 24

      Top = 8

      Width = 75

      Height = 25

      Caption = &39;Start&39;

      TabOrder = 0

      OnClick = ButtonStartClick

      end

      object ButtonStop: TButton

      Left = 105

      Top = 8

      Width = 75

      Height = 25

      Caption = &39;Stop&39;

      TabOrder = 1

      OnClick = ButtonStopClick

      end

      object EditPort: TEdit

      Left = 24

      Top = 67

      Width = 121

      Height = 21

      TabOrder = 2

      Text = &39;8080&39;

      end

      object ButtonOpenBrowser: TButton

      Left = 24

      Top = 112

      Width = 107

      Height = 25

      Caption = &39;Open Browser&39;

      TabOrder = 3

      OnClick = ButtonOpenBrowserClick

      end

      object btnDir: TBitBtn

      Left = 224

      Top = 112

      Width = 107

      Height = 25

      Caption = 251712432031243242073044624405

      TabOrder = 4

      OnClick = btnDirClick

      end

      object btn1: TBitBtn

      Left = 264

      Top = 8

      Width = 107

      Height = 25

      Caption = 2104726032

      TabOrder = 5

      OnClick = btn1Click

      end

      object mmo1: TMemo

      Left = 504

      Top = 8

      Width = 185

      Height = 169

      Lines.Strings = (

      &39;cover.htm&39;

      &39;index0.htm&39;

      &39;index1.htm&39;)

      TabOrder = 6

      end

      object btn2: TBitBtn

      Left = 510

      Top = 192

      Width = 139

      Height = 25

      Caption = 337192146225991202142101534920

      TabOrder = 7

      OnClick = btn2Click

      end

      object ApplicationEvents1: TApplicationEvents

      OnIdle = ApplicationEvents1Idle

      Left = 288

      Top = 24

      end

      object trycn1: TTrayIcon

      PopupMenu = pm1

      Visible = True

      OnDblClick = trycn1DblClick

      Left = 184

      Top = 288

      end

      object pm1: TPopupMenu

      Left = 440

      Top = 104

      object N1: TMenuItem

      Caption = 3686420986

      OnClick = N1Click

      end

      end

      object tmr1: TTimer

      OnTimer = btn1Click

      Left = 424

      Top = 264

      end

      end

      PAS代碼

      unit FormUnit1;

      interface

      uses

      Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants,

      System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs,

      Vcl.AppEvnts, Vcl.StdCtrls, IdHTTPWebBrokerBridge, Web.HTTPApp, Vcl.Buttons,

      Vcl.ExtCtrls, Vcl.Menus;

      type

      TForm1 = class(TForm)

      ButtonStart: TButton;

      ButtonStop: TButton;

      EditPort: TEdit;

      Label1: TLabel;

      ApplicationEvents1: TApplicationEvents;

      ButtonOpenBrowser: TButton;

      btnDir: TBitBtn;

      btn1: TBitBtn;

      trycn1: TTrayIcon;

      Label2: TLabel;

      pm1: TPopupMenu;

      N1: TMenuItem;

      tmr1: TTimer;

      mmo1: TMemo;

      btn2: TBitBtn;

      procedure FormCreate(Sender: TObject);

      procedure ApplicationEvents1Idle(Sender: TObject; var Done: Boolean);

      procedure ButtonStartClick(Sender: TObject);

      procedure ButtonStopClick(Sender: TObject);

      procedure ButtonOpenBrowserClick(Sender: TObject);

      procedure btnDirClick(Sender: TObject);

      procedure btn1Click(Sender: TObject);

      procedure FormClose(Sender: TObject; var Action: TCloseAction);

      procedure FormShow(Sender: TObject);

      procedure N1Click(Sender: TObject);

      procedure trycn1DblClick(Sender: TObject);

      procedure btn2Click(Sender: TObject);

      private

      FServer: TIdHTTPWebBrokerBridge;

      procedure StartServer;

      procedure GetData(Sender: TObject);

      { Private declarations }

      public { Public declarations }

      end;

      var

      Form1: TForm1;

      implementation

      {$R .dfm}

      uses

      Winapi.ShellApi, Datasnap.DSSession, UnitPublic;

      procedure TForm1.ApplicationEvents1Idle(Sender: TObject; var Done: Boolean);

      begin

      ButtonStart.Enabled := not FServer.Active;

      ButtonStop.Enabled := FServer.Active;

      EditPort.Enabled := not FServer.Active;

      end;

      procedure TForm1.GetData(Sender: TObject);

      begin

      Label2.Caption := Format(&39;調(diào)用次數(shù) %s 字節(jié)數(shù):%.2f KB 流量:%s 運(yùn)行時(shí)間:%s &39;, [ncount.ToString, (nsize / 1024), ConvertBytes(nsize), GetSubDateTime(now, dstart)])

      end;

      procedure TForm1.btn1Click(Sender: TObject);

      begin

      GetData(Sender);

      //Label2.Caption:= Format(&39;調(diào)用次數(shù) %s 流量:%s 運(yùn)行時(shí)間:%s &39;,[ncount.ToString,ConvertBytes(nsize) ,GetSubDateTime(now,dstart) ]) ;

      end;

      procedure TForm1.btn2Click(Sender: TObject);

      var

      sl:tstringlist;

      begin

      sl:=GetAllFile(&39;d:\&39;,&39;.&39;);

      sl.SaveToFile(AppPath+&39;d.txt&39;);

      sl.Free;

      end;

      procedure TForm1.btnDirClick(Sender: TObject);

      begin

      openDir(AppPath);

      end;

      procedure TForm1.ButtonOpenBrowserClick(Sender: TObject);

      var

      LURL: string;

      begin

      StartServer;

      LURL := Format(&39;http://192.168.1.13:%s&39;, [EditPort.Text]);

      ShellExecute(0, nil, PChar(LURL), nil, nil, SW_SHOWNOACTIVATE);

      end;

      procedure TForm1.ButtonStartClick(Sender: TObject);

      begin

      StartServer;

      end;

      procedure TerminateThreads;

      begin

      if TDSSessionManager.Instance <> nil then

      TDSSessionManager.Instance.TerminateAllSessions;

      end;

      procedure TForm1.ButtonStopClick(Sender: TObject);

      begin

      TerminateThreads;

      FServer.Active := False;

      FServer.Bindings.Clear;

      end;

      procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);

      begin

      Self.Hide;

      Action := caNone;

      end;

      procedure TForm1.FormCreate(Sender: TObject);

      begin

      EditPort.Text := SetIniNoEn(sconfig, False, &39;set&39;, &39;port&39;, &39;8080&39;);

      mmo1.Text := SetIniNoEn(sconfig, False, &39;set&39;, &39;INDEX&39;, &39;index.htm&39;);

      FServer := TIdHTTPWebBrokerBridge.Create(Self);

      StartServer;

      end;

      procedure TForm1.FormShow(Sender: TObject);

      begin

      getdata(Sender);

      end;

      procedure TForm1.N1Click(Sender: TObject);

      begin

      if MessageDlg(&39;確定退出?&39;, mtConfirmation, mbOKCancel, 0) = mrOk then

      Application.Terminate;

      end;

      procedure TForm1.StartServer;

      var

      I: Integer;

      begin

      if not FServer.Active then

      begin

      FServer.Bindings.Clear;

      FServer.DefaultPort := StrToInt(EditPort.Text);

      FServer.Active := True;

      SetIniNoEn(sconfig, True, &39;set&39;, &39;port&39;, EditPort.Text);

      SetIniNoEn(sconfig, True, &39;set&39;, &39;INDEX&39;, MMO1.Text);

      SetLength(sIndex, mmo1.Lines.Count);

      for I := 0 to mmo1.Lines.Count 1 do

      sIndex[I] := mmo1.Lines[I];

      end;

      end;

      procedure TForm1.trycn1DblClick(Sender: TObject);

      begin

      Self.Show;

      end;

      end.

      unit WebModuleUnit1;

      interface

      uses

      System.SysUtils, System.Classes, Web.HTTPApp, Datasnap.DSHTTPCommon,

      Datasnap.DSHTTPWebBroker, Datasnap.DSServer, Datasnap.DSProxyDispatcher,

      Datasnap.DSProxyJavaAndroid, Datasnap.DSProxyJavaBlackBerry,

      Datasnap.DSProxyObjectiveCiOS, Datasnap.DSProxyCsharpSilverlight,

      Datasnap.DSProxyFreePascal_iOS, Datasnap.DSAuth, IPPeerServer,

      Datasnap.DSMetadata, Datasnap.DSServerMetadata, Winapi.Windows, uQQWry,

      Datasnap.DSClientMetadata, Datasnap.DSCommonServer, Datasnap.DSHTTP, qlog,

      UnitPublic;

      type

      TWebModule1 = class(TWebModule)

      DSHTTPWebDispatcher1: TDSHTTPWebDispatcher;

      DSProxyGenerator1: TDSProxyGenerator;

      DSServerMetaDataProvider1: TDSServerMetaDataProvider;

      DSProxyDispatcher1: TDSProxyDispatcher;

      procedure WebModule1DefaultHandlerAction(Sender: TObject; Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);

      procedure WebModuleCreate(Sender: TObject);

      private

      procedure HandleFileRequest(const FileName: string; Request: TWebRequest; Response: TWebResponse);

      { Private declarations }

      public { Public declarations }

      end;

      var

      WebModuleClass: TComponentClass = TWebModule1;

      implementation

      uses

      ServerMethodsUnit1, ServerContainerUnit1, Web.WebReq, MATH;

      {$R .dfm}

      function StripHTMLTags(const strHTML: string): string;

      var

      P: PChar;

      InTag: Boolean;

      i, intResultLength: Integer;

      begin

      P := PChar(strHTML);

      Result := &39;&39;;

      InTag := False;

      repeat

      case P^ of

      &39;<&39;:

      InTag := True;

      &39;>&39;:

      InTag := False;

      13, 10:

      ; { do nothing }

      else

      if not InTag then

      begin

      if (P^ in [9, 32]) and ((P + 1)^ in [10, 13, 32, 9, &39;<&39;]) then

      else

      Result := Result + P^;

      end;

      end;

      Inc(P);

      until (P^ = 0);

      { convert system characters }

      Result := StringReplace(Result, &39;"&39;, &39;&34;&39;, [rfReplaceAll]);

      Result := StringReplace(Result, &39;'&39;, &39;&39;&39;&39;, [rfReplaceAll]);

      Result := StringReplace(Result, &39;>&39;, &39;>&39;, [rfReplaceAll]);

      Result := StringReplace(Result, &39;<&39;, &39;<&39;, [rfReplaceAll]);

      Result := StringReplace(Result, &39;&&39;, &39;&&39;, [rfReplaceAll]);

      { here you may add another symbols from RFC if you need }

      end;

      function getFileType(inputFile: string): string;

      const

      JPEG_FLAG_BEGIN = $D8FF;

      JPEG_FLAG_END = $D9FF;

      JPEG_FRAME = $C0FF;

      GIF_FLAG_BEGIN = $4947;

      GIF_FLAG_END = $3B00;

      PNG_FLAG_BEGIN = $5089;

      PNG_FLAG_END = $8260;

      BMP_FLAG_BEGIN = $4D42;

      EXE_FLAG_BEGIN = $5A4D;

      ZIP_7Z_FLAG_BEGIN = $7A37;

      ZIP_FLAG_BEGIN = $4B50;

      var

      FileStream: TFileStream;

      BeginFlag, EndFlag: WORD;

      begin

      Result := &39;Unkown&39;;

      FileStream := nil;

      try

      FileStream := TFileStream.Create(inputFile, fmOpenRead);

      FileStream.Position := 0;

      FileStream.Read(BeginFlag, SizeOf(BeginFlag));

      FileStream.Position := FileStream.Size 2;

      FileStream.Read(EndFlag, SizeOf(EndFlag));

      if (BeginFlag = JPEG_FLAG_BEGIN) and (EndFlag = JPEG_FLAG_END) then

      Result := &39;JPG&39;;

      if (BeginFlag = GIF_FLAG_BEGIN) and (EndFlag = GIF_FLAG_END) then

      Result := &39;GIF&39;;

      if (BeginFlag = PNG_FLAG_BEGIN) and (EndFlag = PNG_FLAG_END) then

      Result := &39;PNG&39;;

      if (BeginFlag = BMP_FLAG_BEGIN) then

      Result := &39;BMP&39;;

      if (BeginFlag = EXE_FLAG_BEGIN) then

      Result := &39;EXE&39;;

      if BeginFlag = ZIP_7Z_FLAG_BEGIN then

      Result := &39;7Z&39;;

      if BeginFlag = ZIP_FLAG_BEGIN then

      Result := &39;Zip&39;;

      finally

      freeandnil(FileStream);

      end;

      end;

      function getContect(ext: string): string;

      begin

      if ext[1] = &39;.&39; then

      ext := Copy(ext, 2);

      if ext = &39;ez&39; then

      result := &39;application/andrewinset&39;

      else if ext = &39;hqx&39; then

      result := &39;application/macbinhex40&39;

      else if ext = &39;cpt&39; then

      result := &39;application/maccompactpro&39;

      else if ext = &39;doc&39; then

      result := &39;application/msword&39;

      else if ext = &39;bin&39; then

      result := &39;application/octetstream&39;

      else if ext = &39;dms&39; then

      result := &39;application/octetstream&39;

      else if ext = &39;lha&39; then

      result := &39;application/octetstream&39;

      else if ext = &39;lzh&39; then

      result := &39;application/octetstream&39;

      else if ext = &39;exe&39; then

      result := &39;application/octetstream&39;

      else if ext = &39;class&39; then

      result := &39;application/octetstream&39;

      else if ext = &39;so&39; then

      result := &39;application/octetstream&39;

      else if ext = &39;dll&39; then

      result := &39;application/octetstream&39;

      else if ext = &39;oda&39; then

      result := &39;application/oda&39;

      else if ext = &39;pdf&39; then

      result := &39;application/pdf&39;

      else if ext = &39;ai&39; then

      result := &39;application/postscript&39;

      else if ext = &39;eps&39; then

      result := &39;application/postscript&39;

      else if ext = &39;ps&39; then

      result := &39;application/postscript&39;

      else if ext = &39;smi&39; then

      result := &39;application/smil&39;

      else if ext = &39;smil&39; then

      result := &39;application/smil&39;

      else if ext = &39;mif&39; then

      result := &39;application/vnd.mif&39;

      else if ext = &39;xls&39; then

      result := &39;application/vnd.msexcel&39;

      else if ext = &39;ppt&39; then

      result := &39;application/vnd.mspowerpoint&39;

      else if ext = &39;wbxml&39; then

      result := &39;application/vnd.wap.wbxml&39;

      else if ext = &39;wmlc&39; then

      result := &39;application/vnd.wap.wmlc&39;

      else if ext = &39;wmlsc&39; then

      result := &39;application/vnd.wap.wmlscriptc&39;

      else if ext = &39;bcpio&39; then

      result := &39;application/xbcpio&39;

      else if ext = &39;vcd&39; then

      result := &39;application/xcdlink&39;

      else if ext = &39;pgn&39; then

      result := &39;application/xchesspgn&39;

      else if ext = &39;cpio&39; then

      result := &39;application/xcpio&39;

      else if ext = &39;csh&39; then

      result := &39;application/xcsh&39;

      else if ext = &39;dcr&39; then

      result := &39;application/xdirector&39;

      else if ext = &39;dir&39; then

      result := &39;application/xdirector&39;

      else if ext = &39;dxr&39; then

      result := &39;application/xdirector&39;

      else if ext = &39;dvi&39; then

      result := &39;application/xdvi&39;

      else if ext = &39;spl&39; then

      result := &39;application/xfuturesplash&39;

      else if ext = &39;gtar&39; then

      result := &39;application/xgtar&39;

      else if ext = &39;hdf&39; then

      result := &39;application/xhdf&39;

      else if ext = &39;js&39; then

      result := &39;application/xjavascript&39;

      else if ext = &39;skp&39; then

      result := &39;application/xkoan&39;

      else if ext = &39;skd&39; then

      result := &39;application/xkoan&39;

      else if ext = &39;skt&39; then

      result := &39;application/xkoan&39;

      else if ext = &39;skm&39; then

      result := &39;application/xkoan&39;

      else if ext = &39;latex&39; then

      result := &39;application/xlatex&39;

      else if ext = &39;nc&39; then

      result := &39;application/xnetcdf&39;

      else if ext = &39;cdf&39; then

      result := &39;application/xnetcdf&39;

      else if ext = &39;sh&39; then

      result := &39;application/xsh&39;

      else if ext = &39;shar&39; then

      result := &39;application/xshar&39;

      else if ext = &39;swf&39; then

      result := &39;application/xshockwaveflash&39;

      else if ext = &39;sit&39; then

      result := &39;application/xstuffit&39;

      else if ext = &39;sv4cpio&39; then

      result := &39;application/xsv4cpio&39;

      else if ext = &39;sv4crc&39; then

      result := &39;application/xsv4crc&39;

      else if ext = &39;tar&39; then

      result := &39;application/xtar&39;

      else if ext = &39;tcl&39; then

      result := &39;application/xtcl&39;

      else if ext = &39;tex&39; then

      result := &39;application/xtex&39;

      else if ext = &39;texinfo&39; then

      result := &39;application/xtexinfo&39;

      else if ext = &39;texi&39; then

      result := &39;application/xtexinfo&39;

      else if ext = &39;t&39; then

      result := &39;application/xtroff&39;

      else if ext = &39;tr&39; then

      result := &39;application/xtroff&39;

      else if ext = &39;roff&39; then

      result := &39;application/xtroff&39;

      else if ext = &39;man&39; then

      result := &39;application/xtroffman&39;

      else if ext = &39;me&39; then

      result := &39;application/xtroffme&39;

      else if ext = &39;ms&39; then

      result := &39;application/xtroffms&39;

      else if ext = &39;ustar&39; then

      result := &39;application/xustar&39;

      else if ext = &39;src&39; then

      result := &39;application/xwaissource&39;

      else if ext = &39;xhtml&39; then

      result := &39;application/xhtml+xml&39;

      else if ext = &39;xht&39; then

      result := &39;application/xhtml+xml&39;

      else if ext = &39;zip&39; then

      result := &39;application/zip&39;

      else if ext = &39;au&39; then

      result := &39;audio/basic&39;

      else if ext = &39;snd&39; then

      result := &39;audio/basic&39;

      else if ext = &39;mid&39; then

      result := &39;audio/midi&39;

      else if ext = &39;midi&39; then

      result := &39;audio/midi&39;

      else if ext = &39;kar&39; then

      result := &39;audio/midi&39;

      else if ext = &39;mpga&39; then

      result := &39;audio/mpeg&39;

      else if ext = &39;mp2&39; then

      result := &39;audio/mpeg&39;

      else if ext = &39;mp3&39; then

      result := &39;audio/mpeg&39;

      else if ext = &39;aif&39; then

      result := &39;audio/xaiff&39;

      else if ext = &39;aiff&39; then

      result := &39;audio/xaiff&39;

      else if ext = &39;aifc&39; then

      result := &39;audio/xaiff&39;

      else if ext = &39;m3u&39; then

      result := &39;audio/xmpegurl&39;

      else if ext = &39;ram&39; then

      result := &39;audio/xpnrealaudio&39;

      else if ext = &39;rm&39; then

      result := &39;audio/xpnrealaudio&39;

      else if ext = &39;rpm&39; then

      result := &39;audio/xpnrealaudioplugin&39;

      else if ext = &39;ra&39; then

      result := &39;audio/xrealaudio&39;

      else if ext = &39;wav&39; then

      result := &39;audio/xwav&39;

      else if ext = &39;pdb&39; then

      result := &39;chemical/xpdb&39;

      else if ext = &39;xyz&39; then

      result := &39;chemical/xxyz&39;

      else if ext = &39;bmp&39; then

      result := &39;image/bmp&39;

      else if ext = &39;gif&39; then

      result := &39;image/gif&39;

      else if ext = &39;ief&39; then

      result := &39;image/ief&39;

      else if ext = &39;jpeg&39; then

      result := &39;image/jpeg&39;

      else if ext = &39;jpg&39; then

      result := &39;image/jpeg&39;

      else if ext = &39;jpe&39; then

      result := &39;image/jpeg&39;

      else if ext = &39;png&39; then

      result := &39;image/png&39;

      else if ext = &39;tiff&39; then

      result := &39;image/tiff&39;

      else if ext = &39;tif&39; then

      result := &39;image/tiff&39;

      else if ext = &39;djvu&39; then

      result := &39;image/vnd.djvu&39;

      else if ext = &39;djv&39; then

      result := &39;image/vnd.djvu&39;

      else if ext = &39;wbmp&39; then

      result := &39;image/vnd.wap.wbmp&39;

      else if ext = &39;ras&39; then

      result := &39;image/xcmuraster&39;

      else if ext = &39;pnm&39; then

      result := &39;image/xportableanymap&39;

      else if ext = &39;pbm&39; then

      result := &39;image/xportablebitmap&39;

      else if ext = &39;pgm&39; then

      result := &39;image/xportablegraymap&39;

      else if ext = &39;ppm&39; then

      result := &39;image/xportablepixmap&39;

      else if ext = &39;rgb&39; then

      result := &39;image/xrgb&39;

      else if ext = &39;xbm&39; then

      result := &39;image/xxbitmap&39;

      else if ext = &39;xpm&39; then

      result := &39;image/xxpixmap&39;

      else if ext = &39;xwd&39; then

      result := &39;image/xxwindowdump&39;

      else if ext = &39;igs&39; then

      result := &39;model/iges&39;

      else if ext = &39;iges&39; then

      result := &39;model/iges&39;

      else if ext = &39;msh&39; then

      result := &39;model/mesh&39;

      else if ext = &39;mesh&39; then

      result := &39;model/mesh&39;

      else if ext = &39;silo&39; then

      result := &39;model/mesh&39;

      else if ext = &39;wrl&39; then

      result := &39;model/vrml&39;

      else if ext = &39;vrml&39; then

      result := &39;model/vrml&39;

      else if ext = &39;css&39; then

      result := &39;text/css&39;

      else if ext = &39;html&39; then

      result := &39;text/html;charset=GB2312&39;

      else if ext = &39;htm&39; then

      result := &39;text/html;charset=GB2312&39; // Response.ContentType := &39;text/html;charset=GB2312&39;;&39;

      else if ext = &39;asc&39; then

      result := &39;text/plain&39;

      else if ext = &39;txt&39; then

      result := &39;text/plain&39;

      else if ext = &39;rtx&39; then

      result := &39;text/richtext&39;

      else if ext = &39;rtf&39; then

      result := &39;text/rtf&39;

      else if ext = &39;sgml&39; then

      result := &39;text/sgml&39;

      else if ext = &39;sgm&39; then

      result := &39;text/sgml&39;

      else if ext = &39;tsv&39; then

      result := &39;text/tabseparatedvalues&39;

      else if ext = &39;wml&39; then

      result := &39;text/vnd.wap.wml&39;

      else if ext = &39;wmls&39; then

      result := &39;text/vnd.wap.wmlscript&39;

      else if ext = &39;etx&39; then

      result := &39;text/xsetext&39;

      else if ext = &39;xsl&39; then

      result := &39;text/xml&39;

      else if ext = &39;xml&39; then

      result := &39;text/xml&39;

      else if ext = &39;mpeg&39; then

      result := &39;video/mpeg&39;

      else if ext = &39;mpg&39; then

      result := &39;video/mpeg&39;

      else if ext = &39;mp4&39; then

      result := &39;video/mpeg&39;

      else if ext = &39;mpe&39; then

      result := &39;video/mpeg&39;

      else if ext = &39;qt&39; then

      result := &39;video/quicktime&39;

      else if ext = &39;mov&39; then

      result := &39;video/quicktime&39;

      else if ext = &39;mxu&39; then

      result := &39;video/vnd.mpegurl&39;

      else if ext = &39;avi&39; then

      result := &39;video/xmsvideo&39;

      else if ext = &39;movie&39; then

      result := &39;video/xsgimovie&39;

      else if ext = &39;ice&39; then

      result := &39;xconference/xcooltalk&39;;

      end;

      procedure TWebModule1.HandleFileRequest(const FileName: string; Request: TWebRequest; Response: TWebResponse);

      var

      FC, Ext: string;

      FS: TFileStream;

      // SL: TStringList;

      begin {

      處理來自瀏覽器對(duì)靜態(tài)頁面文件的請(qǐng)求:對(duì)于 Stand alone 模式的 WebBroker 程序,

      這個(gè)默認(rèn) Action 可以用來當(dāng)作一個(gè) Web Server 的根:如果請(qǐng)求的 path 是一個(gè)文件

      ,則返回一個(gè)文件給客戶端。這樣,http://ip/WebBroker.exe/abc.html就可以從這里返回。

      }

      try

      if FileExists(FileName) then

      begin // 以下代碼,測(cè)試通過。網(wǎng)頁里面有圖片鏈接。網(wǎng)頁能夠正確顯示圖片。

      Ext := LowerCase(ExtractFileExt(FileName));

      if (Ext = &39;.html&39;) or (Ext = &39;.htm&39;) or (Ext = &39;.css&39;) or (Ext = &39;.js&39;) or (Ext = &39;.txt&39;) then

      begin

      {

      下載文本文件給瀏覽器,

      不能將文本文件加載為字符串然后用字符串返回,而是應(yīng)該直接用 Stream 來返回。

      用字符串返回,可能會(huì)有問題。估計(jì)原因是文件里面的字符串有些字符的編碼有問題導(dǎo)致。

      }

      FS := TFileStream.Create(FileName, fmOpenRead);

      Response.ContentStream := FS;

      if (Ext = &39;.html&39;) or (Ext = &39;.htm&39;) then

      begin

      // sl:=TStringList.Create;

      // SL.LoadFromFile(FileName);

      Response.ContentType := &39;text/html;charset=GB2312&39;;

      // Response.Content:=SL.Text;

      end

      else if (Ext = &39;.css&39;) then

      begin

      Response.ContentType := &39;text/css&39;;

      end

      else if (Ext = &39;.js&39;) then

      begin

      Response.ContentType := &39;text/javascript&39;;

      end

      else if (Ext = &39;.txt&39;) then

      begin

      Response.ContentType := &39;text/plain&39;;

      end;

      Response.ContentType := getContect(Ext);

      end

      else if (Ext = &39;.jpg&39;) or (Ext = &39;.jpeg&39;) or (Ext = &39;.png&39;) or (Ext = &39;.bmp&39;) or (Ext = &39;.gif&39;) then

      begin

      FS := TFileStream.Create(FileName, fmOpenRead);

      Response.ContentStream := FS;

      // Response.ContentType := &39;image/&39;+Ext;

      Response.ContentType := getContect(Ext);

      end

      else

      begin

      FS := TFileStream.Create(FileName, fmShareDenyNone);

      Response.ContentStream := FS;

      Response.ContentType := getContect(Ext);

      end

      end;

      except

      on e: Exception do

      Logs.Post(llError, e.Message);

      end;

      end;

      function FormatByteSize(const bytes: LongInt): string;

      const

      B = 1; //byte

      KB = 1024 B; //kilobyte

      MB = 1024 KB; //megabyte

      GB = 1024 MB; //gigabyte

      begin

      if bytes > GB then

      result := FormatFloat(&39;. GB&39;, bytes / GB)

      else if bytes > MB then

      result := FormatFloat(&39;. MB&39;, bytes / MB)

      else if bytes > KB then

      result := FormatFloat(&39;. KB&39;, bytes / KB)

      else

      result := FormatFloat(&39;. bytes&39;, bytes);

      end;

      procedure TWebModule1.WebModule1DefaultHandlerAction(Sender: TObject; Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);

      var

      S, slog,slocal: string;

      SL: TStringList;

      i: Integer;

      begin { StandAlone 模式下,

      作為一個(gè) WebServer,瀏覽器請(qǐng)求的靜態(tài)文件,需要直接輸出。如果瀏覽器沒有請(qǐng)求靜態(tài)文件,則輸出動(dòng)態(tài)創(chuàng)

      建的默認(rèn)頁面給瀏覽器。 }

      try

      try

      ncount := ncount + 1;

      // slocal:= getlocal(Request.RemoteIP);

      slog := Format(&39;count=%s ,RemoteIP=%s,%s,Request.URL=%s,Request.Method=%s ,Request.Content=%s ,Request.PathInfo=%s&39;,

      [ncount.ToString, Request.RemoteIP,slocal, Request.URL, Request.Method, Request.Content, Request.PathInfo]);

      Logs.Post(llMessage, slog);

      // Logs.Post(llMessage, ncount.ToString+ &39;: Request.PathInfo=&39; + Request.PathInfo);

      // 獲取文件名 http://localhost:8080/asdf.js?a=123&b=666

      // Logs.Post(llMessage, &39;Request.Query=&39; + Request.Query); // 獲取參數(shù)

      // Logs.Post(llMessage, &39;Request.Content=&39; + Request.Content);

      // for i := 0 to Request.QueryFields.Count 1 do // 取數(shù)數(shù)個(gè)數(shù)

      // begin

      // Logs.Post(llMessage, Format(&39;Request.QueryFields[%s]&39;, [i.ToString]) +

      // Request.QueryFields[i]); // 取單個(gè)參數(shù)

      // end;

      S := Request.PathInfo;

      if FileExists(AppPath + S) then

      begin

      Self.HandleFileRequest(AppPath + S, Request, Response);

      nsize := FileSizeEx(AppPath + S) + nsize;

      Logs.Post(llMessage, &39;已發(fā)送流量:&39; + (nsize / 1024).ToString + &39; KB &39; + ConvertBytes(nsize));

      end

      else if S = &39;/&39; then

      begin

      for I := Low(sindex) to High(sindex) do

      if FileExists(AppPath+&39;/&39;+sIndex[I]) then

      begin

      SL := TStringList.Create;

      // SL.LoadFromFile(AppPath + &39;/cover.htm&39;);

      SL.LoadFromFile(AppPath+&39;/&39;+sIndex[I]);

      Response.ContentType := &39;text/html;charset=GB2312&39;;

      S := &39;&39;;

      S := &39;<html><head></head><body>這是默認(rèn)頁面</body></html>&39;;

      Response.Content := SL.Text;

      SL.Free;

      Break;

      end;

      end

      else

      begin

      for I := Low(sindex) to High(sindex) do

      if FileExists(AppPath+&39;/&39;+sIndex[I]) then

      begin

      SL := TStringList.Create;

      // SL.LoadFromFile(AppPath + &39;/cover.htm&39;);

      SL.LoadFromFile(AppPath+&39;/&39;+sIndex[I]);

      Response.ContentType := &39;text/html;charset=GB2312&39;;

      S := &39;&39;;

      S := &39;<html><head></head><body>這是默認(rèn)頁面</body></html>&39;;

      Response.Content := SL.Text;

      SL.Free;

      Break;

      end ;

      // Response.Content := &39;&39;;

      // SL := TStringList.Create;

      // SL.LoadFromFile(AppPath + &39;/index.htm&39;);

      // Response.ContentType := &39;text/html;charset=GB2312&39;;

      // S := &39;&39;;

      // S := &39;<html><head></head><body>這是默認(rèn)頁面</body></html>&39;;

      // Response.Content := SL.Text;

      // SL.Free;

      end;

      except

      on e: Exception do

      Logs.Post(llMessage, e.Message);

      end;

      finally

      Handled := True;

      end;

      end;

      // procedure TWebModule1.WebModule1DefaultHandlerAction(Sender: TObject;

      // Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);

      // var

      // i: Integer;

      // S, sname: string;

      // SL: TStringList;

      // myst: TMemoryStream;

      // begin

      //

      // try

      //

      // try

      //

      // Logs.Post(llMessage, &39;Request.PathInfo=&39; + Request.PathInfo);

      // // 獲取文件名 http://localhost:8080/asdf.js?a=123&b=666

      //

      // Logs.Post(llMessage, &39;Request.Query=&39; + Request.Query); // 獲取參數(shù)

      // Logs.Post(llMessage, &39;Request.Content=&39; + Request.Content);

      // for i := 0 to Request.QueryFields.Count 1 do // 取數(shù)數(shù)個(gè)數(shù)

      // begin

      // Logs.Post(llMessage, Format(&39;Request.QueryFields[%s]&39;, [i.ToString]) +

      // Request.QueryFields[i]); // 取單個(gè)參數(shù)

      // end;

      //

      // SL := nil;

      // myst := nil;

      //

      // SL := TStringList.Create;

      // myst := TMemoryStream.Create;

      //

      // S := Request.PathInfo;

      // sname := AppPath + S;

      //

      // if FileExists(sname) then

      // begin

      //

      // if getFileType(sname) <> &39;Unkown&39; then

      //

      // begin

      // myst.LoadFromFile(sname);

      // Response.ContentStream := myst;

      //

      // Response.SendResponse;

      // end

      // else

      //

      // begin

      // SL.LoadFromFile(AppPath + &39;/index.htm&39;);

      //

      // Response.ContentType := &39;text/html;charset=GB2312&39;;

      // // 解決 Response 返回中文亂碼問題

      // Response.Content := SL.Text;

      // end;

      //

      // end

      // else

      //

      // begin

      // if S = &39;/&39; then

      //

      // begin

      // SL.LoadFromFile(AppPath + &39;/index.htm&39;);

      //

      // Response.ContentType := &39;text/html;charset=GB2312&39;;

      // // 解決 Response 返回中文亂碼問題

      // Response.Content := SL.Text;

      // end;

      //

      // end;

      // except

      // on e: Exception do

      // Logs.Post(llError, e.Message);

      //

      // end;

      //

      // // Response.Content := &39;<html><heading/><body>DataSnap Server</body></html>&39;;

      //

      // finally

      // myst.Free;

      // SL.Free;

      // end;

      //

      // end;

      procedure TWebModule1.WebModuleCreate(Sender: TObject);

      begin

      DSServerMetaDataProvider1.Server := DSServer;

      DSHTTPWebDispatcher1.Server := DSServer;

      if DSServer.Started then

      begin

      DSHTTPWebDispatcher1.DbxContext := DSServer.DbxContext;

      DSHTTPWebDispatcher1.Start;

      end;

      end;

      initialization

      SetDefaultLogFile(AppPath + &39;log\applog.txt&39;, 1024 1024 20, False, True);

      finalization

      Web.WebReq.FreeWebModules;

      end.

      好的,代碼就到這里結(jié)束。

      如果對(duì)你有幫助請(qǐng)關(guān)注下我,持之以恒的寫delphi。

      拓展知識(shí):

      主站蜘蛛池模板: 久久久水蜜桃| 国产av天堂亚洲国产av麻豆| 无码国产精品一区二区色情男同| 国产精品成人影院在线观看| 免费的黄色网址| 精品一区二区三区不卡| 久久se精品一区精品二区| 亚洲成在人线免费观看| 一区在线看| 扒开双腿被两个男人玩弄视频| 色精品极品国产在线视频| 肉番在线观看| 爽爽影院在线免费观看| 国产亚洲一卡2卡3卡4卡网站| 综合亚洲桃色第一影院| 一本一道精品欧美中文字幕| 欧美另类高清zo欧美| 亚洲精品拍拍央视网出文| 成人爽a毛片一区二区免费| 热99在线| 老外和中国女人毛片免费视频 | 久久精品国产99精品国产亚洲性色| 国产麻豆乱子伦午夜视频观看| 欧洲免费av| 国产国产午夜福利视频| 中国产xxxxa片在线观看| 午夜成人免费视频| 国产经典久久| 国产偷v国产偷v亚洲高清| 免费人妻无码不卡中文视频| 精品一二三四区| 伊人春色网站| 精品国产欧美一区二区| 亚洲精品国产精品乱码不卡√| 日韩欧美在线视频观看| 大乳丰满人妻中文字幕日本| 五月婷婷之综合缴情| 亚洲成a人v影院色老汉影院| 中国人与拘一级毛片| 日本国产精品第一页久久| 亚洲第一狼人伊人av|