Create() public static method

public static Create ( Properties properties, string hintPath ) : AddInReference
properties Properties
hintPath string
return AddInReference
Ejemplo n.º 1
0
        public void ReadManifestSection(XmlReader reader, string hintPath)
        {
            if (reader.AttributeCount != 0)
            {
                throw new AddInLoadException("Manifest node cannot have attributes.");
            }
            if (reader.IsEmptyElement)
            {
                throw new AddInLoadException("Manifest node cannot be empty.");
            }
            while (reader.Read())
            {
                switch (reader.NodeType)
                {
                case XmlNodeType.EndElement:
                    if (reader.LocalName == "Manifest")
                    {
                        return;
                    }
                    break;

                case XmlNodeType.Element:
                    string     nodeName   = reader.LocalName;
                    Properties properties = Properties.ReadFromAttributes(reader);
                    switch (nodeName)
                    {
                    case "Identity":
                        AddIdentity(properties["name"], properties["version"], hintPath);
                        break;

                    case "Dependency":
                        dependencies.Add(AddInReference.Create(properties, hintPath));
                        break;

                    case "Conflict":
                        conflicts.Add(AddInReference.Create(properties, hintPath));
                        break;

                    default:
                        throw new AddInLoadException("Unknown node in Manifest section:" + nodeName);
                    }
                    break;
                }
            }
        }
Ejemplo n.º 2
0
 public void ReadManifestSection(XmlReader reader, string hintPath)
 {
     if (reader.AttributeCount != 0)
     {
         throw new System.ArgumentException("Manifest node cannot have attributes.");
     }
     if (reader.IsEmptyElement)
     {
         throw new System.ArgumentException("Manifest node cannot be empty.");
     }
     while (reader.Read())
     {
         XmlNodeType nodeType = reader.NodeType;
         if (nodeType == XmlNodeType.Element)
         {
             string     localName  = reader.LocalName;
             Properties properties = Properties.ReadFromAttributes(reader);
             string     a;
             if ((a = localName) != null)
             {
                 if (a == "Identity")
                 {
                     this.AddIdentity(properties["name"], properties["version"], hintPath);
                     continue;
                 }
                 if (a == "Dependency")
                 {
                     this.dependencies.Add(AddInReference.Create(properties, hintPath));
                     continue;
                 }
                 if (a == "Conflict")
                 {
                     this.conflicts.Add(AddInReference.Create(properties, hintPath));
                     continue;
                 }
             }
             throw new System.ArgumentException("Unknown node in Manifest section:" + localName);
         }
         if (nodeType == XmlNodeType.EndElement && reader.LocalName == "Manifest")
         {
             return;
         }
     }
 }