public void ChangeProjectBuildOrder()
        {
            Form f = null;

            if (this.TreeView != null)
            {
                f = this.TreeView.FindForm();
            }
            DialogProjectBuildOrder dlg = new DialogProjectBuildOrder();

            dlg.LoadData(this);
            if (dlg.ShowDialog(f) == DialogResult.OK)
            {
                for (int i = 0; i < Nodes.Count; i++)
                {
                    ProjectNode prjNode = Nodes[i] as ProjectNode;
                    if (prjNode != null)
                    {
                        ProjectNodeData prjData = (ProjectNodeData)prjNode.PropertyObject;
                        foreach (ProjectDependencies pd0 in dlg.ProjectDependencies)
                        {
                            if (pd0.Project.ProjectGuid == prjData.Project.ProjectGuid)
                            {
                                prjNode.SetDependencies(pd0.GetDependentProjectIDlist());
                                break;
                            }
                        }
                    }
                }
                Dirty = true;
            }
        }
        public List <ProjectDependencies> GetDependencies()
        {
            List <ProjectDependencies> lst = new List <ProjectDependencies>();

            for (int i = 0; i < Nodes.Count; i++)
            {
                ProjectNode pn = Nodes[i] as ProjectNode;
                if (pn != null)
                {
                    ProjectNodeData      pnd  = pn.PropertyObject as ProjectNodeData;
                    LimnorProject        lp   = pnd.Project;
                    IList <Guid>         pids = pn.DependedProjects;
                    List <LimnorProject> ps   = new List <LimnorProject>();
                    if (pids != null && pids.Count > 0)
                    {
                        foreach (Guid g in pids)
                        {
                            LimnorProject dp = LimnorSolution.Solution.GetProjectByGuid(g);
                            if (dp != null)
                            {
                                ps.Add(dp);
                            }
                        }
                    }
                    ProjectDependencies pds = new ProjectDependencies(lp, ps);
                    lst.Add(pds);
                }
            }
            return(lst);
        }
 public ComponentNode(ClassData classData, ProjectNodeData prj)
 {
     Obj = CreateDataObject(prj, classData, this.Nodes);
     Obj.OnNameChanged      += new EventHandler(Obj_OnNameChanged);
     Obj.OnNameChanging     += new EventHandler(Obj_OnNameChanging);
     this.ImageIndex         = SolutionTree.IMG_COMP;
     this.SelectedImageIndex = SolutionTree.IMG_COMP;
     Text = classData.ComponentName;
 }
        public bool IsProjectBuildIncluded(ProjectNode projectNode)
        {
            ProjectNodeData pdata = projectNode.PropertyObject as ProjectNodeData;
            XmlDocument     doc   = cfgDoc;
            XmlNode         pn    = doc.DocumentElement.SelectSingleNode(string.Format(CultureInfo.InvariantCulture,
                                                                                       "{0}[@{1}='{2}']",
                                                                                       XmlTags.XML_Item, XmlTags.XMLATT_guid, VPLUtil.GuidToString(pdata.Project.ProjectGuid)));

            if (pn == null)
            {
                return(true);
            }
            return(XmlUtil.GetAttributeBoolDefTrue(pn, XMLATT_include));
        }
 public void LoadNextLevel(TreeNodeLoader level)
 {
     if (!_nextLevelLoaded)
     {
         _nextLevelLoaded = true;
         ProjectNodeData   pd      = Obj as ProjectNodeData;
         IList <ClassData> classes = pd.Project.GetAllClasses();
         foreach (ClassData c in classes)
         {
             ComponentNode cn = new ComponentNode(c, pd);
             this.Nodes.Add(cn);
         }
     }
 }
        private List <Guid> _dependedProjects;        //solution data, not project data
        public ProjectNode(LimnorProject project)
        {
            Obj = new ProjectNodeData(project, this);

            Obj.OnNameChanged  += new EventHandler(Obj_OnNameChanged);
            Obj.OnNameChanging += new EventHandler(Obj_OnNameChanging);
            ((ProjectNodeData)Obj).OnActivationChanged += new EventHandler(ProjectNode_OnActivationChanged);
            ((ProjectNodeData)Obj).OnFilenameChanged   += new EventHandler(ProjectNode_OnFilenameChanged);
            this.ImageIndex         = SolutionTree.IMG_WIN_0;
            this.SelectedImageIndex = SolutionTree.IMG_WIN_0;
            Text      = ToString();
            Dirty     = false;
            Obj.Dirty = false;
            Nodes.Add(new TreeNodeLoader());
        }
 public bool ProjectProgramNameExists(string name)
 {
     for (int i = 0; i < Nodes.Count; i++)
     {
         ProjectNode prjNode = Nodes[i] as ProjectNode;
         if (prjNode != null)
         {
             ProjectNodeData prjData = (ProjectNodeData)prjNode.PropertyObject;
             if (string.Compare(name, prjData.ProgramName, StringComparison.OrdinalIgnoreCase) == 0)
             {
                 return(true);
             }
         }
     }
     return(false);
 }
 public ProjectNode GetProjectByGuid(Guid g)
 {
     for (int i = 0; i < Nodes.Count; i++)
     {
         ProjectNode prjNode = Nodes[i] as ProjectNode;
         if (prjNode != null)
         {
             ProjectNodeData prjData = (ProjectNodeData)prjNode.PropertyObject;
             if (prjData.Project.ProjectGuid == g)
             {
                 return(prjNode);
             }
         }
     }
     return(null);
 }
 public ProjectNode GetProjectByName(string name)
 {
     for (int i = 0; i < Nodes.Count; i++)
     {
         ProjectNode prjNode = Nodes[i] as ProjectNode;
         if (prjNode != null)
         {
             ProjectNodeData prjData = (ProjectNodeData)prjNode.PropertyObject;
             if (string.Compare(name, prjData.Name, StringComparison.OrdinalIgnoreCase) == 0)
             {
                 return(prjNode);
             }
         }
     }
     return(null);
 }
