This commit is contained in:
2022-08-22 09:10:19 -07:00
parent f72fcee1db
commit bc2174b17a
150 changed files with 4323 additions and 6259 deletions

View File

@ -1,6 +1,5 @@
using System.Text.Json;
using System.Text.Json.Serialization;
using View_by_Distance.Property.Models;
using View_by_Distance.Shared.Models.Methods;
using View_by_Distance.Shared.Models.Stateless;
@ -76,11 +75,11 @@ public class G_Index : Shared.Models.Properties.IIndex, IIndex
return result;
}
private void WriteNeeded(List<int> indices, List<Tuple<List<string>, string, A_Property>> neededTuples)
private void WriteNeeded(List<int> indices, List<Tuple<List<string>, string, Shared.Models.Property>> neededTuples)
{
string json;
DateTime dateTime;
A_Property property;
Shared.Models.Property property;
G_Index indexInfo;
int maxIndexPlusOne;
DateTime?[] dateTimes;
@ -91,7 +90,7 @@ public class G_Index : Shared.Models.Properties.IIndex, IIndex
maxIndexPlusOne = 1000000;
throw new Exception("Are you sure exception. Use debugger to step over.");
}
foreach (Tuple<List<string>, string, A_Property> tuple in neededTuples)
foreach (Tuple<List<string>, string, Shared.Models.Property> tuple in neededTuples)
{
maxIndexPlusOne += 1;
property = tuple.Item3;
@ -99,7 +98,7 @@ public class G_Index : Shared.Models.Properties.IIndex, IIndex
dateTime = (from l in dateTimes where l.HasValue select l.Value).Min();
indexInfo = new(dateTime, maxIndexPlusOne, tuple.Item1);
json = JsonSerializer.Serialize(indexInfo, _WriteIndentedJsonSerializerOptions);
if (!Property.Models.Stateless.IPath.WriteAllText(tuple.Item2, json, updateDateWhenMatches: true, compareBeforeWrite: true))
if (!Shared.Models.Stateless.Methods.IPath.WriteAllText(tuple.Item2, json, updateDateWhenMatches: true, compareBeforeWrite: true))
continue;
}
}
@ -114,24 +113,24 @@ public class G_Index : Shared.Models.Properties.IIndex, IIndex
indices = (from l in tuple.Item2 select l.Value).ToArray();
directoryInfoCollection = Property.Models.Stateless.IResult.GetDirectoryInfoCollection(configuration, model, predictorModel, tuple.Item1, nameof(G_Index), outputResolution, includeResizeGroup: false, includeModel: false, includePredictorModel: false, contentDescription: string.Empty, singletonDescription: string.Empty, collectionDescription: "Unknown A");
json = JsonSerializer.Serialize(indices, _WriteIndentedJsonSerializerOptions);
if (!Property.Models.Stateless.IPath.WriteAllText(string.Concat(directoryInfoCollection[0].Replace("<>", "[]"), ".json"), json, updateDateWhenMatches: true, compareBeforeWrite: true))
if (!Shared.Models.Stateless.Methods.IPath.WriteAllText(string.Concat(directoryInfoCollection[0].Replace("<>", "[]"), ".json"), json, updateDateWhenMatches: true, compareBeforeWrite: true))
continue;
}
}
private void AppendTSV(Property.Models.Configuration configuration, Model? model, PredictorModel? predictorModel, string outputResolution, Dictionary<string, List<Tuple<string, A_Property>>> filePropertiesKeyValuePairs)
private void AppendTSV(Property.Models.Configuration configuration, Model? model, PredictorModel? predictorModel, string outputResolution, Dictionary<string, List<Tuple<string, Shared.Models.Property>>> filePropertiesKeyValuePairs)
{
A_Property property;
Shared.Models.Property property;
DateTime?[] dateTimes;
DateTime? maximumDateTime;
DateTime? minimumDateTime;
List<string> directoryInfoCollection;
long ticks = System.DateTime.Now.Ticks;
foreach (KeyValuePair<string, List<Tuple<string, A_Property>>> tuples in filePropertiesKeyValuePairs)
foreach (KeyValuePair<string, List<Tuple<string, Shared.Models.Property>>> tuples in filePropertiesKeyValuePairs)
{
maximumDateTime = null;
minimumDateTime = null;
foreach (Tuple<string, A_Property> tuple in tuples.Value)
foreach (Tuple<string, Shared.Models.Property> tuple in tuples.Value)
{
property = tuple.Item2;
dateTimes = new DateTime?[] { maximumDateTime, minimumDateTime, property.CreationTime, property.LastWriteTime, property.DateTime, property.DateTimeDigitized, property.DateTimeOriginal, property.GPSDateStamp };
@ -142,7 +141,7 @@ public class G_Index : Shared.Models.Properties.IIndex, IIndex
}
}
internal void SetIndex(Property.Models.Configuration configuration, Model? model, PredictorModel? predictorModel, string outputResolution, Dictionary<string, List<Tuple<string, A_Property>>> filePropertiesKeyValuePairs)
internal void SetIndex(Property.Models.Configuration configuration, Model? model, PredictorModel? predictorModel, string outputResolution, Dictionary<string, List<Tuple<string, Shared.Models.Property>>> filePropertiesKeyValuePairs)
{
FileInfo fileInfo;
G_Index indexInfo;
@ -151,7 +150,7 @@ public class G_Index : Shared.Models.Properties.IIndex, IIndex
Dictionary<int, G_Index> valuePairs;
List<string> directoryInfoCollection;
List<string> parseExceptions = new();
List<Tuple<List<string>, string, A_Property>> neededTuples = new();
List<Tuple<List<string>, string, Shared.Models.Property>> neededTuples = new();
List<Tuple<string, Dictionary<int, G_Index>>> indexInfoTuples = new();
for (short i = 0; i < short.MaxValue; i++)
{
@ -164,11 +163,11 @@ public class G_Index : Shared.Models.Properties.IIndex, IIndex
parseExceptions.Clear();
}
neededTuples.Clear();
foreach (KeyValuePair<string, List<Tuple<string, A_Property>>> tuples in filePropertiesKeyValuePairs)
foreach (KeyValuePair<string, List<Tuple<string, Shared.Models.Property>>> tuples in filePropertiesKeyValuePairs)
{
valuePairs = new Dictionary<int, G_Index>();
directoryInfoCollection = Property.Models.Stateless.IResult.GetDirectoryInfoCollection(configuration, model, predictorModel, tuples.Key, nameof(G_Index), outputResolution, includeResizeGroup: false, includeModel: false, includePredictorModel: false, contentDescription: string.Empty, singletonDescription: "Unknown C", collectionDescription: string.Empty);
foreach (Tuple<string, A_Property> tuple in tuples.Value)
foreach (Tuple<string, Shared.Models.Property> tuple in tuples.Value)
{
fileInfo = new FileInfo(Path.Combine(directoryInfoCollection[0].Replace("<>", "{}"), string.Concat(Path.GetFileNameWithoutExtension(tuple.Item1), ".json")));
if (!fileInfo.Exists)
@ -191,7 +190,7 @@ public class G_Index : Shared.Models.Properties.IIndex, IIndex
valuePairs.Add(indexInfo.Index.Value, indexInfo);
}
else
neededTuples.Add(new Tuple<List<string>, string, A_Property>(new List<string> { tuple.Item1 }, fileInfo.FullName, tuple.Item2));
neededTuples.Add(new Tuple<List<string>, string, Shared.Models.Property>(new List<string> { tuple.Item1 }, fileInfo.FullName, tuple.Item2));
}
indexInfoTuples.Add(new Tuple<string, Dictionary<int, G_Index>>(tuples.Key, valuePairs));
}