public bool Load(string filename = "config.dat") { try { var config = JSONClass.LoadFromCompressedFile(filename); this.ClassName = config["class"].Value; DestinationApp.Instance.OperationType = config["software operatable"].AsBool ? OperationType.Software : OperationType.Hardware; this.SpriteFile = config["sprites"].Value; this.StatusFile = config["status"].Value; this.PythonDirectory = config["python directory"].Value; this.InitializeScriptName = config["initialize script"].Value; this.FrameScriptName = config["frame script"].Value; this.RenderScriptName = config["render script"].Value; this.DisposeScriptName = config["dispose script"].Value; return(true); } catch (Exception) { return(false); } }
private bool loadConfig(string path) { try { var json = JSONClass.LoadFromCompressedFile(path); this.Receiver.FixLevel = json["receiver"]["fix_level"].AsBool; this.Receiver.LevelTemperatureRange = new Rangef(json["receiver"]["level_min"].AsFloat, json["receiver"]["level_max"].AsFloat); this.Visualizer.Palette = json["visualizer"]["palette"].Value; this.Visualizer.Scaled = json["visualizer"]["scaled"].AsFloat; this.Visualizer.StreamingType = (StreamingType)json["visualizer"]["streaming_type"].AsInt; this.Blender.Enabled = json["blender"]["enabled"].AsBool; this.Blender.Size = new OpenCvSharp.Size(json["blender"]["size"]["width"].AsInt, json["blender"]["size"]["height"].AsInt); this.Blender.Transparency = json["blender"]["transparency"].AsFloat; this.Blender.Threshold = json["blender"]["threshold"].AsInt; this.Blender.Smooth = json["blender"]["smooth"].AsBool; this.Detector.Enabled = json["detector"]["enabled"].AsBool; this.Detector.Notification = json["detector"]["notification"].AsBool; this.Detector.Threshold = json["detector"]["threshold"].AsInt; return(true); } catch (Exception) { return(false); } }