示例#1
0
        public ModelFolderCollection Clone()
        {
            ModelFolderCollection clonedModelFolder = new ModelFolderCollection(itemCount);

            foreach (ModelFolder item in this)
            {
                clonedModelFolder.Add(item);
            }
            return(clonedModelFolder);
        }
示例#2
0
        public ModelFolderCollection Copy()
        {
            ModelFolderCollection copiedFolders = new ModelFolderCollection(itemCount);

            foreach (ModelFolder folder in this)
            {
                copiedFolders.Add(folder.Copy());
            }
            return(copiedFolders);
        }
示例#3
0
        private void parse1_11File(XmlTextReader r)
        {
            string      fileVersion;
            ModelFolder defaultFolder = null;

            fileVersion = "1.11";

            name             = r.ReadElementString("Name");
            defaultNamespace = r.ReadElementString("DefaultNamespace");
            if (r.LocalName == "Description")
            {
                description = r.ReadElementString("Description");
            }
            if (r.LocalName == "ConnectionString")
            {
                connectionString = r.ReadElementString("ConnectionString");
            }
            if (r.LocalName == "ConnectionStringIsCoded")
            {
                connectionStringIsCoded = bool.Parse(r.ReadElementString("ConnectionStringIsCoded"));
            }
            if (r.LocalName == "ConnectionStringIsConfigKey")
            {
                connectionStringIsConfigKey = bool.Parse(r.ReadElementString("ConnectionStringIsConfigKey"));
            }
            if (r.LocalName == "VersionMajor")
            {
                version.Major = int.Parse(r.ReadElementString("VersionMajor"));
            }
            if (r.LocalName == "VersionMinor")
            {
                version.Minor = int.Parse(r.ReadElementString("VersionMinor"));
            }
            if (r.LocalName == "VersionBuild")
            {
                version.Build = int.Parse(r.ReadElementString("VersionBuild"));
            }

            if (r.Name == "References" && !r.IsEmptyElement)
            {
                r.Read();

                while (r.LocalName == "ReferenceEntry")
                {
                    references.Add(new ReferenceEntry(r));
                }

                r.ReadEndElement();
            }
            else
            {
                r.Read();
            }

            //
            // Skip Field Data Types on 1.1 models
            //
            while (r.Name != "ChildDataTypes")
            {
                r.Read();
            }

            if (r.Name == "ChildDataTypes" && !r.IsEmptyElement)
            {
                r.Read();
                while (r.LocalName == "ChildDataType")
                {
                    DataTypeManager.AddDataType(new ReferenceType(r));
                }
                r.ReadEndElement();
            }
            else
            {
                r.Read();
            }

            if ((r.Name == "ModelFolders" | r.Name == "ClassObjects") && !r.IsEmptyElement)
            {
                r.Read();
                while (r.LocalName == "ClassObject" | r.LocalName == "ModelFolder")
                {
                    if (r.LocalName == "ClassObject")
                    {
                        // Create a default folder for the class object if it
                        // is not already created.
                        if (defaultFolder == null)
                        {
                            defaultFolder             = new ModelFolder();
                            defaultFolder.Caption     = "General";
                            defaultFolder.Description = "General";
                            defaultFolder.Name        = "General";
                            defaultFolder.ParentModel = this;
                            defaultFolder.IsBrowsable = true;
                            defaultFolder.IsExpanded  = true;
                            this.Folders.Add(defaultFolder);
                        }

                        // Load ClassEntry
                        ModelClass c = new ModelClass(r, fileVersion);
                        c.ParentModel = this;

                        // Add Class Entry to Default Folder
                        defaultFolder.Items.Add(c);
                    }

                    // Add Model Folder
                    if (r.LocalName == "ModelFolder")
                    {
                        ModelFolder f = new ModelFolder(r, this, fileVersion);
                        folders.Add(f);
                    }
                }
                r.ReadEndElement();
            }
            else
            {
                r.Read();
            }
        }