Exemplo n.º 1
0
 public void Load()
 {
     if (File.Exists(filePath))
     {
         try {
             XDocument doc = XDocument.Load(filePath);
             foreach (var element in doc.Root.Elements())
             {
                 settings[element.Name.LocalName] = element.Value;
             }
         } catch (XmlException ex) {
             PkgSource.LogError(String.Format("Error loading '{0}'", filePath), ex);
         }
     }
 }
Exemplo n.º 2
0
 private JObject TryRead()
 {
     try {
         byte[] data = this.persistSettings.Read();
         if (data != null && data.Length > 0)
         {
             return(JObject.Parse(this.encoding.GetString(data)));
         }
     } catch (Exception ex) {
         // avoid generating a VS error if
         // the JSON stored is invalid.
         // See https://github.com/tomasr/viasfora/issues/112
         PkgSource.LogError("Error loading solution user settings", ex);
     }
     return(null);
 }