Adds official .NET 5 support (#300)

This commit is contained in:
Kamron Batman 2020-11-07 13:26:27 -08:00 • committed by GitHub
parent c3289a20ab
commit 013f333898
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
39 changed files with 496 additions and 668 deletions

View file

@ -451,7 +451,7 @@ namespace Server.Commands
"ICloneable",
"Type"
};
public static bool DontLink( string name )
{
foreach( string dontLink in m_DontLink )
@ -2835,7 +2835,10 @@ namespace Server.Commands
if (v == 0)
{
v = GetNameFrom(aCtor, aProp, aMethod).CompareTo(GetNameFrom(bCtor, bProp, bMethod));
v = string.CompareOrdinal(
GetNameFrom(aCtor, aProp, aMethod),
GetNameFrom(bCtor, bProp, bMethod)
);
}
if (v == 0 && aCtor != null && bCtor != null)
@ -2879,11 +2882,7 @@ namespace Server.Commands
private class TypeComparer : IComparer<TypeInfo>
{
public int Compare(TypeInfo x, TypeInfo y) =>
x == null && y == null ? 0 :
x == null ? -1 :
y == null ? 1 :
x.TypeName.CompareTo(y.TypeName);
public int Compare(TypeInfo x, TypeInfo y) => string.CompareOrdinal(x?.TypeName, y?.TypeName);
}
private class TypeInfo
@ -2973,12 +2972,7 @@ namespace Server.Commands
var v = b?.AccessLevel.CompareTo(a?.AccessLevel) ?? 1;
if (v != 0)
{
return v;
}
return a?.Name.CompareTo(b?.Name) ?? 1;
return v != 0 ? v : string.CompareOrdinal(a?.Name, b?.Name);
}
}
}
@ -3034,12 +3028,7 @@ namespace Server.Commands
v = a?.Body.BodyID.CompareTo(b?.Body.BodyID) ?? 1;
}
if (v != 0)
{
return v;
}
return a?.Name.CompareTo(b?.Name) ?? 1;
return v != 0 ? v : string.CompareOrdinal(a?.Name, b?.Name);
}
}
}

View file

@ -135,7 +135,7 @@ namespace Server.Gumps
var t = types[i];
if ((typeofMobile.IsAssignableFrom(t) || typeofItem.IsAssignableFrom(t)) &&
t.Name.ToLower().IndexOf(match) >= 0 && !results.Contains(t))
t.Name.ToLower().IndexOf(match, StringComparison.Ordinal) >= 0 && !results.Contains(t))
{
var ctors = t.GetConstructors();
@ -236,7 +236,7 @@ namespace Server.Gumps
private class TypeNameComparer : IComparer<Type>
{
public int Compare(Type x, Type y) => x?.Name.CompareTo(y?.Name) ?? 1;
public int Compare(Type x, Type y) => string.CompareOrdinal(x?.Name, y?.Name);
}
public class InternalTarget : Target

View file

@ -265,34 +265,14 @@ namespace Server.Commands
public class CategorySorter : IComparer<CategoryEntry>
{
public int Compare(CategoryEntry x, CategoryEntry y)
{
var a = x?.Title;
var b = y?.Title;
return a switch
{
null when b == null => 0,
null => 1,
_ => a.CompareTo(b)
};
}
public int Compare(CategoryEntry x, CategoryEntry y) =>
string.CompareOrdinal(x?.Title, y?.Title);
}
public class CategoryTypeSorter : IComparer<CategoryTypeEntry>
{
public int Compare(CategoryTypeEntry x, CategoryTypeEntry y)
{
var a = x?.Type.Name;
var b = y?.Type.Name;
return a switch
{
null when b == null => 0,
null => 1,
_ => a.CompareTo(b)
};
}
public int Compare(CategoryTypeEntry x, CategoryTypeEntry y) =>
string.CompareOrdinal(x?.Type.Name, y?.Type.Name);
}
public class CategoryTypeEntry

View file

@ -192,7 +192,7 @@ namespace Server.Commands
/*if (( flags & ExpandFlag.TempFlag ) != 0)
++countTable[5];
if (( flags & ExpandFlag.SaveFlag ) != 0)
++countTable[6];*/
@ -390,7 +390,7 @@ namespace Server.Commands
var v = -aCount.CompareTo(bCount);
return v != 0 ? v : x.Key.FullName?.CompareTo(y.Key.FullName) ?? -1;
return v != 0 ? v : string.CompareOrdinal(x.Key.FullName, y.Key.FullName);
}
}
@ -403,7 +403,7 @@ namespace Server.Commands
var v = -aCount.CompareTo(bCount);
return v != 0 ? v : x.Key.FullName?.CompareTo(y.Key.FullName) ?? 1;
return v != 0 ? v : string.CompareOrdinal(x.Key.FullName, y.Key.FullName);
}
}
}