Exemplo n.º 1
0
        private void CreateNewConfiguration()
        {
            Directory.CreateDirectory(BuildConfigurationsDir);

            string nameBase = "Configuration";
            string name     = nameBase;
            string path     = null;
            int    i        = 0;

            while (true)
            {
                path = BuildConfigurationsDir + name + ".json";
                if (!File.Exists(path))
                {
                    break;
                }

                name = nameBase + (++i).ToString();
            }

            var config = new BuilderConfiguration();

            config.name = name;
            config.InitializeNew();
            var obj = new JObject();

            config.ToJson(obj);
            File.WriteAllText(path, obj.ToString(Newtonsoft.Json.Formatting.Indented), Encoding.UTF8);

            this._currentConfigurationName  = name;
            this._currentConfiguration      = config;
            this._currentConfigurationDirty = false;

            ClearCache();
        }
Exemplo n.º 2
0
        private BuilderConfiguration LoadConfiguration(string name)
        {
            var config = new BuilderConfiguration();

            config.name = name;

            string path = BuildConfigurationsDir + name + ".json";

            if (File.Exists(path))
            {
                config.FromJson(JObject.Parse(File.ReadAllText(path)));
            }
            else
            {
                config.InitializeNew();
            }

            return(config);
        }