Skip to content

Commit 1f1d030

Browse files
committed
Update installation process to reflect changes to components.xml
1 parent dc6e935 commit 1f1d030

6 files changed

Lines changed: 25 additions & 56 deletions

File tree

FlashpointManager.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@
9494
<Reference Include="Costura, Version=5.7.0.0, Culture=neutral, processorArchitecture=MSIL">
9595
<HintPath>packages\Costura.Fody.5.7.0\lib\netstandard1.0\Costura.dll</HintPath>
9696
</Reference>
97-
<Reference Include="Downloader, Version=3.0.1.0, Culture=neutral, PublicKeyToken=844973e732f6cdf4, processorArchitecture=MSIL">
98-
<HintPath>packages\Downloader.3.0.1\lib\net452\Downloader.dll</HintPath>
97+
<Reference Include="Downloader, Version=3.0.2.0, Culture=neutral, PublicKeyToken=844973e732f6cdf4, processorArchitecture=MSIL">
98+
<HintPath>packages\Downloader.3.0.2\lib\net452\Downloader.dll</HintPath>
9999
</Reference>
100100
<Reference Include="Microsoft.Win32.Primitives, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
101101
<HintPath>packages\Microsoft.Win32.Primitives.4.3.0\lib\net46\Microsoft.Win32.Primitives.dll</HintPath>

packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
33
<package id="Costura.Fody" version="5.7.0" targetFramework="net472" developmentDependency="true" />
4-
<package id="Downloader" version="3.0.1" targetFramework="net472" />
4+
<package id="Downloader" version="3.0.2" targetFramework="net472" />
55
<package id="Fody" version="6.6.4" targetFramework="net472" developmentDependency="true" />
66
<package id="Microsoft.NETCore.Platforms" version="7.0.0" targetFramework="net472" />
77
<package id="Microsoft.Win32.Primitives" version="4.3.0" targetFramework="net472" />

src/Common.cs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ public class Component : Category
1616
public string URL { get; set; }
1717
public string Hash { get; set; }
1818
public long Size { get; set; }
19+
public string Path { get; set; }
1920
public string[] Depends { get; set; } = new string[] { };
2021

2122
public Component(XmlNode node) : base(node)
@@ -77,6 +78,10 @@ public Component(XmlNode node) : base(node)
7778
Environment.Exit(1);
7879
}
7980

81+
// Path
82+
83+
Path = GetAttribute(node, "path", false);
84+
8085
// Depends
8186

8287
string depends = GetAttribute(node, "depends", false);
@@ -116,7 +121,7 @@ public Category(XmlNode node)
116121

117122
Title = GetAttribute(node, "title", true);
118123
Description = GetAttribute(node, "description", true);
119-
Required = ID.StartsWith("required");
124+
Required = ID.StartsWith("core");
120125
}
121126

122127
protected static string GetAttribute(XmlNode node, string attribute, bool throwError)
@@ -168,9 +173,6 @@ public static string SourcePath2
168173
set { Main.SourcePath2.Text = value; }
169174
}
170175

