Ejemplo n.º 1
0
        private void AssignVariables(StringTemplate Template)
        {
            //datetime
            Template.Assign("datetime", DateTime.Now);

            //variables
            foreach (Variable var in CurrentProject.Variables)
            {
                //value
                Template.Assign(String.Format("variables[{0}].value", var.Key), var.Value);
            }

            //folders
            foreach (ProjectFolder folder in CurrentProject.Folders)
            {
                //folder directory
                Template.Assign(String.Format("folders[{0}].path", folder.Name), folder.DirectoryName);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Opens the file with the editor specified in the project.
        /// </summary>
        /// <param name="FileName">The file to open.</param>
        private void OpenFile(string FileName)
        {
            if (SelectedFolder != null)
            {
                //get file info
                FileInfo fi = new FileInfo(FileName);

                //find the editor
                ProjectFolderEditor editor = SelectedFolder.FindEditor(fi.Extension);

                //get template
                StringTemplate template = new StringTemplate();

                //asign values
                AssignVariables(template);
                template.Assign("file_name", FileName);
                template.Assign("current_folder.path", SelectedFolder.DirectoryName);
                template.Assign("current_folder.name", SelectedFolder.Name);

                //start the process
                Process.Start(template.GetOutput(editor.Program), template.GetOutput(editor.CommandLineArguments));

            }
        }