Ready to test Windows Project
This commit is contained in:
@ -16,19 +16,19 @@ internal abstract class Age
|
||||
years += 1;
|
||||
}
|
||||
result = new(minuendTicks - check.AddYears(-1).Ticks);
|
||||
return (years, result);
|
||||
return new(years, result);
|
||||
}
|
||||
|
||||
internal static (int, TimeSpan) GetAge(long minuendTicks, DateTime subtrahend)
|
||||
{
|
||||
(int years, TimeSpan result) = GetAge(minuendTicks, subtrahend.Ticks);
|
||||
return (years, result);
|
||||
return new(years, result);
|
||||
}
|
||||
|
||||
internal static (int, TimeSpan) GetAge(DateTime minuend, DateTime subtrahend)
|
||||
{
|
||||
(int years, TimeSpan result) = GetAge(minuend.Ticks, subtrahend.Ticks);
|
||||
return (years, result);
|
||||
return new(years, result);
|
||||
}
|
||||
|
||||
internal static int? GetApproximateYears(char[] personCharacters, string personDisplayDirectoryName)
|
||||
|
@ -3,10 +3,10 @@ namespace View_by_Distance.Shared.Models.Stateless;
|
||||
public interface IDate
|
||||
{
|
||||
|
||||
(bool?, string[]) TestStatic_IsWrongYear(FilePath filePath, ExifDirectory exifDirectory) =>
|
||||
IsWrongYear(filePath, exifDirectory);
|
||||
static (bool?, string[]) IsWrongYear(FilePath filePath, ExifDirectory exifDirectory) =>
|
||||
XDate.IsWrongYear(filePath, exifDirectory);
|
||||
(bool?, string[]) TestStatic_IsWrongYear(DirectoryInfo directoryInfo, FilePath filePath, ExifDirectory exifDirectory) =>
|
||||
IsWrongYear(directoryInfo, filePath, exifDirectory);
|
||||
static (bool?, string[]) IsWrongYear(DirectoryInfo directoryInfo, FilePath filePath, ExifDirectory exifDirectory) =>
|
||||
XDate.IsWrongYear(directoryInfo, filePath, exifDirectory);
|
||||
|
||||
(int Season, string seasonName) TestStatic_GetSeason(int dayOfYear) =>
|
||||
GetSeason(dayOfYear);
|
||||
|
@ -8,6 +8,7 @@ public interface IRename
|
||||
|
||||
ReadOnlyCollection<string> ConvertAndGetFastForwardMovingPictureExpertsGroupFiles(IRenameSettings renameSettings, FilePath filePath);
|
||||
DeterministicHashCode GetDeterministicHashCode(FilePath filePath);
|
||||
void ConstructProgressBar(int maxTicks, string message);
|
||||
void Tick();
|
||||
|
||||
}
|
15
Shared/Models/Stateless/IWindows.cs
Normal file
15
Shared/Models/Stateless/IWindows.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using System.Collections.ObjectModel;
|
||||
using View_by_Distance.Shared.Models.Properties;
|
||||
|
||||
namespace View_by_Distance.Shared.Models.Stateless;
|
||||
|
||||
public interface IWindows
|
||||
{
|
||||
|
||||
ReadOnlyCollection<string> ConvertAndGetFastForwardMovingPictureExpertsGroupFiles(IWindowsSettings windowsSettings, HttpClient? httpClient, FilePath filePath);
|
||||
DeterministicHashCode GetDeterministicHashCode(HttpClient? httpClient, FilePath filePath);
|
||||
DeterministicHashCode GetDeterministicHashCode(HttpClient httpClient, Uri uri);
|
||||
void ConstructProgressBar(int maxTicks, string message);
|
||||
void Tick();
|
||||
|
||||
}
|
@ -48,7 +48,7 @@ internal abstract class PersonBirthday
|
||||
if (birthday?.Value is null)
|
||||
throw new NullReferenceException(nameof(birthday.Value));
|
||||
(years, result) = Age.GetAge(dateTimeTicks, birthday.Value);
|
||||
return (years, result);
|
||||
return new(years, result);
|
||||
}
|
||||
|
||||
internal static (int, TimeSpan) GetAge(DateTime dateTime, Models.PersonBirthday birthday)
|
||||
@ -58,7 +58,7 @@ internal abstract class PersonBirthday
|
||||
if (birthday?.Value is null)
|
||||
throw new NullReferenceException(nameof(birthday.Value));
|
||||
(years, result) = Age.GetAge(dateTime, birthday.Value);
|
||||
return (years, result);
|
||||
return new(years, result);
|
||||
}
|
||||
|
||||
internal static (int, double) GetAge(DateTime dateTime, DateTime dayBeforeLeapDate, Models.PersonBirthday birthday)
|
||||
@ -69,7 +69,7 @@ internal abstract class PersonBirthday
|
||||
result = timeSpan.TotalDays / 365;
|
||||
else
|
||||
result = timeSpan.TotalDays / 366;
|
||||
return (years, result);
|
||||
return new(years, result);
|
||||
}
|
||||
|
||||
internal static double? GetAge(Models.PersonBirthday birthday)
|
||||
|
@ -58,7 +58,7 @@ internal abstract class XDate
|
||||
return result;
|
||||
}
|
||||
|
||||
internal static (bool?, string[]) IsWrongYear(FilePath filePath, ExifDirectory exifDirectory)
|
||||
internal static (bool?, string[]) IsWrongYear(DirectoryInfo directoryInfo, FilePath filePath, ExifDirectory exifDirectory)
|
||||
{
|
||||
string[] results = [];
|
||||
bool? result = null;
|
||||
@ -67,9 +67,6 @@ internal abstract class XDate
|
||||
string[] directorySegments;
|
||||
List<DateTime> collection = [];
|
||||
string? check = Path.GetFullPath(filePath.FullName);
|
||||
string? pathRoot = Path.GetPathRoot(filePath.FullName);
|
||||
if (string.IsNullOrEmpty(pathRoot))
|
||||
throw new Exception();
|
||||
DateTime? dateTimeOriginal = GetDateTimeOriginal(exifDirectory);
|
||||
if (dateTimeOriginal is not null)
|
||||
collection.Add(dateTimeOriginal.Value);
|
||||
@ -85,7 +82,7 @@ internal abstract class XDate
|
||||
for (int i = 0; i < int.MaxValue; i++)
|
||||
{
|
||||
check = Path.GetDirectoryName(check);
|
||||
if (string.IsNullOrEmpty(check) || check == pathRoot)
|
||||
if (string.IsNullOrEmpty(check) || check == directoryInfo.FullName)
|
||||
break;
|
||||
directoryName = Path.GetFileName(check);
|
||||
directorySegments = directoryName.Split(' ');
|
||||
|
@ -281,19 +281,19 @@ internal abstract class XPath
|
||||
result = check;
|
||||
converted = int.Parse(check);
|
||||
}
|
||||
return (result, converted);
|
||||
return new(result, converted);
|
||||
}
|
||||
|
||||
internal static (string, int) GetDirectoryNameAndIndex(ResultSettings resultSettings, int id)
|
||||
{
|
||||
(string result, int converted) = GetDirectoryNameAndIndex(resultSettings.ResultAllInOneSubdirectoryLength, id.ToString());
|
||||
return (result, converted);
|
||||
return new(result, converted);
|
||||
}
|
||||
|
||||
internal static (string, int) GetDirectoryNameAndIndex(ResultSettings resultSettings, FileHolder fileHolder)
|
||||
{
|
||||
(string result, int converted) = GetDirectoryNameAndIndex(resultSettings.ResultAllInOneSubdirectoryLength, fileHolder.NameWithoutExtension);
|
||||
return (result, converted);
|
||||
return new(result, converted);
|
||||
}
|
||||
|
||||
internal static (string, int) GetDirectoryNameAndIndex(ResultSettings resultSettings, FilePath filePath)
|
||||
@ -304,7 +304,7 @@ internal abstract class XPath
|
||||
(result, converted) = GetDirectoryNameAndIndex(resultSettings.ResultAllInOneSubdirectoryLength, filePath.Id.Value.ToString());
|
||||
else
|
||||
(result, converted) = GetDirectoryNameAndIndex(resultSettings.ResultAllInOneSubdirectoryLength, filePath.NameWithoutExtension);
|
||||
return (result, converted);
|
||||
return new(result, converted);
|
||||
}
|
||||
|
||||
private static ReadOnlyCollection<int> GetYears(ResultSettings resultSettings)
|
||||
|
Reference in New Issue
Block a user