Beispiel #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();
        }
Beispiel #2
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();
        }
Beispiel #3
0
        public void LoadUnities()
        {
            this.Unities = new Dictionary<string, Unity>();

            VCFilter unityfilter = this.Filter.GetVCFilter();
            if (unityfilter != null)
            {
                foreach (VCFile file in unityfilter.Files as IVCCollection)
                {
                    if (file.Extension.ToLower() == ".cpp")
                    {
                        Unity unity = new Unity(Path.GetFileNameWithoutExtension(file.Name));
                        unity.Load(file);
                        this.Unities.Add(unity.Name, unity);
                    }
                }
            }
        }