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

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

?? winskinini.pas

?? delphi控件
?? PAS
字號:
unit WinSkinIni;

{$B-}

interface

uses Classes,winconvert;

type
{ TQuickIni class }
  TQuickIni = class(TObject)
  private
    FAuto : boolean;
    FFileName: String;
    FIniFile : TStrings;
    function GetName(const Line: String): String;
    function GetValue(const Line, Name: String): String;
    function GetSectionIndex(const Section: String): Integer;
    function IsSection(const Line: String): Boolean;
    procedure SetFileName(Value: string);
    procedure SetIniFile(Value: TStrings);
  protected
    FSections: TStrings;
    procedure Compress(source,dest:TStream);
    procedure Decompress(source,Dest:TStream);
  public
    constructor Create;
    destructor Destroy; override;
    procedure LoadFromFile(aname:string);
    procedure SaveToFile(aname:string);
    procedure LoadFromStream(Stream: TStream);
    procedure SaveToStream(Stream:Tstream);
    procedure LoadFromZip(aname:string);
    procedure SavetoZip(aname:string);
    procedure DeleteKey(const Section, Ident: String);
    procedure EraseSection(const Section: String);
    function ReadBool(const Section, Ident: String; Default: Boolean): Boolean;
    function ReadInteger(const Section, Ident: String; Default: Longint): Longint;
    procedure ReadSection(const Section: String; Strings: TStrings);
    procedure ReadSections(Strings: TStrings);
    procedure ReadSectionValues(const Section: String; Strings: TStrings);
    function ReadString(const Section, Ident: String; Default: String): String;
    procedure RebuildSections;
    procedure WriteBool(const Section, Ident: String; Value: Boolean);
    procedure WriteInteger(const Section, Ident: String; Value: Longint);
    procedure WriteString(const Section, Ident: String; Value: String);
    property FileName: String read FFileName write SetFileName;
    property AutoSaveLoad: boolean read FAuto write FAuto;
    property IniFile: TStrings read FIniFile write SetIniFile;
    procedure Clear;
  end;

implementation

uses SysUtils;

const
  SStringsUnassignedError = 'The parameter Strings is unassigned!';
  StartBracket = '[';
  EndBracket   = ']';
  Separator    = '=';

{ TQuickIni }

constructor TQuickIni.Create;
begin
  FAuto := False;
  FIniFile := TStringList.Create;
  FSections := TStringList.Create;
//  if FileExists(FileName) then
//    LoadFromFile;
end;

destructor TQuickIni.Destroy;
begin
  FSections.Free;
  FIniFile.Free;
//  Finalize(FFileName);
end;

function TQuickIni.GetName(const Line: String): String;
var
  I: Integer;
begin
  I := Pos(Separator, Line);
  if I <> 0 then
    Result := Trim(Copy(Line, 1, I-1))
  else
    Result := EmptyStr;
  result:=lowercase(result);
end;

function TQuickIni.GetValue(const Line, Name: String): String;
var
  I: Integer;
begin
  Result := EmptyStr;
  if (Line <> EmptyStr) and (Name <> EmptyStr) then
  begin
    I := Pos(Separator, Line);
    if (Name = GetName(Line)) and (I <> 0) then
      Result := Trim(System.Copy(Line, I+1, Maxint));
  end;
end;

function TQuickIni.IsSection(const Line: String): Boolean;
var
  S: String;
begin
  Result := False;
  if Line <> EmptyStr then
  begin
    S := Trim(Line);
    if (S[1] = StartBracket) and (S[System.Length(S)] = EndBracket) then
      Result := True;
  end;
end;

function TQuickIni.GetSectionIndex(const Section: String): Integer;

begin
  Result := FSections.IndexOf(StartBracket + Section + EndBracket);
  if Result >= 0 then
    Result := Integer(FSections.Objects[Result])
  else
    Result := -1;  
end;

procedure TQuickIni.Decompress(source,Dest:TStream);
var
   LZH: TLZH;
   Size, Bytes: Longint;
begin
    // Decompress in memory blob.
    LZH := TLZH.Create;
    try
       LZH.StreamIn:= source;
       LZH.StreamOut:=dest;
       LZH.StreamIn.Position := 0;
       LZH.StreamOut.Position := 0;

       // Uncompressed file size
       LZH.StreamIn.Read(size, sizeof(Longint));
       Bytes := Size;

       // Decompress rest of stream.
       LZH.LZHUnpack(Bytes, LZH.GetBlockStream, LZH.PutBlockStream);
    finally
       LZH.Free;
    end;
end;

