Esempio n. 1
0
        private void Apply()
        {
            this.UnityManager.Filter.Name = this.TextBox_UnityFilter.Text;
            this.UnityManager.Filter.Path = this.TextBox_UnityFolder.Text;
            this.UnityManager.Filter.SaveSettings();

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

            foreach (DataRow row in this.Cpps.Rows)
            {
                string unityname = row[2] as string;

                if (!String.IsNullOrEmpty(unityname))
                {
                    unityname.Trim();

                    Unity unity = null;
                    if (!this.UnityManager.Unities.TryGetValue(unityname, out unity))
                    {
                        unity = new Unity(unityname);
                        this.UnityManager.Unities.Add(unityname, unity);
                    }

                    Cpp cpp = new Cpp(row[0] as string);

                    cpp.Condition = row[3] as string;
                    if (cpp.Condition != null) cpp.Condition.Trim();

                    unity.Cpps.Add(cpp.Name, cpp);
                }
            }

            this.UnityManager.SaveUnities();
        }
Esempio n. 2
0
        public void LoadCpps()
        {
            this.Cpps = new Dictionary <string, Cpp>();

            string config = Connect.GetActiveConfigString(this.Project);

            VCFilter unityfilter = this.Filter.GetVCFilter();

            foreach (VCFile file in this.VCProject.Files as IVCCollection)
            {
                if (file.Extension.ToLower() == ".cpp" && file.Parent != unityfilter)
                {
                    VCFileConfiguration cfg    = Connect.GetFileConfiguration(file, config);
                    VCCLCompilerTool    vctool = cfg.Tool as VCCLCompilerTool;
                    if (vctool != null)
                    {
                        if (vctool.UsePrecompiledHeader == Microsoft.VisualStudio.VCProjectEngine.pchOption.pchCreateUsingSpecific)
                        {
                            continue;
                        }
                    }

                    Cpp cpp = this.GetCppInUnity(file.RelativePath);
                    if (cpp == null)
                    {
                        cpp = new Cpp(file);
                    }
                    this.Cpps.Add(cpp.Name, cpp);
                }
            }
        }
Esempio n. 3
0
        public Cpp GetCppInUnity(string name)
        {
            Cpp cpp = null;

            foreach (Unity unity in this.Unities.Values)
            {
                if (unity.Cpps.TryGetValue(name, out cpp))
                {
                    break;
                }
            }
            return(cpp);
        }
Esempio n. 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);
            }
        }
Esempio n. 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();
        }
Esempio n. 6
0
        public void Load(VCFile file)
        {
            this.FileName = file.FullPath;
            this.Cpps = new Dictionary<string, Cpp>();

            string[] lines = File.ReadAllLines(file.FullPath);

            for (int i = 0; i < lines.Length; i++)
            {
                Match match = Utils.IncludeRegex.Match(lines[i]);
                if (match.Success && match.Groups["Include"].Captures.Count > 0)
                {
                    string include = match.Groups["Include"].Captures[0].Value;
                    if (include.EndsWith(".cpp", true, null))
                    {
                        Cpp cpp;

                        VCFile f = Connect.GetVCFile(file.project as VCProject, include);
                        if (f != null)
                        {
                            cpp = new Cpp(f);
                        }
                        else
                        {
                            cpp = new Cpp(include);
                        }

                        if (i > 0 && lines[i - 1].StartsWith("#if"))
                        {
                            cpp.Condition = lines[i - 1].Substring(4);
                        }

                        cpp.Unity = this;
                        this.Cpps.Add(cpp.Name, cpp);
                    }
                }
            }
        }
Esempio n. 7
0
        public void Load(VCFile file)
        {
            this.FileName = file.FullPath;
            this.Cpps     = new Dictionary <string, Cpp>();

            string[] lines = File.ReadAllLines(file.FullPath);

            for (int i = 0; i < lines.Length; i++)
            {
                Match match = Utils.IncludeRegex.Match(lines[i]);
                if (match.Success && match.Groups["Include"].Captures.Count > 0)
                {
                    string include = match.Groups["Include"].Captures[0].Value;
                    if (include.EndsWith(".cpp", true, null))
                    {
                        Cpp cpp;

                        VCFile f = Connect.GetVCFile(file.project as VCProject, include);
                        if (f != null)
                        {
                            cpp = new Cpp(f);
                        }
                        else
                        {
                            cpp = new Cpp(include);
                        }

                        if (i > 0 && lines[i - 1].StartsWith("#if"))
                        {
                            cpp.Condition = lines[i - 1].Substring(4);
                        }

                        cpp.Unity = this;
                        this.Cpps.Add(cpp.Name, cpp);
                    }
                }
            }
        }
Esempio n. 8
0
        private void Apply()
        {
            this.UnityManager.Filter.Name = this.TextBox_UnityFilter.Text;
            this.UnityManager.Filter.Path = this.TextBox_UnityFolder.Text;
            this.UnityManager.Filter.SaveSettings();

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

            foreach (DataRow row in this.Cpps.Rows)
            {
                string unityname = row[2] as string;

                if (!String.IsNullOrEmpty(unityname))
                {
                    unityname.Trim();

                    Unity unity = null;
                    if (!this.UnityManager.Unities.TryGetValue(unityname, out unity))
                    {
                        unity = new Unity(unityname);
                        this.UnityManager.Unities.Add(unityname, unity);
                    }

                    Cpp cpp = new Cpp(row[0] as string);

                    cpp.Condition = row[3] as string;
                    if (cpp.Condition != null)
                    {
                        cpp.Condition.Trim();
                    }

                    unity.Cpps.Add(cpp.Name, cpp);
                }
            }

            this.UnityManager.SaveUnities();
        }
Esempio n. 9
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();
        }
Esempio n. 10
0
        public void LoadCpps()
        {
            this.Cpps = new Dictionary<string, Cpp>();

            string config = Connect.GetActiveConfigString(this.Project);

            VCFilter unityfilter = this.Filter.GetVCFilter();

            foreach (VCFile file in this.VCProject.Files as IVCCollection)
            {
                if (file.Extension.ToLower() == ".cpp" && file.Parent != unityfilter)
                {
                    VCFileConfiguration cfg = Connect.GetFileConfiguration(file, config);
                    VCCLCompilerTool vctool = cfg.Tool as VCCLCompilerTool;
                    if (vctool != null)
                    {
                        if (vctool.UsePrecompiledHeader == Microsoft.VisualStudio.VCProjectEngine.pchOption.pchCreateUsingSpecific)
                        {
                            continue;
                        }
                    }

                    Cpp cpp = this.GetCppInUnity(file.RelativePath);
                    if (cpp == null)
                    {
                        cpp = new Cpp(file);
                    }
                    this.Cpps.Add(cpp.Name, cpp);
                }
            }
        }