예제 #10
0
 public void LoadData(SolutionNode node)
 {
     _sol = node;
     for (int i = 0; i < node.Nodes.Count; i++)
     {
         ProjectNode pn = node.Nodes[i] as ProjectNode;
         if (pn != null)
         {
             ProjectNodeData pnd = pn.PropertyObject as ProjectNodeData;
             int             n   = checkedListBox1.Items.Add(pnd.Project);
             if (node.IsProjectBuildIncluded(pn))
             {
                 checkedListBox1.SetItemChecked(n, true);
             }
         }
     }
 }
 public NodeObjectComponent(ProjectNodeData prj, ClassData data, TreeNodeCollection parent)
 {
     _classData = data;
     _prj       = prj;
     if (IsWebPage)
     {
         string nm = string.Format(CultureInfo.InvariantCulture, "{0}.html", Path.GetFileNameWithoutExtension(_classData.ComponentFile));
         _classData.Rename(nm);
         SetName0(nm);
     }
     else
     {
         if (string.IsNullOrEmpty(_classData.ComponentName))
         {
             _classData.Rename(Path.GetFileNameWithoutExtension(_classData.ComponentFile));
         }
         SetName0(_classData.ComponentName);
     }
 }
예제 #12
0
 public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
 {
     if (context != null && context.Instance != null && provider != null)
     {
         IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
         if (edSvc != null)
         {
             ProjectNodeData prjd = context.Instance as ProjectNodeData;
             if (prjd != null)
             {
                 DlgLicFiles dlg = new DlgLicFiles();
                 dlg.LoadData(prjd.LicenseFiles);
                 if (edSvc.ShowDialog(dlg) == System.Windows.Forms.DialogResult.OK)
                 {
                     return(dlg.Ret);
                 }
             }
         }
     }
     return(value);
 }
        public override void Save()
        {
            StreamWriter sw = null;

            try
            {
                string           solutionFolder = Path.GetDirectoryName(Filename.Filename);
                StringCollection scSol          = new StringCollection();
                string           sol            = solutionFolder;
                scSol.Add(sol);
                while (sol.Length > 4)
                {
                    sol = Path.GetDirectoryName(sol);
                    scSol.Add(sol);
                }
                sw = new StreamWriter(Filename.Filename, false, Encoding.Unicode);
                sw.Write(Resource1.SolutionHeader);
                sw.WriteLine();
                for (int i = 0; i < _nodes.Nodes.Count; i++)
                {
                    ProjectNode pn = _nodes.Nodes[i] as ProjectNode;
                    if (pn != null)
                    {
                        ProjectNodeData pnd = pn.PropertyObject as ProjectNodeData;
                        sw.Write(PRJ_BEGIN);
                        sw.Write("\"");
                        if (_guid == Guid.Empty)
                        {
                            _guid = Guid.NewGuid();
                        }
                        sw.Write(_guid.ToString("B", CultureInfo.InvariantCulture).ToUpper(CultureInfo.InvariantCulture));
                        sw.Write("\") = \"");
                        sw.Write(pnd.Project.ProjectName);
                        sw.Write("\", \"");
                        //write project file
                        string prjFolder = Path.GetDirectoryName(pnd.Project.ProjectFile);
                        if (string.Compare(prjFolder, solutionFolder, StringComparison.OrdinalIgnoreCase) == 0)
                        {
                            sw.Write(Path.GetFileName(pnd.Project.ProjectFile));
                        }
                        else if (prjFolder[0] != solutionFolder[0])
                        {
                            sw.Write(pnd.Project.ProjectFile);
                        }
                        else
                        {
                            bool             bFound = false;
                            string           sp     = prjFolder;
                            StringCollection scP    = new StringCollection();
                            scP.Add(sp);
                            while (sp.Length > 4)
                            {
                                sp = Path.GetDirectoryName(sp);
                                scP.Add(sp);
                                if (string.Compare(sp, solutionFolder, StringComparison.OrdinalIgnoreCase) == 0)
                                {
                                    bFound = true;
                                    break;
                                }
                            }
                            if (bFound)
                            {
                                string sp0 = prjFolder.Substring(sp.Length);
                                if (sp0.StartsWith("\\", StringComparison.OrdinalIgnoreCase))
                                {
                                    sp0 = sp0.Substring(1);
                                }
                                else if (sp0.StartsWith("/", StringComparison.OrdinalIgnoreCase))
                                {
                                    sp0 = sp0.Substring(1);
                                }
                                sw.Write(Path.Combine(sp0, Path.GetFileName(pnd.Project.ProjectFile)));
                            }
                            else
                            {
                                //project not under solution folder
                                //solution:  d1\d2\d3\d4
                                //           d1\d2\d3
                                //           d1\d2
                                //project:   d1\d2\s1\s2
                                //           d1\d2\s1
                                //           d1\d2
                                bFound = false;
                                string sd = "..";
                                string sk = "";
                                for (int k = 1; k < scSol.Count; k++)
                                {
                                    for (int m = 0; m < scP.Count; m++)
                                    {
                                        if (string.Compare(scSol[k], scP[m], StringComparison.OrdinalIgnoreCase) == 0)
                                        {
                                            for (int h = 1; h < k; h++)
                                            {
                                                sd += "\\..";
                                            }
                                            sk     = scSol[k];
                                            bFound = true;
                                            break;
                                        }
                                    }
                                    if (bFound)
                                    {
                                        break;
                                    }
                                }
                                if (bFound)
                                {
                                    string p0 = prjFolder.Substring(sk.Length);
                                    if (!p0.StartsWith("\\", StringComparison.OrdinalIgnoreCase) && !p0.StartsWith("/", StringComparison.OrdinalIgnoreCase))
                                    {
                                        p0 = string.Format(CultureInfo.InvariantCulture, "{0}\\{1}\\", sd, p0);
                                    }
                                    else
                                    {
                                        p0 = string.Format(CultureInfo.InvariantCulture, "{0}{1}\\", sd, p0);
                                    }
                                    sw.Write(p0);
                                    sw.Write(Path.GetFileName(pnd.Project.ProjectFile));
                                }
                                else
                                {
                                    sw.Write(Path.GetFileName(pnd.Project.ProjectFile));
                                }
                            }
                        }
                        sw.Write("\", \"");
                        sw.Write(pnd.Project.ProjectGuid.ToString("B", CultureInfo.InvariantCulture).ToUpper(CultureInfo.InvariantCulture));
                        sw.WriteLine("\"");
                        //write dependences
                        IList <Guid> gs = pn.DependedProjects;
                        if (gs != null && gs.Count > 0)
                        {
                            sw.Write("\t");
                            sw.Write(PRJ_DEPEND);
                            sw.WriteLine(" = postProject");
                            foreach (Guid g in gs)
                            {
                                sw.Write("\t\t");
                                sw.Write(g.ToString("B", CultureInfo.InvariantCulture).ToUpper(CultureInfo.InvariantCulture));
                                sw.Write(" = ");
                                sw.WriteLine(g.ToString("B", CultureInfo.InvariantCulture).ToUpper(CultureInfo.InvariantCulture));
                            }
                            sw.Write("\t");
                            sw.WriteLine(PRJ_ENDSECT);
                        }
                        //
                        sw.WriteLine(PRJ_END);
                    }
                }
            }
            catch (Exception err)
            {
                MathNode.Log(TraceLogClass.MainForm, err);
            }
            if (sw != null)
            {
                sw.Close();
            }
            if (OnSaved != null)
            {
                OnSaved(this, EventArgs.Empty);
            }
            Dirty = false;
        }
 protected virtual NodeObjectComponent CreateDataObject(ProjectNodeData prj, ClassData classData, TreeNodeCollection nodes)
 {
     return(new NodeObjectComponent(prj, classData, nodes));
 }