コード例 #1
0
 public void DiscardChanges()
 {
     if (File.Exists(Path.Combine(LOCAL_FILE_DIRECTORY_PATH, LOCAL_FILE_NAME)))
     {
         this.seedDataProvider = JsonConvert.DeserializeObject <SeedDataProvider>(File.ReadAllText(Path.Combine(LOCAL_FILE_DIRECTORY_PATH, LOCAL_FILE_NAME)));
     }
     else
     {
         throw new FileNotFoundException(string.Format("Repository not found at {0}", Path.Combine(LOCAL_FILE_DIRECTORY_PATH, LOCAL_FILE_NAME)));
     }
 }
コード例 #2
0
 private void HydrateRepository()
 {
     //If local file doesn't exists, create shipment data and create the local file.
     //Load load from local file.
     if (!File.Exists(Path.Combine(LOCAL_FILE_DIRECTORY_PATH, LOCAL_FILE_NAME)))
     {
         if (!Directory.Exists(LOCAL_FILE_DIRECTORY_PATH))
         {
             Directory.CreateDirectory(LOCAL_FILE_DIRECTORY_PATH);
         }
         this.seedDataProvider = new SeedDataProvider();
         this.seedDataProvider.SetSeedData();
         SaveChanges();
     }
     DiscardChanges();
 }