Changeset 476
- Timestamp:
- Jul 13, 2015, 11:54:55 AM (9 years ago)
- Location:
- Common
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
Common/UCommon.pas
r434 r476 64 64 procedure ExecuteProgram(CommandLine: string); 65 65 procedure FreeThenNil(var Obj); 66 function RemoveQuotes(Text: string): string; 66 67 67 68 … … 440 441 end; 441 442 443 function RemoveQuotes(Text: string): string; 444 begin 445 Result := Text; 446 if (Pos('"', Text) = 1) and (Text[Length(Text)] = '"') then 447 Result := Copy(Text, 2, Length(Text) - 2); 448 end; 449 450 442 451 initialization 443 452 -
Common/UXMLUtils.pas
r468 r476 14 14 procedure WriteBoolean(Node: TDOMNode; Name: string; Value: Boolean); 15 15 procedure WriteString(Node: TDOMNode; Name: string; Value: string); 16 procedure WriteDateTime(Node: TDOMNode; Name: string; Value: TDateTime); 16 17 function ReadInteger(Node: TDOMNode; Name: string; DefaultValue: Integer): Integer; 17 18 function ReadBoolean(Node: TDOMNode; Name: string; DefaultValue: Boolean): Boolean; 18 19 function ReadString(Node: TDOMNode; Name: string; DefaultValue: string): string; 20 function ReadDateTime(Node: TDOMNode; Name: string; DefaultValue: TDateTime): TDateTime; 19 21 20 22 … … 72 74 Minute: Integer; 73 75 Second: Integer; 76 SecondFraction: Double; 74 77 Millisecond: Integer; 75 78 begin … … 94 97 if Pos('Z', XMLDateTime) > 0 then 95 98 LeftCutString(XMLDateTime, Part, 'Z'); 96 Millisecond := StrToInt(Part); 99 SecondFraction := StrToFloat('0.' + Part); 100 Millisecond := Trunc(SecondFraction * 1000); 97 101 end else begin 98 102 if Pos('+', XMLDateTime) > 0 then … … 156 160 end; 157 161 162 procedure WriteDateTime(Node: TDOMNode; Name: string; Value: TDateTime); 163 var 164 NewNode: TDOMNode; 165 begin 166 NewNode := Node.OwnerDocument.CreateElement(Name); 167 NewNode.TextContent := DateTimeToXMLTime(Value); 168 Node.AppendChild(NewNode); 169 end; 170 158 171 function ReadInteger(Node: TDOMNode; Name: string; DefaultValue: Integer): Integer; 159 172 var … … 186 199 end; 187 200 201 function ReadDateTime(Node: TDOMNode; Name: string; DefaultValue: TDateTime 202 ): TDateTime; 203 var 204 NewNode: TDOMNode; 205 begin 206 Result := DefaultValue; 207 NewNode := Node.FindNode(Name); 208 if Assigned(NewNode) then 209 Result := XMLTimeToDateTime(NewNode.TextContent); 210 end; 211 188 212 end. 189 213
Note:
See TracChangeset
for help on using the changeset viewer.