Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Data/BniFileParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ private unsafe void Parse(Stream str)
throw new InvalidDataException("Only 24-bit TGA is supported.");
StartDescriptor descriptor = (StartDescriptor)br.ReadByte();
byte[] info_bytes = br.ReadBytes(infoLength);
Trace.WriteLine(Encoding.ASCII.GetString(info_bytes), "BNI header: information");
Trace.WriteLine(Encoding.Latin1.GetString(info_bytes), "BNI header: information");

int numberOfPixels = width * height;

Expand Down
2 changes: 1 addition & 1 deletion src/Data/BniIcon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ internal BniIcon(Image img, int flags, uint[] softwareList)
temp = code[1];
code[1] = code[2];
code[2] = temp;
m_softwareList[i] = Encoding.ASCII.GetString(code);
m_softwareList[i] = Encoding.Latin1.GetString(code);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/Data/MpqArchive.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
/// <summary>
/// Represents an MPQ archive.
/// </summary>
[SecurityPermission(SecurityAction.Demand, UnmanagedCode = true)]

Check warning on line 33 in src/Data/MpqArchive.cs

View workflow job for this annotation

GitHub Actions / Build MBNCSUtil

'SecurityAction' is obsolete: 'Code Access Security is not supported or honored by the runtime.' (https://aka.ms/dotnet-warnings/SYSLIB0003)

Check warning on line 33 in src/Data/MpqArchive.cs

View workflow job for this annotation

GitHub Actions / Build MBNCSUtil

'SecurityPermissionAttribute' is obsolete: 'Code Access Security is not supported or honored by the runtime.' (https://aka.ms/dotnet-warnings/SYSLIB0003)
public class MpqArchive : IDisposable
{
private IntPtr m_hMPQ;
Expand Down Expand Up @@ -200,7 +200,7 @@
string list = string.Empty;
using (MpqFileStream mfs = OpenFile("(listfile)"))
{
StreamReader sr = new StreamReader(mfs, Encoding.ASCII);
StreamReader sr = new StreamReader(mfs, Encoding.Latin1);
list = sr.ReadToEnd();
sr.Close();
}
Expand Down
8 changes: 4 additions & 4 deletions src/DataBuffer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ public void InsertUInt64Array(ulong[] l)
/// <exception cref="ArgumentNullException">Either <c>str</c> or <c>enc</c> were <b>null</b> (<b>Nothing</b> in Visual Basic).</exception>
public void InsertCString(string str)
{
InsertCString(str, Encoding.ASCII);
InsertCString(str, Encoding.Latin1);
}

/// <summary>
Expand Down Expand Up @@ -625,7 +625,7 @@ public void InsertCString(string str, Encoding enc)
/// <exception cref="ArgumentException">The length of <c>str</c> was too great; maximum string length is 255 characters.</exception>
public void InsertPascalString(string str)
{
InsertPascalString(str, Encoding.ASCII);
InsertPascalString(str, Encoding.Latin1);
}

/// <summary>
Expand Down Expand Up @@ -662,7 +662,7 @@ public void InsertPascalString(string str, Encoding enc)
/// <exception cref="ArgumentException">The length of <c>str</c> was too great; maximum string length is 65,535 characters.</exception>
public void InsertWidePascalString(string str)
{
InsertWidePascalString(str, Encoding.ASCII);
InsertWidePascalString(str, Encoding.Latin1);
}

/// <summary>
Expand Down Expand Up @@ -732,7 +732,7 @@ public void InsertDwordString(string str, byte padding)
for (int i = 0; i < numNulls; i++)
Insert(padding);
}
byte[] bar = Encoding.ASCII.GetBytes(str);
byte[] bar = Encoding.Latin1.GetBytes(str);
for (int i = bar.Length - 1; i >= 0; i--)
Insert(bar[i]);
}
Expand Down
2 changes: 1 addition & 1 deletion src/DataFormatter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ namespace MBNCSUtil
/// <example>
/// <para>This example demonstrates how the formatter prints out binary data.</para>
/// <code language="c#">
/// DataFormatter.WriteToConsole(XSha1.CalculateHash(Encoding.ASCII.GetBytes("password")));
/// DataFormatter.WriteToConsole(XSha1.CalculateHash(Encoding.Latin1.GetBytes("password")));
/// </code>
/// <para><b>Output:</b></para>
/// <code>
Expand Down
8 changes: 4 additions & 4 deletions src/DataReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ public string PeekDwordString(byte padding)
if (idx0 == -1)
idx0 = length;

string result = Encoding.ASCII.GetString(b, 0, idx0);
string result = Encoding.Latin1.GetString(b, 0, idx0);
return result;
}

