示例#1
0
        public ImportSession(string filename, QaDataContext dataContext, LocalListPersistence persistence)
        {
            _dataContext = dataContext;
            _persistence = persistence;

            var str = File.ReadAllText(filename, Encoding.UTF8);

            _data = JsonConvert.DeserializeObject <ImportExportData>(str);
            if (_data.items == null)
            {
                throw new ArgumentException();
            }
        }
示例#2
0
 public LocalListPersistence(QaDataContext database)
 {
     _database = database;
     if (!Directory.Exists(ListDirectoryName))
     {
         Directory.CreateDirectory(ListDirectoryName);
     }
     foreach (var file in Directory.EnumerateFiles(ListDirectoryName))
     {
         if (!Path.HasExtension(file) || Path.GetExtension(file) != ExtensionName)
         {
             continue;
         }
         LoadList(file);
     }
 }