本文整理汇总了C#中BinaryReader.ReadInt64方法的典型用法代码示例。如果您正苦于以下问题:C# BinaryReader.ReadInt64方法的具体用法?C# BinaryReader.ReadInt64怎么用?C# BinaryReader.ReadInt64使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BinaryReader
的用法示例。
在下文中一共展示了BinaryReader.ReadInt64方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ApplyChanges
public override void ApplyChanges(Stream stream)
{
using (var reader = new BinaryReader(stream))
{
var stamp = reader.ReadInt64();
var x = reader.ReadSingle();
var y = reader.ReadSingle();
var z = reader.ReadSingle();
var vx = reader.ReadSingle();
var vy = reader.ReadSingle();
var vz = reader.ReadSingle();
var rx = reader.ReadSingle();
var ry = reader.ReadSingle();
var rz = reader.ReadSingle();
var rw = reader.ReadSingle();
if (LastChanged < stamp)
{
LastChanged = stamp;
Stormancer.MainThread.Post(() =>
{
this.transform.position = new Vector3(x, y, z);
PlayerRigidbody.velocity = new Vector3(vx, vy, vz);
this.transform.rotation = new Quaternion(rx, ry, rz, rw);
});
}
}
}
示例2: Main
public static void Main() {
byte[] bytes;
var values = new long[] {
0, 1, 0xFFFF, 0xFF00FF00FF00L, 12345678901234L, -0xFFFF, -0xFF00FF00FF00L
};
long length;
using (var ms = new MemoryStream())
using (var bw = new BinaryWriter(ms)) {
foreach (var value in values) {
bw.Write(value);
Console.WriteLine(value);
}
bw.Flush();
length = ms.Position;
bytes = ms.GetBuffer();
}
Util.PrintByteArray(bytes, (int)length);
using (var ms = new MemoryStream(bytes, false))
using (var br = new BinaryReader(ms)) {
for (int i = 0; i < values.Length; i++) {
var value = br.ReadInt64();
Console.WriteLine(value);
}
}
}
示例3: ReadEmptyInt64Test
public void ReadEmptyInt64Test()
{
System.IO.Stream stream = new SerializedStreamBuilder()
.ToStream();
BinaryReader reader = new BinaryReader(stream, DeserializationHelper.CannedVersion);
TestHelper.ExpectException<TeslaDeserializationException>(
() =>
{
reader.ReadInt64(string.Empty);
},
"The end of the stream is reached during deserialization.");
}
示例4: ApplyChanges
public override void ApplyChanges(Stream stream)
{
using (var reader = new BinaryReader(stream))
{
var stamp = reader.ReadInt64();
float x = 0;
float y = 0;
float z = 0;
if (ReceivePositionX == true)
x = reader.ReadSingle();
if (ReceivePositionY == true)
y = reader.ReadSingle();
if (ReceivePositionZ == true)
z = reader.ReadSingle();
float vx = 0;
float vy = 0;
float vz = 0;
if (ReceivePositionX == true)
vx = reader.ReadSingle();
if (ReceivePositionY == true)
vy = reader.ReadSingle();
if (ReceivePositionZ == true)
vz = reader.ReadSingle();
float rx = 0;
float ry = 0;
float rz = 0;
if (ReceiveRotationX == true)
rx = reader.ReadSingle();
if (ReceiveRotationY == true)
ry = reader.ReadSingle();
if (ReceiveRotationZ == true)
rz = reader.ReadSingle();
var rot = new Quaternion();
rot = Quaternion.Euler(rx, ry, rz);
if (LastChanged < stamp)
{
LastChanged = stamp;
SetNextPos(new Vector3(x, y, z), new Vector3(vx, vy, vz), rot);
}
}
}
示例5: Pop
public long Pop()
{
if (pos == 0) {
if (Empty) throw new System.Exception("Stack is empty");
string name = Name(--exclHiFileId);
using (var rd = new BinaryReader(new BufferedStream(new FileStream(name, FileMode.Open, FileAccess.Read)))) {
for (int i = 0; i < buf.Length; i++) {
buf[i] = rd.ReadInt64();
}
}
System.IO.File.Delete(name);
pos = buf.Length;
}
return buf[--pos];
}
示例6: Metadata
public Metadata(Profile p)
{
using (BinaryReader br = new BinaryReader (File.OpenRead (p.Filename))) {
br.BaseStream.Seek (-8, SeekOrigin.End);
br.BaseStream.Seek (br.ReadInt64 (), SeekOrigin.Begin);
ProfilerSignature.ReadHeader (br, false);
typeTable = ReadStringTable (br);
methodTable = ReadStringTable (br);
backtraceTable = ReadBacktraceTable (br);
contextTable = ReadContextTable (br);
timeline = ReadTimeline (br);
type_max = ReadTypeMaxTable (br);
}
}
示例7: decode
public ItemQuote decode(Stream wire)
{
BinaryReader src = new BinaryReader(new BufferedStream(wire));
long itemNumber = IPAddress.NetworkToHostOrder(src.ReadInt64());
int quantity = IPAddress.NetworkToHostOrder(src.ReadInt32());
int unitPrice = IPAddress.NetworkToHostOrder(src.ReadInt32());
byte flags = src.ReadByte();
int stringLength = src.Read(); // Returns an unsigned byte as an int
if (stringLength == -1)
throw new EndOfStreamException();
byte[] stringBuf = new byte[stringLength];
src.Read(stringBuf, 0, stringLength);
String itemDesc = encoding.GetString(stringBuf);
return new ItemQuote(itemNumber,itemDesc, quantity, unitPrice,
((flags & ItemQuoteBinConst.DISCOUNT_FLAG) == ItemQuoteBinConst.DISCOUNT_FLAG),
((flags & ItemQuoteBinConst.IN_STOCK_FLAG) == ItemQuoteBinConst.IN_STOCK_FLAG));
}
示例8: GameShopItem
public GameShopItem(BinaryReader reader, int version = int.MaxValue, int Customversion = int.MaxValue)
{
ItemIndex = reader.ReadInt32();
GIndex = reader.ReadInt32();
GoldPrice = reader.ReadUInt32();
CreditPrice = reader.ReadUInt32();
Count = reader.ReadUInt32();
Class = reader.ReadString();
Category = reader.ReadString();
Stock = reader.ReadInt32();
iStock = reader.ReadBoolean();
Deal = reader.ReadBoolean();
TopItem = reader.ReadBoolean();
Date = DateTime.FromBinary(reader.ReadInt64());
}
示例9: ExpireInfo
public ExpireInfo(BinaryReader reader, int version = int.MaxValue, int Customversion = int.MaxValue)
{
ExpiryDate = DateTime.FromBinary(reader.ReadInt64());
}
示例10: SelectInfo
public SelectInfo(BinaryReader reader)
{
Index = reader.ReadInt32();
Name = reader.ReadString();
Level = reader.ReadUInt16();
Class = (MirClass)reader.ReadByte();
Gender = (MirGender)reader.ReadByte();
LastAccess = DateTime.FromBinary(reader.ReadInt64());
}
示例11: Read
public void Read(BinaryReader r)
{
_null = r.ReadBoolean();
_ts = new TimeSpan(r.ReadInt64());
}
示例12: GuildMember
public GuildMember(BinaryReader reader, bool Offline = false)
{
name = reader.ReadString();
Id = reader.ReadInt32();
LastLogin = DateTime.FromBinary(reader.ReadInt64());
hasvoted = reader.ReadBoolean();
Online = reader.ReadBoolean();
Online = Offline ? false: Online;
}
示例13: ClientIntelligentCreature
public ClientIntelligentCreature(BinaryReader reader)
{
PetType = (IntelligentCreatureType)reader.ReadByte();
Icon = reader.ReadInt32();
CustomName = reader.ReadString();
Fullness = reader.ReadInt32();
SlotIndex = reader.ReadInt32();
ExpireTime = reader.ReadInt64();
BlackstoneTime = reader.ReadInt64();
petMode = (IntelligentCreaturePickupMode)reader.ReadByte();
CreatureRules = new IntelligentCreatureRules(reader);
Filter = new IntelligentCreatureItemFilter(reader);
Filter.PickupGrade = (ItemGrade)reader.ReadByte();
MaintainFoodTime = reader.ReadInt64();
}
示例14: ClientAuction
public ClientAuction(BinaryReader reader)
{
AuctionID = reader.ReadUInt64();
Item = new UserItem(reader);
Seller = reader.ReadString();
Price = reader.ReadUInt32();
ConsignmentDate = DateTime.FromBinary(reader.ReadInt64());
}
示例15: 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++)
//.........这里部分代码省略.........