/// <summary> /// Inserts a ScannedLocation into the storage backend /// </summary> /// <param name="scannedLocation">The ScannedLocation to insert</param> public async Task InsertScannedLocationAsync(ScannedLocation scannedLocation) { if (!await ScannedLocationsContains(scannedLocation)) { _scannedLocations.InsertData(scannedLocation); } }
public override bool Equals(object obj) { ScannedLocation otherScannedLocation = obj as ScannedLocation; bool isEqual = this.Path.Equals(otherScannedLocation.Path); return(isEqual); }
/// <summary> /// Iterate through the ScannedFiles to determine if there is an equal ScannedFile /// </summary> /// <param name="scannedFile">The ScannedFile to compare against the ScannedFiles in the dbContext</param> /// <returns>true/false if the ScannedFile is contained in the dbContext</returns> private async Task <bool> ScannedLocationsContains(ScannedLocation scannedLocation) { Task <bool> task = Task.Run(() => { bool contains = false; foreach (ScannedLocation contextScannedLocation in _scannedLocations.ListData()) { contains |= contextScannedLocation.Equals(scannedLocation); } return(contains); }); return(await task); }