本文整理汇总了C#中BinaryReader.ReadUInt64方法的典型用法代码示例。如果您正苦于以下问题:C# BinaryReader.ReadUInt64方法的具体用法?C# BinaryReader.ReadUInt64怎么用?C# BinaryReader.ReadUInt64使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BinaryReader
的用法示例。
在下文中一共展示了BinaryReader.ReadUInt64方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Load
public static GameObject Load(string ModelName)
{
if (ModelsInRAM.ContainsKey(ModelName))
return Object.Instantiate(ModelsInRAM[ModelName]);
if (!File.Exists(Configuration.GameResources + "\\" + ModelName + ".4ds"))
throw new FileNotFoundException("Модель не найдена. Проверьте правильность пути. ");
BinReader = new BinaryReader(File.OpenRead(Configuration.GameResources + "\\" + ModelName + ".4ds"));
if (new string(BinReader.ReadChars(4)) != "4DS\0")
throw new FileLoadException("Неверная сигнатура файла.");
if (BinReader.ReadUInt16() != (ushort)FileVersion.VERSION_MAFIA)
throw new FileLoadException("Данная версия модели не поддерживается.");
ulong TimeStamp = BinReader.ReadUInt64();
Model = new GameObject(Path.GetFileName(ModelName));
ReadMaterials(BinReader.ReadUInt16());
ReadNodes(BinReader.ReadUInt16());
BinReader.BaseStream.Dispose();
ModelsInRAM.Add(ModelName, Model);
return Model;
}
示例2: SetExpertMode
private static void SetExpertMode(string source, string dest, bool expertMode)
{
BinaryReader reader = new BinaryReader(new FileStream(source, FileMode.Open));
int version = reader.ReadInt32();
if (version < 149) {
MessageBox.Show("Error: Outdated terraria version");
return;
}
ulong magic = reader.ReadUInt64();
if ((magic & 72057594037927935uL) != 27981915666277746uL) {
MessageBox.Show("Error: Invalid header");
return;
}
// Skip other file metadata...
reader.ReadBytes(12);
int positionCount = reader.ReadInt16();
int afterMetadataPos = reader.ReadInt32();
int afterHeaderPos = reader.ReadInt32();
// Skip positions...
reader.ReadBytes((positionCount - 2) * 4);
// Skip frame importance...
reader.ReadBytes(reader.ReadInt16() / 8 + 1);
if (reader.BaseStream.Position != afterMetadataPos) {
MessageBox.Show("After Metadata Position Mismatch: expected " +
afterMetadataPos + ", was " + reader.BaseStream.Position);
return;
}
// Skip the first part of the header...
reader.ReadString();
reader.ReadInt32();
reader.ReadInt32();
reader.ReadInt32();
reader.ReadInt32();
reader.ReadInt32();
reader.ReadInt32();
reader.ReadInt32();
// Get the offset...
long expertModeFlagOffset = reader.BaseStream.Position;
bool wasExpertMode = reader.ReadBoolean();
reader.Dispose();
// Notify the user if the world is changed...
if (wasExpertMode == expertMode) {
MessageBox.Show(expertMode ? "World was already Expert Mode." : "World was already not Expert Mode.");
return;
}
BinaryWriter writer = new BinaryWriter(new FileStream(dest, FileMode.Open));
writer.BaseStream.Position = expertModeFlagOffset;
writer.Write(expertMode);
writer.Dispose();
MessageBox.Show(expertMode ? "World is now Expert Mode!" : "World is no longer Expert Mode!");
}
示例3: ConnInit
// Do DH64 key exchange and return a RC4 writer
private static BinaryWriter ConnInit(BinaryReader r) {
ulong privateKey;
ulong publicKey;
dh64.KeyPair(out privateKey, out publicKey);
Console.WriteLine("client public key: {0}", publicKey);
new BinaryWriter(r.BaseStream).Write(publicKey);
ulong srvPublicKey = r.ReadUInt64();
Console.WriteLine("server public key: {0}", srvPublicKey);
ulong secret = dh64.Secret(privateKey, srvPublicKey);
Console.WriteLine("secret: {0}", secret);
byte[] key;
using (MemoryStream ms = new MemoryStream()) {
new BinaryWriter(ms).Write(secret);
key = ms.ToArray();
}
Console.WriteLine("key: {0}", BitConverter.ToString(key).Replace("-", "").ToLower());
return new BinaryWriter(
new RC4Stream(r.BaseStream, key)
);
}
示例4: Initialize
public static unsafe void Initialize()
{
Module mod = typeof(AntiTamperJIT).Module;
IntPtr modPtr = Marshal.GetHINSTANCE(mod);
s = (ulong)modPtr.ToInt64();
if (modPtr == (IntPtr)(-1)) Environment.FailFast(null);
string fq = mod.FullyQualifiedName;
bool mapped = fq[0] != '<'; //<Unknown>
Stream stream;
stream = new UnmanagedMemoryStream((byte*)modPtr.ToPointer(), 0xfffffff, 0xfffffff, FileAccess.ReadWrite);
byte[] buff;
int checkSumOffset;
ulong checkSum;
byte[] iv;
byte[] dats;
int sn;
int snLen;
using (BinaryReader rdr = new BinaryReader(stream))
{
stream.Seek(0x3c, SeekOrigin.Begin);
uint offset = rdr.ReadUInt32();
stream.Seek(offset, SeekOrigin.Begin);
stream.Seek(0x6, SeekOrigin.Current);
uint sections = rdr.ReadUInt16();
stream.Seek(0xC, SeekOrigin.Current);
uint optSize = rdr.ReadUInt16();
stream.Seek(offset = offset + 0x18, SeekOrigin.Begin); //Optional hdr
bool pe32 = (rdr.ReadUInt16() == 0x010b);
stream.Seek(0x3e, SeekOrigin.Current);
checkSumOffset = (int)stream.Position;
uint md = rdr.ReadUInt32() ^ (uint)Mutation.Key0I;
if (md == (uint)Mutation.Key0I)
return;
stream.Seek(offset = offset + optSize, SeekOrigin.Begin); //sect hdr
uint datLoc = 0;
for (int i = 0; i < sections; i++)
{
int h = 0;
for (int j = 0; j < 8; j++)
{
byte chr = rdr.ReadByte();
if (chr != 0) h += chr;
}
uint vSize = rdr.ReadUInt32();
uint vLoc = rdr.ReadUInt32();
uint rSize = rdr.ReadUInt32();
uint rLoc = rdr.ReadUInt32();
if (h == Mutation.Key1I)
datLoc = mapped ? vLoc : rLoc;
if (!mapped && md > vLoc && md < vLoc + vSize)
md = md - vLoc + rLoc;
if (mapped && vSize + vLoc > l) l = vSize + vLoc;
else if (rSize + rLoc > l) l = rSize + rLoc;
stream.Seek(0x10, SeekOrigin.Current);
}
stream.Seek(md, SeekOrigin.Begin);
using (MemoryStream str = new MemoryStream())
{
stream.Position += 12;
stream.Position += rdr.ReadUInt32() + 4;
stream.Position += 2;
ushort streams = rdr.ReadUInt16();
for (int i = 0; i < streams; i++)
{
uint pos = rdr.ReadUInt32() + md;
uint size = rdr.ReadUInt32();
int c = 0;
while (rdr.ReadByte() != 0) c++;
long ori = stream.Position += (((c + 1) + 3) & ~3) - (c + 1);
stream.Position = pos;
str.Write(rdr.ReadBytes((int)size), 0, (int)size);
stream.Position = ori;
}
buff = str.ToArray();
}
stream.Seek(datLoc, SeekOrigin.Begin);
checkSum = rdr.ReadUInt64() ^ (ulong)Mutation.Key0L;
sn = rdr.ReadInt32();
snLen = rdr.ReadInt32();
iv = rdr.ReadBytes(rdr.ReadInt32() ^ Mutation.Key2I);
dats = rdr.ReadBytes(rdr.ReadInt32() ^ Mutation.Key3I);
}
byte[] md5 = MD5.Create().ComputeHash(buff);
ulong tCs = BitConverter.ToUInt64(md5, 0) ^ BitConverter.ToUInt64(md5, 8);
ulong* msg = stackalloc ulong[2];
msg[0] = 0x6574707572726f43; //Corrupte
msg[1] = 0x0021656c69662064; //d file!.
//.........这里部分代码省略.........
示例5: Initalize
public static unsafe void Initalize()
{
Module mod = typeof(AntiTamperMem).Module;
IntPtr modPtr = Marshal.GetHINSTANCE(mod);
if (modPtr == (IntPtr)(-1)) Environment.FailFast("Module error");
bool mapped = mod.FullyQualifiedName[0] != '<'; //<Unknown>
Stream stream;
stream = new UnmanagedMemoryStream((byte*)modPtr.ToPointer(), 0xfffffff, 0xfffffff, FileAccess.ReadWrite);
byte[] buff;
int checkSumOffset;
ulong checkSum;
byte[] iv;
byte[] dats;
int sn;
int snLen;
using (BinaryReader rdr = new BinaryReader(stream))
{
stream.Seek(0x3c, SeekOrigin.Begin);
uint offset = rdr.ReadUInt32();
stream.Seek(offset, SeekOrigin.Begin);
stream.Seek(0x6, SeekOrigin.Current);
uint sections = rdr.ReadUInt16();
stream.Seek(0xC, SeekOrigin.Current);
uint optSize = rdr.ReadUInt16();
stream.Seek(offset = offset + 0x18, SeekOrigin.Begin); //Optional hdr
bool pe32 = (rdr.ReadUInt16() == 0x010b);
stream.Seek(0x3e, SeekOrigin.Current);
checkSumOffset = (int)stream.Position;
uint md = rdr.ReadUInt32() ^ (uint)Mutation.Key0I;
if (md == (uint)Mutation.Key0I)
Environment.FailFast("Broken file");
stream.Seek(offset = offset + optSize, SeekOrigin.Begin); //sect hdr
uint datLoc = 0;
for (int i = 0; i < sections; i++)
{
int h = 0;
for (int j = 0; j < 8; j++)
{
byte chr = rdr.ReadByte();
if (chr != 0) h += chr;
}
uint vSize = rdr.ReadUInt32();
uint vLoc = rdr.ReadUInt32();
uint rSize = rdr.ReadUInt32();
uint rLoc = rdr.ReadUInt32();
if (h == Mutation.Key1I)
datLoc = mapped ? vLoc : rLoc;
if (!mapped && md > vLoc && md < vLoc + vSize)
md = md - vLoc + rLoc;
stream.Seek(0x10, SeekOrigin.Current);
}
stream.Seek(md, SeekOrigin.Begin);
using (MemoryStream str = new MemoryStream())
{
stream.Position += 12;
stream.Position += rdr.ReadUInt32() + 4;
stream.Position += 2;
ushort streams = rdr.ReadUInt16();
for (int i = 0; i < streams; i++)
{
uint pos = rdr.ReadUInt32() + md;
uint size = rdr.ReadUInt32();
int c = 0;
while (rdr.ReadByte() != 0) c++;
long ori = stream.Position += (((c + 1) + 3) & ~3) - (c + 1);
stream.Position = pos;
str.Write(rdr.ReadBytes((int)size), 0, (int)size);
stream.Position = ori;
}
buff = str.ToArray();
}
stream.Seek(datLoc, SeekOrigin.Begin);
checkSum = rdr.ReadUInt64() ^ (ulong)Mutation.Key0L;
sn = rdr.ReadInt32();
snLen = rdr.ReadInt32();
iv = rdr.ReadBytes(rdr.ReadInt32() ^ Mutation.Key2I);
dats = rdr.ReadBytes(rdr.ReadInt32() ^ Mutation.Key3I);
}
byte[] md5 = MD5.Create().ComputeHash(buff);
ulong tCs = BitConverter.ToUInt64(md5, 0) ^ BitConverter.ToUInt64(md5, 8);
if (tCs != checkSum)
Environment.FailFast("Broken file");
byte[] b = Decrypt(buff, iv, dats);
Buffer.BlockCopy(new byte[buff.Length], 0, buff, 0, buff.Length);
if (b[0] != 0xd6 || b[1] != 0x6f)
Environment.FailFast("Broken file");
byte[] tB = new byte[b.Length - 2];
Buffer.BlockCopy(b, 2, tB, 0, tB.Length);
using (BinaryReader rdr = new BinaryReader(new MemoryStream(tB)))
//.........这里部分代码省略.........
示例6: runTest
//.........这里部分代码省略.........
} catch (ObjectDisposedException iexc) {
printinfo( "Info_0198v! Caught expected exception, exc=="+iexc.Message);
} catch (Exception exc) {
iCountErrors++;
printerr( "Error_10796! Incorrect exception thrown, exc=="+exc.ToString());
}
iCountTestcases++;
try {
sr2.ReadInt64();
iCountErrors++;
printerr( "Error_967gb! Expected exception not thrown");
} catch (ObjectDisposedException iexc) {
printinfo( "Info_10860! Caught expected exception, exc=="+iexc.Message);
} catch (Exception exc) {
iCountErrors++;
printerr( "Error_1067b! Incorrect exception thrown, exc=="+exc.ToString());
}
iCountTestcases++;
try {
sr2.ReadSByte();
iCountErrors++;
printerr( "Error_16908! Expected exception not thrown");
} catch (ObjectDisposedException iexc) {
printinfo( "Info_1768b! Caught expected exception, exc=="+iexc.Message);
} catch (Exception exc) {
iCountErrors++;
printerr( "Error_1769g! Incorrect exception thrown, exc=="+exc.ToString());
}
iCountTestcases++;
try {
sr2.ReadString();
iCountErrors++;
printerr( "Error_t5087! Expected exception not thrown");
} catch (ObjectDisposedException iexc) {
printinfo( "Info_35987! Caught expected exception, exc=="+iexc.Message);
} catch (Exception exc) {
iCountErrors++;
printerr( "Error_t87bb! Incorrect exception thrown, exc=="+exc.ToString());
}
iCountTestcases++;
try {
sr2.ReadSingle();
iCountErrors++;
printerr( "Error_5698v! Expected exception not thrown");
} catch (ObjectDisposedException iexc) {
printinfo( "Info_6987y! Caught expected exception, exc=="+iexc.Message);
} catch (Exception exc) {
iCountErrors++;
printerr( "Error_298xa! Incorrect exception thrown, exc=="+exc.ToString());
}
iCountTestcases++;
try {
sr2.ReadUInt16();
iCountErrors++;
printerr( "Error_58743! Expected exception not thrown");
} catch (ObjectDisposedException iexc) {
printinfo( "Info_287cc! Caught expected exception, exc=="+iexc.Message);
} catch (Exception exc) {
iCountErrors++;
printerr( "Error_80954! Incorrect exception thrown, exc=="+exc.ToString());
}
iCountTestcases++;
try {
sr2.ReadUInt32();
iCountErrors++;
printerr( "Error_58074! Expected exception not thrown");
} catch (ObjectDisposedException iexc) {
printinfo( "Info_1509t! Caught expected exception, exc=="+iexc.Message);
} catch (Exception exc) {
iCountErrors++;
printerr( "Error_298cc! Incorrect exception thrown, exc=="+exc.ToString());
}
iCountTestcases++;
try {
sr2.ReadUInt64();
iCountErrors++;
printerr( "Error_78884! Expected exception not thrown");
} catch (ObjectDisposedException iexc) {
printinfo( "Info_208cx! Caught expected exception, exc=="+iexc.Message);
} catch (Exception exc) {
iCountErrors++;
printerr( "Error_28908! Incorrect exception thrown, exc=="+exc.ToString());
}
if(File.Exists("Co5633Test.tmp"))
File.Delete("Co5633Test.tmp");
} catch (Exception exc_general ) {
++iCountErrors;
Console.WriteLine (s_strTFAbbrev + " : Error Err_8888yyy! strLoc=="+ strLoc +", exc_general=="+exc_general.ToString());
}
if ( iCountErrors == 0 )
{
Console.WriteLine( "paSs. "+s_strTFName+" ,iCountTestcases=="+iCountTestcases.ToString());
return true;
}
else
{
Console.WriteLine("FAiL! "+s_strTFName+" ,iCountErrors=="+iCountErrors.ToString()+" , BugNums?: "+s_strActiveBugNums );
return false;
}
}
示例7: loadULongArray
public static ulong[] loadULongArray(string filename)
{
if(!EasySave.fileExists(filename))
{
Debug.LogError("Could not load file: File does not exist.");
return null;
}
BinaryReader br = new BinaryReader(new MemoryStream(getBytesFromFile(filename)));
try
{
int noOfItems = br.ReadInt32();
ulong[] result = new ulong[noOfItems];
for(int i=0;i<noOfItems;i++)
{
result[i] = br.ReadUInt64();
}
br.Close();
return result;
}
catch(Exception e)
{
Debug.LogError("Could not load file: File specified is not in the correct format.\nDetails: "+e.Message);
}
return null;
}
示例8: ClientAuction
public ClientAuction(BinaryReader reader)
{
AuctionID = reader.ReadUInt64();
Item = new UserItem(reader);
Seller = reader.ReadString();
Price = reader.ReadUInt32();
ConsignmentDate = DateTime.FromBinary(reader.ReadInt64());
}
示例9: StreamTest
public static async Task StreamTest(Stream stream, Boolean fSuppress)
{
string strValue;
int iValue;
//[] We will first use the stream's 2 writing methods
int iLength = 1 << 10;
stream.Seek(0, SeekOrigin.Begin);
for (int i = 0; i < iLength; i++)
stream.WriteByte((byte)i);
byte[] btArr = new byte[iLength];
for (int i = 0; i < iLength; i++)
btArr[i] = (byte)i;
stream.Write(btArr, 0, iLength);
//we will write many things here using a binary writer
BinaryWriter bw1 = new BinaryWriter(stream);
bw1.Write(false);
bw1.Write(true);
for (int i = 0; i < 10; i++)
{
bw1.Write((byte)i);
bw1.Write((sbyte)i);
bw1.Write((short)i);
bw1.Write((char)i);
bw1.Write((UInt16)i);
bw1.Write(i);
bw1.Write((uint)i);
bw1.Write((Int64)i);
bw1.Write((ulong)i);
bw1.Write((float)i);
bw1.Write((double)i);
}
//Some strings, chars and Bytes
char[] chArr = new char[iLength];
for (int i = 0; i < iLength; i++)
chArr[i] = (char)i;
bw1.Write(chArr);
bw1.Write(chArr, 512, 512);
bw1.Write(new string(chArr));
bw1.Write(new string(chArr));
//[] we will now read
stream.Seek(0, SeekOrigin.Begin);
for (int i = 0; i < iLength; i++)
{
Assert.Equal(i % 256, stream.ReadByte());
}
btArr = new byte[iLength];
stream.Read(btArr, 0, iLength);
for (int i = 0; i < iLength; i++)
{
Assert.Equal((byte)i, btArr[i]);
}
//Now, for the binary reader
BinaryReader br1 = new BinaryReader(stream);
Assert.False(br1.ReadBoolean());
Assert.True(br1.ReadBoolean());
for (int i = 0; i < 10; i++)
{
Assert.Equal( (byte)i, br1.ReadByte());
Assert.Equal((sbyte)i, br1.ReadSByte());
Assert.Equal((short)i, br1.ReadInt16());
Assert.Equal((char)i, br1.ReadChar());
Assert.Equal((UInt16)i, br1.ReadUInt16());
Assert.Equal(i, br1.ReadInt32());
Assert.Equal((uint)i, br1.ReadUInt32());
Assert.Equal((Int64)i, br1.ReadInt64());
Assert.Equal((ulong)i, br1.ReadUInt64());
Assert.Equal((float)i, br1.ReadSingle());
Assert.Equal((double)i, br1.ReadDouble());
}
chArr = br1.ReadChars(iLength);
for (int i = 0; i < iLength; i++)
{
Assert.Equal((char)i, chArr[i]);
}
chArr = new char[512];
chArr = br1.ReadChars(iLength / 2);
for (int i = 0; i < iLength / 2; i++)
{
Assert.Equal((char)(iLength / 2 + i), chArr[i]);
}
chArr = new char[iLength];
for (int i = 0; i < iLength; i++)
//.........这里部分代码省略.........
示例10: ResourceKey
public ResourceKey(Stream input, uint order)
{
BinaryReader reader = new BinaryReader(input);
this.order = order;
switch (order)
{
case 2: // ITG
this.instanceId = reader.ReadUInt64();
this.typeId = reader.ReadUInt32();
this.groupId = reader.ReadUInt32();
break;
case 1: // IGT
this.instanceId = reader.ReadUInt64();
this.groupId = reader.ReadUInt32();
this.typeId = reader.ReadUInt32();
break;
case 0: // TGI
default:
this.typeId = reader.ReadUInt32();
this.groupId = reader.ReadUInt32();
this.instanceId = reader.ReadUInt64();
break;
}
reader = null;
}
示例11: ReadFixed64
public static ulong ReadFixed64(BinaryReader reader)
{
return reader.ReadUInt64();
}
示例12: UserItem
public UserItem(BinaryReader reader, int version = int.MaxValue)
{
UniqueID = reader.ReadUInt64();
ItemIndex = reader.ReadInt32();
CurrentDura = reader.ReadUInt16();
MaxDura = reader.ReadUInt16();
Count = reader.ReadUInt32();
AC = reader.ReadByte();
MAC = reader.ReadByte();
DC = reader.ReadByte();
MC = reader.ReadByte();
SC = reader.ReadByte();
Accuracy = reader.ReadByte();
Agility = reader.ReadByte();
HP = reader.ReadByte();
MP = reader.ReadByte();
AttackSpeed = reader.ReadSByte();
Luck = reader.ReadSByte();
if (version <= 19) return;
SoulBoundId = reader.ReadInt32();
byte Bools = reader.ReadByte();
Identified = (Bools & 0x01) == 0x01;
Cursed = (Bools & 0x02) == 0x02;
Strong = reader.ReadByte();
MagicResist = reader.ReadByte();
PoisonResist = reader.ReadByte();
HealthRecovery = reader.ReadByte();
ManaRecovery = reader.ReadByte();
PoisonRecovery = reader.ReadByte();
CriticalRate = reader.ReadByte();
CriticalDamage = reader.ReadByte();
Freezing = reader.ReadByte();
PoisonAttack = reader.ReadByte();
if (version <= 22) return;
}
示例13: TryReadBlock
public static bool TryReadBlock(BinaryReader reader, out Zip64EndOfCentralDirectoryRecord zip64EOCDRecord)
{
zip64EOCDRecord = new Zip64EndOfCentralDirectoryRecord();
if (reader.ReadUInt32() != SignatureConstant)
return false;
zip64EOCDRecord.SizeOfThisRecord = reader.ReadUInt64();
zip64EOCDRecord.VersionMadeBy = reader.ReadUInt16();
zip64EOCDRecord.VersionNeededToExtract = reader.ReadUInt16();
zip64EOCDRecord.NumberOfThisDisk = reader.ReadUInt32();
zip64EOCDRecord.NumberOfDiskWithStartOfCD = reader.ReadUInt32();
zip64EOCDRecord.NumberOfEntriesOnThisDisk = reader.ReadUInt64();
zip64EOCDRecord.NumberOfEntriesTotal = reader.ReadUInt64();
zip64EOCDRecord.SizeOfCentralDirectory = reader.ReadUInt64();
zip64EOCDRecord.OffsetOfCentralDirectory = reader.ReadUInt64();
return true;
}
示例14: StartListeningTcp
public static void StartListeningTcp()
{
TcpThreadListener listener = new TcpThreadListener(0);
NetworkStream ns = null;
BinaryReader br = null;
try
{
listener.Start();
IPEndPoint ipe = (IPEndPoint) listener.LocalEndpoint;
Interlocked.Exchange(ref iPortNumber, ipe.Port);
Console.WriteLine("Using port: {0}", iPortNumber);
m_PortSetEvent.Set();
Socket s = listener.AcceptSocket();
ns = new NetworkStream(s);
br = new BinaryReader( ns );
UInt64 iTemp ;
for(int i = 0 ; i < ui64Arr.Length ; i++)
{
iTemp = br.ReadUInt64();
if(iTemp != ui64Arr[i])
{
iCountErrors++;
Console.WriteLine( "Error_5453c_"+i+"! Expected=="+ui64Arr[i]+", got=="+iTemp);
}
}
Console.WriteLine("We are done with the listening");
ns.Close();
}
catch(Exception e)
{
iCountErrors++ ;
Console.WriteLine("Exception receiving Teleportation: " + e.Message + Environment.NewLine + e.StackTrace);
m_PortSetEvent.Set();
}
finally
{
if (listener != null)
{
listener.Stop();
}
if (ns != null)
{
ns.Close();
}
if(br != null)
{
br.Close();
}
} //finally
}
示例15: ReadUInt64Test
public void ReadUInt64Test()
{
// Test value Encoded Bytes
// 130 10000010 00000001
// 16385 10000001 10000000 00000001
byte[] buffer = { 0x82, 0x01, 0x81, 0x80, 0x01 };
BinaryReader reader = new BinaryReader(buffer, DeserializationHelper.CannedVersion);
string name = string.Empty;
ulong actual;
actual = reader.ReadUInt64(name);
Assert.AreEqual((ulong)130, actual);
actual = reader.ReadUInt64(name);
Assert.AreEqual((ulong)16385, actual);
}