public async Task <ISession> LoadSavedSessionAsync(string jsonFileName) { var json = File.ReadAllText(jsonFileName); JsonSerializerSettings settings = new JsonSerializerSettings { TypeNameHandling = TypeNameHandling.Auto }; var session = JsonConvert.DeserializeObject <TelemetrySession>(json, settings); session.FileName = jsonFileName; session.State = TelemetrySession.Serialize(session); if (!String.IsNullOrEmpty(session.SessionFileName)) { var telemetry = await _telemetryFileParser.ParseTelemetryFileAsync(session.SessionFileName, IbtParseOptions.All); session.TelemetrySessionData = telemetry.SessionData; } return(session); }
public async Task <IProject> OpenTelemetryProject(string fileName) { return(await Task.Run(() => { var json = File.ReadAllText(fileName); JsonSerializerSettings settings = new JsonSerializerSettings { TypeNameHandling = TypeNameHandling.Auto, Formatting = Formatting.Indented }; settings.Converters.Add(new ColorConverter()); var project = JsonConvert.DeserializeObject <Project>(json, settings); project.FileName = fileName; project.State = Project.Serialize(project); if (project.Session != null) { ((TelemetrySession)project.Session).State = TelemetrySession.Serialize(project.Session); } return project; })); }