Skip to content
This repository was archived by the owner on Jan 2, 2025. It is now read-only.

Commit a56becc

Browse files
committed
update: new setup type - external
1 parent d561c69 commit a56becc

File tree

5 files changed

+184
-14
lines changed

5 files changed

+184
-14
lines changed

Form1.Designer.cs

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Form1.cs

Lines changed: 80 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ void Form1_DragDrop(object sender, DragEventArgs e)
5353
{
5454
installBtn.Enabled = true;
5555
}
56+
if (gameinfo.host == "offline")
57+
{
58+
downloadBtn.Enabled = false;
59+
gameinfo.title = gameinfo.title + " | Offline | ";
60+
}
5661

5762
typeGameInfo(gameinfo);
5863
}
@@ -62,13 +67,15 @@ void Form1_DragDrop(object sender, DragEventArgs e)
6267
public String ghost = null;
6368
public String gname = null;
6469
public String gexec = null;
70+
public String gtype = null;
6571

6672
public void typeGameInfo(metadata gameinfo)
6773
{
6874
garc = gameinfo.archivename;
6975
gname = gameinfo.title;
7076
ghost = gameinfo.host;
7177
gexec = gameinfo.executable;
78+
gtype = gameinfo.setup;
7279
gtitle.Text = gameinfo.title;
7380
originalsize.Text = gameinfo.originalsize;
7481
repacksize.Text = gameinfo.repacksize;
@@ -124,11 +131,12 @@ private void Client_DownloadProgressChanged(object sender, DownloadProgressChang
124131
public async void prepareWorkDir()
125132
{
126133
System.IO.Directory.CreateDirectory(appfolder);
134+
System.IO.Directory.CreateDirectory(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\dotTemp\\");
127135
if (!System.IO.File.Exists(appfolder + "linker.bat"))
128136
{
129137
string[] linkerCode =
130138
{
131-
"set lnn=%1", "set ldd=%2", "set lnn=%lnn:\"=%", "set ldd=%ldd:\"=%", "mklink \"%userprofile%\\Desktop\\%lnn%\" \"%ldd%\""
139+
"set lnn=%1", "set ldd=%2", "set lnn=%lnn:\"=%", "set ldd=%ldd:\"=%", "mklink /H \"%userprofile%\\Desktop\\%lnn%\" \"%ldd%\""
132140
};
133141
File.WriteAllLines(appfolder + "linker.bat", linkerCode);
134142
}
@@ -188,7 +196,7 @@ public class metadata
188196
}
189197

190198
private void downloadBtn_Click(object sender, EventArgs e)
191-
{
199+
{
192200
downloadArchive(garc, ghost);
193201
this.AllowDrop = false;
194202
installBtn.Enabled = true;
@@ -199,29 +207,87 @@ private void installBtn_Click(object sender, EventArgs e)
199207
this.AllowDrop = false;
200208
gpanel.Hide();
201209
dropMeta.Visible = true;
202-
dropMeta.Text = "Select Installation Path";
203-
204-
DialogResult result = folderBrowserDialog1.ShowDialog();
205-
if (result == DialogResult.OK && !string.IsNullOrWhiteSpace(folderBrowserDialog1.SelectedPath))
210+
211+
if (gtype == "unpack") {
212+
dropMeta.Text = "Select Installation Path";
213+
DialogResult result = folderBrowserDialog1.ShowDialog();
214+
if (result == DialogResult.OK && !string.IsNullOrWhiteSpace(folderBrowserDialog1.SelectedPath))
215+
{
216+
dropMeta.Text = "Installing to: \n" + folderBrowserDialog1.SelectedPath;
217+
218+
var inst = Process.Start(appfolder + "arc.exe", "x -o+ " + appfolder + garc + " --yes --display --diskpath\"" + folderBrowserDialog1.SelectedPath + "\"");
219+
inst.WaitForExit();
220+
221+
dropMeta.Text = "Creating Desktop Shortcut...";
222+
223+
var link = Process.Start(appfolder + "linker.bat", "\"" + gname + "\" " + "\"" + folderBrowserDialog1.SelectedPath + @"\" + gexec + "\"");
224+
Thread.Sleep(1);
225+
dropMeta.Text = gname + "\nInstalled successfully!";
226+
Thread.Sleep(3);
227+
228+
}
229+
} else if (gtype == "external")
206230
{
207-
dropMeta.Text = "Installing to: \n" +folderBrowserDialog1.SelectedPath;
231+
if (System.IO.Directory.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\dotTemp\\"))
232+
{
233+
System.IO.Directory.Delete(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\dotTemp\\", true);
234+
System.IO.Directory.CreateDirectory(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\dotTemp\\");
235+
}
236+
237+
dropMeta.Text = "Decompressing external installer";
238+
239+
string tempcode =
240+
(
241+
appfolder + "arc.exe x -o+ " + appfolder + garc + " --yes --display --diskpath" + Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\dotTemp\\"
242+
);
243+
File.Delete(appfolder + garc + "_decompress.bat");
244+
File.WriteAllText(appfolder + garc + "_decompress.bat", tempcode);
245+
208246

209-
var inst = Process.Start(appfolder + "arc.exe", "x -o+ "+appfolder+garc+" --yes --display --diskpath\"" + folderBrowserDialog1.SelectedPath +"\"");
210-
inst.WaitForExit();
247+
Process unpack = new Process();
248+
ProcessStartInfo info = unpack.StartInfo;
249+
info.FileName = "powershell.exe";
250+
info.Arguments = appfolder + garc + "_decompress.bat";
251+
info.Verb = "runas";
252+
unpack.StartInfo = info;
253+
unpack.Start();
254+
unpack.WaitForExit();
211255

212-
dropMeta.Text = "Creating Desktop Shortcut...";
256+
dropMeta.Text = "Starting external installer";
213257

214-
var link = Process.Start(appfolder + "linker.bat", "\"" +gname + "\" " + "\"" +folderBrowserDialog1.SelectedPath + @"\" + gexec+"\"");
215-
Thread.Sleep(1);
216-
dropMeta.Text = gname + "\nInstalled successfully!";
217-
Thread.Sleep(3);
258+
var setupProcess = Process.Start(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\dotTemp\\" + gexec);
259+
setupProcess.WaitForExit();
260+
261+
dropMeta.Text = "Deleting external installer";
262+
System.IO.Directory.Delete(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\dotTemp\\", true);
218263

219264
}
265+
220266
dropMeta.Visible = false;
221267
gpanel.Show();
268+
this.AllowDrop = true;
222269

223270
}
224271

272+
private void button1_Click(object sender, EventArgs e)
273+
{
274+
DialogResult dialogResult = MessageBox.Show("Do you really want to delete all data and restart? \n( this doesn't uninstall your games, only archives )", "dotGame | Wipe Data", MessageBoxButtons.YesNo);
275+
if (dialogResult == DialogResult.Yes)
276+
{
277+
gpanel.Hide();
278+
dropMeta.Visible = true;
279+
dropMeta.Text = "Clearing data...\nApp will restart soon...";
280+
Thread.Sleep(1);
281+
System.IO.Directory.Delete(appfolder, true);
282+
Thread.Sleep(1);
283+
Application.Restart();
284+
}
285+
else
286+
{
287+
return;
288+
}
289+
}
225290
}
291+
226292
}
227293

dotManager.csproj

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,22 @@
1212
<FileAlignment>512</FileAlignment>
1313
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
1414
<Deterministic>true</Deterministic>
15+
<IsWebBootstrapper>false</IsWebBootstrapper>
16+
<PublishUrl>publish\</PublishUrl>
17+
<Install>true</Install>
18+
<InstallFrom>Disk</InstallFrom>
19+
<UpdateEnabled>false</UpdateEnabled>
20+
<UpdateMode>Foreground</UpdateMode>
21+
<UpdateInterval>7</UpdateInterval>
22+
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
23+
<UpdatePeriodically>false</UpdatePeriodically>
24+
<UpdateRequired>false</UpdateRequired>
25+
<MapFileExtensions>true</MapFileExtensions>
26+
<ApplicationRevision>3</ApplicationRevision>
27+
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
28+
<UseApplicationTrust>false</UseApplicationTrust>
29+
<PublishWizardCompleted>true</PublishWizardCompleted>
30+
<BootstrapperEnabled>true</BootstrapperEnabled>
1531
</PropertyGroup>
1632
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
1733
<PlatformTarget>AnyCPU</PlatformTarget>
@@ -35,6 +51,18 @@
3551
<PropertyGroup>
3652
<ApplicationManifest>app.manifest</ApplicationManifest>
3753
</PropertyGroup>
54+
<PropertyGroup>
55+
<ManifestCertificateThumbprint>C9C698C3EB7658408048B58FB9BC5F7164D72B5B</ManifestCertificateThumbprint>
56+
</PropertyGroup>
57+
<PropertyGroup>
58+
<ManifestKeyFile>dotManager_TemporaryKey.pfx</ManifestKeyFile>
59+
</PropertyGroup>
60+
<PropertyGroup>
61+
<GenerateManifests>true</GenerateManifests>
62+
</PropertyGroup>
63+
<PropertyGroup>
64+
<SignManifests>true</SignManifests>
65+
</PropertyGroup>
3866
<ItemGroup>
3967
<Reference Include="Json.Net, Version=1.0.33.1, Culture=neutral, processorArchitecture=MSIL">
4068
<HintPath>..\packages\Json.Net.1.0.33\lib\netstandard2.0\Json.Net.dll</HintPath>
@@ -79,6 +107,7 @@
79107
<DependentUpon>Resources.resx</DependentUpon>
80108
</Compile>
81109
<None Include="app.manifest" />
110+
<None Include="dotManager_TemporaryKey.pfx" />
82111
<None Include="packages.config" />
83112
<None Include="Properties\Settings.settings">
84113
<Generator>SettingsSingleFileGenerator</Generator>
@@ -93,5 +122,49 @@
93122
<ItemGroup>
94123
<None Include="App.config" />
95124
</ItemGroup>
125+
<ItemGroup>
126+
<BootstrapperPackage Include=".NETFramework,Version=v4.8">
127+
<Visible>False</Visible>
128+
<ProductName>Microsoft .NET Framework 4.8 %28x86 and x64%29</ProductName>
129+
<Install>true</Install>
130+
</BootstrapperPackage>
131+
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
132+
<Visible>False</Visible>
133+
<ProductName>.NET Framework 3.5 SP1</ProductName>
134+
<Install>false</Install>
135+
</BootstrapperPackage>
136+
</ItemGroup>
137+
<ItemGroup>
138+
<PublishFile Include="dotManager.pdb">
139+
<Visible>False</Visible>
140+
<Group>
141+
</Group>
142+
<TargetPath>
143+
</TargetPath>
144+
<PublishState>Exclude</PublishState>
145+
<IncludeHash>True</IncludeHash>
146+
<FileType>File</FileType>
147+
</PublishFile>
148+
<PublishFile Include="Json.Net">
149+
<Visible>False</Visible>
150+
<Group>
151+
</Group>
152+
<TargetPath>
153+
</TargetPath>
154+
<PublishState>Exclude</PublishState>
155+
<IncludeHash>True</IncludeHash>
156+
<FileType>Assembly</FileType>
157+
</PublishFile>
158+
<PublishFile Include="SymbolicLinkSupport">
159+
<Visible>False</Visible>
160+
<Group>
161+
</Group>
162+
<TargetPath>
163+
</TargetPath>
164+
<PublishState>Exclude</PublishState>
165+
<IncludeHash>True</IncludeHash>
166+
<FileType>Assembly</FileType>
167+
</PublishFile>
168+
</ItemGroup>
96169
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
97170
</Project>

dotManager.csproj.user

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<PublishUrlHistory>publish\</PublishUrlHistory>
5+
<InstallUrlHistory />
6+
<SupportUrlHistory />
7+
<UpdateUrlHistory />
8+
<BootstrapperUrlHistory />
9+
<ErrorReportUrlHistory />
10+
<FallbackCulture>en-US</FallbackCulture>
11+
<VerifyUploadedFiles>false</VerifyUploadedFiles>
12+
</PropertyGroup>
13+
<PropertyGroup>
14+
<EnableSecurityDebugging>false</EnableSecurityDebugging>
15+
</PropertyGroup>
16+
</Project>

dotManager_TemporaryKey.pfx

1.66 KB
Binary file not shown.

0 commit comments

Comments
 (0)