Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        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;
            }));
        }