* move stuff out into file transfer manager * obnoxious unsupported version text, adjustments to filetransfermanager * add back file upload transfer progress * restructure code * cleanup some more stuff I guess * downloadids by playername * individual anim/sound bs * fix migration stuff, finalize impl of individual sound/anim pause * fixes with logging stuff * move download manager to transient * rework dl ui first iteration * some refactoring and cleanup * more code cleanup * refactoring * switch to hostbuilder * some more rework I guess * more refactoring * clean up mediator calls and disposal * fun code cleanup * push error message when log level is set to anything but information in non-debug builds * remove notificationservice * move message to after login * add download bars to gameworld * fixes download progress bar * set gpose ui min and max size * remove unnecessary usings * adjustments to reconnection logic * add options to set visible/offline groups visibility * add impl of uploading display, transfer list in settings ui * attempt to fix issues with server selection * add back download status to compact ui * make dl bar fixed size based * some fixes for upload/download handling * adjust text from Syncing back to Uploading --------- Co-authored-by: rootdarkarchon <root.darkarchon@outlook.com> Co-authored-by: Stanley Dimant <stanley.dimant@varian.com>
47 lines
1.4 KiB
C#
47 lines
1.4 KiB
C#
namespace MareSynchronos.PlayerData.Data;
|
|
|
|
public class FileReplacementComparer : IEqualityComparer<FileReplacement>
|
|
{
|
|
private static readonly FileReplacementComparer _instance = new();
|
|
|
|
private FileReplacementComparer()
|
|
{ }
|
|
|
|
public static FileReplacementComparer Instance => _instance;
|
|
|
|
public bool Equals(FileReplacement? x, FileReplacement? y)
|
|
{
|
|
if (x == null || y == null) return false;
|
|
return x.ResolvedPath.Equals(y.ResolvedPath) && CompareLists(x.GamePaths, y.GamePaths);
|
|
}
|
|
|
|
public int GetHashCode(FileReplacement obj)
|
|
{
|
|
return HashCode.Combine(obj.ResolvedPath.GetHashCode(StringComparison.OrdinalIgnoreCase), GetOrderIndependentHashCode(obj.GamePaths));
|
|
}
|
|
|
|
private static bool CompareLists(HashSet<string> list1, HashSet<string> list2)
|
|
{
|
|
if (list1.Count != list2.Count)
|
|
return false;
|
|
|
|
for (int i = 0; i < list1.Count; i++)
|
|
{
|
|
if (!string.Equals(list1.ElementAt(i), list2.ElementAt(i), StringComparison.OrdinalIgnoreCase))
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
private static int GetOrderIndependentHashCode<T>(IEnumerable<T> source)
|
|
{
|
|
int hash = 0;
|
|
foreach (T element in source)
|
|
{
|
|
hash = unchecked(hash +
|
|
EqualityComparer<T>.Default.GetHashCode(element));
|
|
}
|
|
return hash;
|
|
}
|
|
} |