/// <summary> /// Load all runlogs /// </summary> public void LoadRunLogs() { var loadedLogs = new List <RunLog>(); string logBasePath = this.ProjectFolder.Trim(Path.DirectorySeparatorChar) + @"\logs\"; if (Directory.Exists(logBasePath)) { foreach (string runLogFileDirectory in Directory.GetDirectories(logBasePath)) { if (File.Exists(runLogFileDirectory + @"\runLog.xml") == false) { continue; } string serializedRunLog = ConfigurationFileHandler.ReadStringFromFile(runLogFileDirectory + @"\runLog.xml"); RunLog runLog = (RunLog)ConfigurationSerializer.DeserializeObject(serializedRunLog, typeof(RunLog), new Type[] { }); loadedLogs.Add(runLog); } } this.RunLogs.Clear(); foreach (var log in loadedLogs.OrderBy(t => t.StartTime)) { RunLogs.Add(log); } }
public static Project LoadFromFile(string projectPath, Type[] extraTypes) { string serializedProject = ConfigurationFileHandler.ReadStringFromFile(projectPath); Project project = (Project)ConfigurationSerializer.DeserializeObject(serializedProject, typeof(Project), extraTypes); project.ProjectFolder = projectPath.Replace(Path.GetFileName(projectPath), ""); string connectionsPath = project.ProjectFolder + "\\" + project.ProjectName + "Connections.xml"; if (File.Exists(connectionsPath)) { string serializedConnections = ConfigurationFileHandler.ReadStringFromFile(connectionsPath); project.Connections = (ObservableCollection <ConnectionConfigurationBase>)ConfigurationSerializer.DeserializeObject(serializedConnections, typeof(ObservableCollection <ConnectionConfigurationBase>), extraTypes); } return(project); }
/// <summary> /// Load all runlogs /// </summary> public void LoadRunLogs() { this.RunLogs.Clear(); string logBasePath = this.ProjectFolder.Trim('\\') + @"\logs\"; if (Directory.Exists(logBasePath)) { foreach (string runLogFileDirectory in Directory.GetDirectories(logBasePath)) { if (File.Exists(runLogFileDirectory + @"\runLog.xml") == false) { continue; } string serializedRunLog = ConfigurationFileHandler.ReadStringFromFile(runLogFileDirectory + @"\runLog.xml"); RunLog runLog = (RunLog)ConfigurationSerializer.DeserializeObject(serializedRunLog, typeof(RunLog), new Type[] { }); this.RunLogs.Add(runLog); } } }