forked from oulan/Asuite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAppConfig.pas
180 lines (152 loc) · 5.6 KB
/
AppConfig.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
{
Copyright (C) 2006-2009 Matteo Salvi and Shannara
Website: http://www.salvadorsoftware.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.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
}
unit AppConfig;
{$MODE Delphi}
interface
uses
SysUtils, Forms;
const
// Application's informations
APP_NAME = 'ASuite';
APP_TITLE = APP_NAME;
VERSION_RELEASE = '2.0';
VERSION_PRERELEASE = 'Alpha 3'; //For Alpha and Beta version
//(VERSION_RELEASE + VERSION_PRERELEASE = Version)
VERSION_COMPLETE = 'Version ' + VERSION_RELEASE + ' ' + VERSION_PRERELEASE;
BACKUP_DIR = 'backup\';
CACHE_DIR = 'cache\';
ICONS_DIR = 'icons\';
// MENUTHEMES_DIR = 'menuthemes\'; -> For graphic menu
// Caratteri speciali
LF = #10; { line feed }
CR = #13; { carriage return }
SLASH = '/'; { forward slash }
BACKSLASH = '\'; { back slash }
CRLF = CR + LF; { new line }
//FileSystem
PATH_SEPARATOR = BACKSLASH; // Windows only, for now
SLASHES = [SLASH, BACKSLASH];
DriveLetters = ['a'..'z', 'A'..'Z'];
//Extensions
EXT_XML = '.xml';
EXT_SQL = '.sqlite';
EXT_SQLBCK = '.sqbck';
EXT_XMLBCK = '.bck';
EXT_ICO = '.ico';
EXT_LNK = '.lnk';
//File
DEBUG_FILE = 'Debug.txt';
//Form
frmMainWidth = 190;
frmMainHeight = 440;
frmMenuID = 123456789;
// PageControl Indexes
PG_LIST = 0;
PG_SEARCH = 1;
//ASuite placeholders for path
CONST_PATH_ASUITE = '$asuite';
CONST_PATH_DRIVE = '$drive';
//Parameters' variables: constant placeholders
CONST_PARAM_PENDRV = '%pendrive%';
var
//Paths
SUITE_FULLFILENAME : String;
SUITE_FILENAME : String;
SUITE_DRIVE : String;
SUITE_PATH : String;
SUITE_WORKING_PATH : String;
SUITE_CACHE_PATH : String;
SUITE_BACKUP_PATH : String;
SUITE_ICONS_PATH : String;
// Application's files
SUITE_LIST_PATH : String;
//Menu icons
IMG_ASuite, //ID = 0;
IMG_Cat, //ID = 1;
IMG_Help, //ID = 2;
IMG_Options, //ID = 3;
IMG_AddCat, //ID = 4;
IMG_AddFile , //ID = 5;
IMG_AddFolder, //ID = 6;
IMG_Delete, //ID = 7;
IMG_Property, //ID = 8;
IMG_Save, //ID = 9;
IMG_Folder, //ID = 10;
IMG_AddGroupFile, //ID = 11;
IMG_GroupFile, //ID = 12;
IMG_NOTFOUND, //ID = 13;
IMG_Run, //ID = 14;
IMG_Cut, //ID = 15;
IMG_Copy, //ID = 16;
IMG_Paste , //ID = 17;
IMG_Search, //ID = 18;
IMG_SearchType, //ID = 19;
IMG_Url, //ID = 20;
IMG_Accept, //ID = 21;
IMG_Cancel //ID = 22;
: Integer;
resourcestring
msgCopy = 'Copy_';
msgNoName = 'No name';
msgSaveCompleted = 'Save completed';
msgConfirm = 'Are you sure?';
msgProcessingItems = 'Processing items (%.0f%%): %d';
//Import
msgImportProgress = 'Import in progress...';
msgImportTitle1 = 'Select a launcher from which to import list and settings';
msgImportTitle2 = 'Select the location of list to import in ASuite. Select if you want import list and/or settings';
msgImportTitle3 = 'Select which items to import';
msgImportTitle4 = 'Complete';
msgItemsImported = 'Import finished. %d items imported';
msgNext = 'Next >';
msgImport = 'Import';
msgClose = 'Close';
//Classic Menu
msgLongMFU = 'Most Frequently Used';
msgLongMRU = 'Recents';
msgShortMFU = 'MFU';
msgShortMRU = 'MRU';
msgList = 'List';
//Errors
msgErrEmptyName = 'Application''s name field is empty';
msgErrGeneric = '%s error raised, with message: %s';
msgErrIcon = 'Cannot use icon %s';
msgErrNoIcon = 'Couldn''t find the icon %s';
msgErrRun = 'Cannot run %s';
msgErrSave = 'Save failed because of an error';
msgFileNotFound = 'File not found';
msgImportFailed = 'Import failed because of an error';
implementation
uses ulSysUtils;
initialization
//Default paths
SUITE_FULLFILENAME := Application.ExeName;
SUITE_FILENAME := ExtractFileName(SUITE_FULLFILENAME);
SUITE_DRIVE := LowerCase(ExtractFileDrive(SUITE_FULLFILENAME));
SUITE_PATH := IncludeTrailingBackslash(ExtractFileDir(SUITE_FULLFILENAME));
if IsDriveRoot(SUITE_PATH)
then SUITE_WORKING_PATH := GetCorrectWorkingDir(SUITE_PATH)
else SUITE_WORKING_PATH := SUITE_PATH;
SUITE_WORKING_PATH := LowerCase(SUITE_WORKING_PATH);
SUITE_CACHE_PATH := SUITE_WORKING_PATH + CACHE_DIR;
SUITE_BACKUP_PATH := SUITE_WORKING_PATH + BACKUP_DIR;
SUITE_ICONS_PATH := SUITE_WORKING_PATH + ICONS_DIR;
//List
if (ExtractFileExt(ParamStr(1)) = EXT_SQL) and FileExists(ParamStr(1)) then
SUITE_LIST_PATH := ParamStr(1)
else
SUITE_LIST_PATH := SUITE_WORKING_PATH + ChangeFileExt(SUITE_FILENAME, EXT_SQL);
end.