private TelemetryFunction NewFx() { var fx = new TelemetryFunction() { Name = "New Function" }; fx.State = fx.Serialize(); return(fx); }
private void SaveCustomFunctionFile(TelemetryFunction fx) { JsonSerializerSettings settings = new JsonSerializerSettings { TypeNameHandling = TypeNameHandling.Auto }; var json = JsonConvert.SerializeObject(fx, settings); var fieldListFile = Path.Combine(Constants.AppFolder, fx.FileName); if (File.Exists(fieldListFile)) { File.Delete(fieldListFile); } File.WriteAllText(fieldListFile, json); fx.State = fx.Serialize(); }
private TelemetryFunction LoadCustomFunctionFile(string fileName) { TelemetryFunction fx = null; if (File.Exists(fileName)) { var json = File.ReadAllText(fileName); JsonSerializerSettings settings = new JsonSerializerSettings { TypeNameHandling = TypeNameHandling.Auto }; fx = JsonConvert.DeserializeObject <TelemetryFunction>(json, settings); fx.State = fx.Serialize(); } return(fx); }