; ============================================================ ; 成套报价软件 安装包脚本 — Inno Setup 6 ; 文件必须保存为 UTF-8 with BOM 编码(中文才能正确显示) ; ============================================================ [Code] // ★ WebView2 运行时检测(2026-09-21 新装机实测:精简系统没装过 Edge 时所有内嵌网页窗口全黑) // 三处注册表任一存在有效版本即视为已装(64位系统机器级/32位视图/当前用户级) // (标识符必须 ASCII——Inno 的 Check 表达式解析不接受中文函数名) function WebView2RegOk(Root: Integer; SubKey: String): Boolean; var v: String; begin Result := RegQueryStringValue(Root, SubKey, 'pv', v) and (Length(v) > 2) and (Pos('0.0.0.0', v) = 0); end; function NeedWebView2(): Boolean; begin Result := not ( WebView2RegOk(HKEY_LOCAL_MACHINE, 'SOFTWARE\WOW6432Node\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}') or WebView2RegOk(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}') or WebView2RegOk(HKEY_CURRENT_USER, 'SOFTWARE\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}') ); end; // 升级安装:清理旧版遗留的 cadcj(旧 AutoCAD 插件)与 libredwg 目录(2026-09-04 退役) procedure CurStepChanged(CurStep: TSetupStep); begin if CurStep = ssInstall then begin if DirExists(ExpandConstant('{app}\cadcj')) then DelTree(ExpandConstant('{app}\cadcj'), True, True, True); if DirExists(ExpandConstant('{app}\libredwg-0.13.4.8043-win64')) then DelTree(ExpandConstant('{app}\libredwg-0.13.4.8043-win64'), True, True, True); end; end; [Setup] AppName=成套报价软件 ; ★ 版本号与 AssemblyInfo.cs 的 AssemblyVersion 同步(tools\递增版本号.ps1 统一递增) AppVersion=1.0.3 AppPublisher=成套报价软件 AppId={{8F3A7C21-6B54-4E2D-9A71-5C8B20260825} DefaultDirName=C:\成套报价软件 DefaultGroupName=成套报价软件 DisableProgramGroupPage=yes OutputDir=Output ; ★ 安装包文件名带版本号(多版本下载不混淆),与 AppVersion 同步 OutputBaseFilename=成套报价软件_Setup_1.0.3 Compression=lzma2 SolidCompression=yes WizardStyle=modern ; 程序为 x86(32位)编译,但可在 64 位 Windows 上运行 ArchitecturesAllowed=x64 x86 PrivilegesRequired=admin ; ★ 支持直接覆盖安装升级: ; CloseApplications=yes —— 安装时检测到本软件正在运行,提示一键关闭后再继续, ; 避免旧 exe/DLL 被占用导致替换失败(表现为"装了新版但还是旧功能"); ; RestartApplications=no —— 不用重启延迟替换,当场完成替换。 CloseApplications=yes RestartApplications=no ; 安装包自身与卸载项图标 SetupIconFile=app.ico UninstallDisplayIcon={app}\app.ico UninstallDisplayName=成套报价软件 [Languages] Name: "chinesesimp"; MessagesFile: "compiler:Languages\ChineseSimplified.isl" [Tasks] Name: "desktopicon"; Description: "创建桌面快捷方式(&D)"; GroupDescription: "附加图标:" Name: "importdata"; Description: "安装 GCS 铜排计算工具(&M)"; GroupDescription: "可选组件(仅铜排壳体计算需要):"; Flags: unchecked [Files] ; ★ WebView2 运行时官方引导程序(仅安装期用,装进 {tmp} 不落安装目录): ; 新电脑缺运行时(元件库/CAD扒图/AI助手等所有内嵌网页窗口的底层)时静默安装, ; 引导程序联网从微软 CDN 下载——不依赖 GitHub;已装过则整个跳过 Source: "MicrosoftEdgeWebview2Setup.exe"; DestDir: "{tmp}"; Flags: deleteafterinstall ; 主程序 + 配置 + 图标 Source: "成套报价软件.exe"; DestDir: "{app}"; Flags: ignoreversion Source: "成套报价软件.exe.config"; DestDir: "{app}"; Flags: ignoreversion Source: "app.ico"; DestDir: "{app}"; Flags: ignoreversion ; 功能区按钮图标 Source: "icons\*"; DestDir: "{app}\icons"; Flags: ignoreversion recursesubdirs createallsubdirs ; 开源许可证全文(关于窗口「查看许可证全文」用,亦是协议义务的随附声明) Source: "licenses\*"; DestDir: "{app}\licenses"; Flags: ignoreversion ; 元件库网页(node 纯本地静态服务数据,替代旧 python 代理) Source: "元件库网页\*"; DestDir: "{app}\元件库网页"; Flags: ignoreversion recursesubdirs createallsubdirs ; 依赖 DLL Source: "AdvancedDataGridView.dll"; DestDir: "{app}"; Flags: ignoreversion Source: "Smart.CustomComponents.dll"; DestDir: "{app}"; Flags: ignoreversion Source: "WeifenLuo.WinFormsUI.Docking.dll"; DestDir: "{app}"; Flags: ignoreversion Source: "WeifenLuo.WinFormsUI.Docking.ThemeVS2015.dll"; DestDir: "{app}"; Flags: ignoreversion Source: "System.Data.SQLite.dll"; DestDir: "{app}"; Flags: ignoreversion Source: "System.Resources.Extensions.dll"; DestDir: "{app}"; Flags: ignoreversion Source: "System.Memory.dll"; DestDir: "{app}"; Flags: ignoreversion Source: "System.Numerics.Vectors.dll"; DestDir: "{app}"; Flags: ignoreversion Source: "System.Runtime.CompilerServices.Unsafe.dll"; DestDir: "{app}"; Flags: ignoreversion Source: "Microsoft.Web.WebView2.Core.dll"; DestDir: "{app}"; Flags: ignoreversion Source: "Microsoft.Web.WebView2.WinForms.dll"; DestDir: "{app}"; Flags: ignoreversion Source: "WebView2Loader.dll"; DestDir: "{app}"; Flags: ignoreversion ; ★ 2026-09-11 补:主程序扒图 PdfiumNative P/Invoke 根目录 pdfium.dll,上包(9-10)漏装,装机能用仅因手动同步过安装目录 Source: "pdfium.dll"; DestDir: "{app}"; Flags: ignoreversion Source: "NPOI.dll"; DestDir: "{app}"; Flags: ignoreversion Source: "NPOI.OOXML.dll"; DestDir: "{app}"; Flags: ignoreversion Source: "NPOI.OpenXml4Net.dll"; DestDir: "{app}"; Flags: ignoreversion Source: "NPOI.OpenXmlFormats.dll"; DestDir: "{app}"; Flags: ignoreversion Source: "DotNetZip.dll"; DestDir: "{app}"; Flags: ignoreversion Source: "ICSharpCode.SharpZipLib.dll"; DestDir: "{app}"; Flags: ignoreversion Source: "unvell.ReoGrid.dll"; DestDir: "{app}"; Flags: ignoreversion Source: "CJZZ.Controls.dll"; DestDir: "{app}"; Flags: ignoreversion ; 核心数据目录(项目库/用户库/柜体库/母排规格库等程序必需文件,必装) Source: "sjk\*"; DestDir: "{app}\sjk"; Flags: ignoreversion recursesubdirs createallsubdirs Source: "shezhi\*"; DestDir: "{app}\shezhi"; Flags: ignoreversion recursesubdirs createallsubdirs ; 甲方报表 Excel 模板(按图号/按箱号/按箱号+箱体面积/按箱类型) Source: "xiangmu\*"; DestDir: "{app}\xiangmu"; Flags: ignoreversion recursesubdirs createallsubdirs ; CAD 扒图(独立程序,默认安装) Source: "cadbt\*"; DestDir: "{app}\cadbt"; Flags: ignoreversion recursesubdirs createallsubdirs ; PDF 扒图(独立程序+OCR 环境,默认安装) Source: "pdfbt\*"; DestDir: "{app}\pdfbt"; Flags: ignoreversion recursesubdirs createallsubdirs ; AI 助手引擎(ZCode 开源版 zai-org/ZCode,Apache-2.0:zcode 发行包+捆绑 node+预置+启停 cmd;zcode数据 运行时自建不进包) Source: "ai助手\*"; DestDir: "{app}\ai助手"; Flags: ignoreversion recursesubdirs createallsubdirs ; 会员服务器不进包(2026-09-22 用户长期规则:客户端默认连云端 https://ss61.odn.cc,部署套件单独交付) Source: "GCS铜排壳体计算\*"; DestDir: "{app}\GCS铜排壳体计算"; Flags: ignoreversion recursesubdirs createallsubdirs; Tasks: importdata [Dirs] ; 各项目报价库存放目录(空目录,程序运行时在里面建库) Name: "{app}\sjk\bjb" [InstallDelete] ; ★ 覆盖安装升级前,先删掉旧版主程序和依赖 DLL,保证不会残留旧功能文件。 ; 只清安装根目录({app})下的程序文件:通配符不含子目录, ; cadcj/libredwg/GCS铜排壳体计算 等工具目录不受影响; ; 用户数据都在子目录里(sjk 项目库、shezhi 企业信息、停靠布局等),全部保留。 Type: files; Name: "{app}\成套报价软件.exe" Type: files; Name: "{app}\*.dll" [Icons] ; 开始菜单 Name: "{group}\成套报价软件"; Filename: "{app}\成套报价软件.exe"; IconFilename: "{app}\app.ico"; Comment: "电气成套设备报价软件" Name: "{group}\卸载 成套报价软件"; Filename: "{uninstallexe}" ; 桌面快捷方式 Name: "{commondesktop}\成套报价软件"; Filename: "{app}\成套报价软件.exe"; IconFilename: "{app}\app.ico"; Tasks: desktopicon [Run] ; ★ WebView2 运行时缺失时先静默装好再启动软件(所有内嵌网页窗口的底层; ; 已装过的机器 Check 返回 False 整条跳过,不联网不弹窗) Filename: "{tmp}\MicrosoftEdgeWebview2Setup.exe"; Parameters: "/silent /install"; StatusMsg: "正在安装 WebView2 运行时(内嵌网页功能必需)..."; Flags: runhidden waituntilterminated; Check: NeedWebView2 Filename: "{app}\成套报价软件.exe"; Description: "立即启动 成套报价软件"; Flags: nowait postinstall skipifsilent [UninstallDelete] ; 卸载时彻底清理安装目录(含运行时生成的数据库/备份/日志) Type: filesandordirs; Name: "{app}"