Beispiel #1
0
 public void Set(DataRepository dataRepository)
 {
     string json = JsonConvert.SerializeObject(dataRepository);
     try
     {
         _fileHandler.WriteAllText(_filePath, json);
     }
     catch (Exception e)
     {
         throw new MixMaxException(string.Format("Could not save package to file in path: {0}", _filePath), e.InnerException);
     }
 }
Beispiel #2
0
 public DataRepository Get()
 {
     DataRepository dataRepository = new DataRepository();
     try
     {
         string json = _fileHandler.ReadAllText(_filePath);
         dataRepository = JsonConvert.DeserializeObject<DataRepository>(json);
     }
     catch (FileNotFoundException e)
     {
     }
     catch (Exception e)
     {
         throw new MixMaxException("Something went wrong", e);
     }
     return dataRepository;
 }