コード例 #1
0
 public static void InitializePackages()
 {
     foreach (var pack in DEFAULTS)
     {
         var packageName = String.Format("MinerOptionPackage_{0}", pack.Name);
         var packageFile = new MinerOptionPackageFile(packageName);
         var readPack    = packageFile.ReadFile();
         if (readPack == null)   // read has failed
         {
             Helpers.ConsolePrint("ExtraLaunchParameters", "Creating internal params config " + packageName);
             MinerOptionPackages.Add(pack);
             // create defaults
             packageFile.Commit(pack);
         }
         else
         {
             Helpers.ConsolePrint("ExtraLaunchParameters", "Loading internal params config " + packageName);
             MinerOptionPackages.Add(readPack);
         }
     }
 }
コード例 #2
0
        public static void InitializePackages()
        {
            foreach (var pack in Defaults)
            {
                var packageName = $"MinerOptionPackage_{pack.Name}";
                var packageFile = new MinerOptionPackageFile(packageName);
                var readPack    = packageFile.ReadFile();
                if (readPack == null)
                {
                    // read has failed
                    Helpers.ConsolePrint("ExtraLaunchParameters", "Creating internal params config " + packageName);
                    MinerOptionPackages.Add(pack);
                    // create defaults
                    packageFile.Commit(pack);
                }
                else
                {
                    Helpers.ConsolePrint("ExtraLaunchParameters", "Loading internal params config " + packageName);
                    MinerOptionPackages.Add(readPack);
                }
            }
            var defaultKeys = Defaults.ConvertAll(p => p.Type);

            // extra check if DEFAULTS is missing a key
            for (var type = (MinerType.NONE + 1); type < MinerType.END; ++type)
            {
                if (defaultKeys.Contains(type) == false)
                {
                    var packageName = $"MinerOptionPackage_{Enum.GetName(typeof(MinerType), type)}";
                    var packageFile = new MinerOptionPackageFile(packageName);
                    var readPack    = packageFile.ReadFile();
                    if (readPack != null)
                    {
                        // read has failed
                        Helpers.ConsolePrint("ExtraLaunchParameters", "Creating internal params config " + packageName);
                        MinerOptionPackages.Add(readPack);
                    }
                }
            }
        }