Re-write
This commit is contained in:
@ -1,5 +1,4 @@
|
||||
using System.Text.Json;
|
||||
using View_by_Distance.Property.Models;
|
||||
|
||||
namespace View_by_Distance.PropertyCompare.Models;
|
||||
|
||||
@ -11,7 +10,7 @@ public partial class PropertyCompare
|
||||
protected readonly bool _IsArg;
|
||||
protected DateTime _MinimumDateTime;
|
||||
protected readonly List<long> _Numbers;
|
||||
protected A_Property? _Property;
|
||||
protected Shared.Models.Property? _Property;
|
||||
protected string _RegexResult;
|
||||
protected string _RelativeDirectory;
|
||||
protected readonly List<string> _Strings;
|
||||
@ -21,12 +20,12 @@ public partial class PropertyCompare
|
||||
public bool IsArg => _IsArg;
|
||||
public DateTime MinimumDateTime => _MinimumDateTime;
|
||||
public List<long> Numbers => _Numbers;
|
||||
public A_Property? Property => _Property;
|
||||
public Shared.Models.Property? Property => _Property;
|
||||
public string RegexResult => _RegexResult;
|
||||
public string RelativeDirectory => _RelativeDirectory;
|
||||
public List<string> Strings => _Strings;
|
||||
|
||||
public PropertyCompare(string extension, string fileNameWithoutExtension, bool isArg, DateTime minimumDateTime, List<long> numbers, A_Property property, string regexResult, string relativeDirectory, List<string> strings)
|
||||
public PropertyCompare(string extension, string fileNameWithoutExtension, bool isArg, DateTime minimumDateTime, List<long> numbers, Shared.Models.Property property, string regexResult, string relativeDirectory, List<string> strings)
|
||||
{
|
||||
_IsArg = isArg;
|
||||
_Numbers = numbers;
|
||||
@ -49,7 +48,7 @@ public partial class PropertyCompare
|
||||
|
||||
#nullable disable
|
||||
|
||||
public string GetSelect() => string.Concat(_RelativeDirectory, _FileNameWithoutExtension, _Extension, '\t', _Property.CreationTime.Ticks, '\t', View_by_Distance.Property.Models.Stateless.A_Property.GetDateTime(_Property).ToString("yyyy-MM-dd_HH-mm-ss"), '\t', _Property.Id, '\t', _Property.FileSize, '\t', _Property.Width, '\t', _Property.Height);
|
||||
public string GetSelect() => string.Concat(_RelativeDirectory, _FileNameWithoutExtension, _Extension, '\t', _Property.CreationTime.Ticks, '\t', Shared.Models.Stateless.Methods.IProperty.GetDateTime(_Property).ToString("yyyy-MM-dd_HH-mm-ss"), '\t', _Property.Id, '\t', _Property.FileSize, '\t', _Property.Width, '\t', _Property.Height);
|
||||
|
||||
#nullable restore
|
||||
|
||||
|
@ -1,5 +1,3 @@
|
||||
using View_by_Distance.Property.Models;
|
||||
|
||||
namespace View_by_Distance.PropertyCompare.Models;
|
||||
|
||||
internal class PropertyCompareItem
|
||||
@ -9,16 +7,16 @@ internal class PropertyCompareItem
|
||||
protected readonly bool _IsArg;
|
||||
protected readonly string _JsonFileNameWithoutExtension;
|
||||
protected readonly long[] _Numbers;
|
||||
protected readonly A_Property _Property;
|
||||
protected readonly Shared.Models.Property _Property;
|
||||
protected readonly string[] _Strings;
|
||||
public string ImageFileName => _ImageFileName;
|
||||
public bool IsArg => _IsArg;
|
||||
public string JsonFileNameWithoutExtension => _JsonFileNameWithoutExtension;
|
||||
public long[] Numbers => _Numbers;
|
||||
public A_Property Property => _Property;
|
||||
public Shared.Models.Property Property => _Property;
|
||||
public string[] Strings => _Strings;
|
||||
|
||||
public PropertyCompareItem(string imageFileName, bool isArg, string jsonFileNameWithoutExtension, long[] numbers, A_Property property, string[] strings)
|
||||
public PropertyCompareItem(string imageFileName, bool isArg, string jsonFileNameWithoutExtension, long[] numbers, Shared.Models.Property property, string[] strings)
|
||||
{
|
||||
_ImageFileName = imageFileName;
|
||||
_IsArg = isArg;
|
||||
|
@ -19,7 +19,7 @@ public class PropertyCompareLogic
|
||||
_Configuration = configuration;
|
||||
_DiffRootDirectory = diffRootDirectory;
|
||||
_SpellingFindReplace = spellingFindReplace;
|
||||
_Log = Serilog.Log.ForContext<A_Property>();
|
||||
_Log = Serilog.Log.ForContext<PropertyCompareLogic>();
|
||||
_MaxDegreeOfParallelism = Math.Abs(maxDegreeOfParallelism);
|
||||
}
|
||||
|
||||
@ -175,10 +175,10 @@ public class PropertyCompareLogic
|
||||
else
|
||||
extension = Path.GetExtension(files[index]);
|
||||
string json = File.ReadAllText(jsonFile);
|
||||
A_Property? property = JsonSerializer.Deserialize<A_Property>(json);
|
||||
Shared.Models.Property? property = JsonSerializer.Deserialize<Shared.Models.Property>(json);
|
||||
if (property?.Id is null)
|
||||
throw new NullReferenceException(nameof(property));
|
||||
DateTime minimumDateTime = Property.Models.Stateless.A_Property.GetMinimumDateTime(property);
|
||||
DateTime minimumDateTime = Shared.Models.Stateless.Methods.IProperty.GetMinimumDateTime(property);
|
||||
corrected = string.Concat(relativeDirectory, jsonFileNameWithoutExtension);
|
||||
if (_SpellingFindReplace is not null && (from l in _SpellingFindReplace where corrected.Contains(l.Find) select true).Any())
|
||||
{
|
||||
@ -200,17 +200,17 @@ public class PropertyCompareLogic
|
||||
2 => property.Id.Value,
|
||||
3 => property.Id.Value,
|
||||
4 => property.Id.Value,
|
||||
5 => Property.Models.Stateless.A_Property.GetDateTime(property).Ticks,
|
||||
5 => Shared.Models.Stateless.Methods.IProperty.GetDateTime(property).Ticks,
|
||||
6 => property.CreationTime.Ticks,
|
||||
7 => property.FileSize,
|
||||
8 => Property.Models.Stateless.A_Property.GetDateTime(property).Ticks,
|
||||
8 => Shared.Models.Stateless.Methods.IProperty.GetDateTime(property).Ticks,
|
||||
9 => property.FileSize,
|
||||
_ => throw new Exception()
|
||||
};
|
||||
s = i switch
|
||||
{
|
||||
0 => $"{jsonFileNameWithoutExtension.ToLower()}",
|
||||
1 => $"{property.FileSize}{Property.Models.Stateless.A_Property.GetDateTime(property).Ticks}",
|
||||
1 => $"{property.FileSize}{Shared.Models.Stateless.Methods.IProperty.GetDateTime(property).Ticks}",
|
||||
2 => $"{property.FileSize}{property.CreationTime:yyyy-MM-dd_HH-mm-ss}",
|
||||
3 => $"{property.FileSize}{property.Width}{property.Height}",
|
||||
4 => string.Empty,
|
||||
@ -313,7 +313,7 @@ public class PropertyCompareLogic
|
||||
}
|
||||
if (exceptionCount != 0)
|
||||
throw new Exception();
|
||||
return (from l in results orderby Property.Models.Stateless.A_Property.GetMinimumDateTime(l.Property).Ticks select l).ToArray();
|
||||
return (from l in results orderby Shared.Models.Stateless.Methods.IProperty.GetMinimumDateTime(l.Property).Ticks select l).ToArray();
|
||||
}
|
||||
|
||||
private void MoveFiles(string[] directories, List<string[]> fromThenToCollection)
|
||||
|
@ -10,7 +10,7 @@
|
||||
<PropertyGroup>
|
||||
<PackageId>Phares.View.by.Distance.Property.Compare</PackageId>
|
||||
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
|
||||
<Version>5.0.402.104</Version>
|
||||
<Version>6.0.100.1</Version>
|
||||
<Authors>Mike Phares</Authors>
|
||||
<Company>Phares</Company>
|
||||
<IncludeSymbols>true</IncludeSymbols>
|
||||
|
Reference in New Issue
Block a user