public static Options Import(string filename)
 {
     Options options = null;
     try
     {
         if (File.Exists(filename))
         {
             using (FileStream fin = File.OpenRead(filename))
             {
                 var serializer = new OptionsSerializer();
                 options = serializer.Deserialize(fin);
                 var currentProvider = GetCurrentOptionsProvider();
                 if (!currentProvider.IsReadOnly)
                 {
                     currentProvider.Save(options);
                 }
             }
         }
     }
     catch
     {
         options = new Options();
     }
     return options;
 }
Example #2
0
 public Options LoadOptionsFromEmbeddedResource(string name)
 {
     using (Stream s = typeof(SettingsTest).Assembly.GetManifestResourceStream("JSLint.VS2010.test." + name))
     {
         OptionsSerializer serializer = new OptionsSerializer();
         return serializer.Deserialize(s);
     }
 }