示例#1
0
        private void Project_EnableUnity(VCProject project, bool excluded)
        {
            if (project == null)
            {
                return;
            }

            string config = Connect.GetActiveConfigString(project.Object as Project);

            UnityManager um = new UnityManager(project);

            um.LoadUnities();

            VCFilter unityfilter = um.Filter.GetVCFilter();

            if (unityfilter == null || um.Unities.Count == 0)
            {
                return;
            }

            foreach (VCFile file in project.Files as IVCCollection)
            {
                if (file.Extension.ToLower() == ".cpp")
                {
                    if (file.Parent == unityfilter)
                    {
                        Connect.SetExcludedFromBuild(file, config, !excluded);
                    }
                    else
                    {
                        Connect.SetExcludedFromBuild(file, config, excluded && (um.GetCppInUnity(file.RelativePath) != null));
                    }
                }
            }
        }
示例#2
0
        public UnityForm(VCProject project)
        {
            this.UnityManager = new UnityManager(project);

            this.Cpps = new DataTable();
            this.Cpps.Columns.Add("Cpp");
            this.Cpps.Columns.Add("VirtualPath");
            this.Cpps.Columns.Add("Unity");
            this.Cpps.Columns.Add("Condition");
            this.Cpps.Columns.Add("Size", typeof(long));

            this.InitializeComponent();
        }
示例#3
0
        public UnityForm(VCProject project)
        {
            this.UnityManager = new UnityManager(project);

            this.Cpps = new DataTable();
            this.Cpps.Columns.Add("Cpp");
            this.Cpps.Columns.Add("VirtualPath");
            this.Cpps.Columns.Add("Unity");
            this.Cpps.Columns.Add("Condition");
            this.Cpps.Columns.Add("Size", typeof(long));

            this.InitializeComponent();
        }
示例#4
0
        private void Item_RemoveFromUnity()
        {
            if (this.SelectedCppFile == null)
            {
                return;
            }

            UnityManager um = new UnityManager(this.ActiveVCProject);

            um.LoadUnities();

            Cpp cpp = um.GetCppInUnity(this.SelectedCppFile.RelativePath);

            if (cpp != null)
            {
                cpp.Unity.Cpps.Remove(cpp.Name);
                cpp.Unity.Save(this.ActiveVCProject.ProjectDirectory, um.Filter.Path, Connect.GetPCH(um.VCProject, um.VCConfig));

                Connect.SetExcludedFromBuild(this.SelectedCppFile, Connect.GetActiveConfigString(Connect.GetProject(this.SelectedCppFile)), false);
            }
        }
示例#5
0
        private void Project_ImportUnity(VCProject project, XmlNode xProject)
        {
            if (project == null)
            {
                return;
            }

            UnityManager um = new UnityManager(project);

            um.Filter.Name = xProject.Attributes["UnityFilterName"].Value;
            um.Filter.Path = xProject.Attributes["UnityFilterPath"].Value;
            um.Filter.SaveSettings();

            um.Unities = new Dictionary <string, Unity>();

            foreach (XmlNode xUnity in xProject.ChildNodes)
            {
                if (xUnity.Name != "Unity")
                {
                    throw new Exception("Invalid xml file format!");
                }

                Unity unity = new Unity(xUnity.Attributes["Name"].Value);
                um.Unities.Add(unity.Name, unity);

                foreach (XmlNode xCpp in xUnity.ChildNodes)
                {
                    if (xCpp.Name != "Cpp")
                    {
                        throw new Exception("Invalid xml file format!");
                    }

                    Cpp cpp = new Cpp(xCpp.Attributes["Name"].Value);
                    cpp.Condition = xCpp.Attributes["Condition"].Value;
                    unity.Cpps.Add(cpp.Name, cpp);
                }
            }

            um.SaveUnities();
        }
示例#6
0
        private void Project_ExportUnity(VCProject project, XmlElement xParent)
        {
            if (project == null)
            {
                return;
            }

            UnityManager um = new UnityManager(project);

            um.LoadUnities();

            VCFilter unityfilter = um.Filter.GetVCFilter();

            if (unityfilter == null || um.Unities.Count == 0)
            {
                return;
            }

            XmlElement xProject = Utils.AddXmlElement(xParent, "Project");

            Utils.AddXmlAttribute(xProject, "Name", project.Name);
            Utils.AddXmlAttribute(xProject, "Path", project.ProjectFile);
            Utils.AddXmlAttribute(xProject, "UnityFilterName", um.Filter.Name);
            Utils.AddXmlAttribute(xProject, "UnityFilterPath", um.Filter.Path);

            foreach (Unity unity in um.Unities.Values)
            {
                XmlElement xUnity = Utils.AddXmlElement(xProject, "Unity");
                Utils.AddXmlAttribute(xUnity, "Name", unity.Name);

                foreach (Cpp cpp in unity.Cpps.Values)
                {
                    XmlElement xCpp = Utils.AddXmlElement(xUnity, "Cpp");
                    Utils.AddXmlAttribute(xCpp, "Name", cpp.Name);
                    Utils.AddXmlAttribute(xCpp, "Condition", cpp.Condition);
                }
            }
        }
