static XmlDocument loadXmlScheme(string schemeName) { XmlDocument xmlDoc = new XmlDocument(); // Create an XML document object foreach (string path in Scheme.GetSearchPaths(schemeName, ".itermcolors") .Where(File.Exists)) { try { xmlDoc.Load(path); return(xmlDoc); } catch (XmlException /*e*/) { /* failed to parse */ } catch (IOException /*e*/) { /* failed to find */ } catch (UnauthorizedAccessException /*e*/) { /* unauthorized */ } } return(null); }
static XmlDocument loadJsonFile(string schemeName) { XmlDocument xmlDoc = new XmlDocument(); foreach (string path in Scheme.GetSearchPaths(schemeName, ".json") .Where(File.Exists)) { try { var data = File.ReadAllBytes(path); var reader = JsonReaderWriterFactory.CreateJsonReader(data, System.Xml.XmlDictionaryReaderQuotas.Max); xmlDoc.Load(reader); return(xmlDoc); } catch (XmlException /*e*/) { /* failed to parse */ } catch (IOException /*e*/) { /* failed to find */ } catch (UnauthorizedAccessException /*e*/) { /* unauthorized */ } } return(null); }
static string FindIniScheme(string schemeName) { return(Scheme.GetSearchPaths(schemeName, ".ini").FirstOrDefault(File.Exists)); }