Ejemplo n.º 1
0
 public ApplicationDesc(Guid id, DocumentSupport type, string name, string friendlyName)
 {
     this.id           = id;
     this.type         = type;
     this.name         = name;
     this.friendlyName = friendlyName;
 }
Ejemplo n.º 2
0
 public ApplicationDesc(Guid id, DocumentSupport type, string name, string friendlyName, IPublishedInfo info)
 {
     this.id            = id;
     this.type          = type;
     this.name          = name;
     this.friendlyName  = friendlyName;
     this.publisherName = info.PublisherName;
     this.authors       = info.Authors.Clone() as string[];
 }
Ejemplo n.º 3
0
        private void CacheDeserialization()
        {
            Child.InstallEnvironment = environment;
            SerializableXmlDocument doc = Child.OpenForReading <SerializableXmlDocument>().Object;

            doc.Normalize();

            XmlElement node = doc.FirstChild.NextSibling as XmlElement;

            // assert root node
            if (node.Name != "Application")
            {
                throw new AbortInstallationException("Source is not an application descriptor");
            }

            // check version
            if (new Version(node.GetAttribute("xversion")) > new Version(1, 0, 0))
            {
                throw new AbortInstallationException("Application descriptor is of an incorrect version");
            }

            string          name = node.GetAttribute("name");
            Guid            id   = new Guid(node.GetAttribute("id"));
            string          rootComponentName = node.GetAttribute("root");
            DocumentSupport apptype           = (DocumentSupport)Enum.Parse(typeof(DocumentSupport), node.GetAttribute("type"));
            string          friendlyName      = node.GetAttribute("friendly");

            List <ConfiguredComponent> defs = new List <ConfiguredComponent>();

            /** ok, construct **/
            ApplicationDesc app = new ApplicationDesc(id, apptype, name, friendlyName);

            foreach (XmlNode firstNode in node.ChildNodes)
            {
                if (firstNode.Name == "Components")
                {
                    /* load all components */
                    foreach (XmlNode componentNode in firstNode.ChildNodes)
                    {
                        if (componentNode.Name.StartsWith("#"))
                        {
                            continue;
                        }

                        if (componentNode.Name != "Component")
                        {
                            throw new AbortInstallationException("Application description is not well-formed. Only Component nodes are allowed in the Components section");
                        }

                        defs.Add(new ConfiguredComponent(componentNode));
                    }
                }
                if (firstNode.Name == "Bindings")
                {
                    foreach (XmlNode bindingNode in firstNode.ChildNodes)
                    {
                        if (bindingNode.Name != "Binding")
                        {
                            continue;
                        }

                        app.DefaultBindings[((XmlElement)bindingNode).GetAttribute("Type")] =
                            Array.ConvertAll <string, string>(
                                ((XmlElement)bindingNode).GetAttribute("Verbs").Split(','),
                                delegate(string s) { return(s.Trim()); });
                    }
                }
            }

            app.Components           = defs.ToArray();
            app.ApplicationComponent = rootComponentName;

            applicationDescriptor = app;
        }