Files
2026-09-28 15:28:50 +08:00

423 lines
15 KiB
Plaintext

; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName "Envi3D Design System for ZWCAD 国能专版"
#define MyAppPublisher "ShangHuaSoft, Inc."
#define MyAppURL "http://www.shanghuasoft.com/"
#define MyAppExeName "Envi3D_ZW.exe"
#define DateTime GetDateTimeString('(yyyy.mm.dd-hh.nn)', '-', ':')
#define INIDateTime GetDateTimeString('yyyymmddhhnn', '', '')
#define PROFILES "SHS-ENVI"
#define VERSION "2026"
#define APPVER "V7.0"
#define PACKAGE_PATH "..\Original-File\environment_zw"
#define ENAME "Envi3DZW"
;一定是这种格式 {#ENAME} + "-" + {#VERSION}
#define APPDATA "\ShangHuaSoft\Envi3DZW-2026"
#define REG_KEY "Software\ZWSOFT\ZWCAD\"
[Setup]
AppId={{B6B260A5-F162-4A7C-A6E6-FDA33D152FDA}
AppName={#MyAppName}
AppVersion={#APPVER}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={sd}{#APPDATA}
DisableProgramGroupPage=yes
OutputDir=..\Output-File
OutputBaseFilename=国能专版-Envi3DZW{#VERSION}{#DateTime}
SetupIconFile={#PACKAGE_PATH}\sys\poolplant_zw.ico
Compression=lzma
SolidCompression=yes
DisableDirPage=no
;Uninstallable=no
PrivilegesRequired=admin
ArchitecturesInstallIn64BitMode=x64
;修改左侧图片(大)
;WizardImageFile=dh.bmp
;修改右上角图片(小)
;WizardSmallImageFile=xx.bmp
UsePreviousTasks=no
[Languages]
;Name: "Chinese"; MessagesFile: "compiler:Languages\ChineseSimplified.isl"
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: checkablealone
Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked; OnlyBelowVersion: 0,6.1
Name: "remote" ; Description:"集团授权";GroupDescription: "选择授权"; Flags: exclusive;
Name: "local" ; Description:"单机授权";GroupDescription: "选择授权"; Flags: exclusive
Name: "overwriteDB" ; Description:"覆盖当前用户数据";GroupDescription: "安装选项"; Flags: unchecked
[Files]
Source: "{#PACKAGE_PATH}\StartApp.exe"; DestDir: "{app}\"; DestName: "{#MyAppExeName}"; Flags: ignoreversion
Source: "{#PACKAGE_PATH}\INIFileParser.dll"; DestDir: "{app}\"; Flags: ignoreversion
Source: "{#PACKAGE_PATH}\上华软件-集团服务器设置工具.exe"; DestDir: "{app}\"; Flags: ignoreversion;Tasks: remote
Source: "{#PACKAGE_PATH}\上华软件-授权管理工具.exe"; DestDir: "{app}\"; Flags: ignoreversion;Tasks: local
Source: "{#PACKAGE_PATH}\demo\*"; DestDir: "{app}\demo\"; Flags: ignoreversion recursesubdirs createallsubdirs onlyifdoesntexist
;Source: "{#PACKAGE_PATH}\ZwHlrDll\*"; DestDir: "{app}\ZwHlrDll\"; Flags: ignoreversion recursesubdirs createallsubdirs onlyifdoesntexist
Source: "{#PACKAGE_PATH}\drawframe\*"; DestDir: "{app}\drawframe\"; Flags: ignoreversion recursesubdirs createallsubdirs onlyifdoesntexist
Source: "{#PACKAGE_PATH}\temp\*"; DestDir: "{app}\temp\"; Flags: ignoreversion recursesubdirs createallsubdirs onlyifdoesntexist
Source: "{#PACKAGE_PATH}\mdlapps\*"; DestDir: "{app}\mdlapps\"; Flags: ignoreversion recursesubdirs createallsubdirs onlyifdoesntexist
Source: "{#PACKAGE_PATH}\Equipment2D\*"; DestDir: "{app}\Equipment2D\"; Flags: ignoreversion recursesubdirs createallsubdirs onlyifdoesntexist
Source: "{#PACKAGE_PATH}\help\*"; DestDir: "{app}\help\"; Flags: ignoreversion recursesubdirs createallsubdirs onlyifdoesntexist uninsneveruninstall
Source: "{#PACKAGE_PATH}\Support\*"; DestDir: "{app}\Support\"; Flags: ignoreversion recursesubdirs createallsubdirs uninsneveruninstall; Tasks: overwriteDB
Source: "{#PACKAGE_PATH}\dwb\*"; DestDir: "{app}\dwb\"; Flags: ignoreversion recursesubdirs createallsubdirs uninsneveruninstall; Tasks: overwriteDB
Source: "{#PACKAGE_PATH}\tk\*"; DestDir: "{app}\tk\"; Flags: ignoreversion recursesubdirs createallsubdirs uninsneveruninstall; Tasks: overwriteDB
Source: "{#PACKAGE_PATH}\Support\*"; DestDir: "{app}\Support\"; Flags: ignoreversion recursesubdirs createallsubdirs onlyifdoesntexist uninsneveruninstall; Tasks: not overwriteDB
Source: "{#PACKAGE_PATH}\dwb\*"; DestDir: "{app}\dwb\"; Flags: ignoreversion recursesubdirs createallsubdirs onlyifdoesntexist uninsneveruninstall; Tasks: not overwriteDB
Source: "{#PACKAGE_PATH}\tk\*"; DestDir: "{app}\tk\"; Flags: ignoreversion recursesubdirs createallsubdirs onlyifdoesntexist uninsneveruninstall; Tasks: not overwriteDB
;sys目录下文件比较复杂,在此一一说明
;*.db文件为用户数据文件,不要求覆盖
;dict.xml文件专版用户需要使用,不要求覆盖
;拷贝所有sys内的文件,覆盖
Source: "{#PACKAGE_PATH}\sys\*"; DestDir: "{app}\sys\";Flags: ignoreversion recursesubdirs createallsubdirs;Excludes: "pp3d-*.mnu,pp3d-*.dll,*.db,shs-ew.cuix,shs-ew.dll,poolplant.ico"
;单独处里以下类型文件,不覆盖原有文件
Source: "{#PACKAGE_PATH}\sys\*.db"; DestDir: "{app}\sys\"; Flags: ignoreversion recursesubdirs createallsubdirs uninsneveruninstall; Tasks: overwriteDB
Source: "{#PACKAGE_PATH}\sys\*.db"; DestDir: "{app}\sys\"; Flags: ignoreversion recursesubdirs createallsubdirs uninsneveruninstall onlyifdoesntexist; Tasks: not overwriteDB
;arx文件
Source: "{#PACKAGE_PATH}\[v141R24][x64]\*"; DestDir: "{app}\sys2023x64\"; Flags: ignoreversion recursesubdirs createallsubdirs; Check: IsWin64
Source: "{#PACKAGE_PATH}\[v141R24][x64]\*"; DestDir: "{app}\sys2024x64\"; Flags: ignoreversion recursesubdirs createallsubdirs; Check: IsWin64
;arx加密文件
Source: "{#PACKAGE_PATH}\BAL_REMOTE\[v141R24][x64]\*"; DestDir: "{app}\sys2023x64\"; Flags: ignoreversion recursesubdirs createallsubdirs; Check: IsWin64; Tasks: remote
Source: "{#PACKAGE_PATH}\BAL_REMOTE\[v141R24][x64]\*"; DestDir: "{app}\sys2024x64\"; Flags: ignoreversion recursesubdirs createallsubdirs; Check: IsWin64; Tasks: remote
Source: "{#PACKAGE_PATH}\BAL_LOCAL\[v141R24][x64]\*"; DestDir: "{app}\sys2023x64\"; Flags: ignoreversion recursesubdirs createallsubdirs; Check: IsWin64; Tasks: local
Source: "{#PACKAGE_PATH}\BAL_LOCAL\[v141R24][x64]\*"; DestDir: "{app}\sys2024x64\"; Flags: ignoreversion recursesubdirs createallsubdirs; Check: IsWin64; Tasks: local
;拷贝 programData内的数据到{commonappdata}内,只有不存在时,并且不卸载
Source: "{#PACKAGE_PATH}\programdata\*"; DestDir: "{userappdata}{#APPDATA}\";Flags: ignoreversion recursesubdirs createallsubdirs uninsneveruninstall
[Registry]
Root: HKLM; Subkey: "Software\ShangHuaSoft\Environment"; ValueType: string; ValueName: "InstallPath"; ValueData: "{app}"; Flags: uninsdeletekey
[Icons]
Name: "{commonprograms}\{#MyAppName} {#APPVER}"; Filename: "{app}\{#MyAppExeName}"
Name: "{commondesktop}\{#MyAppName} {#APPVER}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
[LangOptions]
LanguageID=$0804
[INI]
Filename: "{app}\sys\product.ini"; Section: "Product"; Key: "CName"; String: "Envi3D"
Filename: "{app}\sys\product.ini"; Section: "Product"; Key: "EName"; String: {#ENAME}
Filename: "{app}\sys\product.ini"; Section: "Product"; Key: "ProfilesName"; String: {#PROFILES};
Filename: "{app}\sys\product.ini"; Section: "Product"; Key: "Version"; String: {#VERSION};
Filename: "{app}\sys\product.ini"; Section: "Product"; Key: "APPVer"; String: {#APPVER};
Filename: "{app}\sys\product.ini"; Section: "Product"; Key: "SubVer"; String: Build{#INIDateTime};
Filename: "{app}\sys\product.ini"; Section: "MENUS"; Key: "env-pid"; String: "工艺流程";
Filename: "{app}\sys\product.ini"; Section: "MENUS"; Key: "env-plot-plan"; String: "总图设计";
Filename: "{app}\sys\product.ini"; Section: "MENUS"; Key: "env-arch"; String: "土建设计";
Filename: "{app}\sys\product.ini"; Section: "MENUS"; Key: "env-pipe"; String: "工艺管道";
Filename: "{app}\sys\product.ini"; Section: "MENUS"; Key: "env-hvac-elec"; String: "暖通电气";
Filename: "{app}\sys\product.ini"; Section: "MENUS"; Key: "env-statistic-plot"; String: "统计出图";
Filename: "{app}\sys\product.ini"; Section: "MENUS"; Key: "env-digital-collaboration"; String: "数字协同";
Filename: "{app}\sys\product.ini"; Section: "Product"; Key: "CADVer"; String: "zw:2023:2024";
Filename: "{app}\sys\product.ini"; Section: "Product"; Key: "IconFile"; String: "poolplant.ico";
[Messages]
ButtonFinish=完成(&F)
[InstallDelete]
Type: files; Name: "{userappdata}{#APPDATA}\*.dat"
;确保efeTemplete.dt ewnode2d.db 两个文件不在 水处理 安装目录下
Type: files; Name: "{app}\sys\efeTemplete.db"
Type: files; Name: "{app}\sys\ewnode2d.db"
[Registry]
[code]
function hasCADVersion(ver:string):boolean;
var
s:string;
begin
s := '{#REG_KEY}' + ver + '\';
Log(s);
if RegKeyExists(HKCU, s) then
begin
Result := true;
Log('exists');
end
else
begin
Result := false;
Log('no exists');
end;
end;
function getCadPath(ver:string):string;
var
key:string;
begin
key:='{#REG_KEY}' + ver + '\zh-CN\';
if RegKeyExists(HKCU, key) then
begin
RegQueryStringValue(HKLM, key, 'Location', Result);
end
else
begin
Result := '';
end;
end;
function getRoamableRootFolder(ver:string; name:string):string;
var
key:string;
I: Integer;
S: String;
value:string;
begin
key := '{#REG_KEY}' + ver + '\' + name + '\';
Log(key);
if RegKeyExists(HKCU, key) then
begin
if RegValueExists(HKCU, key, 'RoamableRootFolder') then
begin
RegQueryStringValue(HKCU, key, 'RoamableRootFolder', value);
Result := value;
end;
end;
end;
function getDefaultACADContent(ver:string; name:string):string;
var
key:string;
Names: TArrayOfString;
I: Integer;
S: String;
acad:string;
insDir:string;
RoamableRoot:string;
begin
RoamableRoot := getRoamableRootFolder(ver,name);
Log(RoamableRoot);
key := '{#REG_KEY}' + ver + '\' + name + '\';
Log(key);
if RegKeyExists(HKLM, key) then
begin
if RegValueExists(HKLM, key, 'Location') then
begin
RegQueryStringValue(HKLM, key, 'Location', insDir);
acad := insDir + 'Support;'
acad := acad + insDir + 'Support\' + name + ';'
acad := acad + insDir + 'fonts;'
acad := acad + insDir + name + '\help;'
acad := acad + insDir + 'Express;'
acad := acad + insDir + 'Support\color;'
acad := acad + insDir + 'Render;'
acad := acad + insDir + 'Render\appl\comm\DCL;'
acad := acad + insDir + 'Render\RPS Material Libraries\Generic;'
acad := acad + RoamableRoot + 'SUPPORT;'
Log(acad);
Result := acad;
end;
end;
end;
function setAuthorizationInfomation(verM:string; ProfileName:string):string;
var
key:string;
subkey:string;
Names: TArrayOfString;
I: Integer;
S: String;
commResPath:String;
begin
if (hasCADVersion(verM)) then
begin
key := '{#REG_KEY}' + verM + '\';
Log(key);
if RegGetSubkeyNames(HKCU, key, Names) then
begin
S := '';
// ZWCAD\2024\...
for I := 0 to GetArrayLength(Names)-1 do
begin
// ZWCAD\2024\zh-CN\Profiles\...
subkey := key + Names[I] + '\Profiles\';
Log(subkey);
if RegKeyExists(HKEY_CURRENT_USER, subkey) then
begin
commResPath := subkey + ProfileName + '\CommonSettings';
//if RegKeyExists(HKEY_CURRENT_USER, commResPath) then
//begin
RegWriteStringValue(HKCU, commResPath, 'CustomResFile', getCadPath(verM) + 'zh-CN\ZwCustomRes.dll');
//end;
end;
end;
end;
end;
end;
function setCADProfilesKey(verM:string):boolean;
var
key:string;
subkey:string;
Names: TArrayOfString;
I: Integer;
S: String;
pfsKey: String;
ver:String;
sApp:String;
str1:String;
str2:String;
intM:Integer;
begin
ver := verM;
sApp := ExpandConstant('{app}');
intM := StrToInt(verM);
if (hasCADVersion(ver)) then
begin
key := '{#REG_KEY}' + ver + '\';
Log(key);
if RegGetSubkeyNames(HKCU, key, Names) then
begin
S := '';
for I := 0 to GetArrayLength(Names)-1 do
begin
subkey := key + Names[I] + '\Profiles\';
Log(subkey);
if RegKeyExists(HKEY_CURRENT_USER, subkey) then
begin
pfsKey := subkey + '{#PROFILES}{#VERSION}' + '\Config';
str1 := sApp + '\sys' + verM + 'x64;' + sApp + '\sys;' + sApp + '\dwb;';
str2 := getDefaultACADContent(ver, Names[I]);
RegWriteStringValue(HKCU, pfsKey, 'ZWCADSEARCHPATH', str1 + str2);
end;
end;
end;
end;
end;
function addARX2RXFile(ver:string):boolean;
var
fileName: String;
svArray: TArrayOfString;
bExist: Boolean;
begin
fileName := ExpandConstant('{app}\sys' + ver + 'x64\zwcad.rx');
bExist := FileExists(fileName); //判断文件是否存在
if (bExist = True) then
begin
SetArrayLength(svArray, 2);
svArray[0] := 'ArchCmd.zrx';
svArray[1] := 'PlumbingCmd.zrx';
SaveStringsToFile(fileName, svArray, true);
end;
end;
function IsVC2008RuntimeInstalled: boolean;
var
Version, KeyPath
, VC2008_guid1, VC2008_guid2
, VC2008_guid3, VC2008_guid4 :string;
begin
Result := False;
KeyPath := 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\';
VC2008_guid1 := KeyPath + '{350AA351-21FA-3270-8B7A-835434E766AD}';
VC2008_guid2 := KeyPath + '{8220EEFE-38CD-377E-8595-13398D740ACE}';
VC2008_guid3 := KeyPath + '{4B6C7001-C7D6-3710-913E-5BC23FCE91E6}';
VC2008_guid4 := KeyPath + '{5FCE6D76-F5DC-37AB-B2B8-22AB8CEDB1D4}';
if RegKeyExists(HKLM, vc2008_guid1)
or RegKeyExists(HKLM, vc2008_guid2)
or RegKeyExists(HKLM, vc2008_guid3)
or RegKeyExists(HKLM, vc2008_guid4) then
begin
Result := True;
end;
end;
procedure CurStepChanged(CurStep: TSetupStep);
var
ResultCode:Integer;
begin
if CurStep=ssinstall then
//MsgBox('准备写入文件了', mbInformation, MB_OK);
begin
setCADProfilesKey('2023');
setCADProfilesKey('2024');
setAuthorizationInfomation('2023', '{#PROFILES}{#VERSION}');
setAuthorizationInfomation('2024', '{#PROFILES}{#VERSION}');
setAuthorizationInfomation('2023', '<<Unnamed Profile>>');
setAuthorizationInfomation('2024', '<<Unnamed Profile>>');
setAuthorizationInfomation('2023', 'Default');
setAuthorizationInfomation('2024', 'Default');
end;
if CurStep=ssPostinstall then
begin
end;
if CurStep=ssDone then
begin
//addARX2RXFile('2024');
//addARX2RXFile('2023');
if IsVC2008RuntimeInstalled()=False then
begin
Exec(ExpandConstant('{app}\sys\' + '2008-vcredist_x64.exe'), '', '', SW_SHOW, ewWaitUntilTerminated, ResultCode);
end;
end;
//MsgBox('软件成功安装', mbInformation, MB_OK);
end;
function deleteKey(ver:string):boolean;
var
key:string;
subkey:string;
Names: TArrayOfString;
I: Integer;
S: String;
begin
if not hasCADVersion(ver) then
begin
Result := false;
exit;
end;
key := '{#REG_KEY}' + ver + '\';
Log(key);
if RegGetSubkeyNames(HKCU, key, Names) then
begin
S := '';
for I := 0 to GetArrayLength(Names)-1 do
begin
subkey := key + Names[I] + '\Profiles\' + '{#PROFILES}{#VERSION}';
Log(subkey);
if RegKeyExists(HKCU, subkey) then
RegDeleteKeyIncludingSubkeys(HKCU, subkey);
end;
end;
end;
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
var
key:string;
begin
// 把新建的注册表删除
deleteKey('2024');
deleteKey('2023');
end;