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); }
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 (MainModule.Dependencies.Count > 0) { errors.Add("Root add-in hosts can't have dependencies."); } } 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(BasePath, file); if (!File.Exists(asmFile)) { errors.Add("The file '" + file + "' referenced in the manifest could not be found."); } } } return(errors); }