| Line 1... |
Line -... |
| 1 |
// SpkFile.h: interface for the CSpkFile class.
|
- |
|
| 2 |
//
|
- |
|
| 3 |
//////////////////////////////////////////////////////////////////////
|
- |
|
| 4 |
|
- |
|
| 5 |
#if !defined(AFX_SPKFILE_H__E35FA619_B901_479F_BE42_2FF1519BA4D3__INCLUDED_)
|
- |
|
| 6 |
#define AFX_SPKFILE_H__E35FA619_B901_479F_BE42_2FF1519BA4D3__INCLUDED_
|
- |
|
| 7 |
|
- |
|
| 8 |
#if _MSC_VER > 1000
|
- |
|
| 9 |
#pragma once
|
1 |
#pragma once
|
| 10 |
#endif // _MSC_VER > 1000
|
- |
|
| 11 |
|
- |
|
| 12 |
#include "lists.h"
|
- |
|
| 13 |
#include "StringList.h"
|
- |
|
| 14 |
#include "File.h"
|
2 |
#include "BaseFile.h"
|
| 15 |
|
- |
|
| 16 |
#define GAME_ALL 0
|
- |
|
| 17 |
#define GAME_X2 1
|
- |
|
| 18 |
#define GAME_X3 2
|
- |
|
| 19 |
#define GAME_X3TC 3
|
- |
|
| 20 |
#define GAME_X3AP 4
|
- |
|
| 21 |
#define GAME_XREBIRTH 5
|
- |
|
| 22 |
#define GAME_MAX (GAME_XREBIRTH)
|
- |
|
| 23 |
|
- |
|
| 24 |
#define FILEVERSION 4.20f
|
- |
|
| 25 |
#define LIBRARYVERSION 1.84f
|
- |
|
| 26 |
#define WRITECHUNK 50000
|
- |
|
| 27 |
|
- |
|
| 28 |
class CPackages;
|
- |
|
| 29 |
|
- |
|
| 30 |
enum {
|
- |
|
| 31 |
READFLAG_NONE = 0,
|
- |
|
| 32 |
READFLAG_NOUNCOMPRESS = 1
|
- |
|
| 33 |
};
|
- |
|
| 34 |
|
- |
|
| 35 |
enum {SPKFILE_INVALID, SPKFILE_SINGLE, SPKFILE_MULTI, SPKFILE_SINGLESHIP, SPKFILE_OLD, SPKFILE_BASE};
|
- |
|
| 36 |
enum {SPKREAD_ALL, SPKREAD_NODATA, SPKREAD_VALUES, SPKREAD_HEADER};
|
- |
|
| 37 |
enum {DELETESTATE_NONE, DELETESTATE_WAITING, DELETESTATE_DONE};
|
- |
|
| 38 |
enum {SETTING_INTEGER, SETTING_STRING, SETTING_CHECK};
|
- |
|
| 39 |
enum {SPKINSTALL_CREATEDIRECTORY, SPKINSTALL_CREATEDIRECTORY_FAIL, SPKINSTALL_WRITEFILE, SPKINSTALL_WRITEFILE_FAIL, SPKINSTALL_DELETEFILE, SPKINSTALL_DELETEFILE_FAIL,
|
- |
|
| 40 |
SPKINSTALL_SKIPFILE, SPKINSTALL_REMOVEDIR, SPKINSTALL_ENABLEFILE, SPKINSTALL_DISABLEFILE, SPKINSTALL_ENABLEFILE_FAIL, SPKINSTALL_DISABLEFILE_FAIL,
|
- |
|
| 41 |
SPKINSTALL_UNINSTALL_MOVE, SPKINSTALL_UNINSTALL_COPY, SPKINSTALL_UNINSTALL_MOVE_FAIL, SPKINSTALL_UNINSTALL_COPY_FAIL, SPKINSTALL_UNINSTALL_REMOVE, SPKINSTALL_UNINSTALL_REMOVE_FAIL,
|
- |
|
| 42 |
SPKINSTALL_ORIGINAL_BACKUP, SPKINSTALL_ORIGINAL_RESTORE, SPKINSTALL_ORIGINAL_BACKUP_FAIL, SPKINSTALL_ORIGINAL_RESTORE_FAIL, SPKINSTALL_FAKEPATCH, SPKINSTALL_FAKEPATCH_FAIL,
|
- |
|
| 43 |
SPKINSTALL_MISSINGFILE, SPKINSTALL_SHARED, SPKINSTALL_SHARED_FAIL, SPKINSTALL_ORPHANED, SPKINSTALL_ORPHANED_FAIL, SPKINSTALL_UNCOMPRESS_FAIL, SPKINSTALL_AUTOTEXT, SPKINSTALL_AUTOTEXT_FAIL
|
- |
|
| 44 |
};
|
- |
|
| 45 |
enum {SCRIPTTYPE_CUSTOM, SCRIPTTYPE_OTHER, SCRIPTTYPE_NAVIGATION, SCRIPTTYPE_COMBAT, SCRIPTTYPE_MISSION, SCRIPTTYPE_ALPLUGIN, SCRIPTTYPE_HOTKEY, SCRIPTTYPE_SHIPUPGRADE, SCRIPTTYPE_SHIPCOMMAND, SCRIPTTYPE_STATIONCOMMAND,
|
- |
|
| 46 |
SCRIPTTYPE_FLEET, SCRIPTTYPE_TRADE, SCRIPTTYPE_PIRACY, SCRIPTTYPE_CHEAT, SCRIPTTYPE_EXTENSION, SCRIPTTYPE_REBALANCE, SCRIPTTYPE_FIX, SCRIPTTYPE_GENERALMOD, SCRIPTTYPE_TOTAL, SCRIPTTYPE_WINGCOMMAND, SCRIPTTYPE_MAX};
|
- |
|
| 47 |
|
- |
|
| 48 |
enum {PACKAGETYPE_NORMAL, PACKAGETYPE_LIBRARY, PACKAGETYPE_CUSTOMSTART, PACKAGETYPE_PATCH, PACKAGETYPE_UPDATE, PACKAGETYPE_MOD, PACKAGETYPE_SHIP, PACKAGETYPE_FAKEPATCH};
|
- |
|
| 49 |
enum {PLUGIN_NORMAL, PLUGIN_STABLE, PLUGIN_EXPERIMENTAL, PLUGIN_CHEAT, PLUGIN_MOD}; // filters for browsing packages
|
- |
|
| 50 |
|
- |
|
| 51 |
enum {TYPE_BASE, TYPE_SPK, TYPE_XSP, TYPE_ARCHIVE};
|
- |
|
| 52 |
|
- |
|
| 53 |
// text pages
|
- |
|
| 54 |
#define TEXTPAGE_RACE 1266
|
- |
|
| 55 |
#define TEXTPAGE_OBJECTS 17
|
- |
|
| 56 |
#define TEXTPAGE_CLASS 2006
|
- |
|
| 57 |
#define TEXTPAGE_CARGOCLASS 1999
|
- |
|
| 58 |
|
- |
|
| 59 |
|
- |
|
| 60 |
// spk header struct
|
- |
|
| 61 |
tstruct SSPKHeader {
|
- |
|
| 62 |
SSPKHeader () { fVersion = 0; iValueCompression = lValueCompressSize = 0; }
|
- |
|
| 63 |
float fVersion;
|
- |
|
| 64 |
int iValueCompression;
|
- |
|
| 65 |
unsigned long lValueCompressSize;
|
- |
|
| 66 |
} SSPKHeader;
|
- |
|
| 67 |
|
3 |
|
| 68 |
tstruct SSettingType {
|
4 |
tstruct SSettingType {
|
| 69 |
CyString sKey;
|
5 |
CyString sKey;
|
| 70 |
int iType;
|
6 |
int iType;
|
| 71 |
} SSettingType;
|
7 |
} SSettingType;
|
| 72 |
|
- |
|
| 73 |
tstruct SNeededLibrary {
|
- |
|
| 74 |
CyString sName;
|
- |
|
| 75 |
CyString sAuthor;
|
- |
|
| 76 |
CyString sMinVersion;
|
- |
|
| 77 |
} SNeededLibrary;
|
- |
|
| 78 |
|
- |
|
| 79 |
tstruct SGameCompat {
|
- |
|
| 80 |
int iGame;
|
- |
|
| 81 |
CyString sVersion;
|
- |
|
| 82 |
int iVersion;
|
- |
|
| 83 |
} SGameCompat;
|
- |
|
| 84 |
|
- |
|
| 85 |
typedef struct SSettingString : public SSettingType {
|
- |
|
| 86 |
SSettingString () { iType = SETTING_STRING; }
|
- |
|
| 87 |
CyString sValue;
|
- |
|
| 88 |
} SSettingString;
|
- |
|
| 89 |
|
- |
|
| 90 |
typedef struct SSettingInteger : public SSettingType {
|
- |
|
| 91 |
SSettingInteger () { iType = SETTING_INTEGER; }
|
- |
|
| 92 |
int iValue;
|
- |
|
| 93 |
} SSettingInteger;
|
- |
|
| 94 |
|
- |
|
| 95 |
typedef struct SSettingCheck : public SSettingType {
|
- |
|
| 96 |
SSettingCheck () { iType = SETTING_CHECK; }
|
- |
|
| 97 |
bool bValue ;
|
- |
|
| 98 |
} SSettingCheck;
|
- |
|
| 99 |
|
- |
|
| 100 |
tstruct SSPKHeader2 {
|
- |
|
| 101 |
SSPKHeader2 () { iNumFiles = 0; lSize = 0; lFullSize = 0; }
|
- |
|
| 102 |
int iNumFiles;
|
- |
|
| 103 |
long lSize;
|
- |
|
| 104 |
long lFullSize;
|
- |
|
| 105 |
int iFileCompression;
|
- |
|
| 106 |
int iDataCompression;
|
- |
|
| 107 |
} SSPKHeader2;
|
- |
|
| 108 |
|
- |
|
| 109 |
tstruct SInstallText {
|
- |
|
| 110 |
int iLanguage;
|
- |
|
| 111 |
CyString sBefore;
|
- |
|
| 112 |
CyString sAfter;
|
- |
|
| 113 |
} SInstallText;
|
- |
|
| 114 |
|
8 |
|
| 115 |
typedef struct SWaresText {
|
9 |
typedef struct SWaresText {
|
| 116 |
int iLang;
|
10 |
int iLang;
|
| 117 |
CyString sName;
|
11 |
CyString sName;
|
| 118 |
CyString sDesc;
|
12 |
CyString sDesc;
|
| Line 132... |
Line 26... |
| 132 |
int iTextPage;
|
26 |
int iTextPage;
|
| 133 |
CLinkList<SWaresText> lText;
|
27 |
CLinkList<SWaresText> lText;
|
| 134 |
int iUsed;
|
28 |
int iUsed;
|
| 135 |
} SWares;
|
29 |
} SWares;
|
| 136 |
|
30 |
|
| 137 |
typedef struct SNames {
|
- |
|
| 138 |
int iLanguage;
|
- |
|
| 139 |
CyString sName;
|
- |
|
| 140 |
} SNames;
|
- |
|
| 141 |
|
31 |
|
| 142 |
|
- |
|
| 143 |
class SPKEXPORT CBaseFile
|
32 |
class SPKEXPORT CSpkFile : public CBaseFile
|
| 144 |
{
|
33 |
{
|
| 145 |
public:
|
34 |
public:
|
| - |
|
35 |
enum {
|
| - |
|
36 |
SCRIPTTYPE_CUSTOM,
|
| - |
|
37 |
SCRIPTTYPE_OTHER,
|
| - |
|
38 |
SCRIPTTYPE_NAVIGATION,
|
| - |
|
39 |
SCRIPTTYPE_COMBAT,
|
| - |
|
40 |
SCRIPTTYPE_MISSION,
|
| - |
|
41 |
SCRIPTTYPE_ALPLUGIN,
|
| - |
|
42 |
SCRIPTTYPE_HOTKEY,
|
| 146 |
static CyString ConvertGameToString(int game);
|
43 |
SCRIPTTYPE_SHIPUPGRADE,
|
| 147 |
static int GetGameFromString(CyString game);
|
44 |
SCRIPTTYPE_SHIPCOMMAND,
|
| 148 |
static CyString ErrorString(int error, CyString errorStr = NullString);
|
45 |
SCRIPTTYPE_STATIONCOMMAND,
|
| - |
|
46 |
SCRIPTTYPE_FLEET,
|
| - |
|
47 |
SCRIPTTYPE_TRADE,
|
| - |
|
48 |
SCRIPTTYPE_PIRACY,
|
| - |
|
49 |
SCRIPTTYPE_CHEAT,
|
| - |
|
50 |
SCRIPTTYPE_EXTENSION,
|
| - |
|
51 |
SCRIPTTYPE_REBALANCE,
|
| - |
|
52 |
SCRIPTTYPE_FIX,
|
| - |
|
53 |
SCRIPTTYPE_GENERALMOD,
|
| - |
|
54 |
SCRIPTTYPE_TOTAL,
|
| - |
|
55 |
SCRIPTTYPE_WINGCOMMAND,
|
| - |
|
56 |
SCRIPTTYPE_MAX
|
| - |
|
57 |
};
|
| - |
|
58 |
|
| - |
|
59 |
private:
|
| - |
|
60 |
enum {
|
| - |
|
61 |
SETTING_INTEGER,
|
| - |
|
62 |
SETTING_STRING,
|
| - |
|
63 |
SETTING_CHECK
|
| - |
|
64 |
};
|
| 149 |
|
65 |
|
| 150 |
CBaseFile();
|
- |
|
| 151 |
virtual ~CBaseFile();
|
- |
|
| 152 |
|
- |
|
| 153 |
// Get basic Settings
|
- |
|
| 154 |
CyString GetName () { return m_sName; }
|
- |
|
| 155 |
CyString GetVersion () { return m_sVersion; }
|
- |
|
| 156 |
CyString GetAuthor () { return m_sAuthor; }
|
- |
|
| 157 |
CyString GetWebSite () { return m_sWebSite; }
|
- |
|
| 158 |
CyString GetWebAddress () { return m_sWebAddress; }
|
- |
|
| 159 |
CyString GetEmail () { return m_sEmail; }
|
- |
|
| 160 |
CyString GetCreationDate () { return m_sCreationDate; }
|
66 |
typedef struct SSettingString : public SSettingType {
|
| 161 |
CyString GetDescription () { return m_sDescription; }
|
- |
|
| 162 |
CyString GetForumLink () { return m_sForumLink; }
|
67 |
SSettingString () { iType = SETTING_STRING; }
|
| 163 |
virtual CyString GetFullPackageName(int language, CyString byString) { return GetFullPackageName(language, true, byString); }
|
- |
|
| 164 |
virtual CyString GetFullPackageName(int language, bool includeVersion = true, CyString byString = "by")
|
- |
|
| 165 |
{
|
- |
|
| 166 |
CyString p;
|
68 |
CyString sValue;
|
| 167 |
if ( language == -1 )
|
- |
|
| 168 |
p = m_sName;
|
- |
|
| 169 |
else
|
- |
|
| 170 |
p = GetLanguageName(language);
|
- |
|
| 171 |
if ( includeVersion )
|
- |
|
| 172 |
{
|
- |
|
| 173 |
p += " V";
|
- |
|
| 174 |
p += m_sVersion;
|
- |
|
| 175 |
}
|
- |
|
| 176 |
p += " ";
|
- |
|
| 177 |
p += byString + " " + m_sAuthor;
|
- |
|
| 178 |
return p;
|
- |
|
| 179 |
}
|
- |
|
| 180 |
CLinkList<C_File> *GetFileList() { return &m_lFiles; }
|
- |
|
| 181 |
C_File *GetIcon () { return m_pIconFile; }
|
- |
|
| 182 |
CyString GetIconExt () { return m_sIconExt; }
|
- |
|
| 183 |
CyString GetNameValidFile ();
|
- |
|
| 184 |
int GetDataCompression () { return m_SHeader2.iDataCompression; }
|
- |
|
| 185 |
float GetFileVersion () { return m_SHeader.fVersion; }
|
- |
|
| 186 |
long GetFullFileSize ();
|
- |
|
| 187 |
CyString GetLanguageName ( int lang );
|
- |
|
| 188 |
virtual CyString GetFullPackageName(CyString format, int lang);
|
- |
|
| 189 |
CyString GetAutosaveName();
|
- |
|
| 190 |
void SetAutosaveName() { m_sFilename = GetAutosaveName(); }
|
- |
|
| 191 |
SGameCompat *GetGameCompatability(int game);
|
- |
|
| 192 |
bool RemoveGameCompatability(int game);
|
- |
|
| 193 |
void AddGameCompatability(int game, CyString version);
|
- |
|
| 194 |
bool CheckGameCompatability(int game);
|
- |
|
| 195 |
bool CheckGameVersionCompatability(int game, CyString sVersion, int iVersion);
|
- |
|
| 196 |
bool AnyGameCompatability() { return !m_lGames.empty(); }
|
- |
|
| 197 |
|
- |
|
| 198 |
bool AnyWebMirrors() { return !m_lMirrors.Empty(); }
|
- |
|
| 199 |
CyStringList *GetWebMirrors() { return &m_lMirrors; }
|
- |
|
| 200 |
int GetMaxWebMirrors() { return m_lMirrors.Count(); }
|
- |
|
| 201 |
CyString GetWebMirror(int i) { if ( i >= 0 && i < m_lMirrors.Count() ) return m_lMirrors.StringAt(i); return NullString; }
|
- |
|
| 202 |
void ClearWebMirrors() { m_lMirrors.Clear(); }
|
- |
|
| 203 |
|
- |
|
| 204 |
CLinkList<C_File> *GetFileList(int type);
|
- |
|
| 205 |
C_File *GetFirstFile(int type);
|
- |
|
| 206 |
C_File *GetNextFile(C_File *prev);
|
- |
|
| 207 |
C_File *GetPrevFile(C_File *next);
|
- |
|
| 208 |
|
- |
|
| 209 |
int GetRecommended() { return m_iRecommended; }
|
- |
|
| 210 |
int GetEaseOfUse() { return m_iEaseOfUse; }
|
- |
|
| 211 |
int GetGameChanging() { return m_iGameChanging; }
|
- |
|
| 212 |
|
- |
|
| 213 |
virtual CyString CreateValuesLine ();
|
- |
|
| 214 |
|
- |
|
| 215 |
virtual bool LoadPackageData(CyString first, CyString rest);
|
- |
|
| 216 |
virtual bool GeneratePackagerScript(bool wildcard, CyStringList *list, bool datafile = false);
|
- |
|
| 217 |
virtual bool GeneratePackagerScriptFile(bool wildcard, CyStringList *list);
|
- |
|
| 218 |
|
- |
|
| 219 |
void ConvertNormalMod(C_File *f, CyString to);
|
- |
|
| 220 |
void ConvertFakePatch(C_File *f);
|
- |
|
| 221 |
void ConvertAutoText(C_File *f);
|
- |
|
| 222 |
C_File *FindMatchingMod(C_File *f);
|
- |
|
| 223 |
void RenameFile(C_File *f, CyString baseName);
|
- |
|
| 224 |
|
- |
|
| 225 |
// set basic settings
|
69 |
} SSettingString;
|
| 226 |
void SetName ( CyString str ) { m_sName = str.Remove ( '|' ); m_bChanged = true; }
|
- |
|
| 227 |
void SetVersion ( CyString str ) { m_sVersion = str; m_bChanged = true; }
|
- |
|
| 228 |
void SetAuthor ( CyString str ) { m_sAuthor = str.Remove ( '|' ); m_bChanged = true; }
|
- |
|
| 229 |
void SetWebAddress ( CyString str ) { m_sWebAddress = str; m_bChanged = true; }
|
- |
|
| 230 |
void SetWebSite ( CyString str ) { m_sWebSite = str; m_bChanged = true; }
|
- |
|
| 231 |
void SetEmail ( CyString str ) { m_sEmail = str; m_bChanged = true; }
|
- |
|
| 232 |
void SetCreationDate ( CyString str ) { m_sCreationDate = str; m_bChanged = true; }
|
- |
|
| 233 |
void AddWebMirror ( CyString str ) { m_lMirrors.PushBack(str, "", true); m_bChanged = true; }
|
- |
|
| 234 |
void RemoveWebMirror ( CyString str ) { m_lMirrors.Remove(str, true); m_bChanged = true; }
|
- |
|
| 235 |
void SetDescription ( CyString str ) { m_sDescription = str; m_bChanged = true; }
|
- |
|
| 236 |
void SetDataCompression ( int c ) { m_SHeader2.iDataCompression = c; }
|
- |
|
| 237 |
void SetFileCompression ( int c ) { m_SHeader2.iFileCompression = c; }
|
- |
|
| 238 |
void SetValueCompression( int c ) { m_SHeader.iValueCompression = c; }
|
- |
|
| 239 |
void SetForumLink ( CyString str ) { m_sForumLink = str; m_bChanged = true; }
|
- |
|
| 240 |
void SetIcon ( C_File *file, CyString ext ) { if ( m_pIconFile ) delete m_pIconFile; m_sIconExt = ext; m_pIconFile = file; m_bChanged = true; }
|
- |
|
| 241 |
void SetFtpAddr ( CyString str ) { m_sFtpAddr = str; }
|
- |
|
| 242 |
|
70 |
|
| 243 |
void AddFileScript(int filetype, bool shared, CyString rest);
|
- |
|
| 244 |
void SetFilename ( CyString str ) { m_sFilename = str; }
|
- |
|
| 245 |
CyString GetFilename() { return m_sFilename; }
|
71 |
typedef struct SSettingInteger : public SSettingType {
|
| 246 |
CyString GetExportFilename() { return m_sExportFilename; }
|
- |
|
| 247 |
|
- |
|
| 248 |
void SetRecommended ( int i ) { m_iRecommended = i; m_bChanged = true; }
|
- |
|
| 249 |
void SetGameChanging ( int i ) { m_iGameChanging = i; m_bChanged = true; }
|
- |
|
| 250 |
void SetEaseOfUse ( int i ) { m_iEaseOfUse = i; m_bChanged = true; }
|
- |
|
| 251 |
|
- |
|
| 252 |
bool IsMod();
|
- |
|
| 253 |
bool IsFakePatch();
|
- |
|
| 254 |
|
- |
|
| 255 |
// error handling
|
- |
|
| 256 |
void ClearError () { m_sLastError = ""; m_iLastError = SPKERR_NONE; }
|
- |
|
| 257 |
int GetLastError () { return m_iLastError; }
|
- |
|
| 258 |
CyString GetLastErrorString() { return m_sLastError; }
|
- |
|
| 259 |
|
- |
|
| 260 |
// file handling
|
- |
|
| 261 |
void AddFile ( C_File *file );
|
- |
|
| 262 |
C_File *AddFile ( CyString, CyString, int type, int game = 0 );
|
- |
|
| 263 |
C_File *AppendFile ( CyString file, int type, int game, CyString dir = NullString, CProgressInfo *progress = NULL );
|
- |
|
| 264 |
C_File *FindFile ( CyString, int, CyString = NullString, int game = 0 );
|
- |
|
| 265 |
bool AddFileNow ( CyString, CyString, int type, CProgressInfo *progress = NULL );
|
- |
|
| 266 |
int CountFiles ( int filetype );
|
- |
|
| 267 |
C_File *FindFileAt ( int filetype, int pos );
|
- |
|
| 268 |
virtual bool RemoveFile ( int pos );
|
- |
|
| 269 |
virtual bool RemoveFile ( C_File *files );
|
- |
|
| 270 |
virtual bool RemoveFile ( CyString file, int type, CyString dir = NullString, int game = 0 );
|
- |
|
| 271 |
void RemoveAllFiles ( int type, int game );
|
- |
|
| 272 |
CyString CreateFilesLine ( bool updateheader, CProgressInfo * = NULL );
|
- |
|
| 273 |
|
- |
|
| 274 |
virtual bool WriteHeader ( FILE *id, int, int );
|
- |
|
| 275 |
virtual bool WriteData ( FILE *id, CProgressInfo * = NULL );
|
- |
|
| 276 |
virtual bool WriteFile ( CyString filename, CProgressInfo * = NULL );
|
- |
|
| 277 |
virtual bool ReadFile ( CyString filename, int readType = SPKREAD_ALL, CProgressInfo *progress = NULL );
|
- |
|
| 278 |
virtual bool ReadFile ( FILE *id, int readtype, CProgressInfo *progress );
|
- |
|
| 279 |
|
- |
|
| 280 |
virtual bool ExtractFile ( C_File *file, CyString dir, bool includedir = true, CProgressInfo *progress = NULL );
|
- |
|
| 281 |
virtual bool ExtractFile ( int file, CyString dir, bool includedir = true, CProgressInfo *progress = NULL );
|
- |
|
| 282 |
virtual bool ExtractAll ( CyString dir, int game, bool includedir = true, CProgressInfo *progress = NULL );
|
- |
|
| 283 |
|
- |
|
| 284 |
virtual bool SaveToArchive(CyString filename, int game, CProgressInfo *progress = NULL);
|
- |
|
| 285 |
void ClearFileData();
|
- |
|
| 286 |
|
- |
|
| 287 |
CLinkList<SNames> *GetNamesList() { return &m_lNames; }
|
- |
|
| 288 |
|
- |
|
| 289 |
// reading files
|
- |
|
| 290 |
void ReadAllFilesToMemory ();
|
- |
|
| 291 |
void ReadIconFileToMemory ();
|
- |
|
| 292 |
bool ReadFileToMemory(C_File *f);
|
- |
|
| 293 |
|
- |
|
| 294 |
// compression
|
- |
|
| 295 |
void RecompressAllFiles ( int compresstype, CProgressInfo *progress );
|
- |
|
| 296 |
void CompressAllFiles ( int compresstype, CProgressInfo *progress = NULL, int level = DEFAULT_COMPRESSION_LEVEL );
|
- |
|
| 297 |
bool UncompressAllFiles ( CProgressInfo * = NULL );
|
- |
|
| 298 |
|
- |
|
| 299 |
// static functions
|
- |
|
| 300 |
static CyString GetEndOfLine ( FILE *id, int *line = NULL, bool upper = true );
|
- |
|
| 301 |
static int CheckFile ( CyString filename, float *version = NULL );
|
- |
|
| 302 |
|
- |
|
| 303 |
bool IsFileAdded(C_File *f) { return m_lFiles.FindData(f); }
|
- |
|
| 304 |
|
- |
|
| 305 |
// installing
|
- |
|
| 306 |
void SwitchFilePointer(C_File *oldFile, C_File *newFile);
|
- |
|
| 307 |
bool InstallFiles ( CyString destdir, CProgressInfo *progress, CLinkList<C_File> *spklist, CyStringList *errorStr, bool enabled = true, CPackages *packages = NULL );
|
- |
|
| 308 |
virtual bool IsPatch () { return false; }
|
- |
|
| 309 |
|
- |
|
| 310 |
// installer functions
|
- |
|
| 311 |
bool IsProfileEnabled () { return m_bProfile; }
|
- |
|
| 312 |
bool IsEnabled () { return m_bEnable; }
|
- |
|
| 313 |
bool IsModifiedEnabled () { return m_bModifiedEnabled; }
|
- |
|
| 314 |
bool IsGlobalEnabled () { return m_bGlobal; }
|
- |
|
| 315 |
|
- |
|
| 316 |
void SetProfileEnabled ( bool en ) { m_bProfile = en; }
|
- |
|
| 317 |
void SetEnabled ( bool en ) { m_bEnable = en; }
|
- |
|
| 318 |
void SetModifiedEnabled ( bool en ) { m_bModifiedEnabled = en; }
|
- |
|
| 319 |
void SetGlobalEnabled ( bool en ) { m_bGlobal = en; }
|
- |
|
| 320 |
|
- |
|
| 321 |
int GetLoadError() { return m_iLoadError; }
|
- |
|
| 322 |
void SetLoadError(int i) { m_iLoadError = i; }
|
- |
|
| 323 |
CyString CreateUpdateFile(CyString dir);
|
- |
|
| 324 |
|
- |
|
| 325 |
// language functions
|
- |
|
| 326 |
void RemoveLanguageName ( int lang );
|
- |
|
| 327 |
void AddLanguageName ( int lang, CyString name );
|
- |
|
| 328 |
void ClearNames ();
|
- |
|
| 329 |
|
- |
|
| 330 |
virtual bool ParseValueLine ( CyString line );
|
- |
|
| 331 |
int ParseInstallText(CyString lang);
|
- |
|
| 332 |
|
- |
|
| 333 |
CLinkList<SInstallText> *GetInstallTextList() { return &m_lInstallText; }
|
- |
|
| 334 |
CLinkList<SInstallText> *GetUninstallTextList() { return &m_lUninstallText; }
|
- |
|
| 335 |
CLinkList<SGameCompat> *GetGameCompatabilityList() { return &m_lGames; }
|
- |
|
| 336 |
CyString GetInstallAfterText ( int lang, bool noDefault = false ) { return GetAfterText ( &m_lInstallText, lang, noDefault ); }
|
- |
|
| 337 |
CyString GetInstallBeforeText ( int lang, bool noDefault = false ) { return GetBeforeText ( &m_lInstallText, lang, noDefault ); }
|
- |
|
| 338 |
CyString GetUninstallAfterText ( int lang, bool noDefault = false ) { return GetAfterText ( &m_lUninstallText, lang, noDefault ); }
|
- |
|
| 339 |
CyString GetUninstallBeforeText ( int lang, bool noDefault = false ) { return GetBeforeText ( &m_lUninstallText, lang, noDefault ); }
|
- |
|
| 340 |
|
- |
|
| 341 |
SInstallText *AddInstallBeforeText ( int lang, CyString data ) { return AddInstallText ( true, true, lang, data ); }
|
- |
|
| 342 |
SInstallText *AddInstallAfterText ( int lang, CyString data ) { return AddInstallText ( false, true, lang, data ); }
|
- |
|
| 343 |
SInstallText *AddUninstallBeforeText ( int lang, CyString data ) { return AddInstallText ( true, false, lang, data ); }
|
- |
|
| 344 |
SInstallText *AddUninstallAfterText ( int lang, CyString data ) { return AddInstallText ( false, false, lang, data ); }
|
- |
|
| 345 |
SInstallText *FindInstallText ( int lang ) { return FindInstallText ( true, lang ); }
|
- |
|
| 346 |
SInstallText *FindUninstallText ( int lang ) { return FindInstallText ( false, lang ); }
|
- |
|
| 347 |
void AddInstallText ( SInstallText * );
|
- |
|
| 348 |
void AddUninstallText ( SInstallText * );
|
- |
|
| 349 |
void RemoveInstallText ( int lang ) { RemoveInstallText ( true, lang ); }
|
- |
|
| 350 |
void RemoveUninstallText ( int lang ) { RemoveInstallText ( false, lang ); }
|
- |
|
| 351 |
bool IsThereInstallText () { return IsThereInstallText ( true ); }
|
- |
|
| 352 |
bool IsThereUninstallText () { return IsThereInstallText ( false ); }
|
- |
|
| 353 |
|
- |
|
| 354 |
CyString GetFullFileSizeString();
|
- |
|
| 355 |
|
- |
|
| 356 |
CLinkList<SNeededLibrary> *GetNeededLibraries() { return &m_lNeededLibrarys; }
|
- |
|
| 357 |
void AddNeededLibrary(CyString scriptName, CyString author, CyString minVersion);
|
- |
|
| 358 |
bool IsPackageNeeded(CyString scriptName, CyString author);
|
- |
|
| 359 |
SNeededLibrary *FindPackageNeeded(CyString scriptName, CyString author);
|
- |
|
| 360 |
void RemovePackageNeeded(CyString scriptName, CyString author);
|
- |
|
| 361 |
void ClearNeededPackages();
|
- |
|
| 362 |
bool AnyDependacies() { return (m_lNeededLibrarys.size()) ? true: false; }
|
- |
|
| 363 |
bool AutoGenerateUpdateFile() { return m_bAutoGenerateUpdateFile; }
|
- |
|
| 364 |
void RemoveFakePatchOrder(bool after, CyString scriptName, CyString author);
|
- |
|
| 365 |
void RemoveFakePatchOrder(CyString scriptName, CyString author);
|
- |
|
| 366 |
void AddFakePatchOrder(bool after, CyString scriptName, CyString author);
|
- |
|
| 367 |
bool AnyFakePatchOrder() { if ( !m_lFakePatchBefore.Empty() || !m_lFakePatchAfter.Empty() ) return true; return false; }
|
- |
|
| 368 |
CyStringList &GetFakePatchBeforeOrder() { return m_lFakePatchBefore; }
|
- |
|
| 369 |
CyStringList &GetFakePatchAfterOrder() { return m_lFakePatchAfter; }
|
- |
|
| 370 |
int GetPluginType() { return m_iPluginType; }
|
72 |
SSettingInteger () { iType = SETTING_INTEGER; }
|
| 371 |
void SetPluginType(int i) { m_iPluginType = i; m_bChanged = true; }
|
- |
|
| 372 |
|
- |
|
| 373 |
bool IsChanged() { return m_bChanged; }
|
- |
|
| 374 |
void SetChanged(bool b) { m_bChanged = b; }
|
- |
|
| 375 |
|
- |
|
| 376 |
int FindFirstGameInPackage();
|
- |
|
| 377 |
bool IsAnyGameInPackage();
|
- |
|
| 378 |
bool IsMultipleGamesInPackage();
|
- |
|
| 379 |
bool IsGameInPackage(int game);
|
- |
|
| 380 |
|
- |
|
| 381 |
virtual int GetType () { return TYPE_BASE; }
|
- |
|
| 382 |
bool AnyFileType ( int type );
|
- |
|
| 383 |
CBaseFile *GetParent () { return m_pParent; }
|
- |
|
| 384 |
void SetParent ( CBaseFile *file ) { m_pParent = file; }
|
- |
|
| 385 |
int ParseLanguage(CyString lang);
|
- |
|
| 386 |
|
- |
|
| 387 |
virtual bool UpdateSigned (bool updateFiles);
|
- |
|
| 388 |
int GetNum() { return m_iNum; }
|
- |
|
| 389 |
void SetNum(int i) { m_iNum = i; }
|
- |
|
| 390 |
|
- |
|
| 391 |
bool IsFullyLoaded() { return m_bFullyLoaded; }
|
- |
|
| 392 |
virtual bool IsSigned () { return m_bSigned;}
|
- |
|
| 393 |
void SetOverrideFiles(bool b) { m_bOverrideFiles = b; }
|
- |
|
| 394 |
bool IsUpdateChecked () { return m_bUpdate; }
|
- |
|
| 395 |
void SetUpdateChecked ( bool en ) { m_bUpdate = en; }
|
- |
|
| 396 |
|
- |
|
| 397 |
unsigned char *CreateData(size_t *size, CProgressInfo *progress = NULL);
|
- |
|
| 398 |
|
- |
|
| 399 |
protected:
|
- |
|
| 400 |
virtual void Delete ();
|
- |
|
| 401 |
virtual void SetDefaults ();
|
- |
|
| 402 |
|
- |
|
| 403 |
// reading of files
|
- |
|
| 404 |
virtual bool CheckHeader(CyString header);
|
- |
|
| 405 |
virtual bool ParseHeader ( CyString header );
|
- |
|
| 406 |
virtual bool ParseFileHeader ( CyString header );
|
- |
|
| 407 |
virtual bool ParseFilesLine ( CyString line );
|
- |
|
| 408 |
virtual void ReadValues ( CyString values );
|
- |
|
| 409 |
virtual void ReadFiles ( CyString values );
|
- |
|
| 410 |
|
- |
|
| 411 |
SInstallText *AddInstallText ( bool before, bool install, int lang, CyString data );
|
- |
|
| 412 |
SInstallText *FindInstallText ( bool install, int lang );
|
- |
|
| 413 |
void RemoveInstallText ( bool install, int lang );
|
- |
|
| 414 |
bool IsThereInstallText ( bool );
|
- |
|
| 415 |
|
- |
|
| 416 |
CyString GetAfterText ( CLinkList<SInstallText> *list, int lang, bool noDefault = false );
|
- |
|
| 417 |
CyString GetBeforeText ( CLinkList<SInstallText> *list, int lang, bool noDefault = false );
|
- |
|
| 418 |
|
- |
|
| 419 |
int m_iType;
|
73 |
int iValue;
|
| 420 |
SSPKHeader m_SHeader;
|
- |
|
| 421 |
SSPKHeader2 m_SHeader2;
|
- |
|
| 422 |
|
- |
|
| 423 |
CyString m_sName;
|
74 |
} SSettingInteger;
|
| 424 |
CyString m_sVersion;
|
- |
|
| 425 |
CyString m_sAuthor;
|
- |
|
| 426 |
CyString m_sWebSite;
|
- |
|
| 427 |
CyString m_sWebAddress;
|
- |
|
| 428 |
CyString m_sEmail;
|
- |
|
| 429 |
CyString m_sDescription;
|
- |
|
| 430 |
CyString m_sCreationDate;
|
- |
|
| 431 |
CyString m_sForumLink;
|
- |
|
| 432 |
|
- |
|
| 433 |
C_File *m_pIconFile;
|
- |
|
| 434 |
CyString m_sIconExt;
|
- |
|
| 435 |
CyString m_sLastError;
|
- |
|
| 436 |
int m_iLastError;
|
- |
|
| 437 |
|
- |
|
| 438 |
CyString m_sFilename;
|
- |
|
| 439 |
CyString m_sExportFilename;
|
- |
|
| 440 |
|
75 |
|
| 441 |
CLinkList<C_File> m_lFiles;
|
- |
|
| 442 |
CLinkList<SNames> m_lNames;
|
- |
|
| 443 |
CLinkList<SInstallText> m_lInstallText;
|
- |
|
| 444 |
CLinkList<SInstallText> m_lUninstallText;
|
76 |
typedef struct SSettingCheck : public SSettingType {
|
| 445 |
CyStringList m_lMirrors;
|
- |
|
| 446 |
CyStringList m_lFakePatchBefore;
|
77 |
SSettingCheck () { iType = SETTING_CHECK; }
|
| 447 |
CyStringList m_lFakePatchAfter;
|
- |
|
| 448 |
|
- |
|
| 449 |
int m_iPluginType;
|
- |
|
| 450 |
CLinkList<SGameCompat> m_lGames;
|
- |
|
| 451 |
|
- |
|
| 452 |
// package stats
|
- |
|
| 453 |
int m_iRecommended;
|
- |
|
| 454 |
int m_iEaseOfUse;
|
- |
|
| 455 |
int m_iGameChanging;
|
- |
|
| 456 |
|
- |
|
| 457 |
bool m_bSigned;
|
78 |
bool bValue ;
|
| 458 |
bool m_bFullyLoaded;
|
- |
|
| 459 |
|
- |
|
| 460 |
//installer varibles
|
- |
|
| 461 |
bool m_bEnable;
|
79 |
} SSettingCheck;
|
| 462 |
bool m_bModifiedEnabled;
|
- |
|
| 463 |
bool m_bGlobal;
|
- |
|
| 464 |
bool m_bProfile;
|
- |
|
| 465 |
int m_iLoadError;
|
- |
|
| 466 |
|
- |
|
| 467 |
CBaseFile *m_pParent;
|
- |
|
| 468 |
|
- |
|
| 469 |
int m_iNum;
|
- |
|
| 470 |
bool m_bChanged;
|
- |
|
| 471 |
|
- |
|
| 472 |
CLinkList<SNeededLibrary> m_lNeededLibrarys;
|
- |
|
| 473 |
|
- |
|
| 474 |
bool m_bOverrideFiles;
|
- |
|
| 475 |
CyString m_sFtpAddr;
|
- |
|
| 476 |
bool m_bAutoGenerateUpdateFile;
|
- |
|
| 477 |
bool m_bUpdate;
|
- |
|
| 478 |
};
|
- |
|
| 479 |
|
80 |
|
| 480 |
class SPKEXPORT CSpkFile : public CBaseFile
|
- |
|
| 481 |
{
|
- |
|
| 482 |
public:
|
81 |
public:
|
| 483 |
static int ConvertScriptType(CyString sType);
|
82 |
static int ConvertScriptType(CyString sType);
|
| 484 |
static CyString GetScriptTypeStringStatic(int type);
|
83 |
static CyString GetScriptTypeStringStatic(int type);
|
| 485 |
static CyString GetWareText(SWares *w, int lang);
|
84 |
static CyString GetWareText(SWares *w, int lang);
|
| 486 |
static CyString GetWareDesc(SWares *w, int lang);
|
85 |
static CyString GetWareDesc(SWares *w, int lang);
|
| Line 561... |
Line 160... |
| 561 |
bool AnyWares() { return !m_lWares.empty(); }
|
160 |
bool AnyWares() { return !m_lWares.empty(); }
|
| 562 |
|
161 |
|
| 563 |
int CheckValidCustomStart ();
|
162 |
int CheckValidCustomStart ();
|
| 564 |
|
163 |
|
| 565 |
bool UpdateSigned (bool updateFiles);
|
164 |
bool UpdateSigned (bool updateFiles);
|
| 566 |
|
165 |
|
| 567 |
SSettingType *AddSetting ( CyString key, int type );
|
166 |
SSettingType *AddSetting ( CyString key, int type );
|
| 568 |
void ClearSettings ();
|
167 |
void ClearSettings ();
|
| 569 |
void ConvertSetting ( SSettingType *t, CyString set );
|
168 |
void ConvertSetting ( SSettingType *t, CyString set );
|
| 570 |
CyString GetSetting ( SSettingType *t );
|
169 |
CyString GetSetting ( SSettingType *t );
|
| 571 |
bool AnySettings() { return !m_lSettings.empty(); }
|
170 |
bool AnySettings() { return !m_lSettings.empty(); }
|
| Line 602... |
Line 201... |
| 602 |
|
201 |
|
| 603 |
// installer varibles
|
202 |
// installer varibles
|
| 604 |
CyString m_sLastReadme;
|
203 |
CyString m_sLastReadme;
|
| 605 |
CyString m_sCustomMap;
|
204 |
CyString m_sCustomMap;
|
| 606 |
};
|
205 |
};
|
| 607 |
|
- |
|
| 608 |
class SPKEXPORT CArchiveFile : public CBaseFile
|
- |
|
| 609 |
{
|
- |
|
| 610 |
public:
|
- |
|
| 611 |
CArchiveFile();
|
- |
|
| 612 |
virtual ~CArchiveFile();
|
- |
|
| 613 |
virtual CyString GetFullPackageName(CyString format, int lang) { return CyString("Archive(") + m_sName + ")"; }
|
- |
|
| 614 |
virtual CyString GetFullPackageName(int language, CyString byString) { return CyString("Archive(") + m_sName + ")"; }
|
- |
|
| 615 |
virtual CyString GetFullPackageName(int language, bool includeVersion = true, CyString byString = "by") { return CyString("Archive(") + m_sName + ")"; }
|
- |
|
| 616 |
virtual int GetType () { return TYPE_ARCHIVE; }
|
- |
|
| 617 |
};
|
- |
|
| 618 |
|
- |
|
| 619 |
#endif // !defined(AFX_SPKFILE_H__E35FA619_B901_479F_BE42_2FF1519BA4D3__INCLUDED_)
|
- |
|
| 620 |
|
- |
|