public void LoadConfig(ISimpleLEDDriverWithConfig simpleLedDriver) { string path = configPath + "\\" + simpleLedDriver.GetProperties().Id + "_config.json"; string json = File.ReadAllText(path); SLSConfigData data = JsonConvert.DeserializeObject <SLSConfigData>(json, new JsonSerializerSettings { TypeNameHandling = TypeNameHandling.All, // $type no longer needs to be first MetadataPropertyHandling = MetadataPropertyHandling.ReadAhead }); simpleLedDriver.PutConfig(data); }
public void SaveConfig(ISimpleLEDDriverWithConfig simpleLedDriver) { simpleLedDriver.SetIsDirty(false); SLSConfigData data = simpleLedDriver.GetConfig <SLSConfigData>(); string json = JsonConvert.SerializeObject(data, new JsonSerializerSettings { TypeNameHandling = TypeNameHandling.All, // $type no longer needs to be first MetadataPropertyHandling = MetadataPropertyHandling.ReadAhead }); string path = configPath + "\\" + simpleLedDriver.GetProperties().Id + "_config.json"; File.WriteAllText(path, json); }