Ejemplo n.º 1
0
        public void SaveSettings()
        {
            SetSetting("AccessKey", tbAccessKey.Text);
            SetSetting("SecretKey", tbSecretKey.Text);
            SetSetting("BucketName", tbBucketName.Text);
            SetSetting("SourceDirectory", txtSourceDirectory.Text);

            Settings.WriteToFile(SettingsFileName);
        }
Ejemplo n.º 2
0
        public void Save(string filepath)
        {
            var root = new Dictionary<string, MiniYaml>();
            foreach (var field in fields)
            {
                FieldInfo f = this.GetType().GetField(field);
                if (f.GetValue(this) == null) continue;
                root.Add(field, new MiniYaml(FieldSaver.FormatValue(this, f), null));
            }

            var gen = new Dictionary<string, MiniYaml>();
            foreach (var field in fields)
            {
                FieldInfo f = this.GetType().GetField(field);
                if (f.GetValue(this) == null) continue;
                gen.Add(field, new MiniYaml(FieldSaver.FormatValue(this, f), null));
            }
            root.Add("General", new MiniYaml(null, gen));

            root.Add("Terrain",
                new MiniYaml(null, Terrain.ToDictionary(
                    t => "TerrainType@{0}".F(t.Value.Type),
                    t => t.Value.Save())));

            root.Add("Templates",
                new MiniYaml(null, Templates.ToDictionary(
                    t => "Template@{0}".F(t.Value.Id),
                    t => t.Value.Save())));
            root.WriteToFile(filepath);
        }
Ejemplo n.º 3
0
        public void Save()
        {
            Dictionary<string, MiniYaml> root = new Dictionary<string, MiniYaml>();
            foreach (var kv in Sections)
                root.Add(kv.Key, SectionYaml(kv.Value));

            root.WriteToFile(SettingsFile);
        }