Ignore:
Timestamp:
Jul 13, 2015, 11:44:23 AM (9 years ago)
Author:
chronos
Message:
  • Added: Support for reading file status from working copy.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Packages/Common/UXMLUtils.pas

    r6 r15  
    1414procedure WriteBoolean(Node: TDOMNode; Name: string; Value: Boolean);
    1515procedure WriteString(Node: TDOMNode; Name: string; Value: string);
     16procedure WriteDateTime(Node: TDOMNode; Name: string; Value: TDateTime);
    1617function ReadInteger(Node: TDOMNode; Name: string; DefaultValue: Integer): Integer;
    1718function ReadBoolean(Node: TDOMNode; Name: string; DefaultValue: Boolean): Boolean;
    1819function ReadString(Node: TDOMNode; Name: string; DefaultValue: string): string;
     20function ReadDateTime(Node: TDOMNode; Name: string; DefaultValue: TDateTime): TDateTime;
    1921
    2022
     
    7274  Minute: Integer;
    7375  Second: Integer;
     76  SecondFraction: Double;
    7477  Millisecond: Integer;
    7578begin
     
    9497      if Pos('Z', XMLDateTime) > 0 then
    9598        LeftCutString(XMLDateTime, Part, 'Z');
    96       Millisecond := StrToInt(Part);
     99      SecondFraction := StrToFloat('0.' + Part);
     100      Millisecond := Trunc(SecondFraction * 1000);
    97101    end else begin
    98102      if Pos('+', XMLDateTime) > 0 then
     
    156160end;
    157161
     162procedure WriteDateTime(Node: TDOMNode; Name: string; Value: TDateTime);
     163var
     164  NewNode: TDOMNode;
     165begin
     166  NewNode := Node.OwnerDocument.CreateElement(Name);
     167  NewNode.TextContent := DateTimeToXMLTime(Value);
     168  Node.AppendChild(NewNode);
     169end;
     170
    158171function ReadInteger(Node: TDOMNode; Name: string; DefaultValue: Integer): Integer;
    159172var
     
    186199end;
    187200
     201function ReadDateTime(Node: TDOMNode; Name: string; DefaultValue: TDateTime
     202  ): TDateTime;
     203var
     204  NewNode: TDOMNode;
     205begin
     206  Result := DefaultValue;
     207  NewNode := Node.FindNode(Name);
     208  if Assigned(NewNode) then
     209    Result := XMLTimeToDateTime(NewNode.TextContent);
     210end;
     211
    188212end.
    189213
Note: See TracChangeset for help on using the changeset viewer.