예제 #1
0
 public ProjectEditor(RedCodeProject aProject)
 {
     project = aProject;
     project.Editor = this;
     InitializeComponent();
     comboBoxMode.Items.AddRange(Enum.GetNames(typeof(EngineMode)));
 }
예제 #2
0
 public static WarriorDocument Load(string fileName, RedCodeProject project)
 {
     if (project.Documents.ContainsKey(fileName))
     {
         return project.Documents[fileName] as WarriorDocument;
     }
     WarriorDocument res = Load(fileName);
     project.Add(res);
     return res;
 }
예제 #3
0
 public static WarriorDocument New(RedCodeProject project)
 {
     WarriorDocument res = New();
     project.Add(res);
     return res;
 }
예제 #4
0
 public void SetProjectActive(RedCodeProject project)
 {
     ActiveProject = project;
     RefreshControls();
 }
예제 #5
0
 public bool SaveProject(RedCodeProject project)
 {
     bool res = project.Save();
     RefreshControls();
     return res;
 }
예제 #6
0
 public void RemoveProject(RedCodeProject project, bool delete)
 {
     ActiveSolution.Remove(project, delete);
     RefreshControls();
 }
예제 #7
0
        public void Compile(RedCodeProject project)
        {
            foreach (IEditor editor in Editors)
            {
                if (editor.Document is ProjectDocument && (editor.Document as ProjectDocument).Project == project)
                {
                    editor.Save();
                }
            }

            ActiveSolution.Components.Parser.Parse(ActiveProject.Project, ConsoleControl);

            RefreshControls();
        }
예제 #8
0
 public void AddNewWarrior(RedCodeProject project)
 {
     WarriorDocument.New(project).Open();
     RefreshControls();
 }
예제 #9
0
 public void AddExistingWarrior(RedCodeProject project)
 {
     MainForm.openDialog.Title = "Open existing warriors";
     MainForm.openDialog.Multiselect = true;
     MainForm.openDialog.Filter = "Warrior Sources|*.red;*.rc|All Files|*.*";
     MainForm.openDialog.FilterIndex = 1;
     MainForm.openDialog.DefaultExt = "red";
     DialogResult dr = MainForm.openDialog.ShowDialog();
     if (dr == DialogResult.OK)
     {
         foreach (string fileName in MainForm.openDialog.FileNames)
         {
             WarriorDocument.Load(fileName, project);
         }
     }
     RefreshControls();
 }
예제 #10
0
        public override bool Save()
        {
            bool res = true;
            RedCodeProject[] values = new RedCodeProject[Projects.Values.Count];
            Projects.Values.CopyTo(values, 0);
            foreach (RedCodeProject project in values)
            {
                res &= project.Save();
            }
            if (IsModified)
            {
                if (IsNew)
                {
                    res = ChooseName("nmsln", "Solution");
                }
                if (res)
                {
                    solution.SaveXml(FileName);
                    IsModified = false;
                    IsNew = false;
                }
            }
            else
            {
                res = true;
            }

            IDEApplication.Instance.SolutionExplorer.ReloadSolution();
            return res;
        }
예제 #11
0
        public void Remove(RedCodeProject project, bool delete)
        {
            project.Solution = null;
            Projects.Remove(project.FileName);
            solution.ProjectFiles.Remove(project.FileName);
            IsModified = true;
            if (Projects.Count == 0)
            {
                ActiveProject = null;
                IDEApplication.Instance.ActiveProject = ActiveProject;
            }
            else
            {
                Dictionary<string, RedCodeProject>.ValueCollection.Enumerator enumerator =
                    Projects.Values.GetEnumerator();
                enumerator.MoveNext();
                ActiveProject = enumerator.Current;
                IDEApplication.Instance.ActiveProject = ActiveProject;
            }

            IDEApplication.Instance.SolutionExplorer.ReloadSolution();
            if (delete && File.Exists(project.FileName))
            {
                File.Delete(project.FileName);
            }
            IDEApplication.Instance.SolutionExplorer.ReloadSolution();
        }
예제 #12
0
 public void Move(RedCodeProject project, string newFileName)
 {
     Projects.Remove(project.FileName);
     solution.ProjectFiles.Remove(project.FileName);
     Projects.Add(newFileName, project);
     solution.ProjectFiles.Add(newFileName);
 }
예제 #13
0
 public void Add(RedCodeProject project)
 {
     project.Solution = this;
     Projects.Add(project.FileName, project);
     solution.ProjectFiles.Add(project.FileName);
     if (Projects.Count == 1)
     {
         ActiveProject = project;
         IDEApplication.Instance.ActiveProject = ActiveProject;
     }
     IsModified = true;
     IDEApplication.Instance.SolutionExplorer.ReloadSolution();
 }