Don't use fixed char, fixes runtime issues on some versions of mono (https://bugzilla.xamarin.com/show_bug.cgi?id=60625)

This commit is contained in:
UnknownShadow200 2018-04-10 14:47:42 +10:00
parent 76f5192d16
commit 76dfe1aab1
4 changed files with 3 additions and 22 deletions

View File

@ -34,7 +34,7 @@ namespace MCGalaxy.Blocks.Extended {
string message = Messages.Rows[last]["Message"].ToString().Trim();
message = message.Replace("\\'", "\'");
message.Cp437ToUnicodeInPlace();
message = message.Cp437ToUnicode();
message = message.Replace("@p", p.name);
if (message != p.prevMsg || (alwaysRepeat || ServerConfig.RepeatMBs)) {

View File

@ -34,7 +34,7 @@ namespace MCGalaxy.Blocks.Extended {
DataRow row = Portals.Rows[last];
string map = row["ExitMap"].ToString();
map.Cp437ToUnicodeInPlace();
map = map.Cp437ToUnicode();
if (p.level.name != map) {
Level curLevel = p.level;

View File

@ -110,7 +110,7 @@ namespace MCGalaxy.DB {
data.LastLogin = ParseDate(row[ColumnLastLogin]);
data.Title = row[ColumnTitle].ToString().Trim();
data.Title.Cp437ToUnicodeInPlace();
data.Title = data.Title.Cp437ToUnicode();
data.TitleColor = ParseColor(row[ColumnTColor]);
data.Color = ParseColor(row[ColumnColor]);

View File

@ -60,25 +60,6 @@ namespace MCGalaxy {
return new String(c);
}
/// <summary> Modifies the characters of a string consisting of code page 437 indices into unicode. </summary>
public unsafe static void Cp437ToUnicodeInPlace(this string str) {
fixed (char* ptr = str) {
for (int i = 0; i < str.Length; i++) {
ptr[i] = Cp437ToUnicode(ptr[i]);
}
}
}
/// <summary> Modifies the characters of a unicode string into code page 437 indices. </summary>
/// <remarks> Unicode characters not in code page 437 are replaced with '?'. </remarks>
public static unsafe void UnicodeToCp437InPlace(this string str) {
fixed (char* ptr = str) {
for (int i = 0; i < str.Length; i++) {
ptr[i] = UnicodeToCp437(ptr[i]);
}
}
}
/// <summary> Converts a code page 437 indice into unicode. </summary>
public static char Cp437ToUnicode(this char c) {