Пример #1
0
        public static ExcludeSection LoadFile(string excludeFile)
        {
            FileInfo file = new FileInfo(excludeFile);

            using (StreamReader stream = file.OpenText())
            {
                ExcludeSection result = JsonConvert.DeserializeObject <ExcludeSection>(stream.ReadToEnd());
                return(result);
            }
        }
Пример #2
0
        public static ExcludeSection ReadFile(string filename)
        {
            FileInfo file = new FileInfo(filename);

            if (file.Exists)
            {
                using (StreamReader stream = file.OpenText())
                {
                    JsonSerializer serializer = new JsonSerializer();
                    ExcludeSection db         = (ExcludeSection)serializer.Deserialize(stream, typeof(ExcludeSection));
                    return(db);
                }
            }
            return(new ExcludeSection());
        }