/// <summary> /// Constructs an instance of Project. /// </summary> ///<param name="projectName">Name of the project.</param> /// <param name="projectPath">Absolute path to the project folder.</param> /// <param name="videoPath">Absolute path to the video file.</param> /// <param name="copyVideo">Whether or not to copy the video file into the project folder.</param> public Project(string projectName, string projectPath, string videoPath, bool copyVideo) { ProjectName = projectName; string projectFolder = Path.Combine(projectPath, projectName); Folders = new ProjectFolders { Project = projectFolder, Cache = ProjectFile.FromRelativePath(Names.CacheFolder, projectFolder), Descriptions = ProjectFile.FromRelativePath(Names.DescriptionsFolder, projectFolder), }; Files = new ProjectFiles { Project = ProjectFile.FromRelativePath(projectName + Names.ProjectExtension, projectFolder), Descriptions = ProjectFile.FromRelativePath(Names.DescriptionsFile, projectFolder), Spaces = ProjectFile.FromRelativePath(Names.SpacesFile, projectFolder), WaveFormHeader = ProjectFile.FromRelativePath(Path.Combine(Folders.Cache.RelativePath, Names.WaveFormHeader), projectFolder), WaveForm = ProjectFile.FromRelativePath(Path.Combine(Folders.Cache.RelativePath, Names.WaveFormFile), projectFolder), }; if (copyVideo) { string videoFileName = Path.GetFileName(videoPath); Files.Video = ProjectFile.FromRelativePath(videoFileName, Folders.Project); } else Files.Video = ProjectFile.FromAbsolutePath(videoPath, Folders.Project); }
private static void writeLogsToFile(string message) { using (StreamWriter writer = new StreamWriter(ProjectFolders.GetRootFolder() + "Debug/" + LOG_NAME, false, Encoding.Default)) { writer.WriteLine(message); } }
static Log() { using (StreamWriter writer = new StreamWriter(ProjectFolders.GetRootFolder() + "Debug/" + LOG_NAME, true, Encoding.Default)) { writer.WriteLine("Session started at : {0}", DateTime.Now); } }
public AltaxoDocument() { _dataTables = new Altaxo.Data.DataTableCollection(this); var commonDictionaryForGraphs = new SortedDictionary <string, IProjectItem>(); _graphs = new Graph.Gdi.GraphDocumentCollection(this, commonDictionaryForGraphs); _graphs3D = new Graph.Graph3D.GraphDocumentCollection(this, commonDictionaryForGraphs); _textDocuments = new Text.TextDocumentCollection(this); _projectFolderProperties = new Main.Properties.ProjectFolderPropertyDocumentCollection(this); _tableLayouts = new Altaxo.Worksheet.WorksheetLayoutCollection(this); _fitFunctionScripts = new Altaxo.Scripting.FitFunctionScriptCollection(this); _projectFolders = new ProjectFolders(this); }
public static void AddAllTableNodes(NGTreeNode tableCollectionNode) { // Create a dictionary of folders to TreeNodes relation var folderDict = new Dictionary <string, NGTreeNode> { { ProjectFolder.RootFolderName, tableCollectionNode } // add the root folder node to the dictionary }; tableCollectionNode.Nodes.Clear(); foreach (var table in Current.Project.DataTableCollection) { var parentNode = ProjectFolders.AddFolderNodeRecursively <StructureNode>(table.FolderName, folderDict); var node = new TableNode(table); parentNode.Nodes.Add(node); } }
protected override IEnumerable <Main.DocumentNodeAndName> GetDocumentNodeChildrenWithName() { if (null != _dataTables) { yield return(new Main.DocumentNodeAndName(_dataTables, () => _dataTables = null, "Tables")); } if (null != _graphs) { yield return(new Main.DocumentNodeAndName(_graphs, () => _graphs = null, "Graphs")); } if (null != _graphs3D) { yield return(new Main.DocumentNodeAndName(_graphs3D, () => _graphs3D = null, "Graphs3D")); } if (null != _textDocuments) { yield return(new Main.DocumentNodeAndName(_textDocuments, () => _textDocuments = null, "Text")); } if (null != _tableLayouts) { yield return(new Main.DocumentNodeAndName(_tableLayouts, () => _tableLayouts = null, "TableLayouts")); } if (null != _fitFunctionScripts) { yield return(new Main.DocumentNodeAndName(_fitFunctionScripts, () => _fitFunctionScripts = null, "FitFunctionScripts")); } if (null != _projectFolderProperties) { yield return(new Main.DocumentNodeAndName(_projectFolderProperties, () => _projectFolderProperties = null, "FolderProperties")); } if (null != _projectFolders) { yield return(new Main.DocumentNodeAndName(_projectFolders, () => _projectFolders = null, "ProjectFolders")); } }
public Dictionary <string, string[]> GetFilesToDelete(string root) { string[] dirs = Directory.GetDirectories(root, "*.*", SearchOption.AllDirectories); var projDirs = new Dictionary <string, string[]>(); foreach (string dir in dirs) { for (int i = 0; i < ProjectFolders.Count; i++) { var ext = ProjectFolders.ElementAt(i); if (Directory.GetFiles(dir, ext.Key).Length == 0) { Logger.WriteLog(LogLevelL4N.DEBUG, $"Cleanbin"); continue; } if (Verbose == true) { Logger.WriteLog(LogLevelL4N.DEBUG, ext.Key + ": found in '" + dir + "'"); } for (int j = 0; j < ext.Value.Length; j++) { string delDir = dir + "\\" + ext.Value[j]; if (Directory.Exists(delDir) == false) { continue; } string[] delFiles = Directory.GetFiles(delDir, "*.*", SearchOption.AllDirectories); if (Verbose == true) { Console.WriteLine("Found " + delFiles.Length + " files in " + delDir); } projDirs.Add(delDir, delFiles); } } } return(projDirs); }