|
1 | | -; SDRSharp Net Remote |
2 | | -; |
3 | | -; http://eartoearoak.com/software/sdrsharp-net-remote |
4 | | -; |
5 | | -; Copyright 2014 - 2017 Al Brown |
6 | | -; |
7 | | -; A network remote control plugin for SDRSharp |
8 | | -; |
9 | | -; |
10 | | -; This program is free software: you can redistribute it and/or modify |
11 | | -; it under the terms of the GNU General Public License as published by |
12 | | -; the Free Software Foundation, or (at your option) |
13 | | -; any later version. |
14 | | -; |
15 | | -; This program is distributed in the hope that it will be useful, |
16 | | -; but WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | | -; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
18 | | -; GNU General Public License for more details. |
19 | | -; |
20 | | -; You should have received a copy of the GNU General Public License |
21 | | -; along with this program. If not, see <http://www.gnu.org/licenses/>. |
22 | | -; |
| 1 | +; SDRSharp Net Remote |
| 2 | +; |
| 3 | +; http://eartoearoak.com/software/sdrsharp-net-remote |
| 4 | +; |
| 5 | +; Copyright 2014 - 2017 Al Brown |
| 6 | +; |
| 7 | +; A network remote control plugin for SDRSharp |
| 8 | +; |
| 9 | +; |
| 10 | +; This program is free software: you can redistribute it and/or modify |
| 11 | +; it under the terms of the GNU General Public License as published by |
| 12 | +; the Free Software Foundation, or (at your option) |
| 13 | +; any later version. |
| 14 | +; |
| 15 | +; This program is distributed in the hope that it will be useful, |
| 16 | +; but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 | +; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 18 | +; GNU General Public License for more details. |
| 19 | +; |
| 20 | +; You should have received a copy of the GNU General Public License |
| 21 | +; along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 22 | +; |
| 23 | + |
| 24 | +#define MyAppName "SDRSharp Net Remote" |
| 25 | +#define MyAppVersion GetFileVersion(AddBackslash(SourcePath) + "x86\SDRSharp.NetRemote.dll") |
| 26 | +#define MyAppPublisher "Al Brown" |
| 27 | +#define MyAppURL "http://eartoearoak.com/software/sdrsharp-net-remote" |
| 28 | + |
| 29 | +[Setup] |
| 30 | +AppId={{9B6C377F-1560-4441-8602-78CECC537F07} |
| 31 | +AppName={#MyAppName} |
| 32 | +AppVersion={#MyAppVersion} |
| 33 | +AppPublisher={#MyAppPublisher} |
| 34 | +AppPublisherURL={#MyAppURL} |
| 35 | +AppSupportURL={#MyAppURL} |
| 36 | +AppUpdatesURL={#MyAppURL} |
| 37 | +DefaultGroupName={#MyAppName} |
| 38 | +DefaultDirName={pf}\SDRSharp |
| 39 | +AlwaysShowDirOnReadyPage=yes |
| 40 | +LicenseFile=license.txt |
| 41 | +InfoBeforeFile=help.txt |
| 42 | +OutputBaseFilename=setup |
| 43 | +Compression=lzma |
| 44 | +SolidCompression=yes |
| 45 | +EnableDirDoesntExistWarning=True |
| 46 | +DirExistsWarning=no |
| 47 | +DisableProgramGroupPage=auto |
| 48 | +MinVersion=0,5.01sp3 |
| 49 | +AppendDefaultDirName=False |
| 50 | +UsePreviousAppDir=False |
| 51 | + |
| 52 | +[Languages] |
| 53 | +Name: "english"; MessagesFile: "compiler:Default.isl" |
| 54 | + |
| 55 | +[Files] |
| 56 | +Source: "x86\SDRSharp.NetRemote.dll"; DestDir: "{app}"; Flags: ignoreversion; Check: not Install64 |
| 57 | +Source: "x64\SDRSharp.NetRemote.dll"; DestDir: "{app}"; Flags: ignoreversion; Check: Install64 |
| 58 | + |
| 59 | +[Icons] |
| 60 | +Name: "{group}\{cm:ProgramOnTheWeb,{#MyAppName}}"; Filename: "{#MyAppURL}" |
| 61 | +Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}" |
| 62 | + |
| 63 | +[ThirdParty] |
| 64 | +UseRelativePaths=True |
| 65 | + |
| 66 | +[Messages] |
| 67 | +SelectDirLabel3=Please select the SDR# installation folder |
| 68 | + |
| 69 | +[Code] |
| 70 | +var |
| 71 | + PlatformPage: TInputOptionWizardPage; |
| 72 | +
|
| 73 | +procedure InitializeWizard; |
| 74 | +begin |
| 75 | + PlatformPage := CreateInputOptionPage(wpSelectDir, |
| 76 | + 'Platform Type', '32 or 64 bits', |
| 77 | + 'This plugin supports the 32 or 64 bit versions of SDRSharp.' + #13#10 + #13#10 + 'Select the version you use, if you are unsure it''s probably 32 bit.', |
| 78 | + True, False); |
| 79 | + PlatformPage.Add('32 bit (Default)'); |
| 80 | + PlatformPage.Add('64 bit'); |
| 81 | + PlatformPage.Values[0] := True; |
| 82 | +end; |
| 83 | +
|
| 84 | +function Install64(): Boolean; |
| 85 | +begin |
| 86 | + Result := not PlatformPage.Values[0]; |
| 87 | +end; |
23 | 88 |
|
24 | | -#define MyAppName "SDRSharp Net Remote" |
25 | | -#define MyAppVersion GetFileVersion(AddBackslash(SourcePath) + "SDRSharp.NetRemote.dll") |
26 | | -#define MyAppPublisher "Al Brown" |
27 | | -#define MyAppURL "http://eartoearoak.com/software/sdrsharp-net-remote" |
28 | | - |
29 | | -[Setup] |
30 | | -AppId={{9B6C377F-1560-4441-8602-78CECC537F07} |
31 | | -AppName={#MyAppName} |
32 | | -AppVersion={#MyAppVersion} |
33 | | -AppPublisher={#MyAppPublisher} |
34 | | -AppPublisherURL={#MyAppURL} |
35 | | -AppSupportURL={#MyAppURL} |
36 | | -AppUpdatesURL={#MyAppURL} |
37 | | -DefaultGroupName={#MyAppName} |
38 | | -DefaultDirName={pf}\SDRSharp |
39 | | -AlwaysShowDirOnReadyPage=yes |
40 | | -LicenseFile=license.txt |
41 | | -InfoBeforeFile=help.txt |
42 | | -OutputBaseFilename=setup |
43 | | -Compression=lzma |
44 | | -SolidCompression=yes |
45 | | -EnableDirDoesntExistWarning=True |
46 | | -DirExistsWarning=no |
47 | | -DisableProgramGroupPage=auto |
48 | | -MinVersion=0,5.01sp3 |
49 | | -AppendDefaultDirName=False |
50 | | -UsePreviousAppDir=False |
51 | | - |
52 | | -[Languages] |
53 | | -Name: "english"; MessagesFile: "compiler:Default.isl" |
54 | | - |
55 | | -[Files] |
56 | | -Source: "SDRSharp.NetRemote.dll"; DestDir: "{app}"; Flags: ignoreversion; |
57 | | - |
58 | | -[Icons] |
59 | | -Name: "{group}\{cm:ProgramOnTheWeb,{#MyAppName}}"; Filename: "{#MyAppURL}" |
60 | | -Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}" |
61 | | - |
62 | | -[ThirdParty] |
63 | | -UseRelativePaths=True |
64 | | - |
65 | | -[Messages] |
66 | | -SelectDirLabel3=Please select the SDR# installation folder |
67 | | - |
68 | | -[Code] |
69 | | -procedure Error(Message: String); |
70 | | -begin |
71 | | - MsgBox('An error occured!' + #13#10 + Message, mbError, MB_OK); |
72 | | -end; |
73 | | -
|
74 | | -function XMLName(): String; |
75 | | -begin |
76 | | - result := ExpandConstant('{app}\Plugins.xml') |
77 | | -end; |
78 | | -
|
79 | | -function XMLLoad(): Variant; |
80 | | -var |
81 | | - Filename: String; |
82 | | - XMLDocument: Variant; |
83 | | -begin |
84 | | - Filename := XMLName(); |
85 | | - FileCopy(Filename, Filename + '.bak', False); |
86 | | - XMLDocument := CreateOleObject('Msxml2.DOMDocument.6.0'); |
87 | | - XMLDocument.async := False; |
88 | | - XMLDocument.load(Filename); |
89 | | - if XMLDocument.parseError.errorCode <> 0 then |
90 | | - MsgBox(ExpandConstant('SDRSharp was not found in {app}'), mbError, MB_OK); |
91 | | - result := XMLDocument; |
92 | | -end; |
93 | | -
|
94 | | -procedure XMLSave(XMLDocument: Variant); |
95 | | -var |
96 | | - Filename: String; |
97 | | -begin |
98 | | - Filename := XMLName(); |
99 | | - XMLDocument.save(Filename); |
100 | | -end; |
101 | | -
|
102 | | -procedure AddXML(); |
103 | | -var |
104 | | - XMLDocument: Variant; |
105 | | - XMLNode: Variant; |
106 | | - XMLNodeNew: Variant; |
107 | | -begin |
108 | | - try |
109 | | - XMLDocument := XMLLoad(); |
110 | | - if (XMLDocument.parseError.errorCode = 0) then |
111 | | - begin |
112 | | - XMLNode := XMLDocument.selectSingleNode('sharpPlugins'); |
113 | | - XMLNodeNew := XMLDocument.createNode(1, 'add', ''); |
114 | | - XMLNodeNew.setAttribute('key', 'Net Remote'); |
115 | | - XMLNodeNew.setAttribute('value','SDRSharp.NetRemote.NetRemotePlugin,SDRSharp.NetRemote'); |
116 | | - XMLNode.appendChild(XMLNodeNew) |
117 | | - XMLSave(XMLDocument); |
118 | | - end; |
119 | | - except |
120 | | - Error(GetExceptionMessage); |
121 | | - end; |
122 | | -end; |
123 | | -
|
124 | | -procedure DelXML(); |
125 | | -var |
126 | | - XMLDocument: Variant; |
127 | | - XMLNode: Variant; |
128 | | -begin |
129 | | - try |
130 | | - XMLDocument := XMLLoad(); |
131 | | - if XMLDocument.parseError.errorCode = 0 then |
132 | | - begin |
133 | | - XMLNode := XMLDocument.selectSingleNode('/sharpPlugins/add[@key="Net Remote"]'); |
134 | | - if not VarIsNull(XMLNode) then |
135 | | - begin |
136 | | - XMLNode.parentNode.removeChild(XMLNode); |
137 | | - XMLSave(XMLDocument); |
138 | | - end; |
139 | | - end; |
140 | | - except |
141 | | - {Error(GetExceptionMessage);} {VarIsNull(XMLNode) fails} |
142 | | - end; |
143 | | -end; |
144 | | -
|
145 | | -procedure CurStepChanged(Step: TSetupStep); |
146 | | -begin |
147 | | - if (Step = ssPostInstall) then |
148 | | - begin |
149 | | - DelXML(); |
150 | | - AddXML(); |
151 | | - end; |
152 | | -end; |
153 | | -
|
154 | | -procedure CurUninstallStepChanged(Step: TUninstallStep); |
155 | | -begin |
156 | | - if (Step = usUninstall) then |
157 | | - DelXML(); |
158 | | -end; |
| 89 | +procedure Error(Message: String); |
| 90 | +begin |
| 91 | + MsgBox('An error occured!' + #13#10 + Message, mbError, MB_OK); |
| 92 | +end; |
| 93 | +
|
| 94 | +function XMLName(): String; |
| 95 | +begin |
| 96 | + result := ExpandConstant('{app}\Plugins.xml') |
| 97 | +end; |
| 98 | +
|
| 99 | +function XMLLoad(): Variant; |
| 100 | +var |
| 101 | + Filename: String; |
| 102 | + XMLDocument: Variant; |
| 103 | +begin |
| 104 | + Filename := XMLName(); |
| 105 | + FileCopy(Filename, Filename + '.bak', False); |
| 106 | + XMLDocument := CreateOleObject('Msxml2.DOMDocument.6.0'); |
| 107 | + XMLDocument.async := False; |
| 108 | + XMLDocument.load(Filename); |
| 109 | + if XMLDocument.parseError.errorCode <> 0 then |
| 110 | + MsgBox(ExpandConstant('SDRSharp was not found in {app}'), mbError, MB_OK); |
| 111 | + result := XMLDocument; |
| 112 | +end; |
| 113 | +
|
| 114 | +procedure XMLSave(XMLDocument: Variant); |
| 115 | +var |
| 116 | + Filename: String; |
| 117 | +begin |
| 118 | + Filename := XMLName(); |
| 119 | + XMLDocument.save(Filename); |
| 120 | +end; |
| 121 | +
|
| 122 | +procedure AddXML(); |
| 123 | +var |
| 124 | + XMLDocument: Variant; |
| 125 | + XMLNode: Variant; |
| 126 | + XMLNodeNew: Variant; |
| 127 | +begin |
| 128 | + try |
| 129 | + XMLDocument := XMLLoad(); |
| 130 | + if (XMLDocument.parseError.errorCode = 0) then |
| 131 | + begin |
| 132 | + XMLNode := XMLDocument.selectSingleNode('sharpPlugins'); |
| 133 | + XMLNodeNew := XMLDocument.createNode(1, 'add', ''); |
| 134 | + XMLNodeNew.setAttribute('key', 'Net Remote'); |
| 135 | + XMLNodeNew.setAttribute('value','SDRSharp.NetRemote.NetRemotePlugin,SDRSharp.NetRemote'); |
| 136 | + XMLNode.appendChild(XMLNodeNew) |
| 137 | + XMLSave(XMLDocument); |
| 138 | + end; |
| 139 | + except |
| 140 | + Error(GetExceptionMessage); |
| 141 | + end; |
| 142 | +end; |
| 143 | +
|
| 144 | +procedure DelXML(); |
| 145 | +var |
| 146 | + XMLDocument: Variant; |
| 147 | + XMLNode: Variant; |
| 148 | +begin |
| 149 | + try |
| 150 | + XMLDocument := XMLLoad(); |
| 151 | + if XMLDocument.parseError.errorCode = 0 then |
| 152 | + begin |
| 153 | + XMLNode := XMLDocument.selectSingleNode('/sharpPlugins/add[@key="Net Remote"]'); |
| 154 | + if not VarIsNull(XMLNode) then |
| 155 | + begin |
| 156 | + XMLNode.parentNode.removeChild(XMLNode); |
| 157 | + XMLSave(XMLDocument); |
| 158 | + end; |
| 159 | + end; |
| 160 | + except |
| 161 | + {Error(GetExceptionMessage);} {VarIsNull(XMLNode) fails} |
| 162 | + end; |
| 163 | +end; |
| 164 | +
|
| 165 | +procedure CurStepChanged(Step: TSetupStep); |
| 166 | +begin |
| 167 | + if (Step = ssPostInstall) then |
| 168 | + begin |
| 169 | + DelXML(); |
| 170 | + AddXML(); |
| 171 | + end; |
| 172 | +end; |
| 173 | +
|
| 174 | +procedure CurUninstallStepChanged(Step: TUninstallStep); |
| 175 | +begin |
| 176 | + if (Step = usUninstall) then |
| 177 | + DelXML(); |
| 178 | +end; |
|
0 commit comments