171-
// Path to launcher executable based on selection
172-
public static string LauncherPath { get; set; } = "";
173-
174176
// Flag to control how operation window will function
175177
// 0 is for downloading Flashpoint
176178
// 1 is for adding/removing components
@@ -251,7 +253,7 @@ public static TreeNode AddNodeToList(XmlNode child, TreeNodeCollection parent, b
251253
listNode.Text = component.Title;
252254
listNode.Name = component.ID;
253255

254-
if (component.ID.StartsWith("required"))
256+
if (component.Required)
255257
{
256258
listNode.ForeColor = Color.FromArgb(255, 96, 96, 96);
257259
}
@@ -265,7 +267,7 @@ public static TreeNode AddNodeToList(XmlNode child, TreeNodeCollection parent, b
265267
listNode.Text = category.Title;
266268
listNode.Name = category.ID;
267269

268-
if (category.ID.StartsWith("required"))
270+
if (category.Required)
269271
{
270272
listNode.ForeColor = Color.FromArgb(255, 96, 96, 96);
271273
}

src/Forms/FinishOperation.cs

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,11 @@ private void FinishDownload_Exit(object sender, EventArgs e)
2727
{
2828
if (RunOnClose.Checked)
2929
{
30-
if (FPM.LauncherPath != "")
31-
{
32-
string[] path = FPM.LauncherPath.Split('\\');
33-
34-
var flashpointProcess = new Process();
35-
flashpointProcess.StartInfo.UseShellExecute = true;
36-
flashpointProcess.StartInfo.FileName = path[1];
37-
flashpointProcess.StartInfo.WorkingDirectory = Path.Combine(FPM.DestinationPath, path[0]);
38-
flashpointProcess.Start();
39-
}
40-
else
41-
{
42-
Process.Start("explorer.exe", FPM.DestinationPath);
43-
}
30+
var flashpointProcess = new Process();
31+
flashpointProcess.StartInfo.UseShellExecute = true;
32+
flashpointProcess.StartInfo.FileName = "Flashpoint.exe";
33+
flashpointProcess.StartInfo.WorkingDirectory = Path.Combine(FPM.DestinationPath, "Launcher");
34+
flashpointProcess.Start();
4435
}
4536
}
4637

src/Forms/MainDownload.cs

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -100,24 +100,6 @@ private void DownloadButton_Click(object sender, EventArgs e)
100100

101101
FPM.CheckDependencies(ComponentList);
102102

103-
FPM.LauncherPath = "";
104-
foreach (TreeNode launcher in ComponentList.Nodes["launcher"].Nodes)
105-
{
106-
if (launcher.Checked)
107-
{
108-
if (launcher.Name == "launcher-electron")
109-
{
110-
FPM.LauncherPath = @"Launcher\Flashpoint.exe";
111-
break;
112-
}
113-
else if (launcher.Name == "launcher-winforms")
114-
{
115-
FPM.LauncherPath = @"SharpLauncher\SharpLauncher.exe";
116-
break;
117-
}
118-
}
119-
}
120-
121103
FPM.OperateMode = 0;
122104

123105
var operationWindow = new Operation();

src/Forms/Operation.cs

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,9 @@ private void ExtractComponents()
162162
long extractedSize = 0;
163163
long totalSize = archive.TotalUncompressSize;
164164

165-
string destPath = FPM.OperateMode > 0 ? FPM.SourcePath : FPM.DestinationPath;
166-
string infoPath = Path.Combine(destPath, "Components");
165+
string rootPath = FPM.OperateMode > 0 ? FPM.SourcePath : FPM.DestinationPath;
166+
string destPath = Path.Combine(rootPath, workingComponent.Path.Replace('/', '\\'));
167+
string infoPath = Path.Combine(rootPath, "Components");
167168
string infoFile = Path.Combine(infoPath, $"{workingComponent.ID}.txt");
168169

169170
Directory.CreateDirectory(infoPath);
@@ -179,13 +180,15 @@ private void ExtractComponents()
179180
{
180181
if (reader.Entry.IsDirectory) continue;
181182

183+
Directory.CreateDirectory(destPath);
184+
182185
reader.WriteEntryToDirectory(destPath, new ExtractionOptions {
183-
ExtractFullPath = true, Overwrite = true, PreserveFileTime = true
186+
ExtractFullPath = true, Overwrite = true, PreserveFileTime = true
184187
});
185188

186189
using (TextWriter writer = File.AppendText(infoFile))
187190
{
188-
writer.WriteLine(reader.Entry.Key.Replace("/", @"\"));
191+
writer.WriteLine(Path.Combine(workingComponent.Path, reader.Entry.Key).Replace("/", @"\"));
189192
}
190193

191194
extractedSize += reader.Entry.Size;
@@ -301,17 +304,8 @@ await Task.Run(() =>
301304
foreach (string path in shortcutPaths)
302305
{
303306
var shortcut = new IWshRuntimeLibrary.WshShell().CreateShortcut(Path.Combine(path, "Flashpoint.lnk"));
304-
305-
if (FPM.LauncherPath != "")
306-
{
307-
shortcut.TargetPath = Path.Combine(FPM.DestinationPath, FPM.LauncherPath);
308-
shortcut.WorkingDirectory = Path.Combine(FPM.DestinationPath, FPM.LauncherPath.Split('\\')[0]);
309-
}
310-
else
311-
{
312-
shortcut.TargetPath = FPM.DestinationPath;
313-
}
314-
307+
shortcut.TargetPath = Path.Combine(FPM.DestinationPath, "Launcher", "Flashpoint.exe");
308+
shortcut.WorkingDirectory = Path.Combine(FPM.DestinationPath, "Launcher");
315309
shortcut.Description = "Shortcut to Flashpoint";
316310
shortcut.Save();
317311
}

0 commit comments

Comments
 (0)