Exemple #1
0
 public async static Task SaveOptionsAsync(List <VersionOption> opts, LaunchHandler core, Modules.Version version)
 {
     await Task.Factory.StartNew(() =>
     {
         try
         {
             if (version != null && opts != null)
             {
                 List <string> optLines = new List <string>();
                 foreach (var item in opts)
                 {
                     optLines.Add(item.ToString());
                 }
                 File.WriteAllLines(core.GetVersionOptions(version), optLines.ToArray());
             }
         }
         catch (Exception) {}
     });
 }
Exemple #2
0
 public async static Task <List <VersionOption> > GetOptionsAsync(LaunchHandler core, Modules.Version version)
 {
     return(await Task.Factory.StartNew(() =>
     {
         if (version != null)
         {
             try
             {
                 string optionsPath = core.GetVersionOptions(version);
                 if (!File.Exists(optionsPath))
                 {
                     return null;
                 }
                 string[] lines = File.ReadAllLines(optionsPath);
                 List <VersionOption> options = new List <VersionOption>();
                 foreach (var item in lines)
                 {
                     string[] kv = item.Split(':');
                     if (kv.Length != 2)
                     {
                         return null;
                     }
                     options.Add(new VersionOption()
                     {
                         Key = kv[0], Value = kv[1]
                     });
                 }
                 return options;
             }
             catch (Exception)
             {
                 return null;
             }
         }
         else
         {
             return null;
         }
     }));
 }