Implements directory browser dialog, part 6: hidden file system items toggle

This commit is contained in:
BinaryAlley committed 2024-09-24 11:10:03 +03:00
1 parent cd44f11d9e
commit debad9ef74
74 files changed
+596 -427

No files matched your search

@@ -1,4 +1,4 @@
#region ========================================================================= USING =====================================================================================
#region ========================================================================= USING =====================================================================================
using Lumina.Contracts.Enums.BookLibrary;
using Lumina.Domain.Common.Primitives;
using Lumina.Domain.Common.ValueObjects.Metadata;
@@ -85,9 +85,9 @@ public class BookJsonConverter : JsonConverter<Book>
contributorIds,
ratings: ratings
);
return createBookResult.IsError
? throw new JsonException($"Failed to create Book: {string.Join(", ", createBookResult.Errors)}")
: createBookResult.Value;
if (createBookResult.IsError)
throw new JsonException($"Failed to create Book: {string.Join(", ", createBookResult.Errors)}");
return createBookResult.Value;
}
}
@@ -135,9 +135,9 @@ public class BookJsonConverter : JsonConverter<Book>
Optional<int>.FromNullable(pageCount)
);
return metadataResult.IsError
? throw new JsonException($"Failed to create WrittenContentMetadata: {string.Join(", ", metadataResult.Errors)}")
: metadataResult.Value;
if (metadataResult.IsError)
throw new JsonException($"Failed to create WrittenContentMetadata: {string.Join(", ", metadataResult.Errors)}");
return metadataResult.Value;
}
/// <summary>
@@ -169,9 +169,9 @@ public class BookJsonConverter : JsonConverter<Book>
Optional<string>.FromNullable(releaseVersion)
);
return releaseInfoResult.IsError
? throw new JsonException($"Failed to create ReleaseInfo: {string.Join(", ", releaseInfoResult.Errors)}")
: releaseInfoResult.Value;
if (releaseInfoResult.IsError)
throw new JsonException($"Failed to create ReleaseInfo: {string.Join(", ", releaseInfoResult.Errors)}");
return releaseInfoResult.Value;
}
/// <summary>
@@ -217,9 +217,9 @@ public class BookJsonConverter : JsonConverter<Book>
Optional<string>.FromNullable(nativeName)
);
return languageInfoResult.IsError
? throw new JsonException($"Failed to create LanguageInfo: {string.Join(", ", languageInfoResult.Errors)}")
: languageInfoResult.Value;
if (languageInfoResult.IsError)
throw new JsonException($"Failed to create LanguageInfo: {string.Join(", ", languageInfoResult.Errors)}");
return languageInfoResult.Value;
}
else
return null;
@@ -280,4 +280,4 @@ public class BookJsonConverter : JsonConverter<Book>
.ToList();
}
#endregion
}
}
@@ -1,4 +1,4 @@
#region ========================================================================= USING =====================================================================================
#region ========================================================================= USING =====================================================================================
using AutoFixture.Kernel;
using System;
using System.Diagnostics.CodeAnalysis;
@@ -21,7 +21,9 @@ public class DateOnlySpecimenBuilder : ISpecimenBuilder
/// <returns>A specimen based on the request.</returns>
public object Create(object request, ISpecimenContext context)
{
return request is Type type && type == typeof(DateOnly) ? DateOnly.FromDateTime(DateTime.Now) : (object)new NoSpecimen();
if (request is Type type && type == typeof(DateOnly))
return DateOnly.FromDateTime(DateTime.Now);
return new NoSpecimen();
}
#endregion
}
}
@@ -1,4 +1,4 @@
#region ========================================================================= USING =====================================================================================
#region ========================================================================= USING =====================================================================================
using AutoFixture.Kernel;
using System;
using System.Diagnostics.CodeAnalysis;
@@ -21,7 +21,9 @@ public class NullableDateOnlySpecimenBuilder : ISpecimenBuilder
/// <returns>A specimen based on the request.</returns>
public object Create(object request, ISpecimenContext context)
{
return request is Type type && type == typeof(DateOnly?) ? (DateOnly?)DateOnly.FromDateTime(DateTime.Now) : (object)new NoSpecimen();
if (request is Type type && type == typeof(DateOnly?))
return (DateOnly?)DateOnly.FromDateTime(DateTime.Now);
return new NoSpecimen();
}
#endregion
}
}
@@ -1,4 +1,4 @@
#region ========================================================================= USING =====================================================================================
#region ========================================================================= USING =====================================================================================
using AutoFixture;
using Bogus;
using Lumina.Contracts.Enums.BookLibrary;
@@ -265,9 +265,9 @@ public class AddBookRequestFixture
.RuleFor(x => x.LibraryThingId, f => f.Random.String2(f.Random.Number(1, 50)))
.RuleFor(x => x.GoogleBooksId, f =>
{
const string validChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
return new string(Enumerable.Repeat(validChars, 12)
.Select(s => s[f.Random.Number(validChars.Length - 1)])
const string VALID_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
return new string(Enumerable.Repeat(VALID_CHARS, 12)
.Select(s => s[f.Random.Number(VALID_CHARS.Length - 1)])
.ToArray());
})
.RuleFor(x => x.BarnesAndNobleId, f => f.Random.String2(10, "0123456789"))
@@ -346,4 +346,4 @@ public class AddBookRequestFixture
return input?.Length > maxLength ? input[..maxLength] : input;
}
#endregion
}
}