Changeset 15 for trunk/Packages/Common
- Timestamp:
- Jul 13, 2015, 11:44:23 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Packages/Common/UXMLUtils.pas
r6 r15 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.