예제 #1
0
        public static void NewFile(ProjectExplorerForm ProjectExplorerWindow)
        {
            NewFileForm frm = new NewFileForm();

            Form1StringResources.SetTextForAllControls(frm);
            frm.FileName = ProjectFactory.Instance.GetUnitFileName();
            frm.SetUnitFilter();
            if (frm.ShowDialog() == DialogResult.OK)
            {
                PascalABCCompiler.IFileInfo fi = ProjectFactory.Instance.AddSourceFile(frm.FileName);
                ProjectExplorerWindow.AddSourceFile(fi, false);
                string       full_file_name = Path.Combine(Path.GetDirectoryName(ProjectFactory.Instance.CurrentProject.Path), frm.FileName);
                StreamWriter sw             = File.CreateText(full_file_name);
                if (frm.GetFileFilter() == FileType.Unit)
                {
                    sw.WriteLine("unit " + Path.GetFileNameWithoutExtension(frm.FileName) + ";");
                    sw.WriteLine();
                    sw.WriteLine("interface");
                    sw.WriteLine();
                    sw.WriteLine("implementation");
                    sw.WriteLine();
                    sw.Write("end.");
                }
                else
                {
                    sw.WriteLine("namespace " + ProjectFactory.Instance.CurrentProject.Name + ";");
                    sw.WriteLine();
                    sw.Write("end.");
                    ProjectFactory.Instance.AddNamespaceFileReference(full_file_name);
                }

                sw.Close();
                WorkbenchServiceFactory.FileService.OpenFile(full_file_name, null);
            }
        }
예제 #2
0
        public static void NewForm(ProjectExplorerForm ProjectExplorerWindow, bool prompt)         //roman//
        {
            NewFileForm frm = new NewFileForm();

            frm.SetWinFormsFilter();
            Form1StringResources.SetTextForAllControls(frm);
            frm.FileName = ProjectFactory.Instance.GetUnitFileName();
            if (prompt && frm.ShowDialog() != DialogResult.OK) //roman//
            {
                return;
            }
            PascalABCCompiler.IFileInfo fi = ProjectFactory.Instance.AddSourceFile(frm.FileName);
            string       full_file_name    = Path.Combine(Path.GetDirectoryName(ProjectFactory.Instance.CurrentProject.Path), frm.FileName);
            StreamWriter sw = File.CreateText(full_file_name);

            sw.Close();

            WorkbenchServiceFactory.FileService.OpenFile(full_file_name, null);
            VisualPABCSingleton.MainForm.CurrentCodeFileDocument.AddDesigner(null);
            ProjectExplorerWindow.AddSourceFile(fi, true);
            VisualPABCSingleton.MainForm.SaveFileAs(VisualPABCSingleton.MainForm.CurrentCodeFileDocument, full_file_name);
        }
예제 #3
0
 public static void ExcludeFile(PascalABCCompiler.IFileInfo fi)
 {
     ProjectFactory.Instance.ExcludeFile(fi);
 }
예제 #4
0
 public static void AddFile(ProjectExplorerForm ProjectExplorerWindow, string file_name)
 {
     PascalABCCompiler.IFileInfo fi = ProjectFactory.Instance.AddSourceFile(file_name);
     ProjectExplorerWindow.AddSourceFile(fi, false);
 }
예제 #5
0
 public static void ExcludeFile(PascalABCCompiler.IFileInfo fi)
 {
     ProjectFactory.Instance.ExcludeFile(fi);
     ProjectFactory.Instance.RemoveNamespaceFileReference(fi.Path);
 }