亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? pfgpalmmisc.pas

?? delphi編寫與Palm數據交換管道連接程序。
?? PAS
字號:
unit pfgPalmMisc;
{**************************************************************************}
{* pfgPalmMisc Unit                                                       *}
{*                                                                        *}
{* This unit provides a set of miscellaneous classes and functions used   *}
{* by the Palm conduit package.                                           *}
{*                                                                        *}
{* Copyright (C) 2000-2002 by Paul Gilbert, All Rights Reserved           *}
{**************************************************************************}

interface

uses Classes, SysUtils, pfgWTypes;

type
  TpfgIntegerStringList = class(TStringList)
  protected
    function GetValue(Index: Integer): Integer; virtual;
    procedure SetValue(Index: Integer; Value: Integer); virtual;
  public
    function AddInteger(const S: string; AValue: Integer): Integer; virtual;

    property Values[Index: Integer]: Integer read GetValue write SetValue;
  end;

  TpfgModifiedMemoryStream = class(TMemoryStream)
  private
    FModified: Boolean;
  protected
    function GetCapacity: Integer; virtual;
    procedure SetCapacity(ACapacity: Integer); virtual;
  public
    procedure LoadFromStream(Stream: TStream); reintroduce;
    procedure LoadFromFile(const FileName: string); reintroduce;
    procedure SetSize(NewSize: Longint); override;
    function Write(const Buffer; Count: Longint): Longint; override;

    property Capacity: Integer read GetCapacity write SetCapacity;
    property Modified: Boolean read FModified write FModified;
  end;

  ECreatorIDError = class(Exception);

  ETimeError = class(Exception);

  { Helper functions }

  function IsCreatorID(id: string): Boolean;
  function StrToCreatorID(ID: string): LongWord;
  function CreatorIDToStr(ID: LongWord): string;
  function PalmDateToDateTime(PalmDate: DateType): TDateTime;
  function DateTimeToPalmDate(DT: TDateTime): DateType;
  function PalmTimeToTime(PalmTime: TimeType): TDateTime;
  function TimeToPalmTime(ATime: TDateTime): TimeType;
  function PalmTimeToTimeStr(PalmTime: TimeType): string;
  function TimeStrToPalmTime(ATime: string): TimeType;
  function PalmDateTimeToDateTime(PalmDT: DateTimeType): TDateTime;
  procedure DateTimeToPalmDateTime(DT: TDateTime; var PDT: DateTimeType);
  function TimSecondsToDateTime(ATime: LongWord): TDateTime;

  function ReverseVal(AVal: Int64; ANumBytes: Integer): Int64;

  function PalmStrToStr(s: string): string;

  function DateTimeToGMTDateTime(dt: TDateTime): TDateTime;
  function GMTDateTimeToDateTime(dt: TDateTime): TDateTime;

  function RemoveDirTree(Value: String): Integer;

implementation

uses pfgSyncMgr, Windows, ShellApi;

resourcestring
  SCreatorIDError = 'The Creator ID "%s" is invalid';
  STimeZoneError = 'Unable to retrieve the current timezone information';
  SNullTimeError = 'The specified time is a null time value';

{**************************************************************************}
{* TpfgIntegerStringList                                                  *}
{*                                                                        *}
{* A string list with associated integers instead of objects              *}
{**************************************************************************}

function TpfgIntegerStringList.AddInteger(const S: string; AValue: Integer): Integer;
begin
  Result := AddObject(S, TObject(AValue));
end;

function TpfgIntegerStringList.GetValue(Index: Integer): Integer;
begin
  Result := Integer(Objects[Index]);
end;

procedure TpfgIntegerStringList.SetValue(Index: Integer; Value: Integer);
begin
  Objects[Index] := TObject(Value);
end;

{**************************************************************************}
{* TpfgModifiedMemoryStream class                                         *}
{*                                                                        *}
{* This class derives from the standard TMemoryStream, and provides a     *}
{* new property Modified, which gets set when the stream is modified.     *}
{**************************************************************************}