procedure TQuickIni.compress(source,dest:TStream);
var
   LZH: TLZH;
   Size, Bytes: Longint;
begin
    // Decompress in memory blob.
    LZH := TLZH.Create;
    try
        LZH.StreamIn := Source;
        LZH.StreamOut := dest;
        LZH.StreamIn.Position := 0;
        LZH.StreamOut.Position := 0;

        //write uncompressed size
        Size := LZH.StreamIn.Size;
        LZH.StreamOut.Write(Size, sizeof(Longint));

        // Compress stream.
        LZH.LZHPack(Bytes, LZH.GetBlockStream, LZH.PutBlockStream);
    finally
       LZH.Free;
    end;
end;

procedure TQuickIni.LoadFromZip(aname:string);
var
  r,r2: TMemoryStream;
begin
    r:=Tmemorystream.create;
    r2:=Tmemorystream.create;
    try
       r2.loadfromfile(aname);
       Decompress(r2,r);
       r.Seek(0,soFromBeginning);
       loadfromstream(r);
    finally
       r.free;
       r2.free;
    end;
end;

procedure TQuickIni.SavetoZip(aname:string);
var
  m,m2: TMemoryStream;
begin
   m:=Tmemorystream.create;
   m2:=Tmemorystream.create;
   try
     savetostream(m);
     compress(m,m2);
     m2.savetofile(aname);
   finally
     m.free;
     m2.free;
   end;
end;

procedure TQuickIni.LoadFromFile(aname:string);
var
  Stream: TStream;
  Ptr, Start: PChar;
  StmStr,Str: string;
  Size : integer;
  I : integer;
begin
  Stream := TFileStream.Create(aname, fmOpenRead or fmShareDenyWrite);
  LoadFromStream(Stream);
  Stream.Free;
end;

procedure TQuickIni.LoadFromStream(Stream: TStream);
var
  Ptr, Start: PChar;
  StmStr,Str: string;
  Size : integer;
  I : integer;
