public static IEnumerable <string> GetExtensions() { if (extensions == null) { extensions = new List <string> (); foreach (ExtensionNode node in AddinManager.GetExtensionNodes("/MonoDevelop/XmlEditor/XmlFileExtensions")) { XmlFileExtensionNode xmlFileExtensionNode = node as XmlFileExtensionNode; if (xmlFileExtensionNode != null) { extensions.Add(xmlFileExtensionNode.FileExtension.ToLowerInvariant()); } } } //get user-registered extensions stored in the properties service but don't duplicate built-in ones //note: XmlEditorAddInOptions returns LowerInvariant strings foreach (string prop in XmlEditorOptions.GetRegisteredFileExtensions()) { if (!extensions.Contains(prop)) { yield return(prop); } } foreach (string s in extensions) { yield return(s); } }
/// <summary> /// Gets the namespace prefix that is associated with the /// specified file extension. /// </summary> public static string GetNamespacePrefix(string extension) { var association = XmlEditorOptions.GetSchemaAssociation(extension); if (association != null) { return(association.NamespacePrefix); } return(String.Empty); }
public static bool IsXmlFileExtension(string extension) { if (string.IsNullOrEmpty(extension)) { return(false); } if (map.ContainsKey(extension)) { return(true); } return(XmlEditorOptions.GetFileAssociation(extension) != null); }
public static XmlFileAssociation GetAssociation(string extension) { var assoc = XmlEditorOptions.GetFileAssociation(extension); if (assoc != null) { return(assoc); } if (map.TryGetValue(extension, out assoc)) { return(assoc); } return(null); }
/// <summary>File extensions that have XML associations.</summary> /// <returns>LowerInvariant file extensions.</returns> public static IEnumerable <string> GetExtensions() { foreach (string prop in XmlEditorOptions.GetFileExtensions()) { if (!map.ContainsKey(prop)) { yield return(prop); } } foreach (var item in map) { yield return(item.Key); } }
public static XmlSchemaCompletionData GetSchemaCompletionData(string fileExtension) { XmlSchemaCompletionData data = null; var association = XmlEditorOptions.GetSchemaAssociation(fileExtension); if (association != null) { if (association.NamespaceUri.Length > 0) { data = SchemaCompletionDataItems [association.NamespaceUri]; } } return(data); }
public static XmlFileAssociation GetAssociationForFileName(string filename) { foreach (var extension in GetFileExtensions(filename)) { var assoc = XmlEditorOptions.GetFileAssociation(extension); if (assoc != null) { return(assoc); } if (map.TryGetValue(extension, out assoc)) { return(assoc); } } return(null); }
public static IEnumerable <XmlFileAssociation> GetAssociations() { var returned = new HashSet <string> (); foreach (var assoc in XmlEditorOptions.GetFileAssociations()) { returned.Add(assoc.Extension); yield return(assoc); } foreach (var item in map) { if (!returned.Contains(item.Key)) { yield return(item.Value); } } }
public static bool IsXmlFileName(string filename) { foreach (var extension in GetFileExtensions(filename)) { if (string.IsNullOrEmpty(extension)) { return(false); } if (map.ContainsKey(extension)) { return(true); } if (XmlEditorOptions.GetFileAssociation(extension) != null) { return(true); } } return(false); }