Any
MoveToDecade
This commit is contained in:
@ -63,7 +63,7 @@ internal abstract class Container
|
||||
{
|
||||
foreach (Models.Container container in containers)
|
||||
{
|
||||
if (!container.Items.Any())
|
||||
if (container.Items.Count == 0)
|
||||
continue;
|
||||
if (!argZeroIsConfigurationRootDirectory && !container.SourceDirectory.StartsWith(argZero))
|
||||
continue;
|
||||
@ -169,7 +169,7 @@ internal abstract class Container
|
||||
Dictionary<string, List<Models.Item>> directoryToItems = new();
|
||||
foreach (string[] files in filesCollection)
|
||||
{
|
||||
if (!files.Any())
|
||||
if (files.Length == 0)
|
||||
continue;
|
||||
directory = Path.GetDirectoryName(files.First());
|
||||
if (directory is null)
|
||||
@ -199,7 +199,7 @@ internal abstract class Container
|
||||
}
|
||||
foreach (KeyValuePair<string, List<Models.Item>> keyValuePair in directoryToItems)
|
||||
{
|
||||
if (!keyValuePair.Value.Any())
|
||||
if (keyValuePair.Value.Count == 0)
|
||||
continue;
|
||||
container = new(keyValuePair.Key, keyValuePair.Value);
|
||||
results.Add(container);
|
||||
@ -233,10 +233,10 @@ internal abstract class Container
|
||||
Models.Item[] filteredItems;
|
||||
foreach (Models.Container container in containers)
|
||||
{
|
||||
if (!container.Items.Any())
|
||||
if (container.Items.Count == 0)
|
||||
continue;
|
||||
filteredItems = GetFilterItems(propertyConfiguration, container);
|
||||
if (!filteredItems.Any())
|
||||
if (filteredItems.Length == 0)
|
||||
continue;
|
||||
foreach (Models.Item item in filteredItems)
|
||||
{
|
||||
@ -257,7 +257,7 @@ internal abstract class Container
|
||||
IEnumerable<Models.Item> filteredItems;
|
||||
foreach (Models.Container container in containers)
|
||||
{
|
||||
if (!container.Items.Any())
|
||||
if (container.Items.Count == 0)
|
||||
continue;
|
||||
if (!filterItems)
|
||||
filteredItems = container.Items;
|
||||
|
@ -56,7 +56,7 @@ internal abstract class Face
|
||||
{
|
||||
Models.Face? result;
|
||||
List<Models.Face> results = GetFaces(jsonFileFullName, maximum: 1);
|
||||
if (!results.Any())
|
||||
if (results.Count == 0)
|
||||
throw new Exception();
|
||||
result = results[0];
|
||||
return result;
|
||||
|
@ -17,7 +17,7 @@ internal abstract class FaceFileSystem
|
||||
else
|
||||
{
|
||||
string[] files = Directory.GetFiles(parentDirectoryName, Path.GetFileName(fullFileName), SearchOption.AllDirectories);
|
||||
if (!files.Any())
|
||||
if (files.Length == 0)
|
||||
throw new Exception($"File [{fileInfo.Name}] <{fullFileName}> doesn't exist (deep search)!");
|
||||
else
|
||||
{
|
||||
|
@ -30,7 +30,7 @@ internal abstract class FileHolder
|
||||
next = Directory.GetFiles(path, searchPattern);
|
||||
}
|
||||
catch { }
|
||||
if (next is not null && next.Any())
|
||||
if (next is not null && next.Length > 0)
|
||||
yield return new(path, next);
|
||||
try
|
||||
{
|
||||
|
@ -37,9 +37,9 @@ public interface IPerson
|
||||
hour == 17 ? "Dead-Male-No" :
|
||||
throw new NotImplementedException(personDisplayDirectoryName);
|
||||
|
||||
bool TestStatic_IsDefaultName(string mappingDefaultName, string value) =>
|
||||
IsDefaultName(mappingDefaultName, value);
|
||||
static bool IsDefaultName(string mappingDefaultName, string value) =>
|
||||
value == mappingDefaultName || (value.Length > 1 && value[0] == 'X' && value[1] == ']');
|
||||
bool TestStatic_IsDefaultName(string mappingDefaultName, string personDisplayDirectoryName) =>
|
||||
IsDefaultName(mappingDefaultName, personDisplayDirectoryName);
|
||||
static bool IsDefaultName(string mappingDefaultName, string personDisplayDirectoryName) =>
|
||||
personDisplayDirectoryName == mappingDefaultName || (personDisplayDirectoryName.Length > 1 && personDisplayDirectoryName[0] == 'X' && personDisplayDirectoryName[1] == ']');
|
||||
|
||||
}
|
@ -103,7 +103,7 @@ internal abstract class PersonContainer
|
||||
foreach ((string personKeyFormatted, Models.PersonBirthday personBirthday) in collection)
|
||||
{
|
||||
orderedPersonBirthdays = (from l in collection where !l.PersonKeyFormatted.Contains(numberSign) orderby l.PersonBirthday.Value.Ticks descending select l.PersonBirthday).ToArray();
|
||||
if (!orderedPersonBirthdays.Any())
|
||||
if (orderedPersonBirthdays.Length == 0)
|
||||
personKey = collection[zero].PersonBirthday.Value.Ticks;
|
||||
else
|
||||
{
|
||||
@ -113,7 +113,7 @@ internal abstract class PersonContainer
|
||||
}
|
||||
personKeyDirectory = Path.Combine(personDisplayDirectory, personKeyFormatted);
|
||||
files = Directory.GetFiles(personKeyDirectory, "*", SearchOption.AllDirectories);
|
||||
if (!files.Any())
|
||||
if (files.Length == 0)
|
||||
continue;
|
||||
personDisplayDirectoryAllFiles.AddRange(files.Where(l => l.EndsWith(".rel")));
|
||||
personContainer = new(approximateYears, orderedPersonBirthdays, personDisplayDirectoryAllFiles.ToArray(), personDisplayDirectoryName, personKey, personDirectory);
|
||||
@ -127,7 +127,7 @@ internal abstract class PersonContainer
|
||||
string? result;
|
||||
if (approximateYears is null)
|
||||
throw new NotSupportedException();
|
||||
if (!collection.Any())
|
||||
if (collection.Count == 0)
|
||||
throw new NotSupportedException();
|
||||
const int zero = 0;
|
||||
int? updateApproximateYears;
|
||||
@ -225,7 +225,7 @@ internal abstract class PersonContainer
|
||||
{
|
||||
innerGroupDirectoryName = Path.GetFileName(innerGroupDirectory);
|
||||
segments = innerGroupDirectoryName.Split('-');
|
||||
if (!segments.Any())
|
||||
if (segments.Length == 0)
|
||||
throw new NotSupportedException("Misplaced directory!");
|
||||
if (segments.Length != 3)
|
||||
continue;
|
||||
@ -285,7 +285,7 @@ internal abstract class PersonContainer
|
||||
_ = Directory.CreateDirectory(a2PeopleSingletonDirectoryChar);
|
||||
}
|
||||
string[] groupDirectories = Directory.GetDirectories(a2PeopleSingletonDirectory, "*", SearchOption.TopDirectoryOnly);
|
||||
if (!groupDirectories.Any())
|
||||
if (groupDirectories.Length == 0)
|
||||
results = new();
|
||||
else
|
||||
results = GetPersonContainersGroups(personBirthdayFormat, facesFileNameExtension, personCharacters, groupDirectories);
|
||||
|
@ -40,10 +40,10 @@ internal abstract class Property
|
||||
|| (l.Length == 7 && l.Substring(1, 4) == year && l[5] == '.')
|
||||
select l
|
||||
).ToArray();
|
||||
if (!results.Any())
|
||||
if (results.Length == 0)
|
||||
result = null;
|
||||
else
|
||||
result = !matches.Any();
|
||||
result = matches.Length == 0;
|
||||
return new(result, results);
|
||||
}
|
||||
|
||||
@ -203,7 +203,7 @@ internal abstract class Property
|
||||
}
|
||||
long threeStandardDeviationHigh;
|
||||
long min;
|
||||
if (!ticksCollection.Any())
|
||||
if (ticksCollection.Count == 0)
|
||||
min = 0;
|
||||
else
|
||||
min = ticksCollection.Min();
|
||||
@ -263,7 +263,7 @@ internal abstract class Property
|
||||
bool result = false;
|
||||
foreach (Models.Container container in containers)
|
||||
{
|
||||
if (!container.Items.Any())
|
||||
if (container.Items.Count == 0)
|
||||
continue;
|
||||
if ((from l in container.Items where l.Any() select true).Any())
|
||||
{
|
||||
|
@ -97,7 +97,7 @@ internal abstract partial class XDirectory
|
||||
}
|
||||
}
|
||||
}
|
||||
if (renameCollection.Any())
|
||||
if (renameCollection.Count > 0)
|
||||
IDirectory.MoveFiles(renameCollection, "{}", "{abd}");
|
||||
return renameCollection.Count;
|
||||
}
|
||||
@ -139,7 +139,7 @@ internal abstract partial class XDirectory
|
||||
continue;
|
||||
matches.Add(possible);
|
||||
}
|
||||
if (matches.Count == 1 || (matches.Any() && lengths.Distinct().Count() == 1 && creationTimes.Distinct().Count() == 1))
|
||||
if (matches.Count == 1 || (matches.Count > 0 && lengths.Distinct().Count() == 1 && creationTimes.Distinct().Count() == 1))
|
||||
result = matches.First();
|
||||
return result;
|
||||
}
|
||||
@ -167,7 +167,7 @@ internal abstract partial class XDirectory
|
||||
results.Add(new(file, uniqueFileName, isNotUniqueAndNeedsReview, new(), null));
|
||||
else
|
||||
{
|
||||
if (!collection.Any())
|
||||
if (collection.Count == 0)
|
||||
results.Add(new(file, uniqueFileName, isNotUniqueAndNeedsReview, collection, null));
|
||||
else if (uniqueFileName && collection.Count == 1)
|
||||
results.Add(new(file, uniqueFileName, isNotUniqueAndNeedsReview, collection, collection.First()));
|
||||
|
@ -32,7 +32,7 @@ internal abstract class XPath
|
||||
bool result;
|
||||
List<string> results = new();
|
||||
DeleteEmptyDirectories(rootDirectory, results);
|
||||
result = results.Any();
|
||||
result = results.Count > 0;
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -64,7 +64,7 @@ internal abstract class XPath
|
||||
{
|
||||
DeleteEmptyDirectories(directory, check);
|
||||
deletedDirectories.AddRange(check);
|
||||
if (check.Any())
|
||||
if (check.Count > 0)
|
||||
DeleteEmptyDirectories(directory, deletedDirectories);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user