Ignore:
Timestamp:
Aug 9, 2018, 3:43:27 PM (6 years ago)
Author:
chronos
Message:
  • Modified: Update Common package.
  • Fixed: Remember forms dimensions after application restart.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/generator/Packages/Common/UXMLUtils.pas

    r136 r167  
    77uses
    88  {$IFDEF WINDOWS}Windows,{$ENDIF}
    9   Classes, SysUtils, DateUtils, XMLRead, DOM;
     9  Classes, SysUtils, DateUtils, DOM, XMLRead;
    1010
    1111function XMLTimeToDateTime(XMLDateTime: string): TDateTime;
    12 function DateTimeToXMLTime(Value: TDateTime; ApplyLocalBias: Boolean = True): WideString;
     12function DateTimeToXMLTime(Value: TDateTime; ApplyLocalBias: Boolean = True): string;
    1313procedure WriteInteger(Node: TDOMNode; Name: string; Value: Integer);
    1414procedure WriteInt64(Node: TDOMNode; Name: string; Value: Int64);
     
    5050  TimeZoneInfo: TTimeZoneInformation;
    5151begin
     52  {$push}{$warn 5057 off}
    5253  case GetTimeZoneInformation(TimeZoneInfo) of
    53   TIME_ZONE_ID_STANDARD: Result := TimeZoneInfo.Bias + TimeZoneInfo.StandardBias;
    54   TIME_ZONE_ID_DAYLIGHT: Result := TimeZoneInfo.Bias + TimeZoneInfo.DaylightBias;
     54    TIME_ZONE_ID_STANDARD: Result := TimeZoneInfo.Bias + TimeZoneInfo.StandardBias;
     55    TIME_ZONE_ID_DAYLIGHT: Result := TimeZoneInfo.Bias + TimeZoneInfo.DaylightBias;
    5556  else
    5657    Result := 0;
    5758  end;
     59  {$pop}
    5860end;
    5961{$ELSE}
     
    6567function LeftCutString(var Source: string; out Output: string; Delimiter: string; Allowed: string = ''): Boolean;
    6668var
    67   I, J: Integer;
     69  I: Integer;
    6870  Matched: Boolean;
    6971begin
     
    119121      if Pos('Z', XMLDateTime) > 0 then
    120122        LeftCutString(XMLDateTime, Part, 'Z');
    121       SecondFraction := StrToFloat('0' + DecimalSeparator + Part);
     123      SecondFraction := StrToFloat('0' + DefaultFormatSettings.DecimalSeparator + Part);
    122124      Millisecond := Trunc(SecondFraction * 1000);
    123125    end else begin
     
    138140end;
    139141
    140 function DateTimeToXMLTime(Value: TDateTime; ApplyLocalBias: Boolean = True): WideString;
     142function DateTimeToXMLTime(Value: TDateTime; ApplyLocalBias: Boolean = True): string;
    141143const
    142144  Neg: array[Boolean] of string =  ('+', '-');
     
    159161  NewNode: TDOMNode;
    160162begin
    161   NewNode := Node.OwnerDocument.CreateElement(Name);
    162   NewNode.TextContent := IntToStr(Value);
     163  NewNode := Node.OwnerDocument.CreateElement(DOMString(Name));
     164  NewNode.TextContent := DOMString(IntToStr(Value));
    163165  Node.AppendChild(NewNode);
    164166end;
     
    168170  NewNode: TDOMNode;
    169171begin
    170   NewNode := Node.OwnerDocument.CreateElement(Name);
    171   NewNode.TextContent := IntToStr(Value);
     172  NewNode := Node.OwnerDocument.CreateElement(DOMString(Name));
     173  NewNode.TextContent := DOMString(IntToStr(Value));
    172174  Node.AppendChild(NewNode);
    173175end;
     
    177179  NewNode: TDOMNode;
    178180begin
    179   NewNode := Node.OwnerDocument.CreateElement(Name);
    180   NewNode.TextContent := BoolToStr(Value);
     181  NewNode := Node.OwnerDocument.CreateElement(DOMString(Name));
     182  NewNode.TextContent := DOMString(BoolToStr(Value));
    181183  Node.AppendChild(NewNode);
    182184end;
     
    186188  NewNode: TDOMNode;
    187189begin
    188   NewNode := Node.OwnerDocument.CreateElement(Name);
    189   NewNode.TextContent := Value;
     190  NewNode := Node.OwnerDocument.CreateElement(DOMString(Name));
     191  NewNode.TextContent := DOMString(Value);
    190192  Node.AppendChild(NewNode);
    191193end;
     
    195197  NewNode: TDOMNode;
    196198begin
    197   NewNode := Node.OwnerDocument.CreateElement(Name);
    198   NewNode.TextContent := DateTimeToXMLTime(Value);
     199  NewNode := Node.OwnerDocument.CreateElement(DOMString(Name));
     200  NewNode.TextContent := DOMString(DateTimeToXMLTime(Value));
    199201  Node.AppendChild(NewNode);
    200202end;
     
    205207begin
    206208  Result := DefaultValue;
    207   NewNode := Node.FindNode(Name);
    208   if Assigned(NewNode) then
    209     Result := StrToInt(NewNode.TextContent);
     209  NewNode := Node.FindNode(DOMString(Name));
     210  if Assigned(NewNode) then
     211    Result := StrToInt(string(NewNode.TextContent));
    210212end;
    211213
     
    215217begin
    216218  Result := DefaultValue;
    217   NewNode := Node.FindNode(Name);
    218   if Assigned(NewNode) then
    219     Result := StrToInt64(NewNode.TextContent);
     219  NewNode := Node.FindNode(DOMString(Name));
     220  if Assigned(NewNode) then
     221    Result := StrToInt64(string(NewNode.TextContent));
    220222end;
    221223
     
    225227begin
    226228  Result := DefaultValue;
    227   NewNode := Node.FindNode(Name);
    228   if Assigned(NewNode) then
    229     Result := StrToBool(NewNode.TextContent);
     229  NewNode := Node.FindNode(DOMString(Name));
     230  if Assigned(NewNode) then
     231    Result := StrToBool(string(NewNode.TextContent));
    230232end;
    231233
     
    235237begin
    236238  Result := DefaultValue;
    237   NewNode := Node.FindNode(Name);
    238   if Assigned(NewNode) then
    239     Result := NewNode.TextContent;
     239  NewNode := Node.FindNode(DOMString(Name));
     240  if Assigned(NewNode) then
     241    Result := string(NewNode.TextContent);
    240242end;
    241243
     
    246248begin
    247249  Result := DefaultValue;
    248   NewNode := Node.FindNode(Name);
    249   if Assigned(NewNode) then
    250     Result := XMLTimeToDateTime(NewNode.TextContent);
     250  NewNode := Node.FindNode(DOMString(Name));
     251  if Assigned(NewNode) then
     252    Result := XMLTimeToDateTime(string(NewNode.TextContent));
    251253end;
    252254
Note: See TracChangeset for help on using the changeset viewer.