Beispiel #1
0
        private void DeSerialisationFixes(StreamingContext context)
        {
            // Our context is our KSP install.
            KSP ksp = (KSP)context.Context;

            registry_version = LATEST_REGISTRY_VERSION;
            factorioAuthData = ksp?.tryGetFactorioAuthData();
        }
Beispiel #2
0
 public FactorioAuthData tryGetFactorioAuthData()
 {
     try
     {
         return(FactorioAuthData.parseConfig(gamedatadir));
     }
     catch (Exception)
     {
         return(null);
     }
 }
Beispiel #3
0
 public static Registry Empty(FactorioAuthData factorioAuthData = null)
 {
     return(new Registry(
                new Dictionary <string, InstalledModule>(),
                new Dictionary <string, AutodetectedModule>(),
                new Dictionary <string, AvailableModule>(),
                new Dictionary <string, string>(),
                new SortedDictionary <string, Repository>(),
                factorioAuthData
                ));
 }
Beispiel #4
0
 public Registry(
     Dictionary <string, InstalledModule> installed_modules,
     Dictionary <string, AutodetectedModule> installed_preexisting_modules,
     Dictionary <string, AvailableModule> available_modules,
     Dictionary <string, string> installed_files,
     SortedDictionary <string, Repository> repositories,
     FactorioAuthData factorioAuthData
     )
 {
     // Is there a better way of writing constructors than this? Srsly?
     this.installed_modules             = installed_modules;
     this.installed_preexisting_modules = installed_preexisting_modules;
     this.available_modules             = available_modules;
     this.installed_files  = installed_files;
     this.repositories     = repositories;
     this.factorioAuthData = factorioAuthData;
     registry_version      = LATEST_REGISTRY_VERSION;
 }
Beispiel #5
0
 /// <summary>
 /// Returns a perfectly boring NetAsyncModulesDownloader.
 /// </summary>
 public NetAsyncModulesDownloader(IUser user, FactorioAuthData factorioAuthData = null)
 {
     modules               = new List <CfanModule>();
     downloader            = new NetAsyncDownloader(user);
     this.factorioAuthData = factorioAuthData;
 }
Beispiel #6
0
 public string getFactorioAuthDataPath()
 {
     return(FactorioAuthData.getConfigPath(gamedatadir));
 }
Beispiel #7
0
 public FactorioAuthData getFactorioAuthData()
 {
     return(FactorioAuthData.parseConfig(gamedatadir));
 }