begin
  if not assigned(Stream) then exit;

  FIniFile.BeginUpdate;
  FSections.BeginUpdate;
  try
    Size := Stream.Size - Stream.Position;
    SetString(StmStr, nil, Size);
    Stream.Read(Pointer(StmStr)^, Size);
    FIniFile.Clear;
    FSections.Clear;
    Ptr := Pointer(StmStr);
    I := 0;
    if Ptr <> nil then
      while Ptr^ <> #0 do
      begin
        Start := Ptr;
        while not (Ptr^ in [#0, #10, #13]) do
          Inc(Ptr);
        SetString(Str, Start, Ptr - Start);
        Str := Trim(Str);
        if (Str <> '') and (Str[1] <> ';') then
        begin
          FIniFile.Add(Str);
          if (Str[1] = '[') and (Str[Length(Str)] = ']') then
          begin
            FSections.AddObject(Trim(Str),TObject(I));
          end;
          inc(I);
        end;
        if Ptr^ = #13 then Inc(Ptr);
        if Ptr^ = #10 then Inc(Ptr);
      end;
  finally
    FSections.EndUpdate;
    FIniFile.EndUpdate;
  end;
end;

procedure TQuickIni.SaveToFile(aname:string);
begin
//  if AutoSaveLoad then
    FIniFile.SaveToFile(aname);
end;

procedure TQuickIni.SaveToStream(Stream:Tstream);
begin
//  if AutoSaveLoad then
    if assigned(stream) then
    FIniFile.SaveTostream(stream);
end;

{ Read all Names of one Section }

procedure TQuickIni.ReadSection(const Section: String; Strings: TStrings);
var
  I: Integer;
  N: String;
begin
  Assert(Assigned(Strings), SStringsUnassignedError);
  Strings.BeginUpdate;
  try
    Strings.Clear;
    if FIniFile.Count > 0 then
    begin
      I := GetSectionIndex(Section);
      if I <> -1 then
      begin
        Inc(I);
        while (I < FIniFile.Count) and not IsSection(FIniFile[I]) do
        begin
          N := GetName(FIniFile[I]);
          if N <> EmptyStr then Strings.Add(N);
          Inc(I);
        end;
      end;
    end;
  finally
    Strings.EndUpdate;
  end;
end;

{ Read all Sections of the Ini-File }

procedure TQuickIni.ReadSections(Strings: TStrings);
var
  I: Integer;
  Section: String;
begin
  Assert(Assigned(Strings), SStringsUnassignedError);
  Strings.Assign(FSections);
  I := 0;
  while I < Strings.Count do
  begin
    Strings.Objects[I] := Nil;
    Section := Trim(Strings.Strings[I]);
    System.Delete(Section, 1, 1);
    System.Delete(Section, System.Length(Section), 1);
    Strings.Strings[I] := Trim(Section);
    Inc(I);
  end;
end;

{ Reads a String-Value of Ident in one Section.
  The result is Default if
  o Section doesn't exists
  o Ident doesn't exists
  o Ident doesn't have any assigned value }

function TQuickIni.ReadString(const Section, Ident: String; Default: String): String;
var
  I: Integer;
  V,s: String;
begin
  Result := Default;
  s:=lowercase(ident);
  if FIniFile.Count > 0 then
  begin
    I := GetSectionIndex(Section);
    if I <> -1 then
    begin
      Inc(I);
      while (I < FIniFile.Count) and not IsSection(FIniFile[I]) do
      begin
        if GetName(FIniFile[I]) = s then
        begin
          V := GetValue(FIniFile[I], s);
          if V <> EmptyStr then
            Result := V;
          break;
        end;
        Inc(I);
      end;
    end;
  end;
end;

{ Reads an Integer-Value of Ident in one Section }

function TQuickIni.ReadInteger(const Section, Ident: String; Default: Longint): Longint;
var
  IntStr: string;
begin
  IntStr := ReadString(Section, Ident, '');
  // convert a Hex-Value
  if (Length(IntStr) > 2) and (IntStr[1] = '0') and ((IntStr[2] = 'X') or (IntStr[2] = 'x')) then
    IntStr := '$' + System.Copy(IntStr, 3, Maxint);
  Result := StrToIntDef(IntStr, Default);
end;

{ Reads a Bool-Value of Ident in one Section }

function TQuickIni.ReadBool(const Section, Ident: String; Default: Boolean): Boolean;
begin
  Result := ReadInteger(Section, Ident, Ord(Default)) <> 0;
end;

{ Reads all Names + Values of one Section }

procedure TQuickIni.ReadSectionValues(const Section: String; Strings: TStrings);
var
  I: Integer;
begin
  Assert(Assigned(Strings), SStringsUnassignedError);
  Strings.BeginUpdate;
  try
    Strings.Clear;
    if FIniFile.Count > 0 then
    begin
      I := GetSectionIndex(Section);
      if I <> -1 then
      begin
        Inc(I);
        while (I < FIniFile.Count) and not IsSection(FIniFile[I]) do
        begin
          if (FIniFile[I] <> '') then
            Strings.Add(FIniFile[I]);
          Inc(I);
        end;
      end;
    end;
  finally
    Strings.EndUpdate;
  end;
end;

{ Writes a String-Value for Ident in one Section.
  Note: If Section and/or Ident don't exist, they will be placed in the Ini-File }

procedure TQuickIni.WriteString(const Section, Ident: String; Value: String);
var
  I: Integer;
  Q : integer;
  s:string;
begin
  I := GetSectionIndex(Section);
  s:=lowercase(ident);
  // Section exists
  if I >= 0 then
  begin
    Inc(I);
    while (I < FIniFile.Count) and not IsSection(FIniFile[I])
      and (GetName(FIniFile[I]) <> s) do
    begin
      Inc(I);
    end;
    // End of File or Ident doesn't exists in the Section
    if (I >= FIniFile.Count) then
    begin
      if Ident <> EmptyStr then
      begin
        FIniFile.Add(Ident + Separator + Value);
      end
    end
    else if (I < FIniFile.Count) and IsSection(FIniFile[I]) then
    begin
      if Ident <> EmptyStr then
      begin
        FIniFile.Insert(I,Ident + Separator + Value);
        Inc(I);
        Q := FSections.IndexOf(FIniFile[I]);
        FSections.Objects[Q] := TObject(I+1);
      end
    end
    // Ident does exists in the section
    else if Ident <> EmptyStr then
    begin
      FIniFile[I] := Ident + Separator + Value;
    end;
  end
  // Section doesn't exists, so add new [Section] with Ident=Value
  else
  begin
    I := FIniFile.Add(StartBracket + Section + EndBracket);
    FSections.AddObject(StartBracket + Section + EndBracket,TObject(I));
    if Ident <> EmptyStr then
    begin
      FIniFile.Add(Ident + Separator + Value);
    end;
  end;
//  SaveToFile;
end;

{ Writes an Integer-Value for Ident in one Section }

procedure TQuickIni.WriteInteger(const Section, Ident: String; Value: Longint);
begin
  WriteString(Section, Ident, IntToStr(Value));
end;

{ Writes a Bool-Value for Ident in one Section }

procedure TQuickIni.WriteBool(const Section, Ident: String; Value: Boolean);
const
  Values: array[Boolean] of string = ('0', '1');
begin
  WriteString(Section, Ident, Values[Value]);
end;

{ Deletes the Value of Ident in one Section.
  Note: Only if Section and Ident exist, the Value of Ident will be set to NULL }

procedure TQuickIni.DeleteKey(const Section, Ident: String);
var
  I: Integer;
begin
  I := GetSectionIndex(Section);
  if I <> -1 then
  begin
    Inc(I);
    while (I < FIniFile.Count) and not IsSection(FIniFile[I]) and
      (GetName(FIniFile[I]) <> Ident) do Inc(I);
    // Ident does exists  
    if not (I >= FIniFile.Count) and not IsSection(FIniFile[I]) then
    begin
      FIniFile.Delete(I);
//      SaveToFile;
    end;  
  end;
end;

procedure TQuickIni.EraseSection(const Section: String);
var
  I: Integer;
begin
  I := GetSectionIndex(Section);
  if I <> -1 then
  begin
    // Delete Section-Header
    FIniFile.Delete(I);
    // Delete Section-Items
    while (I < FIniFile.Count) and not IsSection(FIniFile[I]) do
      FIniFile.Delete(I);
    if I > 0 then FIniFile.Insert(I, EmptyStr);  
//    SaveToFile;
  end;
end;

procedure TQuickIni.SetFileName(Value: string);
begin
  if Value <> FFileName then
  begin
    FFileName := Value;
//    if FileExists(Value) and FAuto then
//      LoadFromFile;
  end;
end;

procedure TQuickIni.SetIniFile(Value: TStrings);
begin
  FIniFile.Assign(Value);
  RebuildSections;
end;

procedure TQuickIni.RebuildSections;
Var
  I : integer;
  Count : integer;
begin
  FSections.Clear;
  I := 0;
  Count := FIniFile.Count;
  while I < Count do
  begin
    if (FIniFile[I] <> '') and (FIniFile[I][1] = '[') and (FIniFile[I][Length(FIniFile[I])] = ']') then
    begin
      if assigned(FSections) then
        FSections.AddObject(Trim(FIniFile[I]),TObject(I));
    end;
    inc(I);
  end;
end;

procedure TQuickIni.Clear;
begin
  FIniFile.Clear;
  FSections.Clear;
end;

end.

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人午夜在线视频| 69堂亚洲精品首页| 中文字幕一区二区三区四区| 成人激情校园春色| 亚洲欧美日韩在线| 欧美中文字幕一区二区三区亚洲| 性久久久久久久久久久久| 在线成人小视频| 毛片基地黄久久久久久天堂| 精品1区2区在线观看| 成人美女在线视频| 一区二区三区欧美久久| 欧美丰满美乳xxx高潮www| 久久99久久精品| 亚洲国产精品99久久久久久久久| 91社区在线播放| 爽好多水快深点欧美视频| 日韩精品资源二区在线| 成人av电影在线播放| 亚洲一区二区三区视频在线| 制服丝袜一区二区三区| 国产成人午夜视频| 亚洲伊人色欲综合网| 精品日本一线二线三线不卡| www.色精品| 日韩av中文字幕一区二区三区 | 亚洲伦在线观看| 欧美日韩精品一区二区天天拍小说 | 久久蜜臀中文字幕| 国产福利91精品一区二区三区| 国产亚洲精品超碰| 久久精品国内一区二区三区| 国产精品情趣视频| 欧美一区二区三区电影| 成人激情免费网站| 人人狠狠综合久久亚洲| 国产精品乱码妇女bbbb| 欧美一区二区黄| 色婷婷精品久久二区二区蜜臂av| 蜜臀va亚洲va欧美va天堂| 国产精品九色蝌蚪自拍| 欧美成人vr18sexvr| 91久久精品午夜一区二区| 久久91精品国产91久久小草| 亚洲黄色性网站| 中文字幕电影一区| 精品伦理精品一区| 欧美日韩精品一区二区天天拍小说 | 亚洲一区二区三区在线看| 麻豆国产一区二区| 国产精品麻豆99久久久久久| 激情都市一区二区| 午夜精品久久久久久久| 欧美午夜精品久久久久久孕妇| 亚洲成a人v欧美综合天堂下载| 国产视频一区不卡| 91精选在线观看| 97精品国产97久久久久久久久久久久| 久久99久久久久| 视频精品一区二区| 亚洲一区二区在线免费看| 国产精品国产三级国产三级人妇 | 亚洲午夜久久久久久久久电影网| 国产在线精品一区二区三区不卡 | 欧美精品一区二区久久久| 欧美视频你懂的| 色综合久久中文字幕综合网| 国产福利精品导航| 福利一区二区在线| 国产精品资源在线看| 激情伊人五月天久久综合| 七七婷婷婷婷精品国产| 日韩精品乱码免费| 日韩欧美123| 欧美日韩一级大片网址| 欧美系列日韩一区| 欧美一卡2卡3卡4卡| 国产激情视频一区二区三区欧美 | 欧美第一区第二区| 国产成人午夜99999| 亚洲妇女屁股眼交7| 日本一区二区三区视频视频| 日韩一区二区三区视频| 精品日韩欧美一区二区| 丁香一区二区三区| 成年人网站91| 91免费看片在线观看| 91麻豆产精品久久久久久 | 日韩福利视频导航| 首页国产欧美日韩丝袜| 蜜臀国产一区二区三区在线播放| 久久国产麻豆精品| 国产一区视频导航| 成人av午夜电影| 色噜噜夜夜夜综合网| 欧美日韩中文国产| 精品免费一区二区三区| 国产午夜精品一区二区三区嫩草| 国产欧美日韩另类一区| 亚洲欧洲无码一区二区三区| 亚洲摸摸操操av| 亚洲成av人片观看| 久久国产福利国产秒拍| 成人不卡免费av| 欧美系列在线观看| www精品美女久久久tv| 中文字幕一区二区三区四区| 日本va欧美va欧美va精品| 色综合欧美在线| 国产在线精品一区二区| 99精品一区二区三区| 欧美日韩国产在线观看| 欧美精品一区男女天堂| 国产精品超碰97尤物18| 亚洲黄色在线视频| 国内精品伊人久久久久影院对白| av电影一区二区| 日韩亚洲欧美在线观看| 精品国产第一区二区三区观看体验| 国产一区二区91| 一本色道a无线码一区v| 色婷婷综合久久| 国产a级毛片一区| 欧美色老头old∨ideo| 奇米影视一区二区三区| 精品国产自在久精品国产| 亚洲色图欧美偷拍| 午夜激情一区二区三区| 久久综合狠狠综合久久激情 | 亚洲成av人影院在线观看网| 久久国产成人午夜av影院| 国产又黄又大久久| 在线这里只有精品| 国产午夜精品福利| 一区二区三区不卡视频 | 亚洲超碰精品一区二区| 久久电影国产免费久久电影| av爱爱亚洲一区| 日韩欧美一区二区三区在线| 亚洲人成小说网站色在线| 国产主播一区二区| 欧美日本国产视频| 亚洲影院免费观看| 91在线码无精品| 精品福利一二区| 七七婷婷婷婷精品国产| 欧美日韩高清影院| 一区二区三区四区不卡在线| 成人白浆超碰人人人人| 精品久久人人做人人爽| 日本v片在线高清不卡在线观看| 99re热视频这里只精品| 久久久精品免费免费| 国产一区中文字幕| 精品乱人伦一区二区三区| 日韩电影免费一区| 欧美精品自拍偷拍| 亚洲成av人在线观看| 在线观看www91| 夜夜嗨av一区二区三区四季av| 99久久精品国产毛片| 亚洲国产精品精华液ab| 国产成人精品一区二区三区网站观看| 欧美电视剧在线观看完整版| 麻豆视频一区二区| 精品三级av在线| 国产乱码精品一区二区三区av| 欧美大胆一级视频| 免费欧美日韩国产三级电影| 欧美精品视频www在线观看| 亚洲午夜一区二区| 欧美日韩国产123区| 午夜久久电影网| 日韩一区二区三区三四区视频在线观看| 日韩精品电影一区亚洲| 日韩精品一区在线观看| 日韩avvvv在线播放| 日韩视频免费观看高清在线视频| 秋霞成人午夜伦在线观看| 日韩精品一区在线| 国产精品亚洲第一区在线暖暖韩国| 久久―日本道色综合久久| 成人免费的视频| 亚洲免费观看高清完整版在线观看熊 | 免费成人深夜小野草| 日韩视频一区二区在线观看| 91免费视频网| 亚洲韩国一区二区三区| 欧美性色综合网| 麻豆极品一区二区三区| 中文字幕国产一区| 色久综合一二码| 亚洲视频香蕉人妖| 久久在线免费观看| 国产白丝网站精品污在线入口| 国产精品剧情在线亚洲| 在线观看亚洲精品| 美腿丝袜亚洲一区| 成人av电影在线网| 欧美影院一区二区|