コード例 #1
0
        public ConfigCollection CreatePresets()
        {
            var modSetupCollection = new ConfigCollection
            {
                GameSetups = new List <GameSetup>
                {
                    new GameSetup()
                }
            };

            modSetupCollection.ModSetups = new List <ModSetup>
            {
                new ModSetup()
            };

            return(modSetupCollection);
        }
コード例 #2
0
        public void LoadConfig()
        {
            var configCollection = new ConfigCollection();

            using (var fileStream = File.OpenRead(ConfigFilePath))
            {
                DataContractJsonSerializer ser = new DataContractJsonSerializer(typeof(ConfigCollection));

                using (var stream = new MemoryStream())
                {
                    fileStream.CopyTo(stream);
                    stream.Seek(0, SeekOrigin.Begin);
                    configCollection = (ConfigCollection)ser.ReadObject(stream);
                }
            }

            ConfigCollection  = configCollection;
            cbGame.DataSource = ConfigCollection.GameSetups;
            cbMod.DataSource  = ConfigCollection.ModSetups;
        }