Expand All @@ -380,7 +380,7 @@ public string ReadDwordString(byte padding)
/// <returns>The next C-style string.</returns>
public string ReadCString()
{
return ReadCString(Encoding.ASCII);
return ReadCString(Encoding.Latin1);
}

/// <summary>
Expand All @@ -399,7 +399,7 @@ public string ReadCString(Encoding enc)
/// <returns>The next pascal-style string.</returns>
public string ReadPascalString()
{
return ReadPascalString(Encoding.ASCII);
return ReadPascalString(Encoding.Latin1);
}

/// <summary>
Expand All @@ -421,7 +421,7 @@ public string ReadPascalString(Encoding enc)
/// <returns>The next wide-pascal-style string.</returns>
public string ReadWidePascalString()
{
return ReadWidePascalString(Encoding.ASCII);
return ReadWidePascalString(Encoding.Latin1);
}

/// <summary>
Expand Down
6 changes: 3 additions & 3 deletions src/NLS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public sealed class NLS
public NLS(string Username, string Password)
{
userName = Username;
userNameAscii = Encoding.ASCII.GetBytes(userName);
userNameAscii = Encoding.Latin1.GetBytes(userName);
password = Password;

byte[] rand_a = new byte[32];
Expand Down Expand Up @@ -435,7 +435,7 @@ private void CalculateVerifier(byte[] serverSalt)
userName.ToUpper(CultureInfo.InvariantCulture), ":", password.ToUpper(CultureInfo.InvariantCulture)
);

byte[] unpw_bytes = Encoding.ASCII.GetBytes(unpwexpr);
byte[] unpw_bytes = Encoding.Latin1.GetBytes(unpwexpr);
byte[] hash1 = s_sha.ComputeHash(unpw_bytes);

byte[] unpw_salt_bytes = new byte[serverSalt.Length + hash1.Length]; // should be 52
Expand Down Expand Up @@ -503,7 +503,7 @@ private void CalculateM1(byte[] saltFromServer, byte[] issuedServerKey)
MemoryStream ms = new MemoryStream(40 + saltFromServer.Length + A.GetBytes().Length + issuedServerKey.Length + local_k.Length);
BinaryWriter bw = new BinaryWriter(ms);
bw.Write(g_xor_n.GetBytes());
bw.Write(s_sha.ComputeHash(Encoding.ASCII.GetBytes(userName.ToUpper(CultureInfo.InvariantCulture))));
bw.Write(s_sha.ComputeHash(Encoding.Latin1.GetBytes(userName.ToUpper(CultureInfo.InvariantCulture))));
bw.Write(saltFromServer);
bw.Write(EnsureArrayLength(A.GetBytes(), 32));
#if DEBUG
Expand Down
6 changes: 3 additions & 3 deletions src/OldAuth.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public static byte[] HashData(byte[] data)
/// <returns>A 20-byte buffer containing the hash value.</returns>
public static byte[] HashPassword(string data)
{
return HashData(Encoding.ASCII.GetBytes(data));
return HashData(Encoding.Latin1.GetBytes(data));
}

/// <summary>
Expand Down Expand Up @@ -96,7 +96,7 @@ public static byte[] DoubleHashData(byte[] data,
public static byte[] DoubleHashPassword(string data,
int clientToken, int serverToken)
{
return DoubleHashData(Encoding.ASCII.GetBytes(data),
return DoubleHashData(Encoding.Latin1.GetBytes(data),
unchecked((uint)clientToken),
unchecked((uint)serverToken));
}
Expand All @@ -116,7 +116,7 @@ public static byte[] DoubleHashPassword(string data,
public static byte[] DoubleHashPassword(string data,
uint clientToken, uint serverToken)
{
return DoubleHashData(Encoding.ASCII.GetBytes(data),
return DoubleHashData(Encoding.Latin1.GetBytes(data),
clientToken, serverToken);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Util/LockdownCrev.cs
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ public static unsafe bool CheckRevision(string file1, string file2, string file3
internal unsafe static int GetDigit(string filename)
{
int digit_1, digit_2;
byte[] filenameBytes = Encoding.ASCII.GetBytes(filename);
byte[] filenameBytes = Encoding.Latin1.GetBytes(filename);
fixed (byte* pdigit_ptr = filenameBytes)
{
byte* digit_ptr = (byte*)(pdigit_ptr + filename.Length - 4);
Expand Down
Loading