📄 banlistupdate.h
字号:
/*
This file is part of KCeasy (http://www.kceasy.com)
Copyright (C) 2002-2004 Markus Kern <mkern@kceasy.com>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
*/
//---------------------------------------------------------------------------
#ifndef BanlistUpdateH
#define BanlistUpdateH
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <ComCtrls.hpp>
#include "istring.h"
#include "HttpDownload.h"
//---------------------------------------------------------------------------
class TUpdateFile
{
public:
TUpdateFile(const string& NNetwork);
~TUpdateFile();
bool Parse(const string& ConfStr);
string Network;
string DisplayName;
string Type;
string FileName;
string Url;
unsigned int LastUpdate; // last update of remote file
bool UpdateOnInstall;
enum
{
CompressNone = 0,
CompressGzip = 1
} Compression;
int ChallengeStart; // inclusive
int ChallengeStop; // inclusive
string SavePath; // absolute file save path
};
class TBanlistUpdateForm : public TForm
{
__published: // IDE-managed Components
TListView *FilesListView;
TLabel *InfoLbl;
TLabel *FilesLbl;
TButton *UpdateBtn;
TButton *CancelBtn;
TProgressBar *ProgressBar;
TLabel *ImportantLbl;
void __fastcall CancelBtnClick(TObject *Sender);
void __fastcall UpdateBtnClick(TObject *Sender);
private: // User declarations
static const int WM_DOWNLOAD_CB = WM_USER + 0x125;
static const int WM_LISTRETRIEVE_CB = WM_USER + 0x126;
string TempFilePath;
list<TUpdateFile*> UpdateFiles;
list<TUpdateFile*>::iterator CurrentFileItr; // file we are currently updating
bool UpdateFinished;
int UpdatedFiles;
int UpdateErrors;
THttpDownload* Download;
bool Automatic; // true if we run in automatic mode after first install
void __fastcall WMListRetrieveCb(TMessage& Msg);
bool AddFilesFromConfig(const string& Path);
void PopulateListView();
void UpdateNextFile();
AnsiString GetFileStatus(const TUpdateFile* File);
bool CopyDecompressFile(const char* Src, const TUpdateFile* DstFile);
bool SetFileCreateTime(const TUpdateFile* File);
void __fastcall WMDownloadCb(TMessage& Msg);
BEGIN_MESSAGE_MAP
VCL_MESSAGE_HANDLER(WM_DOWNLOAD_CB, TMessage, WMDownloadCb)
VCL_MESSAGE_HANDLER(WM_LISTRETRIEVE_CB, TMessage, WMListRetrieveCb)
END_MESSAGE_MAP(TForm)
public: // User declarations
__fastcall TBanlistUpdateForm(TComponent* Owner, bool FirstInstall);
__fastcall ~TBanlistUpdateForm();
};
//---------------------------------------------------------------------------
//extern PACKAGE TBanlistUpdateForm *BanlistUpdateForm;
//---------------------------------------------------------------------------
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -