Inheritance: IConfigurable
Ejemplo n.º 1
0
        public Profiles(string app, string car)
        {
            UniqueID = string.Format("{0}.{1}", app, car);
            MasterFile = string.Format("Settings/Profiles/{0}.{1}.Master.ini", app, car);
            PatternFile = string.Format("Settings/Profiles/{0}.{1}.{2}.ini", app, car, "{0}");

            if (File.Exists(MasterFile) == false)
            {
                Debug.WriteLine("Cannot find " + MasterFile + " - creating default Performance");

                ResetParameters();
                var performanceProfile = new Profile(this, "Performance");
                Loaded.Add(performanceProfile);
                var efficiencyProfile = new Profile(this, "Efficiency");
                Loaded.Add(efficiencyProfile);
                var economyProfile = new Profile(this, "Economy");
                Loaded.Add(economyProfile);

                Main.Store(ExportParameters(), MasterFile);
            }

            Main.Load(this, MasterFile);
        }
Ejemplo n.º 2
0
        public void ApplyParameter(IniValueObject obj)
        {
            switch (obj.Key)
            {
                case "Load":
                    var p = new Profile(this, obj.ReadAsString());
                    if(p.Loaded==false)
                    {
                        Unloaded.Add(obj.ReadAsString());
                    }
                    else
                    {
                        Loaded.Add(p);
                    }
                    break;

                case "Unload":
                    Unloaded.Add(obj.ReadAsString());
                    break;
            }
        }