Exemple #1
0
        private bool saveConfig(string path)
        {
            try
            {
                var json = new JSONClass();

                json["receiver"]["fix_level"] = new JSONData(this.Receiver.FixLevel);
                json["receiver"]["level_min"] = new JSONData(this.Receiver.LevelTemperatureRange.Start);
                json["receiver"]["level_max"] = new JSONData(this.Receiver.LevelTemperatureRange.End);

                json["visualizer"]["palette"]         = new JSONData(this.Visualizer.Palette);
                json["visualizer"]["scaled"]          = new JSONData(this.Visualizer.Scaled);
                json["visualilzer"]["streaming_type"] = new JSONData((int)this.Visualizer.StreamingType);

                json["blender"]["enabled"]        = new JSONData(this.Blender.Enabled);
                json["blender"]["size"]           = new JSONClass();
                json["blender"]["size"]["width"]  = new JSONData(this.Blender.Size.Width);
                json["blender"]["size"]["height"] = new JSONData(this.Blender.Size.Height);
                json["blender"]["transparency"]   = new JSONData(this.Blender.Transparency);
                json["blender"]["threshold"]      = new JSONData(this.Blender.Threshold);
                json["blender"]["smooth"]         = new JSONData(this.Blender.Smooth);

                json["detector"]["enabled"]      = new JSONData(this.Detector.Enabled);
                json["detector"]["notification"] = new JSONData(this.Detector.Notification);
                json["detector"]["threshold"]    = new JSONData(this.Detector.Threshold);

                json.SaveToCompressedFile(path);
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Exemple #2
0
        public void Save(string filename = "config.dat")
        {
            var config = new JSONClass();

            config["class"] = this.ClassName;
            config["software operatable"] = new JSONData(DestinationApp.Instance.OperationType == OperationType.Software);

            config["sprites"]          = this.SpriteFile;
            config["status"]           = this.StatusFile;
            config["python directory"] = this.PythonDirectory;

            config["initialize script"] = this.InitializeScriptName;
            config["frame script"]      = this.FrameScriptName;
            config["render script"]     = this.RenderScriptName;
            config["dispose script"]    = this.DisposeScriptName;

            config.SaveToCompressedFile(filename);
        }