From c9458897ebbb739d8db83c80e06512d8a612f743 Mon Sep 17 00:00:00 2001 From: danglassey Date: Wed, 14 Aug 2002 09:57:17 +0000 Subject: *** empty log message *** --- apps/windoze/CBuilder4/InstallMgr/FTPDownload.cpp | 29 + apps/windoze/CBuilder4/InstallMgr/FTPDownload.h | 16 + apps/windoze/CBuilder4/InstallMgr/InfoFrm.cpp | 33 + apps/windoze/CBuilder4/InstallMgr/InfoFrm.dfm | Bin 0 -> 1124 bytes apps/windoze/CBuilder4/InstallMgr/InfoFrm.h | 32 + apps/windoze/CBuilder4/InstallMgr/InstallMgr.bpg | 23 + apps/windoze/CBuilder4/InstallMgr/InstallMgr.bpr | 202 ++++ apps/windoze/CBuilder4/InstallMgr/InstallMgr.conf | 5 + apps/windoze/CBuilder4/InstallMgr/InstallMgr.cpp | 33 + apps/windoze/CBuilder4/InstallMgr/InstallMgr.res | Bin 0 -> 1796 bytes apps/windoze/CBuilder4/InstallMgr/MainFrm.cpp | 1021 ++++++++++++++++++++ apps/windoze/CBuilder4/InstallMgr/MainFrm.dfm | Bin 0 -> 32703 bytes apps/windoze/CBuilder4/InstallMgr/MainFrm.h | 139 +++ apps/windoze/CBuilder4/InstallMgr/RemoteMntFrm.cpp | 145 +++ apps/windoze/CBuilder4/InstallMgr/RemoteMntFrm.dfm | Bin 0 -> 3327 bytes apps/windoze/CBuilder4/InstallMgr/RemoteMntFrm.h | 49 + apps/windoze/CBuilder4/InstallMgr/StatusFrm.cpp | 175 ++++ apps/windoze/CBuilder4/InstallMgr/StatusFrm.dfm | Bin 0 -> 1065 bytes apps/windoze/CBuilder4/InstallMgr/StatusFrm.h | 61 ++ apps/windoze/CBuilder4/InstallMgr/arrow2r.bmp | Bin 0 -> 376 bytes apps/windoze/CBuilder4/InstallMgr/arrow3u.bmp | Bin 0 -> 376 bytes apps/windoze/CBuilder4/InstallMgr/back.bmp | Bin 0 -> 798 bytes apps/windoze/CBuilder4/InstallMgr/bookshut.bmp | Bin 0 -> 376 bytes apps/windoze/CBuilder4/InstallMgr/bulblk.bmp | Bin 0 -> 374 bytes apps/windoze/CBuilder4/InstallMgr/bulbon.bmp | Bin 0 -> 376 bytes apps/windoze/CBuilder4/InstallMgr/check.bmp | Bin 0 -> 374 bytes apps/windoze/CBuilder4/InstallMgr/cipherfrm.cpp | 67 ++ apps/windoze/CBuilder4/InstallMgr/cipherfrm.dfm | Bin 0 -> 1172 bytes apps/windoze/CBuilder4/InstallMgr/cipherfrm.h | 36 + apps/windoze/CBuilder4/InstallMgr/delete.bmp | Bin 0 -> 374 bytes apps/windoze/CBuilder4/InstallMgr/filenew.bmp | Bin 0 -> 374 bytes apps/windoze/CBuilder4/InstallMgr/floppy.bmp | Bin 0 -> 376 bytes apps/windoze/CBuilder4/InstallMgr/globe.bmp | Bin 0 -> 376 bytes apps/windoze/CBuilder4/InstallMgr/insert.bmp | Bin 0 -> 374 bytes apps/windoze/CBuilder4/InstallMgr/query.bmp | Bin 0 -> 374 bytes apps/windoze/CBuilder4/InstallMgr/sword.bmp | Bin 0 -> 8950 bytes apps/windoze/CBuilder4/InstallMgr/trash.bmp | Bin 0 -> 376 bytes apps/windoze/CBuilder4/InstallMgr/undo.bmp | Bin 0 -> 374 bytes apps/windoze/CBuilder4/InstallMgr/upgdlk.bmp | Bin 0 -> 374 bytes 39 files changed, 2066 insertions(+) create mode 100644 apps/windoze/CBuilder4/InstallMgr/FTPDownload.cpp create mode 100644 apps/windoze/CBuilder4/InstallMgr/FTPDownload.h create mode 100644 apps/windoze/CBuilder4/InstallMgr/InfoFrm.cpp create mode 100644 apps/windoze/CBuilder4/InstallMgr/InfoFrm.dfm create mode 100644 apps/windoze/CBuilder4/InstallMgr/InfoFrm.h create mode 100644 apps/windoze/CBuilder4/InstallMgr/InstallMgr.bpg create mode 100644 apps/windoze/CBuilder4/InstallMgr/InstallMgr.bpr create mode 100644 apps/windoze/CBuilder4/InstallMgr/InstallMgr.conf create mode 100644 apps/windoze/CBuilder4/InstallMgr/InstallMgr.cpp create mode 100644 apps/windoze/CBuilder4/InstallMgr/InstallMgr.res create mode 100644 apps/windoze/CBuilder4/InstallMgr/MainFrm.cpp create mode 100644 apps/windoze/CBuilder4/InstallMgr/MainFrm.dfm create mode 100644 apps/windoze/CBuilder4/InstallMgr/MainFrm.h create mode 100644 apps/windoze/CBuilder4/InstallMgr/RemoteMntFrm.cpp create mode 100644 apps/windoze/CBuilder4/InstallMgr/RemoteMntFrm.dfm create mode 100644 apps/windoze/CBuilder4/InstallMgr/RemoteMntFrm.h create mode 100644 apps/windoze/CBuilder4/InstallMgr/StatusFrm.cpp create mode 100644 apps/windoze/CBuilder4/InstallMgr/StatusFrm.dfm create mode 100644 apps/windoze/CBuilder4/InstallMgr/StatusFrm.h create mode 100644 apps/windoze/CBuilder4/InstallMgr/arrow2r.bmp create mode 100644 apps/windoze/CBuilder4/InstallMgr/arrow3u.bmp create mode 100644 apps/windoze/CBuilder4/InstallMgr/back.bmp create mode 100644 apps/windoze/CBuilder4/InstallMgr/bookshut.bmp create mode 100644 apps/windoze/CBuilder4/InstallMgr/bulblk.bmp create mode 100644 apps/windoze/CBuilder4/InstallMgr/bulbon.bmp create mode 100644 apps/windoze/CBuilder4/InstallMgr/check.bmp create mode 100644 apps/windoze/CBuilder4/InstallMgr/cipherfrm.cpp create mode 100644 apps/windoze/CBuilder4/InstallMgr/cipherfrm.dfm create mode 100644 apps/windoze/CBuilder4/InstallMgr/cipherfrm.h create mode 100644 apps/windoze/CBuilder4/InstallMgr/delete.bmp create mode 100644 apps/windoze/CBuilder4/InstallMgr/filenew.bmp create mode 100644 apps/windoze/CBuilder4/InstallMgr/floppy.bmp create mode 100644 apps/windoze/CBuilder4/InstallMgr/globe.bmp create mode 100644 apps/windoze/CBuilder4/InstallMgr/insert.bmp create mode 100644 apps/windoze/CBuilder4/InstallMgr/query.bmp create mode 100644 apps/windoze/CBuilder4/InstallMgr/sword.bmp create mode 100644 apps/windoze/CBuilder4/InstallMgr/trash.bmp create mode 100644 apps/windoze/CBuilder4/InstallMgr/undo.bmp create mode 100644 apps/windoze/CBuilder4/InstallMgr/upgdlk.bmp (limited to 'apps/windoze/CBuilder4/InstallMgr') diff --git a/apps/windoze/CBuilder4/InstallMgr/FTPDownload.cpp b/apps/windoze/CBuilder4/InstallMgr/FTPDownload.cpp new file mode 100644 index 0000000..eb74177 --- /dev/null +++ b/apps/windoze/CBuilder4/InstallMgr/FTPDownload.cpp @@ -0,0 +1,29 @@ +//--------------------------------------------------------------------------- +#include +#pragma hdrstop + +#include "FTPDownload.h" +#pragma package(smart_init) +//--------------------------------------------------------------------------- +// Important: Methods and properties of objects in VCL can only be +// used in a method called using Synchronize, for example: +// +// Synchronize(UpdateCaption); +// +// where UpdateCaption could look like: +// +// void __fastcall FTPDownload::UpdateCaption() +// { +// Form1->Caption = "Updated in a thread"; +// } +//--------------------------------------------------------------------------- +__fastcall FTPDownload::FTPDownload(bool CreateSuspended) + : TThread(CreateSuspended) +{ +} +//--------------------------------------------------------------------------- +void __fastcall FTPDownload::Execute() +{ + //---- Place thread code here ---- +} +//--------------------------------------------------------------------------- diff --git a/apps/windoze/CBuilder4/InstallMgr/FTPDownload.h b/apps/windoze/CBuilder4/InstallMgr/FTPDownload.h new file mode 100644 index 0000000..4ad9e01 --- /dev/null +++ b/apps/windoze/CBuilder4/InstallMgr/FTPDownload.h @@ -0,0 +1,16 @@ +//--------------------------------------------------------------------------- +#ifndef FTPDownloadH +#define FTPDownloadH +//--------------------------------------------------------------------------- +#include +//--------------------------------------------------------------------------- +class FTPDownload : public TThread +{ +private: +protected: + void __fastcall Execute(); +public: + __fastcall FTPDownload(bool CreateSuspended); +}; +//--------------------------------------------------------------------------- +#endif diff --git a/apps/windoze/CBuilder4/InstallMgr/InfoFrm.cpp b/apps/windoze/CBuilder4/InstallMgr/InfoFrm.cpp new file mode 100644 index 0000000..a75b7b2 --- /dev/null +++ b/apps/windoze/CBuilder4/InstallMgr/InfoFrm.cpp @@ -0,0 +1,33 @@ +//--------------------------------------------------------------------------- +#include +#pragma hdrstop + +#include "InfoFrm.h" +//--------------------------------------------------------------------------- +#pragma package(smart_init) +#pragma resource "*.dfm" +TInfoForm *InfoForm; +//--------------------------------------------------------------------------- +__fastcall TInfoForm::TInfoForm(TComponent* Owner) + : TForm(Owner) +{ +} +//--------------------------------------------------------------------------- +void __fastcall TInfoForm::FormShow(TObject *Sender) +{ + AnsiString abouttext = ""; + TMemoryStream *RTFStream = new TMemoryStream(); + + abouttext = abouttext + "{\\fs20\\cf0 " + info.c_str() + " }"; + RTFStream->Clear(); + RTFStream->WriteBuffer(abouttext.c_str(), abouttext.Length()); + RTFStream->Position = 0; + InfoText->Lines->LoadFromStream(RTFStream); + delete RTFStream; +} +//--------------------------------------------------------------------------- +void __fastcall TInfoForm::SpeedButton1Click(TObject *Sender) +{ + ModalResult = mrOk; +} +//--------------------------------------------------------------------------- diff --git a/apps/windoze/CBuilder4/InstallMgr/InfoFrm.dfm b/apps/windoze/CBuilder4/InstallMgr/InfoFrm.dfm new file mode 100644 index 0000000..065b0c2 Binary files /dev/null and b/apps/windoze/CBuilder4/InstallMgr/InfoFrm.dfm differ diff --git a/apps/windoze/CBuilder4/InstallMgr/InfoFrm.h b/apps/windoze/CBuilder4/InstallMgr/InfoFrm.h new file mode 100644 index 0000000..9bbeef6 --- /dev/null +++ b/apps/windoze/CBuilder4/InstallMgr/InfoFrm.h @@ -0,0 +1,32 @@ +//--------------------------------------------------------------------------- +#ifndef InfoFrmH +#define InfoFrmH +//--------------------------------------------------------------------------- +#include +#include +#include +#include +#include +#include +#include +#include + +//--------------------------------------------------------------------------- +class TInfoForm : public TForm +{ +__published: // IDE-managed Components + TPanel *Panel1; + TPanel *Panel2; + TRichEdit *InfoText; + TSpeedButton *SpeedButton1; + void __fastcall FormShow(TObject *Sender); + void __fastcall SpeedButton1Click(TObject *Sender); +private: // User declarations +public: // User declarations + std::string info; + __fastcall TInfoForm(TComponent* Owner); +}; +//--------------------------------------------------------------------------- +extern PACKAGE TInfoForm *InfoForm; +//--------------------------------------------------------------------------- +#endif diff --git a/apps/windoze/CBuilder4/InstallMgr/InstallMgr.bpg b/apps/windoze/CBuilder4/InstallMgr/InstallMgr.bpg new file mode 100644 index 0000000..bad1593 --- /dev/null +++ b/apps/windoze/CBuilder4/InstallMgr/InstallMgr.bpg @@ -0,0 +1,23 @@ +#------------------------------------------------------------------------------ +VERSION = BWS.01 +#------------------------------------------------------------------------------ +!ifndef ROOT +ROOT = $(MAKEDIR)\.. +!endif +#------------------------------------------------------------------------------ +MAKE = $(ROOT)\bin\make.exe -$(MAKEFLAGS) -f$** +DCC = $(ROOT)\bin\dcc32.exe $** +BRCC = $(ROOT)\bin\brcc32.exe $** +#------------------------------------------------------------------------------ +PROJECTS = swordlib.lib InstallMgr.exe +#------------------------------------------------------------------------------ +default: $(PROJECTS) +#------------------------------------------------------------------------------ + +InstallMgr.exe: InstallMgr.bpr + $(MAKE) + +swordlib.lib: ..\BibleCS\swordlib.bpr + $(MAKE) + + diff --git a/apps/windoze/CBuilder4/InstallMgr/InstallMgr.bpr b/apps/windoze/CBuilder4/InstallMgr/InstallMgr.bpr new file mode 100644 index 0000000..93e3047 --- /dev/null +++ b/apps/windoze/CBuilder4/InstallMgr/InstallMgr.bpr @@ -0,0 +1,202 @@ +# --------------------------------------------------------------------------- +!if !$d(BCB) +BCB = $(MAKEDIR)\.. +!endif + +# --------------------------------------------------------------------------- +# IDE SECTION +# --------------------------------------------------------------------------- +# The following section of the project makefile is managed by the BCB IDE. +# It is recommended to use the IDE to change any of the values in this +# section. +# --------------------------------------------------------------------------- + +VERSION = BCB.04.04 +# --------------------------------------------------------------------------- +PROJECT = InstallMgr.exe +OBJFILES = InstallMgr.obj MainFrm.obj StatusFrm.obj RemoteMntFrm.obj InfoFrm.obj \ + cipherfrm.obj UninstallFrm.obj +RESFILES = InstallMgr.res +RESDEPEN = $(RESFILES) MainFrm.dfm StatusFrm.dfm RemoteMntFrm.dfm InfoFrm.dfm \ + cipherfrm.dfm UninstallFrm.dfm +LIBFILES = ..\BibleCS\swordlib.lib +LIBRARIES = nmfast40.lib Vclx40.lib Vcl40.lib +SPARELIBS = Vcl40.lib Vclx40.lib nmfast40.lib +PACKAGES = Vcl40.bpi Vclx40.bpi vcljpg40.bpi bcbsmp40.bpi Qrpt40.bpi Vcldb40.bpi \ + ibsmp40.bpi vcldbx40.bpi TeeUI40.bpi teedb40.bpi tee40.bpi nmfast40.bpi \ + dclocx40.bpi +DEFFILE = +# --------------------------------------------------------------------------- +PATHCPP = .; +PATHASM = .; +PATHPAS = .; +PATHRC = .; +DEBUGLIBPATH = $(BCB)\lib\debug +RELEASELIBPATH = $(BCB)\lib\release +USERDEFINES = +SYSDEFINES = NO_STRICT +# --------------------------------------------------------------------------- +CFLAG1 = -I..\BibleCS;..\..\..\..\usr\src\sword\apps\windoze\CBuilder4\InstallMgr;$(BCB)\include;$(BCB)\include\vcl;..\..\..\..\include \ + -O2 -Hc -H=$(BCB)\lib\vcl40.csm -w -Ve -a8 -k- -vi -c -b- -w-par -w-inl -Vx -tW \ + -tWM -D$(SYSDEFINES);$(USERDEFINES) +PFLAGS = -U..\BibleCS;..\..\..\..\usr\src\sword\apps\windoze\CBuilder4\InstallMgr;$(BCB)\lib\obj;$(BCB)\lib;$(RELEASELIBPATH) \ + -I..\BibleCS;..\..\..\..\usr\src\sword\apps\windoze\CBuilder4\InstallMgr;$(BCB)\include;$(BCB)\include\vcl;..\..\..\..\include \ + -$Y- -$L- -$D- -v -JPHNE -M +RFLAGS = -i..\BibleCS;..\..\..\..\usr\src\sword\apps\windoze\CBuilder4\InstallMgr;$(BCB)\include;$(BCB)\include\vcl;..\..\..\..\include +AFLAGS = /i..\BibleCS /i..\..\..\..\usr\src\sword\apps\windoze\CBuilder4\InstallMgr \ + /i$(BCB)\include /i$(BCB)\include\vcl /i..\..\..\..\include /mx /w2 /zn +LFLAGS = -L..\BibleCS;..\..\..\..\usr\src\sword\apps\windoze\CBuilder4\InstallMgr;$(BCB)\lib\obj;$(BCB)\lib;$(RELEASELIBPATH) \ + -aa -Tpe -x -Gn +# --------------------------------------------------------------------------- +ALLOBJ = c0w32.obj sysinit.obj $(OBJFILES) +ALLRES = $(RESFILES) +ALLLIB = $(LIBFILES) $(LIBRARIES) import32.lib cp32mt.lib +# --------------------------------------------------------------------------- +!ifdef IDEOPTIONS + +[Version Info] +IncludeVerInfo=1 +AutoIncBuild=0 +MajorVer=1 +MinorVer=4 +Release=5 +Build=0 +Debug=0 +PreRelease=0 +Special=0 +Private=0 +DLL=0 +Locale=1033 +CodePage=1252 + +[Version Info Keys] +CompanyName=CrossWire Bible Society +FileDescription=SWORD Installation Manager +FileVersion=1.4.5.0 +InternalName=InstallMgr +LegalCopyright=GNU GPL 1999 +LegalTrademarks= +OriginalFilename= +ProductName=The SWORD Project +ProductVersion=1.4.5 +Comments=Seek Jesus who exchanges temporary for eternal + +[HistoryLists\hlIncludePath] +Count=2 +Item0=..\BibleCS;..\..\..\..\usr\src\sword\apps\windoze\CBuilder4\InstallMgr;$(BCB)\include;$(BCB)\include\vcl;..\..\..\..\include +Item1=..\..\..\..\usr\src\sword\apps\windoze\CBuilder4\InstallMgr;$(BCB)\include;$(BCB)\include\vcl;..\..\..\..\include + +[HistoryLists\hlLibraryPath] +Count=2 +Item0=..\BibleCS;..\..\..\..\usr\src\sword\apps\windoze\CBuilder4\InstallMgr;$(BCB)\lib\obj;$(BCB)\lib +Item1=..\..\..\..\usr\src\sword\apps\windoze\CBuilder4\InstallMgr;$(BCB)\lib\obj;$(BCB)\lib + +[HistoryLists\hlDebugSourcePath] +Count=1 +Item0=$(BCB)\source\vcl + +[HistoryLists\hlRunParameters] +Count=1 +Item0=-uninstall + +[Debugging] +DebugSourceDirs=$(BCB)\source\vcl + +[Parameters] +RunParams= +HostApplication= +RemoteHost= +RemotePath= +RemoteDebug=0 + +[Compiler] +InMemoryExe=0 +ShowInfoMsgs=0 + +!endif + +# --------------------------------------------------------------------------- +# MAKE SECTION +# --------------------------------------------------------------------------- +# This section of the project file is not used by the BCB IDE. It is for +# the benefit of building from the command-line using the MAKE utility. +# --------------------------------------------------------------------------- + +.autodepend +# --------------------------------------------------------------------------- +!if !$d(BCC32) +BCC32 = bcc32 +!endif + +!if !$d(CPP32) +CPP32 = cpp32 +!endif + +!if !$d(DCC32) +DCC32 = dcc32 +!endif + +!if !$d(TASM32) +TASM32 = tasm32 +!endif + +!if !$d(LINKER) +LINKER = ilink32 +!endif + +!if !$d(BRCC32) +BRCC32 = brcc32 +!endif + +# --------------------------------------------------------------------------- +!if $d(PATHCPP) +.PATH.CPP = $(PATHCPP) +.PATH.C = $(PATHCPP) +!endif + +!if $d(PATHPAS) +.PATH.PAS = $(PATHPAS) +!endif + +!if $d(PATHASM) +.PATH.ASM = $(PATHASM) +!endif + +!if $d(PATHRC) +.PATH.RC = $(PATHRC) +!endif +# --------------------------------------------------------------------------- +$(PROJECT): $(OBJFILES) $(RESDEPEN) $(DEFFILE) + $(BCB)\BIN\$(LINKER) @&&! + $(LFLAGS) + + $(ALLOBJ), + + $(PROJECT),, + + $(ALLLIB), + + $(DEFFILE), + + $(ALLRES) +! +# --------------------------------------------------------------------------- +.pas.hpp: + $(BCB)\BIN\$(DCC32) $(PFLAGS) {$< } + +.pas.obj: + $(BCB)\BIN\$(DCC32) $(PFLAGS) {$< } + +.cpp.obj: + $(BCB)\BIN\$(BCC32) $(CFLAG1) -n$(@D) {$< } + +.c.obj: + $(BCB)\BIN\$(BCC32) $(CFLAG1) -n$(@D) {$< } + +.c.i: + $(BCB)\BIN\$(CPP32) $(CFLAG1) -n. {$< } + +.cpp.i: + $(BCB)\BIN\$(CPP32) $(CFLAG1) -n. {$< } + +.asm.obj: + $(BCB)\BIN\$(TASM32) $(AFLAGS) $<, $@ + +.rc.res: + $(BCB)\BIN\$(BRCC32) $(RFLAGS) -fo$@ $< +# --------------------------------------------------------------------------- diff --git a/apps/windoze/CBuilder4/InstallMgr/InstallMgr.conf b/apps/windoze/CBuilder4/InstallMgr/InstallMgr.conf new file mode 100644 index 0000000..f217e61 --- /dev/null +++ b/apps/windoze/CBuilder4/InstallMgr/InstallMgr.conf @@ -0,0 +1,5 @@ + +[Sources] +FTPSource=CrossWire Bible Society|ftp.crosswire.org|/pub/sword/raw/ +LocalPath=C:\sword + diff --git a/apps/windoze/CBuilder4/InstallMgr/InstallMgr.cpp b/apps/windoze/CBuilder4/InstallMgr/InstallMgr.cpp new file mode 100644 index 0000000..1d6907e --- /dev/null +++ b/apps/windoze/CBuilder4/InstallMgr/InstallMgr.cpp @@ -0,0 +1,33 @@ +//--------------------------------------------------------------------------- +#include +#pragma hdrstop +USERES("InstallMgr.res"); +USEFORM("MainFrm.cpp", MainForm); +USELIB("..\BibleCS\swordlib.lib"); +USEFORM("StatusFrm.cpp", StatusForm); +USEFORM("RemoteMntFrm.cpp", RemoteMntForm); +USEFORM("InfoFrm.cpp", InfoForm); +USEFORM("cipherfrm.cpp", CipherForm); +USEFORM("UninstallFrm.cpp", UninstallForm); +//--------------------------------------------------------------------------- +WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int) +{ + try + { + Application->Initialize(); + Application->Title = "Install Manager"; + Application->CreateForm(__classid(TMainForm), &MainForm); + Application->CreateForm(__classid(TStatusForm), &StatusForm); + Application->CreateForm(__classid(TRemoteMntForm), &RemoteMntForm); + Application->CreateForm(__classid(TInfoForm), &InfoForm); + Application->CreateForm(__classid(TCipherForm), &CipherForm); + Application->CreateForm(__classid(TUninstallForm), &UninstallForm); + Application->Run(); + } + catch (Exception &exception) + { + Application->ShowException(&exception); + } + return 0; +} +//--------------------------------------------------------------------------- diff --git a/apps/windoze/CBuilder4/InstallMgr/InstallMgr.res b/apps/windoze/CBuilder4/InstallMgr/InstallMgr.res new file mode 100644 index 0000000..f65507c Binary files /dev/null and b/apps/windoze/CBuilder4/InstallMgr/InstallMgr.res differ diff --git a/apps/windoze/CBuilder4/InstallMgr/MainFrm.cpp b/apps/windoze/CBuilder4/InstallMgr/MainFrm.cpp new file mode 100644 index 0000000..55eb8fb --- /dev/null +++ b/apps/windoze/CBuilder4/InstallMgr/MainFrm.cpp @@ -0,0 +1,1021 @@ +//--------------------------------------------------------------------------- +#include +#pragma hdrstop + +#include "MainFrm.h" +#include "StatusFrm.h" +#include "RemoteMntFrm.h" +#include "InfoFrm.h" +#include "cipherfrm.h" +#include "UninstallFrm.h" +//--------------------------------------------------------------------------- +#pragma package(smart_init) +#pragma resource "*.dfm" + +#include +#include +#include +#include +#include +#include +#include + +TMainForm *MainForm; + + +VersionInfo::VersionInfo(const char *version) { + char *buf = new char[ strlen(version) + 1 ]; + char *tok; + major = minor = minor2 = minor3 = 0; + + strcpy(buf, version); + tok = strtok(buf, "."); + if (tok) + major = atoi(tok); + tok = strtok(0, "."); + if (tok) + minor = atoi(tok); + tok = strtok(0, "."); + if (tok) + minor2 = atoi(tok); + tok = strtok(0, "."); + if (tok) + minor3 = atoi(tok); + delete [] buf; +} + + +int VersionInfo::compare(const VersionInfo &vi) const { + if (major == vi.major) + if (minor == vi.minor) + if (minor2 == vi.minor2) + if (minor3 == vi.minor3) + return 0; + else return minor3 - vi.minor3; + else return minor2 - vi.minor2; + else return minor - vi.minor; + else return major - vi.major; +} + + +__fastcall InstallSourceTab::InstallSourceTab(TComponent *Owner, const char *confEnt, const char *type) : TControl(Owner) { + char *buf = new char [ strlen(confEnt) + 1 ]; + + strcpy(buf, confEnt); + + Caption = strtok(buf, "|"); + Source = strtok(0, "|"); + Directory = strtok(0, "|"); + delete [] buf; + Type = type; + mgr = 0; +} + +__fastcall InstallSourceTab::~InstallSourceTab() { + if (mgr) + delete mgr; +} + +__fastcall TMainForm::TMainForm(TComponent* Owner) + : TForm(Owner) +{ + manager = new SWMgr(); + installConf = new SWConfig("./InstallMgr.conf"); + localMgr = 0; +} + + +__fastcall TMainForm::~TMainForm() +{ + delete manager; + delete installConf; + if (localMgr) + delete localMgr; +} + + +void __fastcall TMainForm::FormCreate(TObject *Sender) { + + refreshPageControl(); + + if (SWLog::systemlog) + delete SWLog::systemlog; + SWLog::systemlog = new SWWinLog(this->Handle); // set the system logger to our MSWindows specific SWLog class + + fillInstallTree(); + fillSourceTree(getLocalDir(), localTree); +} + + +void TMainForm::refreshPageControl() +{ + SectionMap::iterator sources; + ConfigEntMap::iterator sourceBegin; + ConfigEntMap::iterator sourceEnd; + + while (PageControl1->PageCount > 1) { + delete PageControl1->Pages[1]; + } + + sources = installConf->Sections.find("Sources"); + + if (sources != installConf->Sections.end()) { + sourceBegin = sources->second.lower_bound("FTPSource"); + sourceEnd = sources->second.upper_bound("FTPSource"); + + if (sourceBegin != sourceEnd) { + while (sourceBegin != sourceEnd) { + addSource(new InstallSourceTab(this, sourceBegin->second.c_str(), "FTP")); + sourceBegin++; + } + } + } +} + + +void TMainForm::addSource(InstallSourceTab *ist) +{ + TTabSheet *newtab = new TTabSheet(this); + TTreeView *newtree = new TTreeView(this); + TSpeedButton *newbutton = new TSpeedButton(this); + TPanel *newpanel = new TPanel(this); + char buf[512]; + SectionMap::iterator sit; + + newtab->Caption = ist->Caption.c_str(); + newtab->Hint = ist->Source.c_str(); + newtab->ShowHint = true; + newtab->PageControl = PageControl1; + ist->Parent = newtab; + ist->tree = newtree; + newpanel->Parent = newtab; + newpanel->Align = alTop; + newpanel->BevelOuter = bvNone; + newpanel->BevelInner = bvNone; + newpanel->Height = 25; + newbutton->Parent = newpanel; + newbutton->Caption = "Refresh from Remote Source"; + newbutton->Width = 175; + newbutton->OnClick = RefreshRemoteSource; + newbutton->Flat = true; + newbutton->Glyph = SpeedButton2->Glyph; + newtree->Parent = newtab; + newtree->Align = alClient; + newtree->ReadOnly = true; + newtree->OnDblClick = localTreeDblClick; + newtree->Images = ImageList1; + newtree->StateImages = ImageList2; + string parent = "./sources/" + ist->Source + "/file"; + createParent(parent.c_str()); + parent = "./sources/" + ist->Source; + fillSourceTree(parent.c_str(), newtree); +} + + +const char *TMainForm::getLocalDir() +{ + ConfigEntMap::iterator entry; + + entry = installConf->Sections["Sources"].find("LocalPath"); + if (entry == installConf->Sections["Sources"].end()) { + installConf->Sections["Sources"].insert(ConfigEntMap::value_type("LocalPath", "d:/sword")); + entry = installConf->Sections["Sources"].find("LocalPath"); + } + return entry->second.c_str(); + +} + + +void TMainForm::setLocalDir(const char *idir) +{ + installConf->Sections["Sources"].erase("LocalPath"); installConf->Sections["Sources"].insert(ConfigEntMap::value_type("LocalPath", idir)); +} + + +//--------------------------------------------------------------------------- +void __fastcall TMainForm::LocalPath1Click(TObject *Sender) +{ + localPathDlg->Title = "Select a file in the directory to choose"; + localPathDlg->InitialDir = getLocalDir(); + if (localPathDlg->Execute()) { + char *buf = new char [ strlen(localPathDlg->FileName.c_str()) + 1 ]; + + strcpy(buf, localPathDlg->FileName.c_str()); + int end = strlen(buf) - 1; + while (end) { + if ((buf[end] == '/') || (buf[end] == '\\')) + break; + end--; + } + buf[end+1] = 0; + setLocalDir(buf); + delete [] buf; + } + + installConf->Save(); + fillSourceTree(getLocalDir(), localTree); +} +//--------------------------------------------------------------------------- + +void TMainForm::fillInstallTree() +{ + ModMap::iterator mods; + TTreeNode *node; + string nodeName; + + installTree->Items->Clear(); + + if (!manager->configPath) + return; + + for (mods = manager->Modules.begin(); mods != manager->Modules.end(); mods++) { + for (node = installTree->Items->GetFirstNode(); node; node = node->getNextSibling()) { + if (!strcmp(node->Text.c_str(), mods->second->Type())) { + break; + } + } + if (!node) { // Add Section + if (!strncmp(mods->second->Type(), "Bibl", 4)) // If Bibles, put first in list + node = installTree->Items->AddChildFirst(0, mods->second->Type()); + else node = installTree->Items->AddChild(0, mods->second->Type()); + } + nodeName = "["; + nodeName += mods->second->Name(); + nodeName += "] "; + nodeName += mods->second->Description(); + node = installTree->Items->AddChildObject(node, nodeName.c_str(), mods->second->Name()); + } +} + + +void TMainForm::fillSourceTree(const char *sourceConf, TTreeView *tree) +{ + ModMap::iterator mods; + TTreeNode *node; + SectionMap::iterator sections, targetSection; + ConfigEntMap::iterator entry; + string secName; + const char * modDesc; + string nodeName; + string targetVersion; + string sourceVersion; + bool cipher; + + SWMgr *mgr; + + if (tree == localTree) { + if (localMgr) + delete localMgr; + mgr = localMgr = new SWMgr(sourceConf); + } + else { + InstallSourceTab *ist = (InstallSourceTab *) MainForm->PageControl1->ActivePage->Controls[0]; + if (ist->mgr) + delete ist->mgr; + mgr = ist->mgr = new SWMgr(sourceConf); + } + + tree->Items->Clear(); + + if (!mgr->configPath) + return; + + for (sections = mgr->config->Sections.begin(); sections != mgr->config->Sections.end(); sections++) { + + cipher = false; + + if (!strcmp(sections->first.c_str(), "Globals")) // skip [Globals] + continue; + + mods = mgr->Modules.find(sections->first.c_str()); + if (mods != mgr->Modules.end()) + secName = mods->second->Type(); + else { + secName = "Other"; + } + entry = sections->second.find("Description"); + if (entry != sections->second.end()) + modDesc = entry->second.c_str(); + else modDesc = ""; + + + targetVersion = "0.0"; + sourceVersion = "1.0"; + + entry = sections->second.find("CipherKey"); + if (entry != sections->second.end()) + cipher = true; + + entry = sections->second.find("Version"); + if (entry != sections->second.end()) + sourceVersion = entry->second.c_str(); + + targetSection = manager->config->Sections.find(sections->first); + if (targetSection != manager->config->Sections.end()) { + targetVersion = "1.0"; + entry = targetSection->second.find("Version"); + if (entry != targetSection->second.end()) + targetVersion = entry->second; + } + + if (VersionInfo(sourceVersion.c_str()) > VersionInfo(targetVersion.c_str())) { + + + for (node = tree->Items->GetFirstNode(); node; node = node->getNextSibling()) { + if (!strcmp(node->Text.c_str(), secName.c_str())) { + break; + } + } + + if (!node) { // Add Section + if (!strncmp(secName.c_str(), "Bibl", 4)) // If Bibles, put first in list + node = tree->Items->AddChildFirst(0, secName.c_str()); + else node = tree->Items->AddChild(0, secName.c_str()); + node->ImageIndex = 0; + } + nodeName = "[" + sections->first + "] " + modDesc; + node = tree->Items->AddChildObject(node, nodeName.c_str(), (void *) sections->first.c_str()); + if (VersionInfo(targetVersion.c_str()) < VersionInfo("1.0")) { + node->ImageIndex = 1; + node->SelectedIndex = 1; + } + else { + node->ImageIndex = 2; + node->SelectedIndex = 2; + } + if (cipher) { + node->ImageIndex += 2; + node->SelectedIndex += 2; + } + node->StateIndex = 0; + } + } +} + + +void __fastcall TMainForm::Button5Click(TObject *Sender) +{ + TTreeView *tree; + for (int i = 0; i < PageControl1->ActivePage->ControlCount; i++) { + if (PageControl1->ActivePage->Controls[i]->ClassNameIs("TTreeView")) { + tree = (TTreeView*)(PageControl1->ActivePage->Controls[i]); + break; + } + } + TTreeNode *node = tree->Selected; + if (node) { + if (node->Parent) { + if (node->StateIndex == 1) + node->StateIndex = 0; //node->StateIndex; + else node->StateIndex = 1; + tree->Repaint(); + } + } +} +//--------------------------------------------------------------------------- + +void __fastcall TMainForm::localTreeDblClick(TObject *Sender) +{ + Button5Click(Sender); +} +//--------------------------------------------------------------------------- + +int TMainForm::selectAll(TTreeView *tree, bool sel) +{ + TTreeNode *node; + TTreeNode *node2; + int retCount = 0; + + for (node = tree->Items->GetFirstNode(); node; node = node->getNextSibling()) { + for (node2 = node->getFirstChild(); node2; node2 = node2->getNextSibling()) { + if (node2->StateIndex == 1) { + if (!sel) { + node2->StateIndex = 0; //node2->StateIndex; + retCount++; + } + } + else { + if (sel) { + node2->StateIndex = 1; + retCount++; + } + } + } + } + return retCount; +} + + +void __fastcall TMainForm::Button6Click(TObject *Sender) // SELECT ALL +{ + TTreeView *tree; + for (int i = 0; i < PageControl1->ActivePage->ControlCount; i++) { + if (PageControl1->ActivePage->Controls[i]->ClassNameIs("TTreeView")) { + tree = (TTreeView*)(PageControl1->ActivePage->Controls[i]); + break; + } + } + if (!selectAll(tree, true)) + selectAll(tree, false); + tree->Repaint(); +} +//--------------------------------------------------------------------------- + +void __fastcall TMainForm::Image1Click(TObject *Sender) +{ + ShellExecute(this->Handle, "open", "http://www.crosswire.org", NULL, NULL, SW_SHOWNORMAL); + +} +//--------------------------------------------------------------------------- + + +int TMainForm::removeModule(const char *modName) +{ + SectionMap::iterator module; + ConfigEntMap::iterator fileBegin; + ConfigEntMap::iterator fileEnd, entry; + + module = manager->config->Sections.find(modName); + + if (module != manager->config->Sections.end()) { + entry = module->second.find("CipherKey"); + if (entry != module->second.end()) + CipherForm->cipherEdit->Text = entry->second.c_str(); + + fileBegin = module->second.lower_bound("File"); + fileEnd = module->second.upper_bound("File"); + + if (fileBegin != fileEnd) { // remove each file + while (fileBegin != fileEnd) { + //remove file + remove(fileBegin->second.c_str()); + fileBegin++; + } + } + else { //remove all files in DataPath directory + + DIR *dir; + struct dirent *ent; + ConfigEntMap::iterator entry; + string modDir; + string modFile; + + entry = module->second.find("DataPath"); + if (entry != module->second.end()) { + modDir = entry->second.c_str(); + entry = module->second.find("ModDrv"); + if (entry != module->second.end()) { + if (!strcmp(entry->second.c_str(), "RawLD")) { + char *buf = new char [ strlen(modDir.c_str()) + 1 ]; + + strcpy(buf, modDir.c_str()); + int end = strlen(buf) - 1; + while (end) { + if (buf[end] == '/') + break; + end--; + } + buf[end] = 0; + modDir = buf; + delete [] buf; + } + } + + if (dir = opendir(modDir.c_str())) { + rewinddir(dir); + while ((ent = readdir(dir))) { + if ((strcmp(ent->d_name, ".")) && (strcmp(ent->d_name, ".."))) { + modFile = modDir; + modFile += "/"; + modFile += ent->d_name; + remove(modFile.c_str()); + } + } + closedir(dir); + } + if (dir = opendir(manager->configPath)) { // find and remove .conf file + rewinddir(dir); + while ((ent = readdir(dir))) { + if ((strcmp(ent->d_name, ".")) && (strcmp(ent->d_name, ".."))) { + modFile = manager->configPath; + modFile += "/"; + modFile += ent->d_name; + SWConfig *config = new SWConfig(modFile.c_str()); + if (config->Sections.find(modName) != config->Sections.end()) { + delete config; + remove(modFile.c_str()); + } + else delete config; + } + } + closedir(dir); + } + } + } + return 0; + } + return 1; +} + + +int TMainForm::createParent(const char *pName) +{ + char *buf = new char [ strlen(pName) + 1 ]; + int retCode; + + strcpy(buf, pName); + int end = strlen(buf) - 1; + while (end) { + if (buf[end] == '/') + break; + end--; + } + buf[end] = 0; + if (!strlen(buf)) + return -1; + + if ((retCode = mkdir(buf))) { + createParent(buf); + retCode = mkdir(buf); + } + delete [] buf; + return retCode; +} + + +int TMainForm::createPathAndFile(const char *fName) +{ + int fd; + + fd = open(fName, O_CREAT|O_WRONLY|O_BINARY, S_IREAD|S_IWRITE); + if (fd < 1) { + createParent(fName); + fd = open(fName, O_CREAT|O_WRONLY|O_BINARY, S_IREAD|S_IWRITE); + } + return fd; +} + + +int TMainForm::copyFileToCWD(const char *sourceDir, const char *fName) +{ + string sourcePath = sourceDir; + sourcePath += fName; + + return copyFile(sourcePath.c_str(), fName); +} + + +int TMainForm::copyFile(const char *sourceFile, const char *targetFile) +{ + int sfd, dfd, len; + char buf[4096]; + + if ((sfd = open(sourceFile, O_RDONLY|O_BINARY)) < 1) + return -1; + if ((dfd = createPathAndFile(targetFile)) < 1) + return -1; + + do { + len = read(sfd, buf, 4096); + write(dfd, buf, len); + } + while(len == 4096); + close(dfd); + close(sfd); + + return 0; +} + + +int TMainForm::installModule(const char *modName, InstallSourceTab *ist) +{ + SectionMap::iterator module, section; + ConfigEntMap::iterator fileBegin; + ConfigEntMap::iterator fileEnd; + ConfigEntMap::iterator entry; + string sourceDir; + string buffer; + bool aborted = false; + bool cipher = false; + + if (ist) + sourceDir = "./sources/" + ist->Source; + else sourceDir = getLocalDir(); + + SWMgr mgr(sourceDir.c_str()); + + module = mgr.config->Sections.find(modName); + + if (module != mgr.config->Sections.end()) { + + entry = module->second.find("CipherKey"); + if (entry != module->second.end()) + cipher = true; + + fileEnd = module->second.upper_bound("File"); + fileBegin = module->second.lower_bound("File"); + + if (fileBegin != fileEnd) { // copy each file + if (ist) { + while (fileBegin != fileEnd) { // ftp each file first + buffer = sourceDir + "/" + fileBegin->second; + if (FTPCopy(ist, fileBegin->second.c_str(), buffer.c_str())) { + aborted = true; + break; // user aborted + } + fileBegin++; + } + fileBegin = module->second.lower_bound("File"); + } + + if (!aborted) { + // DO THE INSTALL + while (fileBegin != fileEnd) { + copyFileToCWD(sourceDir.c_str(), fileBegin->second.c_str()); + fileBegin++; + } + } + //--------------- + + if (ist) { + fileBegin = module->second.lower_bound("File"); + while (fileBegin != fileEnd) { // delete each tmp ftp file + buffer = sourceDir + "/" + fileBegin->second; + remove(buffer.c_str()); + fileBegin++; + } + } + } + else { //copy all files in DataPath directory + DIR *dir; + struct dirent *ent; + ConfigEntMap::iterator entry; + string modDir; + string modFile; + string sourceOrig = sourceDir; + + entry = module->second.find("DataPath"); + if (entry != module->second.end()) { + modDir = entry->second.c_str(); + entry = module->second.find("ModDrv"); + if (entry != module->second.end()) { + if (!strcmp(entry->second.c_str(), "RawLD")) { + char *buf = new char [ strlen(modDir.c_str()) + 1 ]; + + strcpy(buf, modDir.c_str()); + int end = strlen(buf) - 1; + while (end) { + if (buf[end] == '/') + break; + end--; + } + buf[end] = 0; + modDir = buf; + delete [] buf; + } + } + + if (ist) { + buffer = sourceDir + "/" + modDir; + if (FTPCopy(ist, modDir.c_str(), buffer.c_str(), true)) { + aborted = true; // user aborted + } + } + sourceDir += "/"; + sourceDir += modDir; + if (!aborted) { + if (dir = opendir(sourceDir.c_str())) { + rewinddir(dir); + while ((ent = readdir(dir))) { + if ((strcmp(ent->d_name, ".")) && (strcmp(ent->d_name, ".."))) { + modFile = modDir; + modFile += "/"; + modFile += ent->d_name; + copyFileToCWD(sourceOrig.c_str(), modFile.c_str()); + } + } + closedir(dir); + } + } + if (ist) { // delete tmp ftp files + if (dir = opendir(sourceDir.c_str())) { + rewinddir(dir); + while ((ent = readdir(dir))) { + if ((strcmp(ent->d_name, ".")) && (strcmp(ent->d_name, ".."))) { + modFile = sourceOrig + "/" + modDir; + modFile += "/"; + modFile += ent->d_name; + remove(modFile.c_str()); + } + } + closedir(dir); + } + } + sourceDir = sourceOrig; + sourceDir += "/mods.d/"; + if (!aborted) { + if (dir = opendir(sourceDir.c_str())) { // find and copy .conf file + rewinddir(dir); + while ((ent = readdir(dir))) { + if ((strcmp(ent->d_name, ".")) && (strcmp(ent->d_name, ".."))) { + modFile = sourceDir; + modFile += ent->d_name; + SWConfig *config = new SWConfig(modFile.c_str()); + if (config->Sections.find(modName) != config->Sections.end()) { + delete config; + string targetFile = "./mods.d/"; + targetFile += ent->d_name; + copyFile(modFile.c_str(), targetFile.c_str()); + if (cipher) { + CipherForm->modName = modName; + CipherForm->confFile = targetFile; + CipherForm->ShowModal(); + } + } + else delete config; + } + } + closedir(dir); + } + } + } + } + return (aborted) ? -1 : 0; + } + return 1; +} + + +void TMainForm::fillAllSourceTrees() +{ + fillSourceTree(getLocalDir(), localTree); + for (int i = 1; i < PageControl1->PageCount; i++) { + InstallSourceTab *ist = (InstallSourceTab *) MainForm->PageControl1->Pages[i]->Controls[0]; + string parent = "./sources/" + ist->Source; + fillSourceTree(parent.c_str(), ist->tree); + } +} + + +void __fastcall TMainForm::Button4Click(TObject *Sender) // REMOVE MODULE +{ + TTreeNode *node = installTree->Selected; + if (node) { + if (node->Parent) { + removeModule((const char *)node->Data); + delete manager; + manager = new SWMgr(); + fillInstallTree(); + fillAllSourceTrees(); + } + } +} +//--------------------------------------------------------------------------- + +void __fastcall TMainForm::Button2Click(TObject *Sender) // INSTALL +{ + TTreeNode *node; + int count = 0; + int abort = 0; + + class TWaitCursor { + public: + TWaitCursor() : oldc(Screen->Cursor) { Screen->Cursor = crHourGlass; } + ~TWaitCursor() { Screen->Cursor = oldc; } + private: + TCursor oldc; + } wait; // show hourglass + + TTreeView *tree; + for (int i = 0; i < PageControl1->ActivePage->ControlCount; i++) { + if (PageControl1->ActivePage->Controls[i]->ClassNameIs("TTreeView")) { + tree = (TTreeView*)(PageControl1->ActivePage->Controls[i]); + break; + } + } + + for (node = tree->Items->GetFirstNode(); node; node = node->GetNext()) { + if (node->StateIndex == 1) + count++; + } // do true progress bar + + if (!count) return; // if nothing is selected, do nothing + + progressBar->Max = count; + progressBar->Position = 0; + + for (node = tree->Items->GetFirstNode(); node; node = node->GetNext()) { + if (node->StateIndex == 1) { // if selected for install + CipherForm->cipherEdit->Text = ""; + if ((node->ImageIndex == 2) || (node->ImageIndex == 4)) { // if this is an upgrade + removeModule((const char *)node->Data); + } + // install module + statusBar->Caption = "Installing: " + node->Text + "..."; + statusBar->Repaint(); + if (tree == localTree) + abort = installModule((const char *)node->Data); + else abort = installModule((const char *)node->Data, (InstallSourceTab *) PageControl1->ActivePage->Controls[0]); + if (abort) + break; + progressBar->Position++; + } + } + delete manager; + manager = new SWMgr(); + fillInstallTree(); + fillAllSourceTrees(); + statusBar->Caption = ""; + progressBar->Position = 0; +} + + +int TMainForm::FTPCopy(InstallSourceTab *ist, const char *src, const char *dest, bool dirTransfer) +{ + StatusForm->ist = ist; + StatusForm->src = src; + StatusForm->dest = dest; + StatusForm->dirTransfer = dirTransfer; + + Application->ProcessMessages(); + if (StatusForm->ShowModal() == mrCancel) + return -1; + else return 0; +} + + +void __fastcall TMainForm::RefreshRemoteSource(TObject *Sender) +{ + InstallSourceTab *ist = (InstallSourceTab *) MainForm->PageControl1->ActivePage->Controls[0]; + DIR *dir; + struct dirent *ent; + ConfigEntMap::iterator entry; + string modDir; + string modFile; + string target = "./sources/"; + target += ist->Source.c_str(); + target += "/mods.d"; + + if (dir = opendir(target.c_str())) { + rewinddir(dir); + while ((ent = readdir(dir))) { + if ((strcmp(ent->d_name, ".")) && (strcmp(ent->d_name, ".."))) { + modFile = target; + modFile += "/"; + modFile += ent->d_name; + remove(modFile.c_str()); + } + } + closedir(dir); + } + + + FTPCopy(ist, "mods.d", target.c_str(), true); + + target = "./sources/"; + target += ist->Source.c_str(); + + fillSourceTree(target.c_str(), ist->tree); +} + + + +void __fastcall TMainForm::SpeedButton1Click(TObject *Sender) +{ + InfoForm->Caption = "W A R N I N G"; + InfoForm->info = "\\qc {\\b \\fs20 -=+* WARNING *+=- -=+* WARNING *+=-}\\par\\par\\pard "; + InfoForm->info += "Although Install Manager provides a convenient way for installing and upgrading SWORD components, it also uses a systematic method for accessing sites which gives packet sniffers a target to lock into for singling out users. \\par\\par "; + InfoForm->info += "\\b\\qc IF YOU LIVE IN A PERSECUTED COUNTRY AND DO NOT WISH TO RISK DETECTION, YOU SHOULD *NOT* USE INSTALL MANAGER'S REMOTE SOURCE FEATURES."; + InfoForm->ShowModal(); + if (RemoteMntForm->ShowModal() == mrOk) { + delete installConf; + installConf = new SWConfig("./InstallMgr.conf"); + + refreshPageControl(); + } +} + +void __fastcall TMainForm::SpeedButton5Click(TObject *Sender) +{ + TTreeView *tree; + InstallSourceTab *ist = 0; + SectionMap::iterator module; + ConfigEntMap::iterator entry, entryEnd; + string sourceDir; + + if (PageControl1->ActivePage != PageControl1->Pages[0]) { + ist = (InstallSourceTab *) PageControl1->ActivePage->Controls[0]; + tree = ist->tree; + } + else tree = localTree; + + TTreeNode *node = tree->Selected; + if (node) { + if (node->Parent) { + if (ist) + sourceDir = "./sources/" + ist->Source; + else sourceDir = getLocalDir(); + SWMgr *mgr = new SWMgr(sourceDir.c_str()); + + module = mgr->config->Sections.find((const char *)node->Data); + + if (module != mgr->config->Sections.end()) { + string targetVersion = "0.0"; + string sourceVersion = "1.0"; + SectionMap::iterator targetSection; + + entry = module->second.find("Version"); + if (entry != module->second.end()) + sourceVersion = entry->second.c_str(); + + targetSection = manager->config->Sections.find(module->first); + if (targetSection != manager->config->Sections.end()) { + targetVersion = "1.0"; + entry = targetSection->second.find("Version"); + if (entry != targetSection->second.end()) + targetVersion = entry->second; + } + if (VersionInfo(targetVersion.c_str()) < VersionInfo("1.0")) { + InfoForm->info = "\\pard{\\b * Additional Module Available for Install. } \\par "; + } + else { + InfoForm->info = "\\pard{\\b + Upgraded Module Available for Install.}\\par\\tab Current Version: \\tab " + targetVersion + " \\par\\tab Upgrade Version:\\tab " + sourceVersion + " \\par "; + bool changes = false; + for (entry = module->second.begin(); entry != module->second.end(); entry++) { + if (!strncmp(entry->first.c_str(), "History_", 8)) { + if (VersionInfo(&entry->first.c_str()[8]) > VersionInfo(targetVersion.c_str())) { + if (!changes) { + changes = true; + InfoForm->info += "\\par{\\b Changes: }\\par "; + } + InfoForm->info += "\\tab "; + InfoForm->info += entry->second.c_str(); + InfoForm->info += "\\par "; + } + } + } + } + + entry = module->second.find("About"); + if (entry != module->second.end()) { + InfoForm->info += "\\par{\\b About: } \\par\\par "; + InfoForm->info += entry->second.c_str(); + } + InfoForm->Caption = "Module Information"; + InfoForm->ShowModal(); + } + delete mgr; + } + } +} +//--------------------------------------------------------------------------- + +void __fastcall TMainForm::Exit1Click(TObject *Sender) +{ + Close(); +} +//--------------------------------------------------------------------------- + + +void TMainForm::deleteAllModules() { + + SWMgr *mgr = new SWMgr(); + + + int count = mgr->Modules.size(); + + if (!count) + return; + + UninstallForm->Show(); + UninstallForm->ProgressBar1->Max = count; + UninstallForm->ProgressBar1->Position = 0; + + ModMap::iterator it; + for (it = mgr->Modules.begin(); it != mgr->Modules.end(); it++) { + string label = "Uninstalling: ["; + label += it->second->Name(); + label += "] "; + label += it->second->Description(); + UninstallForm->Label1->Caption = label.c_str(); + UninstallForm->Label1->Repaint(); + removeModule(it->second->Name()); + UninstallForm->ProgressBar1->Position = UninstallForm->ProgressBar1->Position + 1; + UninstallForm->ProgressBar1->Repaint(); + } + delete mgr; + UninstallForm->Hide(); + return; +} +void __fastcall TMainForm::FormShow(TObject *Sender) +{ + for (int i=0;i<=ParamCount();i++) { + if (LowerCase(ParamStr(i)) == "-uninstall") { + deleteAllModules(); + Application->Terminate(); + } + } + +} +//--------------------------------------------------------------------------- + diff --git a/apps/windoze/CBuilder4/InstallMgr/MainFrm.dfm b/apps/windoze/CBuilder4/InstallMgr/MainFrm.dfm new file mode 100644 index 0000000..9dd6502 Binary files /dev/null and b/apps/windoze/CBuilder4/InstallMgr/MainFrm.dfm differ diff --git a/apps/windoze/CBuilder4/InstallMgr/MainFrm.h b/apps/windoze/CBuilder4/InstallMgr/MainFrm.h new file mode 100644 index 0000000..a6f7cd8 --- /dev/null +++ b/apps/windoze/CBuilder4/InstallMgr/MainFrm.h @@ -0,0 +1,139 @@ +//--------------------------------------------------------------------------- +#ifndef MainFrmH +#define MainFrmH +//--------------------------------------------------------------------------- +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +class VersionInfo { + public: + int major, minor, minor2, minor3; + + VersionInfo(const char *version); + int compare(const VersionInfo &vi) const; + bool operator>(const VersionInfo &vi) const {return (compare(vi) > 0);} + bool operator<(const VersionInfo &vi) const {return (compare(vi) < 0);} + bool operator==(const VersionInfo &vi) const {return (compare(vi) == 0);} +}; + + +class InstallSourceTab : public TControl { +public: + __fastcall InstallSourceTab(TComponent *Owner, const char *confEnt, const char *type); + __fastcall ~InstallSourceTab(); + string Type; + string Source; + string Directory; + string Caption; + TTreeView *tree; + SWMgr *mgr; +}; + + +//--------------------------------------------------------------------------- +class TMainForm : public TForm +{ + class TWebThread; + friend class TWebThread; +__published: // IDE-managed Components + TMainMenu *MainMenu1; + TMenuItem *File1; + TMenuItem *Exit1; + TMenuItem *Option1; + TMenuItem *LocalPath1; + TOpenDialog *localPathDlg; + TPanel *Panel1; + TMediaPlayer *MediaPlayer1; + TImage *Image1; + TPanel *pnlAvailable; + TPanel *pnlInstalled; + TSplitter *Splitter1; + TPanel *Panel2; + TPanel *Panel5; + TPageControl *PageControl1; + TTabSheet *TabSheet1; + TTreeView *localTree; + TPanel *Panel8; + TPanel *Panel7; + TPanel *Panel6; + TTreeView *installTree; + TTimer *Timer1; + TLabel *Label1; + TImageList *ImageList1; + TPanel *Panel3; + TImageList *ImageList2; + TPanel *statusBar; + TPanel *Panel4; + TProgressBar *progressBar; + TSpeedButton *SpeedButton2; + TImage *Image2; + TLabel *Label2; + TMenuItem *ManageRemoteSources1; + TSpeedButton *SpeedButton1; + TSpeedButton *SpeedButton3; + TSpeedButton *SpeedButton4; + TSpeedButton *SpeedButton5; + TSpeedButton *SpeedButton6; + TSpeedButton *SpeedButton7; + void __fastcall LocalPath1Click(TObject *Sender); + void __fastcall FormCreate(TObject *Sender); + void __fastcall Button5Click(TObject *Sender); + void __fastcall localTreeDblClick(TObject *Sender); + void __fastcall Button6Click(TObject *Sender); + void __fastcall Image1Click(TObject *Sender); + void __fastcall Button4Click(TObject *Sender); + void __fastcall Button2Click(TObject *Sender); + void __fastcall SpeedButton1Click(TObject *Sender); + void __fastcall SpeedButton5Click(TObject *Sender); + void __fastcall Exit1Click(TObject *Sender); + void __fastcall FormShow(TObject *Sender); + +private: // User declarations + + SWMgr *manager; + SWConfig *installConf; + const char *getLocalDir(); + void setLocalDir(const char *idir); + void refreshPageControl(); + void addSource(InstallSourceTab *ist); + void fillAllSourceTrees(); + void deleteAllModules(); + +public: // User declarations + __fastcall TMainForm(TComponent* Owner); + __fastcall ~TMainForm(); + void __fastcall RefreshRemoteSource(TObject *Sender); + int selectAll(TTreeView *tree, bool sel); + int removeModule(const char *modName); + int installModule(const char *modName, InstallSourceTab *ist = 0); + static int createParent(const char *pName); + int createPathAndFile(const char *fName); + int copyFile(const char *sourceFile, const char *targetFile); + int copyFileToCWD(const char *sourceDir, const char *fName); + int FTPCopy(InstallSourceTab *ist, const char *src, const char *dest, bool dirTransfer = false); + SWMgr *localMgr; + +protected: + virtual void fillInstallTree(); + virtual void fillSourceTree(const char *sourceConf, TTreeView *tree); +}; + +//--------------------------------------------------------------------------- +extern PACKAGE TMainForm *MainForm; +//--------------------------------------------------------------------------- +#endif diff --git a/apps/windoze/CBuilder4/InstallMgr/RemoteMntFrm.cpp b/apps/windoze/CBuilder4/InstallMgr/RemoteMntFrm.cpp new file mode 100644 index 0000000..a6b04b3 --- /dev/null +++ b/apps/windoze/CBuilder4/InstallMgr/RemoteMntFrm.cpp @@ -0,0 +1,145 @@ +//--------------------------------------------------------------------------- +#include +#pragma hdrstop + +#include "RemoteMntFrm.h" +//--------------------------------------------------------------------------- +#pragma package(smart_init) +#pragma resource "*.dfm" + +TRemoteMntForm *RemoteMntForm; + + +class TRemoteSource : public TObject { +public: + string name; + string machine; + string dir; + TRemoteSource(const char *confEnt) { + char *buf = new char [ strlen(confEnt) + 1 ]; + + strcpy(buf, confEnt); + + name = strtok(buf, "|"); + machine = strtok(0, "|"); + dir = strtok(0, "|"); + delete [] buf; + } + string getConfEnt() { + return name +"|" + machine + "|" + dir; + } +}; + + +//--------------------------------------------------------------------------- +__fastcall TRemoteMntForm::TRemoteMntForm(TComponent* Owner) + : TForm(Owner) +{ +} +//--------------------------------------------------------------------------- +void __fastcall TRemoteMntForm::FormShow(TObject *Sender) +{ + ConfigEntMap::iterator loop, end; + config = new SWConfig("./InstallMgr.conf"); + ListBox1->Clear(); + loop = config->Sections["Sources"].lower_bound("FTPSource"); + end = config->Sections["Sources"].upper_bound("FTPSource"); + while (loop != end) { + TRemoteSource *rs = new TRemoteSource(loop->second.c_str()); + ListBox1->Items->AddObject(rs->name.c_str(), rs); + loop++; + } + ListBox1->ItemIndex = 0; + ListBox1Click(0); +} +//--------------------------------------------------------------------------- +void __fastcall TRemoteMntForm::FormClose(TObject *Sender, + TCloseAction &Action) +{ + delete config; +} + + +void __fastcall TRemoteMntForm::SpeedButton4Click(TObject *Sender) +{ + ModalResult = mrCancel; +} + + +void __fastcall TRemoteMntForm::ListBox1Click(TObject *Sender) +{ + if (ListBox1->ItemIndex >= 0) { + TRemoteSource *rs = (TRemoteSource *)ListBox1->Items->Objects[ListBox1->ItemIndex]; + + NameEdit->Text = rs->name.c_str(); + MachineEdit->Text = rs->machine.c_str(); + DirEdit->Text = rs->dir.c_str(); + } + else { + NameEdit->Text = ""; + MachineEdit->Text = ""; + DirEdit->Text = ""; + } +} + + +void __fastcall TRemoteMntForm::NameEditChange(TObject *Sender) +{ + if (ListBox1->ItemIndex < 0) + return; + TRemoteSource *rs = (TRemoteSource *)ListBox1->Items->Objects[ListBox1->ItemIndex]; + rs->name = NameEdit->Text.c_str(); + ListBox1->Items->Strings[ListBox1->ItemIndex] = rs->name.c_str(); +} + + +void __fastcall TRemoteMntForm::MachineEditChange(TObject *Sender) +{ + if (ListBox1->ItemIndex < 0) + return; + TRemoteSource *rs = (TRemoteSource *)ListBox1->Items->Objects[ListBox1->ItemIndex]; + rs->machine = MachineEdit->Text.c_str(); +} + + +void __fastcall TRemoteMntForm::DirEditChange(TObject *Sender) +{ + if (ListBox1->ItemIndex < 0) + return; + TRemoteSource *rs = (TRemoteSource *)ListBox1->Items->Objects[ListBox1->ItemIndex]; + rs->dir = DirEdit->Text.c_str(); +} + +void __fastcall TRemoteMntForm::SpeedButton2Click(TObject *Sender) +{ + if (ListBox1->ItemIndex < 0) + return; + int delItem = ListBox1->ItemIndex; + ListBox1->Items->Delete(delItem); + ListBox1->ItemIndex = (delItem < ListBox1->Items->Count) ? delItem : delItem - 1; + ListBox1Click(0); +} +//--------------------------------------------------------------------------- + +void __fastcall TRemoteMntForm::SpeedButton1Click(TObject *Sender) +{ + TRemoteSource *rs = new TRemoteSource("[New Remote Site]|ftp.domain.org|/pub/sword/"); + ListBox1->ItemIndex = ListBox1->Items->AddObject(rs->name.c_str(), rs); + + ListBox1Click(0); +} +//--------------------------------------------------------------------------- + +void __fastcall TRemoteMntForm::SpeedButton3Click(TObject *Sender) +{ + TRemoteSource *rs; + config->Sections["Sources"].erase("FTPSource"); + for (int i = 0; i < ListBox1->Items->Count; i++) { + rs = (TRemoteSource *)ListBox1->Items->Objects[i]; + config->Sections["Sources"].insert(ConfigEntMap::value_type("FTPSource", rs->getConfEnt().c_str())); + } + config->Save(); + ModalResult = mrOk; +} +//--------------------------------------------------------------------------- + diff --git a/apps/windoze/CBuilder4/InstallMgr/RemoteMntFrm.dfm b/apps/windoze/CBuilder4/InstallMgr/RemoteMntFrm.dfm new file mode 100644 index 0000000..965036c Binary files /dev/null and b/apps/windoze/CBuilder4/InstallMgr/RemoteMntFrm.dfm differ diff --git a/apps/windoze/CBuilder4/InstallMgr/RemoteMntFrm.h b/apps/windoze/CBuilder4/InstallMgr/RemoteMntFrm.h new file mode 100644 index 0000000..81060e1 --- /dev/null +++ b/apps/windoze/CBuilder4/InstallMgr/RemoteMntFrm.h @@ -0,0 +1,49 @@ +//--------------------------------------------------------------------------- +#ifndef RemoteMntFrmH +#define RemoteMntFrmH +//--------------------------------------------------------------------------- +#include +#include +#include +#include +#include +#include +#include +//--------------------------------------------------------------------------- +class TRemoteMntForm : public TForm +{ +__published: // IDE-managed Components + TPanel *Panel1; + TPanel *Panel2; + TPanel *Panel3; + TListBox *ListBox1; + TSpeedButton *SpeedButton1; + TSpeedButton *SpeedButton2; + TEdit *NameEdit; + TEdit *MachineEdit; + TEdit *DirEdit; + TPanel *Panel4; + TSpeedButton *SpeedButton3; + TSpeedButton *SpeedButton4; + TLabel *Label1; + TLabel *Label2; + TLabel *Label3; + void __fastcall FormShow(TObject *Sender); + void __fastcall FormClose(TObject *Sender, TCloseAction &Action); + void __fastcall NameEditChange(TObject *Sender); + void __fastcall SpeedButton4Click(TObject *Sender); + void __fastcall ListBox1Click(TObject *Sender); + void __fastcall MachineEditChange(TObject *Sender); + void __fastcall DirEditChange(TObject *Sender); + void __fastcall SpeedButton2Click(TObject *Sender); + void __fastcall SpeedButton1Click(TObject *Sender); + void __fastcall SpeedButton3Click(TObject *Sender); +private: // User declarations + SWConfig *config; +public: // User declarations + __fastcall TRemoteMntForm(TComponent* Owner); +}; +//--------------------------------------------------------------------------- +extern PACKAGE TRemoteMntForm *RemoteMntForm; +//--------------------------------------------------------------------------- +#endif diff --git a/apps/windoze/CBuilder4/InstallMgr/StatusFrm.cpp b/apps/windoze/CBuilder4/InstallMgr/StatusFrm.cpp new file mode 100644 index 0000000..36911d2 --- /dev/null +++ b/apps/windoze/CBuilder4/InstallMgr/StatusFrm.cpp @@ -0,0 +1,175 @@ +//--------------------------------------------------------------------------- +#include +#pragma hdrstop + +#include "StatusFrm.h" +#include "MainFrm.h" +//--------------------------------------------------------------------------- +#pragma package(smart_init) +#pragma resource "*.dfm" +TStatusForm *StatusForm; +//--------------------------------------------------------------------------- +__fastcall TStatusForm::TStatusForm(TComponent* Owner) + : TForm(Owner) +{ +} +//--------------------------------------------------------------------------- +void __fastcall TStatusForm::FormShow(TObject *Sender) +{ + abort = false; + ftpThread = new TFTPThread(ist, src.c_str(), dest.c_str(), dirTransfer, true); + ftpThread->OnTerminate = Cleanup; + ftpThread->Resume(); +} +//--------------------------------------------------------------------------- +__fastcall TStatusForm::TFTPThread::TFTPThread(InstallSourceTab *iist, const char *isrc, const char *idest, bool idirTransfer, bool CreateSuspended) + : TThread(CreateSuspended) +{ + ist = iist; + src = isrc; + dest = idest; + dirTransfer = idirTransfer; + Priority = tpNormal; + FreeOnTerminate = true; + Synchronize((TThreadMethod)&CreateFTPObject); +} + +__fastcall TStatusForm::TFTPThread::~TFTPThread() +{ + delete FTPLink; +} + + +void __fastcall TStatusForm::TFTPThread::Execute() +{ + Synchronize((TThreadMethod)&PreConnect); + FTPLink->OnPacketRecvd = FTPLinkPacketRecvd; + FTPLink->ParseList = true; + FTPLink->Host = ist->Source.c_str(); + FTPLink->Port = 21; + FTPLink->UserID = "ftp"; + FTPLink->Password = "installmgr@user.com"; + + try { + FTPLink->Connect(); + FTPLink->Mode(MODE_IMAGE); + FTPLink->ChangeDir(ist->Directory.c_str()); + } + catch(...) { + StatusForm->Button1Click(0); // abort thread + } + + if (!Terminated) { + if (dirTransfer) { + FTPLink->ChangeDir(src.c_str()); + fileList.clear(); + FTPLink->List(); + int fileCount = FTPLink->FTPDirectoryList->name->Count; + for (int i = 0; i < fileCount; i++) { + if (FTPLink->FTPDirectoryList->Attribute->Strings[i].c_str()[0] != 'd') { + buffer = dest + "/" + FTPLink->FTPDirectoryList->name->Strings[i].c_str(); + buffer2 = "Downloading ("; + buffer2 += IntToStr(i+1).c_str(); + buffer2 += " of "; + buffer2 += IntToStr(fileCount).c_str(); + buffer2 += "): "; + buffer2 += FTPLink->FTPDirectoryList->name->Strings[i].c_str(); + // SWLog::systemlog->LogInformation("%s", buffer.c_str()); + TMainForm::createParent(buffer.c_str()); // make sure parent directory exists + Synchronize((TThreadMethod)&PreDownload1); + try { + FTPLink->Download(FTPLink->FTPDirectoryList->name->Strings[i].c_str(), buffer.c_str()); + } + catch(...) {} + if (Terminated) + break; + } + } + + } + else { + Synchronize((TThreadMethod)&PreDownload2); + FTPLink->Download(src.c_str(), dest.c_str()); + } + try { + FTPLink->Disconnect(); + } + catch(...){} + } +} + + +void __fastcall TStatusForm::TFTPThread::FTPLinkPacketRecvd(TObject *Sender) +{ + Synchronize((TThreadMethod)&UpdateBytes); +} + + +void __fastcall TStatusForm::TFTPThread::UpdateBytes(void) +{ + StatusForm->statusBar->Caption = IntToStr(FTPLink->BytesRecvd) + " bytes out of " + IntToStr(FTPLink->BytesTotal) + " transferred (" + IntToStr((int)((float)(FTPLink->BytesRecvd + 1) / (float)(FTPLink->BytesTotal + 1) * 100)) + "%)"; + StatusForm->statusBar->Repaint(); +} + + +void __fastcall TStatusForm::TFTPThread::CreateFTPObject(void) +{ + FTPLink = new TNMFTP(0); +} + + +void __fastcall TStatusForm::TFTPThread::PreConnect(void) +{ + buffer = "Connecting to server at "; + buffer += ist->Source.c_str(); + buffer += "..."; + StatusForm->actionBar->Caption = buffer.c_str(); + StatusForm->statusBar->Caption = ""; + StatusForm->Repaint(); +} + + +void __fastcall TStatusForm::TFTPThread::PreDownload1(void) +{ +// SWLog::systemlog->LogInformation("Creating parent dir: %s", buffer.c_str()); +// SWLog::systemlog->LogInformation("Return: %d", ret); + StatusForm->actionBar->Caption = buffer2.c_str(); + StatusForm->statusBar->Caption = ""; + StatusForm->Repaint(); +} + + +void __fastcall TStatusForm::TFTPThread::PreDownload2(void) +{ + buffer = "Downloading: "; + buffer += src.c_str(); + StatusForm->actionBar->Caption = buffer.c_str(); + StatusForm->statusBar->Caption = ""; + StatusForm->Repaint(); + MainForm->createParent(dest.c_str()); // make sure parent directory exists +} + + +void __fastcall TStatusForm::Cleanup(TObject *Sender) +//void __fastcall TStatusForm::TFTPThread::Cleanup() +{ + if (abort) + StatusForm->ModalResult = mrCancel; + else StatusForm->ModalResult = mrOk; +// StatusForm->Close(); +} + +void __fastcall TStatusForm::FormClose(TObject *Sender, TCloseAction &Action) +{ + MainForm->SetFocus(); +} +//--------------------------------------------------------------------------- + +void __fastcall TStatusForm::Button1Click(TObject *Sender) +{ + abort = true; + ftpThread->Terminate(); + ftpThread->FTPLink->Abort(); +} +//--------------------------------------------------------------------------- + diff --git a/apps/windoze/CBuilder4/InstallMgr/StatusFrm.dfm b/apps/windoze/CBuilder4/InstallMgr/StatusFrm.dfm new file mode 100644 index 0000000..2075523 Binary files /dev/null and b/apps/windoze/CBuilder4/InstallMgr/StatusFrm.dfm differ diff --git a/apps/windoze/CBuilder4/InstallMgr/StatusFrm.h b/apps/windoze/CBuilder4/InstallMgr/StatusFrm.h new file mode 100644 index 0000000..fdf7800 --- /dev/null +++ b/apps/windoze/CBuilder4/InstallMgr/StatusFrm.h @@ -0,0 +1,61 @@ +//--------------------------------------------------------------------------- +#ifndef StatusFrmH +#define StatusFrmH +//--------------------------------------------------------------------------- +#include +#include +#include +#include +#include +#include +#include "MainFrm.h" +//--------------------------------------------------------------------------- +class TStatusForm : public TForm +{ +__published: // IDE-managed Components + TPanel *Panel1; + TPanel *Panel2; + TButton *Button1; + TPanel *statusBar; + TPanel *Panel3; + TPanel *actionBar; + void __fastcall FormShow(TObject *Sender); + void __fastcall Cleanup(TObject *Sender); + void __fastcall FormClose(TObject *Sender, TCloseAction &Action); + void __fastcall Button1Click(TObject *Sender); +private: // User declarations + class TFTPThread : public TThread { + bool abort; + InstallSourceTab *ist; + string src; + string dest; + string buffer; + string buffer2; + bool dirTransfer; + protected: + void __fastcall Execute(); + public: + TNMFTP *FTPLink; + list fileList; + __fastcall TFTPThread(InstallSourceTab *iist, const char *isrc, const char *idest, bool idirTransfer = false, bool CreateSuspended = false); + __fastcall TFTPThread::~TFTPThread(); + void __fastcall FTPLinkPacketRecvd(TObject *Sender); + void __fastcall CreateFTPObject(void); + void __fastcall UpdateBytes(void); + void __fastcall PreConnect(void); + void __fastcall PreDownload1(void); + void __fastcall PreDownload2(void); +// void __fastcall Cleanup(void); + } *ftpThread; +public: // User declarations + InstallSourceTab *ist; + string src; + string dest; + bool dirTransfer; + bool abort; + __fastcall TStatusForm(TComponent* Owner); +}; +//--------------------------------------------------------------------------- +extern PACKAGE TStatusForm *StatusForm; +//--------------------------------------------------------------------------- +#endif diff --git a/apps/windoze/CBuilder4/InstallMgr/arrow2r.bmp b/apps/windoze/CBuilder4/InstallMgr/arrow2r.bmp new file mode 100644 index 0000000..8d5713f Binary files /dev/null and b/apps/windoze/CBuilder4/InstallMgr/arrow2r.bmp differ diff --git a/apps/windoze/CBuilder4/InstallMgr/arrow3u.bmp b/apps/windoze/CBuilder4/InstallMgr/arrow3u.bmp new file mode 100644 index 0000000..a1c4068 Binary files /dev/null and b/apps/windoze/CBuilder4/InstallMgr/arrow3u.bmp differ diff --git a/apps/windoze/CBuilder4/InstallMgr/back.bmp b/apps/windoze/CBuilder4/InstallMgr/back.bmp new file mode 100644 index 0000000..966e157 Binary files /dev/null and b/apps/windoze/CBuilder4/InstallMgr/back.bmp differ diff --git a/apps/windoze/CBuilder4/InstallMgr/bookshut.bmp b/apps/windoze/CBuilder4/InstallMgr/bookshut.bmp new file mode 100644 index 0000000..5389910 Binary files /dev/null and b/apps/windoze/CBuilder4/InstallMgr/bookshut.bmp differ diff --git a/apps/windoze/CBuilder4/InstallMgr/bulblk.bmp b/apps/windoze/CBuilder4/InstallMgr/bulblk.bmp new file mode 100644 index 0000000..0da70ab Binary files /dev/null and b/apps/windoze/CBuilder4/InstallMgr/bulblk.bmp differ diff --git a/apps/windoze/CBuilder4/InstallMgr/bulbon.bmp b/apps/windoze/CBuilder4/InstallMgr/bulbon.bmp new file mode 100644 index 0000000..61c7e5b Binary files /dev/null and b/apps/windoze/CBuilder4/InstallMgr/bulbon.bmp differ diff --git a/apps/windoze/CBuilder4/InstallMgr/check.bmp b/apps/windoze/CBuilder4/InstallMgr/check.bmp new file mode 100644 index 0000000..09307a9 Binary files /dev/null and b/apps/windoze/CBuilder4/InstallMgr/check.bmp differ diff --git a/apps/windoze/CBuilder4/InstallMgr/cipherfrm.cpp b/apps/windoze/CBuilder4/InstallMgr/cipherfrm.cpp new file mode 100644 index 0000000..5b77797 --- /dev/null +++ b/apps/windoze/CBuilder4/InstallMgr/cipherfrm.cpp @@ -0,0 +1,67 @@ +//--------------------------------------------------------------------------- +#include +#pragma hdrstop + +#include "cipherfrm.h" +#include +#include +//--------------------------------------------------------------------------- +#pragma package(smart_init) +#pragma resource "*.dfm" +TCipherForm *CipherForm; +//--------------------------------------------------------------------------- +__fastcall TCipherForm::TCipherForm(TComponent* Owner) + : TForm(Owner) +{ +} +//--------------------------------------------------------------------------- +void __fastcall TCipherForm::Button2Click(TObject *Sender) +{ + SectionMap::iterator section; + ConfigEntMap::iterator entry; + SWConfig *modconf = new SWConfig(confFile.c_str()); + string tmpBuf; + + section = modconf->Sections.find(modName); + if (section != modconf->Sections.end()) { + entry = section->second.find("CipherKey"); + if (entry != section->second.end()) { + entry->second = CipherForm->cipherEdit->Text.c_str(); + modconf->Save(); + delete modconf; // close file + modconf = 0; + SWMgr *mgr = new SWMgr(); + SWModule *mod = mgr->Modules[modName]; + mod->SetKey("Ipet 2:12"); + tmpBuf = mod->StripText(); + mod->SetKey("gen 1:10"); + tmpBuf += "\r\n\r\n"; + tmpBuf += mod->StripText(); + Memo1->Text = tmpBuf.c_str(); + delete mgr; + } + } + if (modconf) + delete modconf; + +} +//--------------------------------------------------------------------------- + +void __fastcall TCipherForm::FormShow(TObject *Sender) +{ + string tmpCaption; + tmpCaption = "Cipher Key: ["; + tmpCaption += modName; + tmpCaption += "]"; + Caption = tmpCaption.c_str(); +} +//--------------------------------------------------------------------------- + + +void __fastcall TCipherForm::FormClose(TObject *Sender, + TCloseAction &Action) +{ + Memo1->Text = ""; +} +//--------------------------------------------------------------------------- + diff --git a/apps/windoze/CBuilder4/InstallMgr/cipherfrm.dfm b/apps/windoze/CBuilder4/InstallMgr/cipherfrm.dfm new file mode 100644 index 0000000..8758bdb Binary files /dev/null and b/apps/windoze/CBuilder4/InstallMgr/cipherfrm.dfm differ diff --git a/apps/windoze/CBuilder4/InstallMgr/cipherfrm.h b/apps/windoze/CBuilder4/InstallMgr/cipherfrm.h new file mode 100644 index 0000000..4fcd722 --- /dev/null +++ b/apps/windoze/CBuilder4/InstallMgr/cipherfrm.h @@ -0,0 +1,36 @@ +//--------------------------------------------------------------------------- +#ifndef cipherfrmH +#define cipherfrmH +//--------------------------------------------------------------------------- +#include +#include +#include +#include +#include +#include +//--------------------------------------------------------------------------- +class TCipherForm : public TForm +{ +__published: // IDE-managed Components + TPanel *Panel1; + TPanel *Panel2; + TPanel *Panel3; + TLabel *Label1; + TLabel *Label2; + TEdit *cipherEdit; + TMemo *Memo1; + TButton *Button1; + TButton *Button2; + void __fastcall Button2Click(TObject *Sender); + void __fastcall FormShow(TObject *Sender); + void __fastcall FormClose(TObject *Sender, TCloseAction &Action); +private: // User declarations +public: // User declarations + std::string confFile; + std::string modName; + __fastcall TCipherForm(TComponent* Owner); +}; +//--------------------------------------------------------------------------- +extern PACKAGE TCipherForm *CipherForm; +//--------------------------------------------------------------------------- +#endif diff --git a/apps/windoze/CBuilder4/InstallMgr/delete.bmp b/apps/windoze/CBuilder4/InstallMgr/delete.bmp new file mode 100644 index 0000000..d20cbf9 Binary files /dev/null and b/apps/windoze/CBuilder4/InstallMgr/delete.bmp differ diff --git a/apps/windoze/CBuilder4/InstallMgr/filenew.bmp b/apps/windoze/CBuilder4/InstallMgr/filenew.bmp new file mode 100644 index 0000000..59fb3db Binary files /dev/null and b/apps/windoze/CBuilder4/InstallMgr/filenew.bmp differ diff --git a/apps/windoze/CBuilder4/InstallMgr/floppy.bmp b/apps/windoze/CBuilder4/InstallMgr/floppy.bmp new file mode 100644 index 0000000..5fbef0a Binary files /dev/null and b/apps/windoze/CBuilder4/InstallMgr/floppy.bmp differ diff --git a/apps/windoze/CBuilder4/InstallMgr/globe.bmp b/apps/windoze/CBuilder4/InstallMgr/globe.bmp new file mode 100644 index 0000000..e4b661d Binary files /dev/null and b/apps/windoze/CBuilder4/InstallMgr/globe.bmp differ diff --git a/apps/windoze/CBuilder4/InstallMgr/insert.bmp b/apps/windoze/CBuilder4/InstallMgr/insert.bmp new file mode 100644 index 0000000..7cc35c5 Binary files /dev/null and b/apps/windoze/CBuilder4/InstallMgr/insert.bmp differ diff --git a/apps/windoze/CBuilder4/InstallMgr/query.bmp b/apps/windoze/CBuilder4/InstallMgr/query.bmp new file mode 100644 index 0000000..36cd506 Binary files /dev/null and b/apps/windoze/CBuilder4/InstallMgr/query.bmp differ diff --git a/apps/windoze/CBuilder4/InstallMgr/sword.bmp b/apps/windoze/CBuilder4/InstallMgr/sword.bmp new file mode 100644 index 0000000..32c5606 Binary files /dev/null and b/apps/windoze/CBuilder4/InstallMgr/sword.bmp differ diff --git a/apps/windoze/CBuilder4/InstallMgr/trash.bmp b/apps/windoze/CBuilder4/InstallMgr/trash.bmp new file mode 100644 index 0000000..effbab9 Binary files /dev/null and b/apps/windoze/CBuilder4/InstallMgr/trash.bmp differ diff --git a/apps/windoze/CBuilder4/InstallMgr/undo.bmp b/apps/windoze/CBuilder4/InstallMgr/undo.bmp new file mode 100644 index 0000000..fc4fff6 Binary files /dev/null and b/apps/windoze/CBuilder4/InstallMgr/undo.bmp differ diff --git a/apps/windoze/CBuilder4/InstallMgr/upgdlk.bmp b/apps/windoze/CBuilder4/InstallMgr/upgdlk.bmp new file mode 100644 index 0000000..4158452 Binary files /dev/null and b/apps/windoze/CBuilder4/InstallMgr/upgdlk.bmp differ -- cgit