コード例 #1
0
        void VerifyNode(string location, ExtensionNodeDescription node, StringCollection errors)
        {
            string id = node.GetAttribute("id");

            if (id.Length > 0)
            {
                id = "(" + id + ")";
            }
            if (node.NodeName == "Condition" && node.GetAttribute("id").Length == 0)
            {
                errors.Add(location + node.NodeName + id + ": Missing 'id' attribute in Condition element.");
            }
            if (node.NodeName == "ComplexCondition")
            {
                if (node.ChildNodes.Count > 0)
                {
                    VerifyConditionNode(location, node.ChildNodes[0], errors);
                    for (int n = 1; n < node.ChildNodes.Count; n++)
                    {
                        VerifyNode(location + node.NodeName + id + "/", node.ChildNodes[n], errors);
                    }
                }
                else
                {
                    errors.Add(location + "ComplexCondition: Missing child condition in ComplexCondition element.");
                }
            }
            foreach (ExtensionNodeDescription cnode in node.ChildNodes)
            {
                VerifyNode(location + node.NodeName + id + "/", cnode, errors);
            }
        }
コード例 #2
0
        internal StringCollection Verify(AddinFileSystemExtension fs)
        {
            StringCollection errors = new StringCollection();

            if (IsRoot)
            {
                if (OptionalModules.Count > 0)
                {
                    errors.Add("Root add-in hosts can't have optional modules.");
                }
            }

            if (AddinId.Length == 0 || Version.Length == 0)
            {
                if (ExtensionPoints.Count > 0)
                {
                    errors.Add("Add-ins which define new extension points must have an Id and Version.");
                }
            }

            MainModule.Verify("", errors);
            OptionalModules.Verify("", errors);
            ExtensionNodeSets.Verify("", errors);
            ExtensionPoints.Verify("", errors);
            ConditionTypes.Verify("", errors);

            foreach (ExtensionNodeSet nset in ExtensionNodeSets)
            {
                if (nset.Id.Length == 0)
                {
                    errors.Add("Attribute 'id' can't be empty for global node sets.");
                }
            }

            string bp = null;

            if (BasePath.Length > 0)
            {
                bp = BasePath;
            }
            else if (sourceAddinFile != null && sourceAddinFile.Length > 0)
            {
                bp = Path.GetDirectoryName(AddinFile);
            }
            else if (configFile != null && configFile.Length > 0)
            {
                bp = Path.GetDirectoryName(configFile);
            }

            if (bp != null)
            {
                foreach (string file in AllFiles)
                {
                    string asmFile = Path.Combine(bp, file);
                    if (!fs.FileExists(asmFile))
                    {
                        errors.Add("The file '" + asmFile + "' referenced in the manifest could not be found.");
                    }
                }
            }

            if (localizer != null && localizer.GetAttribute("type").Length == 0)
            {
                errors.Add("The attribute 'type' in the Location element is required.");
            }

            // Ensure that there are no duplicated properties

            if (properties != null)
            {
                HashSet <string> props = new HashSet <string> ();
                foreach (var prop in properties)
                {
                    if (!props.Add(prop.Name + " " + prop.Locale))
                    {
                        errors.Add(string.Format("Property {0} specified more than once", prop.Name + (prop.Locale != null ? " (" + prop.Locale + ")" : "")));
                    }
                }
            }

            return(errors);
        }
コード例 #3
0
		void VerifyNode (string location, ExtensionNodeDescription node, StringCollection errors)
		{
			string id = node.GetAttribute ("id");
			if (id.Length > 0)
				id = "(" + id + ")";
			if (node.NodeName == "Condition" && node.GetAttribute ("id").Length == 0) {
				errors.Add (location + node.NodeName + id + ": Missing 'id' attribute in Condition element.");
			}
			if (node.NodeName == "ComplexCondition") {
				if (node.ChildNodes.Count > 0) {
					VerifyConditionNode (location, node.ChildNodes[0], errors);
					for (int n=1; n<node.ChildNodes.Count; n++)
						VerifyNode (location + node.NodeName + id + "/", node.ChildNodes[n], errors);
				}
				else
					errors.Add (location + "ComplexCondition: Missing child condition in ComplexCondition element.");
			}
			foreach (ExtensionNodeDescription cnode in node.ChildNodes)
				VerifyNode (location + node.NodeName + id + "/", cnode, errors);
		}
コード例 #4
0
        public StringCollection Verify()
        {
            StringCollection errors = new StringCollection();

            if (IsRoot)
            {
                if (OptionalModules.Count > 0)
                {
                    errors.Add("Root add-in hosts can't have optional modules.");
                }
            }

            if (AddinId.Length == 0 || Version.Length == 0)
            {
                if (ExtensionPoints.Count > 0)
                {
                    errors.Add("Add-ins which define new extension points must have an Id and Version.");
                }
            }

            MainModule.Verify("", errors);
            OptionalModules.Verify("", errors);
            ExtensionNodeSets.Verify("", errors);
            ExtensionPoints.Verify("", errors);
            ConditionTypes.Verify("", errors);

            foreach (ExtensionNodeSet nset in ExtensionNodeSets)
            {
                if (nset.Id.Length == 0)
                {
                    errors.Add("Attribute 'id' can't be empty for global node sets.");
                }
            }

            string bp = null;

            if (BasePath.Length > 0)
            {
                bp = BasePath;
            }
            else if (sourceAddinFile != null && sourceAddinFile.Length > 0)
            {
                bp = Path.GetDirectoryName(AddinFile);
            }
            else if (configFile != null && configFile.Length > 0)
            {
                bp = Path.GetDirectoryName(configFile);
            }

            if (bp != null)
            {
                foreach (string file in AllFiles)
                {
                    string asmFile = Path.Combine(bp, file);
                    if (!File.Exists(asmFile))
                    {
                        errors.Add("The file '" + asmFile + "' referenced in the manifest could not be found.");
                    }
                }
            }

            if (localizer != null && localizer.GetAttribute("type").Length == 0)
            {
                errors.Add("The attribute 'type' in the Location element is required.");
            }

            return(errors);
        }
コード例 #5
0
		void AddAttribute (HBox fieldsBox, ExtensionNodeDescription node, string name, string type, bool req)
		{
			HBox box = new HBox ();
			Gtk.Label lab = new Gtk.Label ();
			lab.Markup = "<b>" + name + "</b>=\"";
			box.PackStart (lab, false, false, 0);
			Gtk.Entry entry = new AutoSizeEntry ();
			entry.Text = node.GetAttribute (name);
			box.PackStart (entry, false, false, 0);
			box.PackStart (new Gtk.Label ("\" "), false, false, 0);
			fieldsBox.PackStart (box, false, false, 0);
		}
コード例 #6
0
		internal Condition (AddinEngine addinEngine, ExtensionNodeDescription element, BaseCondition parent): base (parent)
		{
			this.addinEngine = addinEngine;
			typeId = element.GetAttribute ("id");
			addin = element.GetAttribute (SourceAddinAttribute);
			node = element;
		}
コード例 #7
0
		internal Condition (ExtensionNodeDescription element, BaseCondition parent): base (parent)
		{
			typeId = element.GetAttribute ("id");
			node = element;
		}