function TpfgModifiedMemoryStream.GetCapacity: Integer;
begin
  Result := inherited Capacity;
end;

procedure TpfgModifiedMemoryStream.SetCapacity(ACapacity: Integer);
begin
  inherited Capacity := ACapacity;
  FModified := True;
end;

procedure TpfgModifiedMemoryStream.LoadFromStream(Stream: TStream);
begin
  inherited LoadFromStream(Stream);
  FModified := True;
end;

procedure TpfgModifiedMemoryStream.LoadFromFile(const FileName: string);
begin
  inherited LoadFromFile(FileName);
  FModified := True;
end;

procedure TpfgModifiedMemoryStream.SetSize(NewSize: Longint);
begin
  inherited SetSize(NewSize);
  FModified := True;
end;

function TpfgModifiedMemoryStream.Write(const Buffer; Count: Longint): Longint;
begin
  Result := inherited Write(Buffer, Count);
  FModified := True;
end;

{**************************************************************************}
{* Helper functions                                                       *}
{*                                                                        *}
{**************************************************************************}

// IsCreatorID
// Returns true if the given string is a valid creator ID

function IsCreatorID(id: string): Boolean;
var
  ctr: Integer;
begin
  Result := Length(ID) = 4;
  if Result then
    for ctr := 1 to 4 do
      if (Ord(ID[ctr]) < 32) or (Ord(ID[ctr]) > 127) then
      begin
        Result := False;
        Exit;
      end;
end;

// StrToCreatorID
// Returns the creator ID for a string

function StrToCreatorID(ID: string): LongWord;
begin
  if not IsCreatorID(ID) then
    raise ECreatorIDError.CreateFmt(SCreatorIDError, [ID]);

  // Get the string as a longword, and reverse it to accomodate Palm byte order
  Result := ReverseVal(PLongWord(@ID[1])^, 4);
end;

// Returns the string for a given creator ID

function CreatorIDToStr(ID: LongWord): string;
var
  v: LongWord;
  bytes: Array [0..3] of Byte absolute ID;
begin
  if (not bytes[0] in [32..127]) or (not bytes[1] in [32..127]) or
     (not bytes[2] in [32..127]) or (not bytes[3] in [32..127]) then
    raise ECreatorIDError.CreateFmt(SCreatorIDError, [IntToStr(ID)]);

  // Reverse the byte ordering of the ID to convert to Intel ordering
  v := ReverseVal(ID, 4);
  // Convert value into four digit string
  SetLength(Result, 4);
  Move(v, Result[1], 4);
end;


// PalmDateToDateTime
// Converts a Palm date variable into a Windows TDateTime variable

function PalmDateToDateTime(PalmDate: DateType): TDateTime;
var
  y, m, d: Word;
begin
  y := (PalmDate shr 9) + 1904;
  m := (PalmDate shr 5) and $F;
  d := PalmDate and $1F;
  Result := EncodeDate(y, m, d);
end;

// DateTimeToPalmDate
// Converts a Windows TDateTime variable into a Palm date variable

function DateTimeToPalmDate(DT: TDateTime): DateType;
var
  y, m, d: Word;
begin
  if DT = 0 then Result := 0 else
  begin
    DecodeDate(DT, y, m, d);
    Result := ((y-1904) shl 9) + (m shl 5) + d;
  end;
end;

// PalmTimeToTime
// Converts a Palm time structure to a PC time structure

function PalmTimeToTime(PalmTime: TimeType): TDateTime;
begin
  if (PalmTime.hours = $FF) and (PalmTime.minutes = $FF) then
    raise ETimeError.Create(SNullTimeError);
  Result := EncodeTime(PalmTime.hours, PalmTime.minutes, 0, 0);
end;

function TimeToPalmTime(ATime: TDateTime): TimeType;
var
  h, m, s, msec: Word;
begin
  DecodeTime(ATime, h, m, s, msec);
  Result.hours := h; Result.minutes := m;
