From 8ce1f636504f299e8782cd06478525a7679aba5c Mon Sep 17 00:00:00 2001 From: Vadim Dashevskiy Date: Thu, 17 Jan 2013 17:59:41 +0000 Subject: - iceit: patching fix and version bump git-svn-id: http://svn.miranda-ng.org/main/trunk@3146 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- tools/iceit/Unit1.dfm | 2 +- tools/iceit/Unit1.pas | 181 ++++++++++++++++++++++++++-------------------- tools/iceit/bin/iceit.exe | Bin 183808 -> 183808 bytes 3 files changed, 105 insertions(+), 78 deletions(-) (limited to 'tools') diff --git a/tools/iceit/Unit1.dfm b/tools/iceit/Unit1.dfm index 3f49727fd5..7da647078b 100644 --- a/tools/iceit/Unit1.dfm +++ b/tools/iceit/Unit1.dfm @@ -3,7 +3,7 @@ object Form1: TForm1 Top = 134 BorderIcons = [biSystemMenu, biMinimize] BorderStyle = bsSingle - Caption = 'Miranda ICE Icon pack patcher | v.0.2.b' + Caption = 'Miranda ICE Icon pack patcher | v.0.3.b' ClientHeight = 320 ClientWidth = 336 Color = clBtnFace diff --git a/tools/iceit/Unit1.pas b/tools/iceit/Unit1.pas index 6493615a1c..83cfe5bc90 100644 --- a/tools/iceit/Unit1.pas +++ b/tools/iceit/Unit1.pas @@ -31,7 +31,6 @@ type procedure FormDestroy(Sender: TObject); private { Private declarations } - function FillCombo(typ:string):integer; public { Public declarations } procedure Error(const Msg: String); @@ -407,7 +406,6 @@ var xIcoPath: String; xTemp: String; MaxCount: Integer; - res:String; begin if FileExists(Edit1.Text) then begin @@ -420,60 +418,56 @@ begin ProgressBar1.Min := 0; ProgressBar1.Max := MaxCount; for n := 0 to CheckListBox1.Items.Count - 1 do + if (CheckListBox1.Checked[n]) and not (CheckListBox1.Header[n]) then begin - if (CheckListBox1.Checked[n]) and not (CheckListBox1.Header[n]) then + ProgressBar1.Position := n; + S := GetValue(CheckListBox1.Items[n], 0); + S := LowerCase(S); + if n < IconsItem then F := '\core' else + if n < PluginsItem then F := '\icons' else F := '\plugins'; + StatusBar1.Panels[0].Text := ' Processing: ' + S; + if (S = 'miranda32') or (S = 'miranda64') then begin - ProgressBar1.Position := n; - S := GetValue(CheckListBox1.Items[n], 0); - S := LowerCase(S); - if n < PluginsItem then F := '\icons' else - if n < CoreItem then F := '\plugins' else F := '\core'; - StatusBar1.Panels[0].Text := ' Processing: ' + S; - if (S = 'miranda32') or (S = 'miranda64') then - begin - xFilePath := MirandaPath + '\' + S + '.exe'; - //in order not to duplicate existing packages of icons (miranda32) for miranda 64 - // will not work if there are two files (miranda32.exe and miranda64.exe) - if not FileExists(mirandapath+'\miranda32.exe') then - xFilePath := MirandaPath + '\Miranda64.exe'; - xIcoPath := IcePath + F + '\' + S + '\' + S; - end - else + xFilePath := MirandaPath + '\' + S + '.exe'; + //in order not to duplicate existing packages of icons (miranda32) for miranda 64 + // will not work if there are two files (miranda32.exe and miranda64.exe) + if not FileExists(mirandapath+'\miranda32.exe') then + xFilePath := MirandaPath + '\Miranda64.exe'; + xIcoPath := IcePath + F + '\' + S + '\' + S; + end else begin + xFilePath := MirandaPath + F + '\' + S + '.dll'; + xIcoPath := IcePath + F + '\' + S + '\' + S; + end; + CheckListBox1.Items[n] := SetValue(CheckListBox1.Items[n], 1, 'PROGRESS'); + CheckListBox1.ItemIndex := n; + if not FileExists(xFilePath) then + CheckListBox1.Items[n] := SetValue(CheckListBox1.Items[n], 1, 'PASS') + else begin + xTemp := xFilePath + '.temp'; + CopyFile(PChar(xFilePath), Pchar(xTemp), False); + if not ProgressUpdate(xTemp, xIcoPath) <> True then begin - xFilePath := MirandaPath + F + '\' + S + '.dll'; - xIcoPath := IcePath + F + '\' + S + '\' + S; + CheckListBox1.Items[n] := SetValue(CheckListBox1.Items[n], 1, 'ERROR') + end else begin + CheckListBox1.Items[n] := SetValue(CheckListBox1.Items[n], 1, 'SUCCESS'); end; - CheckListBox1.Items[n] := SetValue(CheckListBox1.Items[n], 1, 'PROGRESS'); - CheckListBox1.ItemIndex := n; - if not FileExists(xFilePath) then - CheckListBox1.Items[n] := SetValue(CheckListBox1.Items[n], 1, 'PASS') - else + if GetValue(CheckListBox1.Items[n], 1) = 'SUCCESS' then begin - xTemp := xFilePath + '.temp'; - CopyFile(PChar(xFilePath), Pchar(xTemp), False); - - if ProgressUpdate(xTemp, xIcoPath) then - res := 'ERROR' - else - begin - res := 'SUCCESS'; - DeleteFile(xFilePath); - MoveFile(PChar(xTemp), PChar(xFilePath)); - end; - CheckListBox1.Items[n] := SetValue(CheckListBox1.Items[n], 1, res); + DeleteFile(xFilePath); + MoveFile(PChar(xTemp), PChar(xFilePath)); end; - if FileExists(xTemp) then DeleteFile(xTemp); end; - end // for - end - else - begin + if FileExists(xTemp) then DeleteFile(xTemp); + end; + end else begin Edit1.Text := 'Enter path to Miranda*.exe here or click this button ------>'; Edit1.SelectAll; Edit1.SetFocus; end; ProgressBar1.Position := 0; StatusBar1.Panels[0].Text := ' Ready'; + if FileSize(Log) = 0 then DeleteFile('iceit.log'); + end; procedure TForm1.Button4Click(Sender: TObject); @@ -497,9 +491,7 @@ begin ImageList1.Draw(CheckListBox1.Canvas, Rect.Left+17, Rect.Top+1, 3); CheckListBox1.Canvas.Font.Style := []; CheckListBox1.Canvas.Font.Size := 8; - end - else - begin + end else begin ImageList1.Draw(CheckListBox1.Canvas, Rect.Left+17, Rect.Top+1, 0); CheckListBox1.Canvas.Font.Style := []; CheckListBox1.Canvas.Font.Size := 7; @@ -507,9 +499,7 @@ begin if CheckListBox1.Checked[Index] then begin ImageList1.Draw(CheckListBox1.Canvas, Rect.Left+1, Rect.Top+1, 1); - end - else - begin + end else begin ImageList1.Draw(CheckListBox1.Canvas, Rect.Left+1, Rect.Top+1, 2); end; CheckListBox1.Canvas.Brush.Style := bsClear; @@ -518,57 +508,94 @@ begin S2 := GetValue(CheckListBox1.Items[Index], 1); n := CheckListBox1.Canvas.TextWidth(S2); CheckListBox1.Canvas.TextOut(Rect.Left+36, Rect.Top+2, S1); - if S2 = 'NONE' then CheckListBox1.Canvas.Font.Color := clWindow - else if S2 = 'PROGRESS' then CheckListBox1.Canvas.Font.Color := $007E7E7E - else if S2 = 'SUCCESS' then CheckListBox1.Canvas.Font.Color := $00129D02 - else if S2 = 'PASS' then CheckListBox1.Canvas.Font.Color := $00168FAD - else if S2 = 'ERROR' then CheckListBox1.Canvas.Font.Color := $001232C7; + if S2 = 'NONE' then CheckListBox1.Canvas.Font.Color := clWindow; + if S2 = 'PROGRESS' then CheckListBox1.Canvas.Font.Color := $007E7E7E; + if S2 = 'SUCCESS' then CheckListBox1.Canvas.Font.Color := $00129D02; + if S2 = 'PASS' then CheckListBox1.Canvas.Font.Color := $00168FAD; + if S2 = 'ERROR' then CheckListBox1.Canvas.Font.Color := $001232C7; CheckListBox1.Canvas.TextOut(Rect.Right-(n+4), Rect.Top+2, S2); end; -function TForm1.FillCombo(typ:String):integer; +procedure TForm1.FormCreate(Sender: TObject); var FindHandle: THandle; FindData: TWin32FindData; + FindNext: Boolean; FileName: String; FilePath: String; begin - CheckListBox1.Items.Add(typ+'|NONE|'); - result := CheckListBox1.Items.Count-1; - CheckListBox1.Header[result] := True; + AssignFile(Log, 'iceit.log'); + Rewrite(Log); + IcePath := ExtractFilePath(ParamStr(0)); + // Core + CheckListBox1.Items.Add('core|NONE|'); + CoreItem := CheckListBox1.Items.Count-1; + CheckListBox1.Header[CoreItem] := True; FindData.dwFileAttributes := FILE_ATTRIBUTE_NORMAL; - FilePath := IcePath + '\' + typ + '\*.*'; + FilePath := IcePath + '\core\*.*'; FindHandle := FindFirstFile(PChar(FilePath), FindData); if FindHandle <> INVALID_HANDLE_VALUE then begin - repeat + FindNext := True; + while FindNext do + begin FileName := FindData.cFileName; if (FileName <> '..') and (FileName <> '.') then if (FindData.dwFileAttributes and FILE_ATTRIBUTE_DIRECTORY) <> 0 then CheckListBox1.Items.Add(LowerCase(FileName)+'|NONE|'); - until not FindNextFile(FindHandle, FindData); + FindNext := FindNextFile(FindHandle, FindData); + end; + end; + Windows.FindClose(FindHandle); + // Icons + CheckListBox1.Items.Add('icons|NONE|'); + IconsItem := CheckListBox1.Items.Count-1; + CheckListBox1.Header[IconsItem] := True; + FindData.dwFileAttributes := FILE_ATTRIBUTE_NORMAL; + FilePath := IcePath + '\icons\*.*'; + FindHandle := FindFirstFile(PChar(FilePath), FindData); + if FindHandle <> INVALID_HANDLE_VALUE then + begin + FindNext := True; + while FindNext do + begin + FileName := FindData.cFileName; + if (FileName <> '..') and (FileName <> '.') then + if (FindData.dwFileAttributes and FILE_ATTRIBUTE_DIRECTORY) <> 0 then + CheckListBox1.Items.Add(LowerCase(FileName)+'|NONE|'); + FindNext := FindNextFile(FindHandle, FindData); + end; + end; + Windows.FindClose(FindHandle); + // Plugins + CheckListBox1.Items.Add('plugins|NONE|'); + PluginsItem := CheckListBox1.Items.Count-1; + CheckListBox1.Header[PluginsItem] := True; + FindData.dwFileAttributes := FILE_ATTRIBUTE_NORMAL; + FilePath := IcePath + '\plugins\*.*'; + FindHandle := FindFirstFile(PChar(FilePath), FindData); + if FindHandle <> INVALID_HANDLE_VALUE then + begin + FindNext := True; + while FindNext do + begin + FileName := FindData.cFileName; + if (FileName <> '..') and (FileName <> '.') then + if (FindData.dwFileAttributes and FILE_ATTRIBUTE_DIRECTORY) <> 0 then + CheckListBox1.Items.Add(LowerCase(FileName)+'|NONE|'); + FindNext := FindNextFile(FindHandle, FindData); + end; end; Windows.FindClose(FindHandle); -end; - -procedure TForm1.FormCreate(Sender: TObject); -begin - AssignFile(Log, 'iceit.log'); - Rewrite(Log); - IcePath := ExtractFilePath(ParamStr(0)); - - CoreItem := FillCombo('core'); - PluginsItem := FillCombo('icons'); - IconsItem := FillCombo('plugins'); end; procedure TForm1.FormDestroy(Sender: TObject); -var - size:integer; -begin - size:=FileSize(Log); +var + size:integer; +begin + size:=FileSize(Log); CloseFile(Log); - if size = 0 then DeleteFile('iceit.log'); + if size = 0 then DeleteFile('iceit.log'); end; function TForm1.ProgressUpdate(const FileName, IcoName: String): Boolean; diff --git a/tools/iceit/bin/iceit.exe b/tools/iceit/bin/iceit.exe index 06f83c7e89..0120b3ba71 100644 Binary files a/tools/iceit/bin/iceit.exe and b/tools/iceit/bin/iceit.exe differ -- cgit v1.2.3