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); } } }
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); } } } }