mirror of
https://github.com/TalAloni/SMBLibrary.git
synced 2025-05-21 11:49:25 +02:00
Updated Utilities
This commit is contained in:
parent
153abe3d27
commit
67198dd05b
1 changed files with 18 additions and 0 deletions
|
@ -115,5 +115,23 @@ namespace Utilities
|
||||||
ByteUtils.CopyStream(stream, temp);
|
ByteUtils.CopyStream(stream, temp);
|
||||||
return temp.ToArray();
|
return temp.ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static string ReadAnsiString(Stream stream, int length)
|
||||||
|
{
|
||||||
|
byte[] buffer = ReadBytes(stream, length);
|
||||||
|
return ASCIIEncoding.GetEncoding(28591).GetString(buffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string ReadNullTerminatedAnsiString(Stream stream)
|
||||||
|
{
|
||||||
|
StringBuilder builder = new StringBuilder();
|
||||||
|
char c = (char)stream.ReadByte();
|
||||||
|
while (c != '\0')
|
||||||
|
{
|
||||||
|
builder.Append(c);
|
||||||
|
c = (char)stream.ReadByte();
|
||||||
|
}
|
||||||
|
return builder.ToString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue