11using System ;
22using System . Collections . Generic ;
3- using System . Diagnostics ;
43using System . Drawing ;
54using System . IO ;
65using System . Linq ;
76using System . Windows . Forms ;
87using System . Xml ;
98
10- namespace FlashpointInstaller
9+ namespace FlashpointManager
1110{
1211 namespace Common
1312 {
@@ -179,15 +178,21 @@ public static class FPM
179178
180179 // Name of configuration file
181180 public static string ConfigFile { get ; set ; } = "fpm.cfg" ;
182- // Internet location of component list XML
183- public static string ListURL { get ; set ; } = "https://nexus-dev.unstable.life/repository/stable/components.xml" ;
181+ // Internet locations of component list XMLs
182+ public static class RepoXmlTemplates
183+ {
184+ public const string Stable = "https://nexus-dev.unstable.life/repository/stable/components.xml" ;
185+ public const string Development = "https://nexus-dev.unstable.life/repository/development/components.xml" ;
186+ }
187+ public static string RepoXml { get ; set ; } = RepoXmlTemplates . Stable ;
184188 // Path to the local Flashpoint copy
185- public static string SourcePath { get ; set ; } = Debugger . IsAttached
186- ? Path . Combine ( Path . GetPathRoot ( AppDomain . CurrentDomain . BaseDirectory ) , "Flashpoint" )
187- : Path . GetFullPath ( Path . Combine ( Directory . GetCurrentDirectory ( ) , ".." ) ) ;
189+ public static string SourcePath { get ; set ; } = Path . GetFullPath ( Path . Combine ( Directory . GetCurrentDirectory ( ) , ".." ) ) ;
188190
189- // Controls whether components are being updated instead of added or removed
190- public static bool UpdateMode { get ; set ; } = false ;
191+ // Controls which components the operate tab adds and removes
192+ // 0 = Download/remove selected components
193+ // 1 = Reinstall outdated components
194+ // 2 = Reinstall broken components
195+ public static int OperateMode { get ; set ; } = 0 ;
191196 // Controls whether the update tab is selected at launch
192197 public static bool OpenUpdateTab { get ; set ; } = false ;
193198 // Controls whether the launcher should be opened upon the manager closing
@@ -205,6 +210,8 @@ public static class ComponentTracker
205210 public static List < Component > Downloaded { get ; set ; } = new List < Component > ( ) ;
206211 // Returns all outdated components
207212 public static List < Component > Outdated { get ; set ; } = new List < Component > ( ) ;
213+ // Returns all components with missing files
214+ public static List < Component > Broken { get ; set ; } = new List < Component > ( ) ;
208215 }
209216
210217 // Performs an operation on every node in the specified TreeNodeCollection
@@ -309,16 +316,18 @@ public static void SyncManager(bool init = false)
309316
310317 var component = new Component ( node ) ;
311318
312- bool outdated = false ;
313319 bool downloaded = ComponentTracker . Downloaded . Exists ( c => c . ID == component . ID ) ;
320+ bool outdated = false ;
314321
315322 if ( downloaded )
316323 {
317324 string localHash = File . ReadLines ( component . InfoFile ) . First ( ) . Split ( ' ' ) [ 0 ] ;
318325 outdated = localHash != component . Hash && component . ID != "core-database" ;
319326 }
320-
321- if ( ! downloaded && component . Required ) outdated = true ;
327+ else if ( component . Required )
328+ {
329+ outdated = true ;
330+ }
322331
323332 if ( outdated )
324333 {
@@ -374,6 +383,21 @@ public static void SyncManager(bool init = false)
374383 {
375384 Main . UpdateButton . Enabled = false ;
376385 }
386+
387+ Main . LocationBox . Text = SourcePath ;
388+
389+ switch ( RepoXml )
390+ {
391+ case RepoXmlTemplates . Stable :
392+ Main . StableRepo . Checked = true ;
393+ break ;
394+ case RepoXmlTemplates . Development :
395+ Main . DevRepo . Checked = true ;
396+ break ;
397+ default :
398+ Main . CustomRepo . Checked = true ;
399+ break ;
400+ }
377401 }
378402
379403 // Deletes a file as well as any directories made empty by its deletion
0 commit comments