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))); } }
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(); }