diff options
author | Rune Henriksen <ruju@itu.dk> | 2018-10-07 20:06:28 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-07 20:06:28 +0300 |
commit | be7edb580dc32cf34d9bdd3bf7b7aecb08d2f220 (patch) | |
tree | e6df25fcd8eea62cfea781b6671fb7f9a123a9d4 /Duplicati/CommandLine/Commands.cs | |
parent | dc5a0dbc94960b9dace99c8835ec886c47b5325e (diff) | |
parent | b824c86c7edf8d1aa7ea9df0a5ee6b75dec3e467 (diff) |
Merge pull request #3410 from warwickmm/simplify_enumerating_collections
Simplify enumeration of collections
Diffstat (limited to 'Duplicati/CommandLine/Commands.cs')
-rw-r--r-- | Duplicati/CommandLine/Commands.cs | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/Duplicati/CommandLine/Commands.cs b/Duplicati/CommandLine/Commands.cs index dda56c303..edd7866b7 100644 --- a/Duplicati/CommandLine/Commands.cs +++ b/Duplicati/CommandLine/Commands.cs @@ -174,7 +174,7 @@ namespace Duplicati.CommandLine setup(i);
i.ListAffected(args, res =>
{
- if (res.Filesets != null && res.Filesets.Count() != 0)
+ if (res.Filesets != null && res.Filesets.Any())
{
outwriter.WriteLine("The following filesets are affected:");
foreach (var e in res.Filesets)
@@ -314,8 +314,8 @@ namespace Duplicati.CommandLine // try again with all-versions set
var compareFilter = Library.Utility.JoinedFilterExpression.Join(new Library.Utility.FilterExpression(args), filter);
var isRequestForFiles =
- !controlFiles && res.Filesets.Count() != 0 &&
- (res.Files == null || res.Files.Count() == 0) &&
+ !controlFiles && res.Filesets.Any() &&
+ (res.Files == null || !res.Files.Any()) &&
!compareFilter.Empty;
if (isRequestForFiles && !Library.Utility.Utility.ParseBoolOption(options, "all-versions"))
@@ -327,7 +327,7 @@ namespace Duplicati.CommandLine res = i.List(args, filter);
}
- if (res.Filesets.Count() != 0 && (res.Files == null || res.Files.Count() == 0) && compareFilter.Empty)
+ if (res.Filesets.Any() && (res.Files == null || !res.Files.Any()) && compareFilter.Empty)
{
outwriter.WriteLine("Listing filesets:");
@@ -345,11 +345,11 @@ namespace Duplicati.CommandLine }
else
{
- if (res.Filesets.Count() == 0)
+ if (!res.Filesets.Any())
{
outwriter.WriteLine("No time or version matched a fileset");
}
- else if (res.Files == null || res.Files.Count() == 0)
+ else if (res.Files == null || !res.Files.Any())
{
outwriter.WriteLine("Found {0} filesets, but no files matched", res.Filesets.Count());
}
@@ -383,7 +383,7 @@ namespace Duplicati.CommandLine {
var requiredOptions = new string[] { "keep-time", "keep-versions", "version" };
- if (!options.Keys.Where(x => requiredOptions.Contains(x, StringComparer.OrdinalIgnoreCase)).Any())
+ if (!options.Keys.Any(x => requiredOptions.Contains(x, StringComparer.OrdinalIgnoreCase)))
{
outwriter.WriteLine(Strings.Program.DeleteCommandNeedsOptions("delete", requiredOptions));
return 200;
@@ -396,7 +396,7 @@ namespace Duplicati.CommandLine args.RemoveAt(0);
var res = i.Delete();
- if (res.DeletedSets.Count() == 0)
+ if (!res.DeletedSets.Any())
{
outwriter.WriteLine(Strings.Program.NoFilesetsMatching);
}
@@ -519,7 +519,7 @@ namespace Duplicati.CommandLine if (output.FullResults)
Library.Utility.Utility.PrintSerializeObject(res, outwriter);
- if (res.Warnings.Count() > 0)
+ if (res.Warnings.Any())
return 2;
}
}
@@ -694,8 +694,8 @@ namespace Duplicati.CommandLine }
else
{
- var filtered = from n in result.Verifications where n.Value.Count() != 0 select n;
- if (filtered.Count() == 0)
+ var filtered = from n in result.Verifications where n.Value.Any() select n;
+ if (!filtered.Any())
{
outwriter.WriteLine("Examined {0} files and found no errors", totalFiles);
return 0;
|