Ejemplo n.º 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);
            }
        }
Ejemplo n.º 2
0
		public static void AddReferencesToProject(ProjectExplorerForm ProjectExplorerWindow)
		{
			ReferenceForm.Instance.Clear();
			ReferenceForm.Instance.LoadAssemblies();
			if (ReferenceForm.Instance.ShowDialog() == DialogResult.OK)
			{
				if (ReferenceForm.Instance.AssemblyType == AssemblyType.GAC)
				{
					string[] assemblies = ReferenceForm.Instance.GetSelectedGACAssemblies();
					foreach (string s in assemblies)
					{
						PascalABCCompiler.IReferenceInfo ri = ProjectFactory.Instance.AddReference(s);
						ProjectExplorerWindow.AddReferenceNode(ri);
                        try
                        {
                            ToolboxProvider.AddComponentsFromAssembly(PascalABCCompiler.NetHelper.NetHelper.LoadAssembly(Compiler.get_assembly_path(ri.FullAssemblyName, false)));
                        }
                        catch
                        {

                        }

					}
				}
				else if (ReferenceForm.Instance.AssemblyType == AssemblyType.COM)
				{
					string[] assemblies = ReferenceForm.Instance.GetSelectedCOMObjects();
					foreach (string s in assemblies)
					{
						PascalABCCompiler.IReferenceInfo ri = ProjectFactory.Instance.AddReference(s);
						ProjectExplorerWindow.AddReferenceNode(ri);
					}
				}
				else
				{
					string[] assemblies = ReferenceForm.Instance.GetSelectedFileAssemblies();
					List<string> assm_lst = new List<string>();
                    foreach (string s in assemblies)
                    {
                        if (string.Compare(s, Path.Combine(ProjectFactory.Instance.ProjectDirectory, Path.GetFileName(s)), true) != 0)
                            File.Copy(s, Path.Combine(ProjectFactory.Instance.ProjectDirectory, Path.GetFileName(s)), true);
                        //assm_lst.Add(Path.GetFileNameWithoutExtension(s));
                        //ProjectExplorerWindow.AddReferenceNode(Path.GetFileNameWithoutExtension(s));
                        PascalABCCompiler.IReferenceInfo ri = ProjectFactory.Instance.AddReference(Path.GetFileNameWithoutExtension(s));
                        ProjectExplorerWindow.AddReferenceNode(ri);
                        try
                        {
                            ToolboxProvider.AddComponentsFromAssembly(PascalABCCompiler.NetHelper.NetHelper.LoadAssembly(Compiler.get_assembly_path(Path.Combine(ProjectFactory.Instance.ProjectDirectory, ri.FullAssemblyName), false)));
                        }
                        catch
                        {

                        }
                    }
					//ProjectFactory.Instance.AddReferences(assm_lst.ToArray());
				}
			}
		}
Ejemplo n.º 3
0
 public static void AddReferencesToProject(ProjectExplorerForm ProjectExplorerWindow)
 {
     ReferenceForm.Instance.Clear();
     ReferenceForm.Instance.LoadAssemblies();
     if (ReferenceForm.Instance.ShowDialog() == DialogResult.OK)
     {
         if (ReferenceForm.Instance.AssemblyType == AssemblyType.GAC)
         {
             string[] assemblies = ReferenceForm.Instance.GetSelectedGACAssemblies();
             foreach (string s in assemblies)
             {
                 PascalABCCompiler.IReferenceInfo ri = ProjectFactory.Instance.AddReference(s);
                 ProjectExplorerWindow.AddReferenceNode(ri);
                 try
                 {
                     ToolboxProvider.AddComponentsFromAssembly(PascalABCCompiler.NetHelper.NetHelper.LoadAssembly(Compiler.get_assembly_path(ri.FullAssemblyName, false)));
                 }
                 catch
                 {
                 }
             }
         }
         else if (ReferenceForm.Instance.AssemblyType == AssemblyType.COM)
         {
             string[] assemblies = ReferenceForm.Instance.GetSelectedCOMObjects();
             foreach (string s in assemblies)
             {
                 PascalABCCompiler.IReferenceInfo ri = ProjectFactory.Instance.AddReference(s);
                 ProjectExplorerWindow.AddReferenceNode(ri);
             }
         }
         else
         {
             string[]      assemblies = ReferenceForm.Instance.GetSelectedFileAssemblies();
             List <string> assm_lst   = new List <string>();
             foreach (string s in assemblies)
             {
                 if (string.Compare(s, Path.Combine(ProjectFactory.Instance.ProjectDirectory, Path.GetFileName(s)), true) != 0)
                 {
                     File.Copy(s, Path.Combine(ProjectFactory.Instance.ProjectDirectory, Path.GetFileName(s)), true);
                 }
                 //assm_lst.Add(Path.GetFileNameWithoutExtension(s));
                 //ProjectExplorerWindow.AddReferenceNode(Path.GetFileNameWithoutExtension(s));
                 PascalABCCompiler.IReferenceInfo ri = ProjectFactory.Instance.AddReference(Path.GetFileNameWithoutExtension(s));
                 ProjectExplorerWindow.AddReferenceNode(ri);
                 try
                 {
                     ToolboxProvider.AddComponentsFromAssembly(PascalABCCompiler.NetHelper.NetHelper.LoadAssembly(Compiler.get_assembly_path(Path.Combine(ProjectFactory.Instance.ProjectDirectory, ri.FullAssemblyName), false)));
                 }
                 catch
                 {
                 }
             }
             //ProjectFactory.Instance.AddReferences(assm_lst.ToArray());
         }
     }
 }