示例#7
0
        private void Project_ImportUnity(VCProject project, XmlNode xProject)
        {
            if (project == null) return;

            UnityManager um = new UnityManager(project);

            um.Filter.Name = xProject.Attributes["UnityFilterName"].Value;
            um.Filter.Path = xProject.Attributes["UnityFilterPath"].Value;
            um.Filter.SaveSettings();

            um.Unities = new Dictionary<string, Unity>();

            foreach (XmlNode xUnity in xProject.ChildNodes)
            {
                if (xUnity.Name != "Unity")
                {
                    throw new Exception("Invalid xml file format!");
                }

                Unity unity = new Unity(xUnity.Attributes["Name"].Value);
                um.Unities.Add(unity.Name, unity);

                foreach (XmlNode xCpp in xUnity.ChildNodes)
                {
                    if (xCpp.Name != "Cpp")
                    {
                        throw new Exception("Invalid xml file format!");
                    }

                    Cpp cpp = new Cpp(xCpp.Attributes["Name"].Value);
                    cpp.Condition = xCpp.Attributes["Condition"].Value;
                    unity.Cpps.Add(cpp.Name, cpp);
                }
            }

            um.SaveUnities();
        }
示例#8
0
        private void Project_ExportUnity(VCProject project, XmlElement xParent)
        {
            if (project == null) return;

            UnityManager um = new UnityManager(project);
            um.LoadUnities();

            VCFilter unityfilter = um.Filter.GetVCFilter();
            if (unityfilter == null || um.Unities.Count == 0) return;

            XmlElement xProject = Utils.AddXmlElement(xParent, "Project");
            Utils.AddXmlAttribute(xProject, "Name", project.Name);
            Utils.AddXmlAttribute(xProject, "Path", project.ProjectFile);
            Utils.AddXmlAttribute(xProject, "UnityFilterName", um.Filter.Name);
            Utils.AddXmlAttribute(xProject, "UnityFilterPath", um.Filter.Path);

            foreach (Unity unity in um.Unities.Values)
            {
                XmlElement xUnity = Utils.AddXmlElement(xProject, "Unity");
                Utils.AddXmlAttribute(xUnity, "Name", unity.Name);

                foreach (Cpp cpp in unity.Cpps.Values)
                {
                    XmlElement xCpp = Utils.AddXmlElement(xUnity, "Cpp");
                    Utils.AddXmlAttribute(xCpp, "Name", cpp.Name);
                    Utils.AddXmlAttribute(xCpp, "Condition", cpp.Condition);
                }
            }
        }
示例#9
0
        private void Project_EnableUnity(VCProject project, bool excluded)
        {
            if (project == null) return;

            string config = Connect.GetActiveConfigString(project.Object as Project);

            UnityManager um = new UnityManager(project);
            um.LoadUnities();

            VCFilter unityfilter = um.Filter.GetVCFilter();
            if (unityfilter == null || um.Unities.Count == 0) return;

            foreach (VCFile file in project.Files as IVCCollection)
            {
                if (file.Extension.ToLower() == ".cpp")
                {
                    if (file.Parent == unityfilter)
                    {
                        Connect.SetExcludedFromBuild(file, config, !excluded);
                    }
                    else
                    {
                        Connect.SetExcludedFromBuild(file, config, excluded && (um.GetCppInUnity(file.RelativePath) != null));
                    }
                }
            }
        }
示例#10
0
        private void Item_RemoveFromUnity()
        {
            if (this.SelectedCppFile == null) return;

            UnityManager um = new UnityManager(this.ActiveVCProject);
            um.LoadUnities();

            Cpp cpp = um.GetCppInUnity(this.SelectedCppFile.RelativePath);
            if (cpp != null)
            {
                cpp.Unity.Cpps.Remove(cpp.Name);
                cpp.Unity.Save(this.ActiveVCProject.ProjectDirectory, um.Filter.Path, Connect.GetPCH(um.VCProject, um.VCConfig));

                Connect.SetExcludedFromBuild(this.SelectedCppFile, Connect.GetActiveConfigString(Connect.GetProject(this.SelectedCppFile)), false);
            }
        }