Exemplo n.º 1
0
 public static T ReadSettings <T>(this UserSettingsService settsSvc, string settsFile, params IValueSerializer[] serializers)
 {
     using (var textReader = File.OpenText(settsFile))
     {
         return(settsSvc.ReadSettings <T>(textReader, serializers));
     }
 }
Exemplo n.º 2
0
        public static void StoreSettings <T>(this UserSettingsService settsSvc, T setts, string settsFile, params IValueSerializer[] serializers)
        {
            var settsDir = Path.GetDirectoryName(settsFile);

            if (!Directory.Exists(settsDir))
            {
                Directory.CreateDirectory(settsDir);
            }

            using (var textWriter = File.CreateText(settsFile))
            {
                settsSvc.StoreSettings <T>(setts, textWriter, serializers);
            }
        }