end;

function PalmTimeToTimeStr(PalmTime: TimeType): string;
begin
  try
    Result := TimeToStr(PalmTimeToTime(PalmTime));
  except
    on ETimeError do Result := '';
  end;
end;

function TimeStrToPalmTime(ATime: string): TimeType;
begin
  if ATime = '' then
  begin
    Result.hours := $FF; Result.minutes := $FF;
  end
  else
    Result := TimeToPalmTime(StrToTime(ATime));
end;

// TimSecondsToDateTime
// Converts a longword time specifier (number of seconds since 1/1/1904) to
// a standard TDateTime format. Note that for the special case of 0 seconds,
// it translates to the TDateTime(0) for easier checking of empty status
// TODO: Verify that this works - currently only experimental

function TimSecondsToDateTime(ATime: LongWord): TDateTime;
const
  SecsPerDay = 24 * 60 * 60;
var
  n, d: Double;
begin
  if ATime = 0 then
    Result := 0
  else
  begin
    n := ATime mod SecsPerDay;
    d := SecsPerDay;

    Result := EncodeDate(1904, 1, 1) + (ATime div SecsPerDay) +
      (n / d);
  end;
end;

function PalmDateTimeToDateTime(PalmDT: DateTimeType): TDateTime;
begin
  if (PalmDT.year = 0) and (PalmDT.month = 0) and (PalmDT.day = 0) then
    Result := 0
  else
    Result := EncodeDate(Swap(PalmDT.year), Swap(PalmDT.month), Swap(PalmDT.day)) +
                 EncodeTime(Swap(PalmDT.hour), Swap(PalmDT.minute),
                           Swap(PalmDT.second), 0);
end;

procedure DateTimeToPalmDateTime(DT: TDateTime; var PDT: DateTimeType);
var
  y, m, d, h, min, sec, msec: Word;
begin
  if DT = 0.0 then
    // Zero date, so set empty date value
    FillChar(PDT, sizeof(DateTimeType), 0)
  else
  begin
    DecodeDate(dt, y, m, d);
    DecodeTime(dt, h, min, sec, msec);

    PDT.year := Swap(y); PDT.month := Swap(m); PDT.day := Swap(d);
    PDT.hour := Swap(h); PDT.minute := Swap(min); PDT.second := Swap(sec);
    PDT.weekday := Swap(Word(DayOfWeek(dt)-1));
  end;
end;


// ReverseVal
// Reverses the byte order of the specified value

function ReverseVal(AVal: Int64; ANumBytes: Integer): Int64;
var
  ctr: Integer;
begin
  Assert((ANumBytes >= 1) and (ANumBytes <= 8), 'Illegal # Bytes for ReverseVal');
  Result := 0;
  for ctr := 1 to ANumBytes do
  begin
    Result := Result shl 8 + (AVal and $FF);
    AVal := AVal shr 8;
  end;
end;

// PalmStrToStr
// Returns a string with any non-ASCII characters stripped out. Note that I
// don't use this automatically in the AsString field, since a person may
// want to get the extra control characters. Note that the Palm CR's are
// automatically translated to a LF character

function PalmStrToStr(s: string): string;
var
  ctr: Integer;
