void ISaveState.Load(string filename) { filename = filename + ".serverTimings"; if (!File.Exists(filename)) { return; } _eventAggregator.PublishOnUIThread(new ShowTraceWindowEvent(this)); string data = File.ReadAllText(filename); var eventConverter = new ServerTimingConverter(); var deseralizeSettings = new JsonSerializerSettings(); deseralizeSettings.Converters.Add(eventConverter); deseralizeSettings.TypeNameAssemblyFormatHandling = TypeNameAssemblyFormatHandling.Simple; deseralizeSettings.TypeNameHandling = TypeNameHandling.Auto; ServerTimesModel m = JsonConvert.DeserializeObject <ServerTimesModel>(data, deseralizeSettings); FormulaEngineDuration = m.FormulaEngineDuration; StorageEngineDuration = m.StorageEngineDuration; StorageEngineCpu = m.StorageEngineCpu; TotalDuration = m.TotalDuration; VertipaqCacheMatches = m.VertipaqCacheMatches; StorageEngineQueryCount = m.StorageEngineQueryCount; TotalCpuDuration = m.TotalCpuDuration; this._storageEngineEvents.Clear(); this._storageEngineEvents.AddRange(m.StoreageEngineEvents); NotifyOfPropertyChange(() => StorageEngineEvents); }
void ISaveState.Save(string filename) { var m = new ServerTimesModel() { FormulaEngineDuration = this.FormulaEngineDuration, StorageEngineDuration = this.StorageEngineDuration, StorageEngineCpu = this.StorageEngineCpu, TotalDuration = this.TotalDuration, VertipaqCacheMatches = this.VertipaqCacheMatches, StorageEngineQueryCount = this.StorageEngineQueryCount, StoreageEngineEvents = this._storageEngineEvents, TotalCpuDuration = this.TotalCpuDuration }; var json = JsonConvert.SerializeObject(m, Formatting.Indented); File.WriteAllText(filename + ".serverTimings", json); }
private string GetJsonString() { var m = new ServerTimesModel() { FormulaEngineDuration = this.FormulaEngineDuration, StorageEngineDuration = this.StorageEngineDuration, StorageEngineCpu = this.StorageEngineCpu, TotalDuration = this.TotalDuration, VertipaqCacheMatches = this.VertipaqCacheMatches, StorageEngineQueryCount = this.StorageEngineQueryCount, StoreageEngineEvents = this._storageEngineEvents, TotalCpuDuration = this.TotalCpuDuration }; var json = JsonConvert.SerializeObject(m, Formatting.Indented); return(json); }
void ISaveState.Load(string filename) { filename = filename + ".serverTimings"; if (!File.Exists(filename)) { return; } this.IsChecked = true; string data = File.ReadAllText(filename); ServerTimesModel m = JsonConvert.DeserializeObject <ServerTimesModel>(data); FormulaEngineDuration = m.FormulaEngineDuration; StorageEngineDuration = m.StorageEngineDuration; StorageEngineCpu = m.StorageEngineCpu; TotalDuration = m.TotalDuration; VertipaqCacheMatches = m.VertipaqCacheMatches; StorageEngineQueryCount = m.StorageEngineQueryCount; TotalCpuDuration = m.TotalCpuDuration; this._storageEngineEvents.Clear(); this._storageEngineEvents.AddRange(m.StoreageEngineEvents); NotifyOfPropertyChange(() => StorageEngineEvents); }