@@ -18,8 +18,6 @@ namespace FlashpointInstaller
1818{
1919 public partial class Install : Form
2020 {
21- Main mainForm = ( Main ) Application . OpenForms [ "Main" ] ;
22-
2321 List < Dictionary < string , string > > componentInfo = new List < Dictionary < string , string > > ( ) ;
2422 Dictionary < string , string > workingComponent ;
2523
@@ -30,7 +28,7 @@ public partial class Install : Form
3028 IReader reader ;
3129
3230 long byteProgress = 0 ;
33- long byteTotal = ( ( Main ) Application . OpenForms [ "Main" ] ) . DownloadSize ;
31+ long byteTotal = FPM . DownloadSize ;
3432
3533 int cancelStatus = 0 ;
3634
@@ -40,7 +38,7 @@ private async void Install_Load(object sender, EventArgs e)
4038 {
4139 downloader . DownloadProgressChanged += OnDownloadProgressChanged ;
4240 downloader . DownloadFileCompleted += OnDownloadFileCompleted ;
43-
41+
4442 void Iterate ( TreeNodeCollection parent )
4543 {
4644 foreach ( TreeNode childNode in parent )
@@ -55,7 +53,7 @@ void Iterate(TreeNodeCollection parent)
5553 Iterate ( childNode . Nodes ) ;
5654 }
5755 }
58- Iterate ( mainForm . ComponentQueue . Nodes ) ;
56+ Iterate ( FPM . Main . ComponentList . Nodes ) ;
5957
6058 foreach ( var component in componentInfo )
6159 {
@@ -64,7 +62,7 @@ void Iterate(TreeNodeCollection parent)
6462
6563 if ( cancelStatus != 0 ) return ;
6664
67- Directory . CreateDirectory ( mainForm . FolderTextBox . Text ) ;
65+ Directory . CreateDirectory ( FPM . Path ) ;
6866 await Task . Run ( ExtractTask ) ;
6967
7068 byteProgress += int . Parse ( component [ "size" ] ) ;
@@ -112,7 +110,7 @@ private void ExtractTask()
112110 long extractedSize = 0 ;
113111 long totalSize = archive . TotalUncompressSize ;
114112
115- string infoPath = Path . Combine ( mainForm . FolderTextBox . Text , "Components" , workingComponent [ "path" ] ) ;
113+ string infoPath = Path . Combine ( FPM . Path , "Components" , workingComponent [ "path" ] ) ;
116114 string infoFile = $ "{ workingComponent [ "title" ] } .txt";
117115
118116 Directory . CreateDirectory ( infoPath ) ;
@@ -127,7 +125,7 @@ private void ExtractTask()
127125 if ( reader . Entry . IsDirectory ) continue ;
128126
129127 reader . WriteEntryToDirectory (
130- mainForm . FolderTextBox . Text , new ExtractionOptions { ExtractFullPath = true , Overwrite = true }
128+ FPM . Path , new ExtractionOptions { ExtractFullPath = true , Overwrite = true }
131129 ) ;
132130
133131 using ( TextWriter writer = File . AppendText ( infoPath + infoFile ) )
@@ -169,27 +167,27 @@ await Task.Run(() =>
169167 {
170168 var shortcutPaths = new List < string > ( ) ;
171169
172- if ( mainForm . ShortcutDesktop . Checked )
170+ if ( FPM . Main . ShortcutDesktop . Checked )
173171 {
174172 shortcutPaths . Add ( Environment . GetFolderPath ( Environment . SpecialFolder . Desktop ) ) ;
175173 }
176- if ( mainForm . ShortcutStartMenu . Checked )
174+ if ( FPM . Main . ShortcutStartMenu . Checked )
177175 {
178176 shortcutPaths . Add ( Environment . GetFolderPath ( Environment . SpecialFolder . StartMenu ) ) ;
179177 }
180178
181179 foreach ( string path in shortcutPaths )
182180 {
183181 IWshShortcut shortcut = new WshShell ( ) . CreateShortcut ( Path . Combine ( path , "Flashpoint.lnk" ) ) ;
184- shortcut . TargetPath = Path . Combine ( mainForm . FolderTextBox . Text , @"Launcher\Flashpoint.exe" ) ;
185- shortcut . WorkingDirectory = Path . Combine ( mainForm . FolderTextBox . Text , @"Launcher" ) ;
182+ shortcut . TargetPath = Path . Combine ( FPM . Path , @"Launcher\Flashpoint.exe" ) ;
183+ shortcut . WorkingDirectory = Path . Combine ( FPM . Path , @"Launcher" ) ;
186184 shortcut . Description = "Shortcut to Flashpoint" ;
187185 shortcut . Save ( ) ;
188186 }
189187 } ) ;
190188
191189 Hide ( ) ;
192- mainForm . Hide ( ) ;
190+ FPM . Main . Hide ( ) ;
193191
194192 var FinishWindow = new Finish ( ) ;
195193 FinishWindow . ShowDialog ( ) ;
@@ -204,9 +202,9 @@ await Task.Run(() =>
204202 {
205203 while ( cancelStatus != 2 ) { }
206204
207- if ( Directory . Exists ( mainForm . FolderTextBox . Text ) )
205+ if ( Directory . Exists ( FPM . Path ) )
208206 {
209- Directory . Delete ( mainForm . FolderTextBox . Text , true ) ;
207+ Directory . Delete ( FPM . Path , true ) ;
210208 }
211209 } ) ;
212210
0 commit comments