public void ModifySaveFile(string installSavePath, string saveFullPath, SaveType type, params SaveInfo[] info) { // this needs to be dynamic someday switch (type) { case SaveType.CFG: { SourceCfgFile cfg = new SourceCfgFile(installSavePath); for (int j = 0; j < info.Length; j++) { SaveInfo save = info[j]; cfg.ChangeProperty(save); } cfg.Save(saveFullPath); } break; case SaveType.INI: { if (!installSavePath.Equals(saveFullPath)) { File.Copy(installSavePath, saveFullPath); } IniFile file = new IniFile(saveFullPath); for (int j = 0; j < info.Length; j++) { SaveInfo save = info[j]; file.IniWriteValue(save["Section"], save["Key"], save["Value"]); } } break; case SaveType.SCR: { if (!installSavePath.Equals(saveFullPath)) { File.Copy(installSavePath, saveFullPath); } ScrConfigFile file = new ScrConfigFile(saveFullPath); for (int j = 0; j < info.Length; j++) { SaveInfo save = info[j]; file.ChangeProperty(save); } } break; default: throw new NotImplementedException(); } }
public void ModifySaveFile(string installSavePath, string saveFullPath, SaveType type, params SaveInfo[] info) { // this needs to be dynamic someday switch (type) { case SaveType.CFG: { SourceCfgFile cfg = new SourceCfgFile(installSavePath); for (int j = 0; j < info.Length; j++) { SaveInfo save = info[j]; if (save is CfgSaveInfo) { CfgSaveInfo option = (CfgSaveInfo)save; cfg.ChangeProperty(option.Section, option.Key, option.Value); } } cfg.Save(saveFullPath); } break; case SaveType.INI: { if (!installSavePath.Equals(saveFullPath)) { File.Copy(installSavePath, saveFullPath); } IniFile file = new IniFile(saveFullPath); for (int j = 0; j < info.Length; j++) { SaveInfo save = info[j]; if (save is IniSaveInfo) { IniSaveInfo ini = (IniSaveInfo)save; file.IniWriteValue(ini.Section, ini.Key, ini.Value); } } } break; } }