Shortcut description and Sum overflow
This commit is contained in:
parent
b567a7f854
commit
569ee26c55
@ -234,7 +234,8 @@ public class MapLogic
|
||||
continue;
|
||||
try
|
||||
{
|
||||
windowsShortcut = new() { Path = saveContainer.ResizedFileHolder.FullName };
|
||||
string description = saveContainer.FaceFileHolder is not null ? saveContainer.FaceFileHolder.Name : string.Empty;
|
||||
windowsShortcut = new() { Path = saveContainer.ResizedFileHolder.FullName, Description = description };
|
||||
windowsShortcut.Save(saveContainer.ShortcutFile);
|
||||
windowsShortcut.Dispose();
|
||||
if (saveContainer.MakeAllHidden)
|
||||
|
@ -436,6 +436,22 @@ internal abstract class MapLogic
|
||||
return result;
|
||||
}
|
||||
|
||||
private static List<double> GetSumCollection(long[] collection)
|
||||
{
|
||||
List<double> results = new();
|
||||
long result = 0;
|
||||
foreach (long item in collection)
|
||||
{
|
||||
result += item;
|
||||
if (result > long.MaxValue)
|
||||
{
|
||||
results.Add(result);
|
||||
result = 0;
|
||||
}
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
private static void SetPersonKeysRanges(Configuration configuration, long ticks, Dictionary<long, List<long>> personKeyToMinimumDateTimeTicks, Dictionary<long, (long LCL, long Minimum, long Maximum, long UCL)> personKeyToRanges)
|
||||
{
|
||||
long lcl;
|
||||
@ -445,6 +461,7 @@ internal abstract class MapLogic
|
||||
double average;
|
||||
long[] collection;
|
||||
double standardDeviation;
|
||||
List<double> sumCollection;
|
||||
foreach (KeyValuePair<long, List<long>> keyValuePair in personKeyToMinimumDateTimeTicks)
|
||||
{
|
||||
minimum = keyValuePair.Value.Min();
|
||||
@ -457,7 +474,11 @@ internal abstract class MapLogic
|
||||
{
|
||||
collection = (from l in keyValuePair.Value select l - minimum).ToArray();
|
||||
maximum = collection.Max() + minimum;
|
||||
average = (collection.Sum() / collection.Length) + minimum;
|
||||
sumCollection = GetSumCollection(collection);
|
||||
if (sumCollection.Count < 2)
|
||||
average = (sumCollection.Sum() / collection.Length) + minimum;
|
||||
else
|
||||
average = (sumCollection.Sum() / collection.Length) + minimum;
|
||||
standardDeviation = GetStandardDeviation(collection, average);
|
||||
ucl = (long)(average + (standardDeviation * IMapLogic.Sigma));
|
||||
lcl = (long)(average - (standardDeviation * IMapLogic.Sigma));
|
||||
@ -660,8 +681,9 @@ internal abstract class MapLogic
|
||||
internal static SaveContainer GetDebugSaveContainer(string directory, SortingContainer sortingContainer, Mapping mapping)
|
||||
{
|
||||
SaveContainer result;
|
||||
FileHolder faceFileHolder = new($"C:/{sortingContainer.Sorting.Id}.{sortingContainer.Sorting.NormalizedPixelPercentage}");
|
||||
string shortcutFile = Path.Combine(directory, $"{sortingContainer.Mapping.MappingFromLocation.DeterministicHashCodeKey}{sortingContainer.Mapping.MappingFromItem.ImageFileHolder.ExtensionLowered}.debug.lnk");
|
||||
result = new(directory, mapping.MappingFromItem.ResizedFileHolder, shortcutFile);
|
||||
result = new(directory, faceFileHolder, mapping.MappingFromItem.ResizedFileHolder, shortcutFile);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -32,8 +32,8 @@ public class SaveContainer
|
||||
this(string.Empty, directory, null, null, null, false, null, string.Empty)
|
||||
{ }
|
||||
|
||||
public SaveContainer(string directory, FileHolder? resizedFileHolder, string shortcutFile) :
|
||||
this(string.Empty, directory, null, null, null, true, resizedFileHolder, shortcutFile)
|
||||
public SaveContainer(string directory, FileHolder? faceFileHolder, FileHolder? resizedFileHolder, string shortcutFile) :
|
||||
this(string.Empty, directory, faceFileHolder, null, null, true, resizedFileHolder, shortcutFile)
|
||||
{ }
|
||||
|
||||
public SaveContainer(string checkFile, string directory, FileHolder faceFileHolder) :
|
||||
|
Loading…
x
Reference in New Issue
Block a user