begin
  Result := '';
  for ctr := 1 to Length(s) do
    if (s[ctr] >= #32) then Result := Result + s[ctr]
    else if (s[ctr] = #9) then Result := Result + #9
    else if (s[ctr] = #13) or (s[ctr] = #10) then Result := Result + #10;
end;

// DateTimeToGMTDateTime
// Converts a given TDateTime variable to it's GMT equivalent

function DateTimeToGMTDateTime(dt: TDateTime): TDateTime;
var
  tz: _TIME_ZONE_INFORMATION;
begin
  if not Succeeded(GetTimeZoneInformation(tz)) then
    raise Exception.Create(STimeZoneError);

  if dt = 0 then Result := 0
  else Result := dt + tz.Bias * EncodeTime(0, 1, 0, 0);
end;

// GMTDateTimeToDateTime
// Converts a given GMT TDateTime variable to it's local time equivalent

function GMTDateTimeToDateTime(dt: TDateTime): TDateTime;
var
  tz: _TIME_ZONE_INFORMATION;
begin
  if not Succeeded(GetTimeZoneInformation(tz)) then
    raise Exception.Create(STimeZoneError);

  if dt = 0 then Result := 0
  else Result := dt - tz.Bias * EncodeTime(0, 1, 0, 0);
end;

// RemoveDirTree
// Removes the specified folder, and any subfolders

function RemoveDirTree(Value: String): Integer;
var
  FOS : TSHFileOpStruct;
begin
  FillChar(FOS, SizeOf(TSHFileOpStruct), 0);
  with FOS do
  begin
    wFunc :=FO_DELETE;
    pFrom :=PChar(Value+#0#0);
    fFlags:=FOF_NOCONFIRMATION Or FOF_SILENT or FOF_NOERRORUI;
  end;
  Result:=ShFileOperation(FOS);
end;

end.

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国内久久精品视频| 欧美电影影音先锋| 欧美日韩一区二区三区在线看| 91精品国产麻豆国产自产在线| 国产精品久久久久一区二区三区共| 午夜激情一区二区三区| gogo大胆日本视频一区| 欧美一级理论性理论a| 亚洲欧洲国产专区| 国产伦精品一区二区三区免费迷| 欧美三区免费完整视频在线观看| 国产色一区二区| 久久国产人妖系列| 欧美一级免费观看| 丝袜亚洲另类丝袜在线| 欧美中文字幕久久| √…a在线天堂一区| 国产a视频精品免费观看| 欧美日韩国产美| 亚洲一区二区精品久久av| 99久久精品国产网站| 亚洲一区免费观看| 91小视频免费观看| 国产精品毛片高清在线完整版| 狠狠色丁香婷婷综合| 日韩美女视频一区二区在线观看| 亚洲mv在线观看| 欧美日韩在线播| 一区二区三区四区在线免费观看| 91色porny蝌蚪| 亚洲三级在线免费| 在线视频你懂得一区| 亚洲欧美激情视频在线观看一区二区三区 | 国产在线播放一区| 久久午夜免费电影| 国产一区二区中文字幕| 久久一区二区三区国产精品| 蜜臀国产一区二区三区在线播放| 欧美日韩一卡二卡| 午夜日韩在线观看| 日韩一区二区不卡| 久久99久久久欧美国产| 久久影院电视剧免费观看| 国产麻豆9l精品三级站| 国产婷婷一区二区| jlzzjlzz欧美大全| 艳妇臀荡乳欲伦亚洲一区| 欧美日韩另类一区| 奇米四色…亚洲| 久久久久国产一区二区三区四区| 国产成a人无v码亚洲福利| 亚洲视频免费在线观看| 欧美三级蜜桃2在线观看| 天堂蜜桃一区二区三区| 2024国产精品| 99久久久国产精品免费蜜臀| 玉米视频成人免费看| 欧美一区二区三区色| 国产乱人伦偷精品视频不卡| 亚洲日本一区二区| 91精品国产手机| 国产精品99久久久久久久女警| 国产精品久久一卡二卡| 欧美日韩亚洲综合在线| 国产一区二区三区免费观看| 亚洲欧美成人一区二区三区| 欧美一区二区福利视频| 国产成人高清视频| 日韩专区一卡二卡| 国产精品久久久久久久久免费相片| 在线观看免费视频综合| 国内精品伊人久久久久影院对白| 国产精品久久久久久久蜜臀| 欧美视频一区二区三区四区| 国产一区二区中文字幕| 亚洲一区精品在线| 欧美极品xxx| 91精品国产91久久久久久一区二区 | 欧美日本一区二区三区| 国产成人免费av在线| 亚洲1区2区3区4区| 国产精品国产三级国产三级人妇| 欧美日韩午夜在线| 波多野结衣亚洲| 狠狠色丁香久久婷婷综合丁香| 亚洲午夜电影网| 欧美经典三级视频一区二区三区| 日韩一区二区三区av| 在线观看欧美日本| 99精品国产视频| 国产成人在线免费观看| 美女精品一区二区| 亚洲777理论| 亚洲国产中文字幕| 亚洲精品成a人| 日韩美女视频一区二区 | 亚洲乱码日产精品bd| 欧美激情一区二区三区全黄| 欧美xxxx老人做受| 正在播放亚洲一区| 欧美日精品一区视频| 91久久精品一区二区| 色综合久久综合网欧美综合网| 国产精品12区| 国产精品亚洲人在线观看| 久久国产精品99久久人人澡| 青娱乐精品在线视频| 日韩成人精品视频| 丝袜美腿高跟呻吟高潮一区| 亚洲v精品v日韩v欧美v专区| 午夜一区二区三区在线观看| 亚洲综合免费观看高清完整版在线| 亚洲私人黄色宅男| 亚洲精品视频一区| 一区二区三区四区精品在线视频| 一区二区三区四区在线免费观看| 一区二区三区日本| 亚洲国产精品久久久久秋霞影院| 亚洲综合一二三区| 亚洲午夜精品17c| 日本午夜一区二区| 狠狠狠色丁香婷婷综合久久五月| 国产精品中文字幕日韩精品| 成人午夜在线播放| 91麻豆成人久久精品二区三区| 一本久久综合亚洲鲁鲁五月天 | 最新日韩av在线| 亚洲精品成人在线| 日欧美一区二区| 国内精品不卡在线| 99re成人精品视频| 欧美在线观看18| 精品乱人伦小说| 中文字幕欧美激情一区| 亚洲欧美日韩综合aⅴ视频| 夜夜操天天操亚洲| 久草这里只有精品视频| 国产99精品国产| 91福利在线看| 日韩一级成人av| 中文一区一区三区高中清不卡| 亚洲精品中文在线影院| 欧美aaa在线| 国产99久久久久| 欧美日韩中字一区| 国产午夜亚洲精品理论片色戒| 亚洲色图一区二区三区| 免费在线观看视频一区| 东方aⅴ免费观看久久av| 欧美在线免费观看亚洲| 精品久久久久久久久久久久包黑料 | 国产一区二区在线观看视频| 成人av免费网站| 337p亚洲精品色噜噜狠狠| 欧美激情一区二区三区不卡| 午夜精品视频一区| 国产成人av一区| 欧美精品久久99| 国产精品久久精品日日| 日韩中文字幕不卡| 91在线视频观看| 精品久久99ma| 一区二区三区不卡视频| 国产成人一区二区精品非洲| 欧美视频一区二区在线观看| 久久精品亚洲一区二区三区浴池 | 亚洲成人午夜电影| 成人久久久精品乱码一区二区三区 | 中文字幕五月欧美| 蜜臀91精品一区二区三区 | 肉肉av福利一精品导航| 成人在线一区二区三区| 欧美一级一区二区| 亚洲gay无套男同| 91福利视频在线| 亚洲男女毛片无遮挡| 国产成人免费视频网站高清观看视频| 欧美美女激情18p| 一区二区三区在线视频观看58| 不卡高清视频专区| 国产亚洲综合av| 精品一区二区三区久久| 欧美一区二区三区在线观看视频| 免费观看日韩av| 欧美三级电影在线观看| 尤物视频一区二区| 日本久久一区二区三区| 亚洲欧洲一区二区在线播放| 国产999精品久久| 日本一区二区三区久久久久久久久不| 日本中文字幕不卡| 91精品国产黑色紧身裤美女| 天堂va蜜桃一区二区三区| 欧美老女人在线| 日本中文字幕一区二区有限公司| 欧美日韩日本视频| 亚洲123区在线观看| 欧美军同video69gay| 日本美女一区二区三区| 日韩一级大片在线观看|