private void UpdateVideoCfg(string width, string height, string fullscreen, string noWindowBorder)
        {
            const string defaultRes       = "defaultres";
            const string defaultResHeight = "defaultresheight";
            const string def_fullscreen   = "fullscreen";
            const string nowindowborder   = "nowindowborder";

            videoCfg.Reset();
            videoCfg.ChangeProperty(defaultRes, width);
            videoCfg.ChangeProperty(defaultResHeight, height);
            videoCfg.ChangeProperty(def_fullscreen, fullscreen);
            videoCfg.ChangeProperty(nowindowborder, noWindowBorder);

            using (Stream videoStream = new FileStream(videoFile, FileMode.Create))
            {
                videoCfg.Write(videoStream);
            }
        }
Beispiel #2
0
        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();
            }
        }
Beispiel #3
0
        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;
            }
        }