Ejemplo n.º 4
0
 void AddProjectExplorerWindow()
 {
     if (ProjectExplorerWindow == null)
     {
         ProjectExplorerWindow = new ProjectExplorerForm();
         Form1StringResources.SetTextForAllControls(ProjectExplorerWindow);
     }
     ProjectPane = null;
     AddWindowToDockPanel(ProjectExplorerWindow, MainDockPanel, ProjectExplorerWindow.Dock, DockState.DockLeft, OutputWindow.IsFloat, ProjectPane, -1);
     ProjectPane = ProjectExplorerWindow.Pane;
 }
Ejemplo n.º 5
0
 public static void AddFile(ProjectExplorerForm ProjectExplorerWindow)
 {
     if (open_dlg == null)
     {
         open_dlg             = new OpenFileDialog();
         open_dlg.Multiselect = true;
         open_dlg.FileOk     += new System.ComponentModel.CancelEventHandler(openFileDialog_FileOk);
     }
     open_dlg.FileName         = "";
     open_dlg.InitialDirectory = ProjectFactory.Instance.ProjectDirectory;
     open_dlg.Filter           = VisualPABCSingleton.MainForm.VisualEnvironmentCompiler.GetFilterForDialogs();
     open_dlg.ShowDialog();
 }
Ejemplo n.º 6
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);
        }
Ejemplo n.º 7
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);
				sw.WriteLine("unit "+Path.GetFileNameWithoutExtension(frm.FileName)+";");
				sw.WriteLine();
				sw.WriteLine("interface");
				sw.WriteLine();
				sw.WriteLine("implementation");
				sw.WriteLine();
				sw.WriteLine("end.");
				sw.Close();
                WorkbenchServiceFactory.FileService.OpenFile(full_file_name, null);
			}
		}
Ejemplo n.º 8
0
 public static void AddFile(ProjectExplorerForm ProjectExplorerWindow, string file_name)
 {
     PascalABCCompiler.IFileInfo fi = ProjectFactory.Instance.AddSourceFile(file_name);
     ProjectExplorerWindow.AddSourceFile(fi, false);
 }
Ejemplo n.º 9
0
 void AddProjectExplorerWindow()
 {
     if (ProjectExplorerWindow == null)
     {
         ProjectExplorerWindow = new ProjectExplorerForm();
         Form1StringResources.SetTextForAllControls(ProjectExplorerWindow);
     }
     ProjectPane = null;
     AddWindowToDockPanel(ProjectExplorerWindow, MainDockPanel, ProjectExplorerWindow.Dock, DockState.DockLeft, OutputWindow.IsFloat, ProjectPane, -1);
     ProjectPane = ProjectExplorerWindow.Pane;
 }
Ejemplo n.º 10
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);
		}
Ejemplo n.º 11
0
		public static void AddFile(ProjectExplorerForm ProjectExplorerWindow)
		{
			if (open_dlg == null) 
			{
				open_dlg = new OpenFileDialog();
				open_dlg.Multiselect = true;
				open_dlg.FileOk += new System.ComponentModel.CancelEventHandler(openFileDialog_FileOk);
			}
			open_dlg.FileName = "";
			open_dlg.InitialDirectory = ProjectFactory.Instance.ProjectDirectory;
			open_dlg.Filter = VisualPABCSingleton.MainForm.VisualEnvironmentCompiler.GetFilterForDialogs();
			open_dlg.ShowDialog();
		}
Ejemplo n.º 12
0
		public static void AddFile(ProjectExplorerForm ProjectExplorerWindow, string file_name)
		{
			PascalABCCompiler.IFileInfo fi = ProjectFactory.Instance.AddSourceFile(file_name);
			ProjectExplorerWindow.AddSourceFile(fi,false);
		}