| 十年前写的玩意了,现在自己干了个公司也没精力去维护更新。 不如发布代码,给行业做点奉献。
 这东西也没什么太多的技术含量,代码量也不大。当年技术也不好,写的不工整。
 代码标准Delphi7开发的,无任何三方组件。
 有看不明白的地方去群里咨询吧。
 
 SQLSERVER 绿色版交流群 497038306
 
 
 
 uses TryAdoCon_Unit, SuiWinSvc_Unit, Logs_Unit, DateFun_Unit,
 DBAdmin_Unit, Funs_Unit, USBDisk_Unit, Tools_Unit, Task_Unit,
 SqlLink_Unit, FireWall_Unit, ASMFastReplace, FireWallForm_Unit,
 GetABout_Unit;
 
 {$R *.dfm}
 
 //--- 日志部分 ----------
 //日志
 procedure Log(AColor: TColor; AText: String);
 Var
 sCuted     : string;
 iCutLength : integer;
 i          : integer;
 bIsDBCS    : boolean;
 begin
 if AdminConfig.SaveLogo then
 begin
 Logs_Unit.wLog(AText);
 end;
 
 if AdminConfig.LogShowTime then
 begin
 Delete(AText, 1, 1);
 AText := '['+Copy(FormatDateTime('YYYY-MM-DD HH:NN', Now),3,14)+']' + AText;
 end;
 
 repeat
 //截出字元出来
 iCutLength := LogLong;
 sCuted     := Copy(AText, 1, iCutLength);
 iCutLength := Length(sCuted);
 bIsDBCS    := False;
 
 //看看最後一个字元是不是中文的前半个字
 for  i := 1 to iCutLength do
 begin
 if bIsDBCS then
 begin
 bIsDBCS := False;
 end else if Windows.IsDBCSLeadByte(byte(sCuted[i])) then
 begin
 bIsDBCS := True;
 end;
 end;
 
 //如果最後一个字是中文的话, 少截一个字元。
 if   bIsDBCS   then   Dec(iCutLength);
 
 //截出确定长度的字元
 Main.RichEdit1.SelAttributes.Color:=AColor;
 Main.RichEdit1.Lines.Add(Copy(AText, 1, iCutLength));
 
 //从 AText 中去掉已截出的文字.
 AText := Copy(AText, iCutLength + 1, Length(AText) - iCutLength);
 
 if Length(AText) > 0 then
 begin
 While AText[1] = ' ' do
 begin
 Delete(AText, 1, 1);
 end;
 
 if AdminConfig.LogShowTime then
 AText := '          ' + AText
 else
 AText := '          ' + AText;
 end;
 
 until Length(AText) <= 0;
 end;
 
 //SQL日志
 procedure TMain.SQLLog(AColor: TColor; AText: String);
 begin
 if length(AText) = 0 then Exit;
 
 if pos('将 SQL Server 消息记录在文件', AText) <> 0 then
 begin
 //这句不显示
 end else if pos('Microsoft SQL Server', AText) <> 0 then  //版权部分
 begin
 Delete(AText, 1, 33);
 RichEdit1.Paragraph.Alignment := taLeftJustify; //taCenter;
 Log(clRed, '  MsVersion ' + AText);
 end else if ord(AText[1])=9 then          //版权部分
 begin
 Delete(AText, 1, 1);
 RichEdit1.Paragraph.Alignment := taLeftJustify; //taCenter;
 Log(clRed, '  MsVersion ' + AText);
 end else if AText[1]='*' then          //错误日志
 begin
 Delete(AText, 1, 1);
 RichEdit1.Paragraph.Alignment := taLeftJustify;
 Log(clRed, AText);
 end else          //正常以时间为开始的信息
 begin
 Delete(AText, 1, 23);
 RichEdit1.Paragraph.Alignment := taLeftJustify;
 Log(AColor, '  '+AText);
 end;
 end;
 |