Changeset 518
- Timestamp:
- Aug 31, 2018, 3:28:41 PM (6 years ago)
- Location:
- Common
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
Common/UCommon.pas
r517 r518 72 72 function MergeArray(A, B: array of string): TArrayOfString; 73 73 function LoadFileToStr(const FileName: TFileName): AnsiString; 74 procedure SaveStringToFile(S, FileName: string); 74 75 procedure SearchFiles(AList: TStrings; Dir: string; 75 76 FilterMethod: TFilterMethodMethod = nil); 76 77 function GetStringPart(var Text: string; Separator: string): string; 78 function StripTags(const S: string): string; 77 79 function PosFromIndex(SubStr: string; Text: string; 78 80 StartIndex: Integer): Integer; … … 527 529 end; 528 530 531 procedure SaveStringToFile(S, FileName: string); 532 var 533 F: TextFile; 534 begin 535 AssignFile(F, FileName); 536 try 537 ReWrite(F); 538 Write(F, S); 539 finally 540 CloseFile(F); 541 end; 542 end; 543 529 544 procedure SearchFiles(AList: TStrings; Dir: string; 530 545 FilterMethod: TFilterMethodMethod = nil); … … 561 576 Result := Trim(Result); 562 577 Text := Trim(Text); 578 end; 579 580 function StripTags(const S: string): string; 581 var 582 Len: Integer; 583 584 function ReadUntil(const ReadFrom: Integer; const C: Char): Integer; 585 var 586 J: Integer; 587 begin 588 for J := ReadFrom to Len do 589 if (S[j] = C) then 590 begin 591 Result := J; 592 Exit; 593 end; 594 Result := Len + 1; 595 end; 596 597 var 598 I, APos: Integer; 599 begin 600 Len := Length(S); 601 I := 0; 602 Result := ''; 603 while (I <= Len) do begin 604 Inc(I); 605 APos := ReadUntil(I, '<'); 606 Result := Result + Copy(S, I, APos - i); 607 I := ReadUntil(APos + 1, '>'); 608 end; 563 609 end; 564 610 … … 608 654 end; 609 655 656 610 657 initialization 611 658 -
Common/ULastOpenedList.pas
r510 r518 30 30 procedure SaveToXMLConfig(XMLConfig: TXMLConfig; Path: string); 31 31 procedure AddItem(FileName: string); 32 function GetFirstFileName: string; 32 33 published 33 34 property MaxCount: Integer read FMaxCount write SetMaxCount; … … 185 186 end; 186 187 188 function TLastOpenedList.GetFirstFileName: string; 189 begin 190 if Items.Count > 0 then Result := Items[0] 191 else Result := ''; 192 end; 193 187 194 end. 188 195 -
Common/UScaleDPI.pas
r511 r518 289 289 //OldAutoSize: Boolean; 290 290 begin 291 //if not (Control is TCustomPage) then 292 // Resize childs first 293 if Control is TWinControl then begin 294 WinControl := TWinControl(Control); 295 if WinControl.ControlCount > 0 then begin 296 for I := 0 to WinControl.ControlCount - 1 do begin 297 if WinControl.Controls[I] is TControl then begin 298 ScaleControl(WinControl.Controls[I], FromDPI); 299 end; 300 end; 301 end; 302 end; 303 291 304 //if Control is TMemo then Exit; 292 305 //if Control is TForm then … … 340 353 end; 341 354 342 //if not (Control is TCustomPage) then343 if Control is TWinControl then begin344 WinControl := TWinControl(Control);345 if WinControl.ControlCount > 0 then begin346 for I := 0 to WinControl.ControlCount - 1 do begin347 if WinControl.Controls[I] is TControl then begin348 ScaleControl(WinControl.Controls[I], FromDPI);349 end;350 end;351 end;352 end;353 355 //if Control is TForm then 354 356 // Control.EnableAutoSizing; -
Common/UXMLUtils.pas
r510 r518 7 7 uses 8 8 {$IFDEF WINDOWS}Windows,{$ENDIF} 9 Classes, SysUtils, DateUtils, DOM ;9 Classes, SysUtils, DateUtils, DOM, xmlread; 10 10 11 11 function XMLTimeToDateTime(XMLDateTime: string): TDateTime; … … 21 21 function ReadString(Node: TDOMNode; Name: string; DefaultValue: string): string; 22 22 function ReadDateTime(Node: TDOMNode; Name: string; DefaultValue: TDateTime): TDateTime; 23 procedure ReadXMLFileParser(out Doc: TXMLDocument; FileName: string); 23 24 24 25 25 26 implementation 27 28 procedure ReadXMLFileParser(out Doc: TXMLDocument; FileName: string); 29 var 30 Parser: TDOMParser; 31 Src: TXMLInputSource; 32 InFile: TFileStream; 33 begin 34 try 35 InFile := TFileStream.Create(FileName, fmOpenRead); 36 Src := TXMLInputSource.Create(InFile); 37 Parser := TDOMParser.Create; 38 Parser.Options.PreserveWhitespace := True; 39 Parser.Parse(Src, Doc); 40 finally 41 Src.Free; 42 Parser.Free; 43 InFile.Free; 44 end; 45 end; 26 46 27 47 function GetTimeZoneBias: Integer;
Note:
See TracChangeset
for help on using the changeset viewer.