diff --git a/starsky/starsky.foundation.sync/Helpers/SizeFileHashIsTheSame.cs b/starsky/starsky.foundation.sync/Helpers/SizeFileHashIsTheSame.cs index dbcfd95c96..68ff5bfc0c 100644 --- a/starsky/starsky.foundation.sync/Helpers/SizeFileHashIsTheSame.cs +++ b/starsky/starsky.foundation.sync/Helpers/SizeFileHashIsTheSame.cs @@ -26,7 +26,7 @@ public SizeFileHashIsTheSameHelper(IStorage subPathStorage) /// Last Edited is the bool (null is should check further in process), FileHash Same bool (null is not checked) , database item internal async Task> SizeFileHashIsTheSame(List dbItems, string subPath) { - var dbItem = dbItems.Find(p => p.FilePath == subPath); + var dbItem = dbItems.FirstOrDefault(p => p.FilePath == subPath); if ( dbItem == null ) { return new Tuple(false, false, null); diff --git a/starsky/starsky.foundation.sync/Helpers/SyncCli.cs b/starsky/starsky.foundation.sync/Helpers/SyncCli.cs index ea2890d175..a64ad758e1 100644 --- a/starsky/starsky.foundation.sync/Helpers/SyncCli.cs +++ b/starsky/starsky.foundation.sync/Helpers/SyncCli.cs @@ -54,7 +54,7 @@ public async Task Sync(string[] args) var stopWatch = Stopwatch.StartNew(); _console.WriteLine($"Start indexing {subPath}"); var result = await _synchronize.Sync(subPath); - if ( result.TrueForAll(p => p.FilePath != subPath) ) + if ( result.All(p => p.FilePath != subPath) ) { _console.WriteLine($"Not Found: {subPath}"); } diff --git a/starsky/starsky.foundation.sync/Helpers/SyncIgnoreCheck.cs b/starsky/starsky.foundation.sync/Helpers/SyncIgnoreCheck.cs index 74712a3278..ba62c4b01d 100644 --- a/starsky/starsky.foundation.sync/Helpers/SyncIgnoreCheck.cs +++ b/starsky/starsky.foundation.sync/Helpers/SyncIgnoreCheck.cs @@ -17,7 +17,7 @@ public SyncIgnoreCheck(AppSettings appSettings, IConsole console) public bool Filter(string subPath) { - var isSynced = _appSettings.SyncIgnore.Exists(subPath.StartsWith); + var isSynced = _appSettings.SyncIgnore.Any(subPath.StartsWith); if ( isSynced && _appSettings.IsVerbose()) _console.WriteLine($"sync ignored for: {subPath}"); return isSynced; } diff --git a/starsky/starsky.foundation.sync/SyncServices/SyncFolder.cs b/starsky/starsky.foundation.sync/SyncServices/SyncFolder.cs index 1289be1e45..058f7e6941 100644 --- a/starsky/starsky.foundation.sync/SyncServices/SyncFolder.cs +++ b/starsky/starsky.foundation.sync/SyncServices/SyncFolder.cs @@ -137,7 +137,7 @@ internal async Task CompareFolderListAndFixMissingFolders(List subPaths, { if ( subPaths.Count == folderList.Count ) return; - foreach ( var path in subPaths.Where(path => folderList.Exists(p => p.FilePath != path) && + foreach ( var path in subPaths.Where(path => folderList.All(p => p.FilePath != path) && _subPathStorage.ExistFolder(path) && !_syncIgnoreCheck.Filter(path) ) ) { await _query.AddItemAsync(new FileIndexItem(path) @@ -155,7 +155,7 @@ internal async Task> AddParentFolder(string subPath, List p.FilePath).ToList(); - if ( allResults.TrueForAll(p => p.FilePath != subPath)) + if ( allResults.All(p => p.FilePath != subPath)) { var subPathStatus = _subPathStorage.IsFolderOrFile(subPath); var exifStatus = subPathStatus == @@ -301,7 +301,7 @@ internal static List PathsToUpdateInDatabase( var resultDatabaseItems = new List(databaseItems); foreach ( var path in pathsOnDisk ) { - var item = databaseItems.Find(p => string.Equals(p.FilePath, path, StringComparison.InvariantCultureIgnoreCase)); + var item = databaseItems.FirstOrDefault(p => string.Equals(p.FilePath, path, StringComparison.InvariantCultureIgnoreCase)); if (item == null ) // when the file should be added to the index { // Status is used by MultiFile diff --git a/starsky/starsky.foundation.sync/SyncServices/SyncMultiFile.cs b/starsky/starsky.foundation.sync/SyncServices/SyncMultiFile.cs index 262b2417b6..17e90b38ba 100644 --- a/starsky/starsky.foundation.sync/SyncServices/SyncMultiFile.cs +++ b/starsky/starsky.foundation.sync/SyncServices/SyncMultiFile.cs @@ -50,7 +50,7 @@ internal async Task> MultiFile(List subPathInFiles, var resultDatabaseItems = new List(); foreach ( var path in subPathInFiles ) { - var item = databaseItems.Find(p => + var item = databaseItems.FirstOrDefault(p => string.Equals(p.FilePath, path, StringComparison.InvariantCultureIgnoreCase)); if (item == null ) // when the file should be added to the index { diff --git a/starsky/starsky.foundation.sync/SyncServices/SyncSingleFile.cs b/starsky/starsky.foundation.sync/SyncServices/SyncSingleFile.cs index d4acaff790..a4f8f69ce6 100644 --- a/starsky/starsky.foundation.sync/SyncServices/SyncSingleFile.cs +++ b/starsky/starsky.foundation.sync/SyncServices/SyncSingleFile.cs @@ -44,7 +44,7 @@ internal async Task> SingleFile(string subPath, ISynchronize.SocketUpdateDelegate? updateDelegate = null) { // when item does not exist in db - if ( dbItems?.Find(p => p.FilePath == subPath) == null ) + if ( dbItems?.FirstOrDefault(p => p.FilePath == subPath) == null ) { return await SingleFile(subPath); } @@ -81,7 +81,7 @@ internal async Task> SingleFile(string subPath, var dbItems = await _query.GetObjectsByFilePathAsync(subPath,true); foreach ( var item in statusItems ) { - var dbItem = dbItems.Find(p => item.FilePath == p.FilePath); + var dbItem = dbItems.FirstOrDefault(p => item.FilePath == p.FilePath); if ( dbItem != null ) { scanItems.Add(dbItem); @@ -91,7 +91,7 @@ internal async Task> SingleFile(string subPath, scanItems.Add(item); } - foreach ( var item in dbItems.Where(item => scanItems.TrueForAll(p => p.FilePath != item.FilePath)) ) + foreach ( var item in dbItems.Where(item => scanItems.All(p => p.FilePath != item.FilePath)) ) { scanItems.Add(item); }