本文整理汇总了C#中System.Net.Sockets.NetworkStream.ReadByte方法的典型用法代码示例。如果您正苦于以下问题:C# NetworkStream.ReadByte方法的具体用法?C# NetworkStream.ReadByte怎么用?C# NetworkStream.ReadByte使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Net.Sockets.NetworkStream
的用法示例。
在下文中一共展示了NetworkStream.ReadByte方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InboundPacket
public InboundPacket(NetworkStream stream)
{
for (int i = 0; i < 8; i++)
stream.ReadByte();
byte[] dataSizeRaw = new byte[4];
for (int i = 0; i < 4; i++)
dataSizeRaw[i] = (byte)stream.ReadByte();
byte[] dataSizeBE = new byte[4];
dataSizeBE[0] = dataSizeRaw[3];
dataSizeBE[1] = dataSizeRaw[2];
dataSizeBE[2] = dataSizeRaw[1];
dataSizeBE[3] = dataSizeRaw[0];
int dataSize = BitConverter.ToInt32(dataSizeBE, 0);
for (int i = 0; i < 4; i++)
stream.ReadByte();
byte[] dataPacketRaw = new byte[dataSize];
for (int i = 0; i < dataSize; i++)
dataPacketRaw[i] = (byte)stream.ReadByte();
byte[] dataPacketTrimmed = new byte[dataPacketRaw.Length - 3];
for (int i = 0; i < dataPacketTrimmed.Length; i++)
dataPacketTrimmed[i] = dataPacketRaw[i];
Message = System.Text.Encoding.ASCII.GetString(dataPacketTrimmed).Substring(2);
Prefix = Message.Substring(0, 3);
}
示例2: Read
public static ArrayList Read(NetworkStream stream)
{
ArrayList list = new ArrayList();
for (byte b = (byte)stream.ReadByte(); b != 127; b = (byte)stream.ReadByte())
{
int i = (b & 0xe0) >> 5;
int j = b & 0x1f;
WatchableObject obj = null;
switch (i)
{
case 0: //Byte
obj = new WatchableObject(i, j, (byte)stream.ReadByte());
break;
case 1: //Short
obj = new WatchableObject(i, j, StreamHelper.ReadShort(stream));
break;
case 2: //Int
obj = new WatchableObject(i, j, StreamHelper.ReadInt(stream));
break;
case 3: //Float
obj = new WatchableObject(i, j, StreamHelper.ReadFloat(stream));
break;
case 4: //String
obj = new WatchableObject(i, j, StreamHelper.ReadString(stream));
break;
case 5: //Item stack
obj = new WatchableObject(i, j, new ItemStack(StreamHelper.ReadShort(stream), stream.ReadByte(), StreamHelper.ReadShort(stream)));
break;
}
list.Add(obj);
}
return list;
}
示例3: Read
public void Read(NetworkStream stream)
{
WindowId = (byte)stream.ReadByte();
WindowType = (WindowTypes)stream.ReadByte();
Title = StreamHelper.ReadString(stream);
Slots = (byte)stream.ReadByte();
}
示例4: Read
public void Read(NetworkStream stream)
{
EntityID = StreamHelper.ReadInt(stream);
X = (sbyte)stream.ReadByte();
Y = (sbyte)stream.ReadByte();
Z = (sbyte)stream.ReadByte();
}
示例5: Read
public void Read(NetworkStream stream)
{
Status = stream.ReadByte();
X = StreamHelper.ReadInt(stream);
Y = stream.ReadByte();
Z = StreamHelper.ReadInt(stream);
FaceType = (Face)stream.ReadByte();
}
示例6: Read
public void Read(NetworkStream stream)
{
a = StreamHelper.ReadInt(stream);
b = stream.ReadByte();
c = StreamHelper.ReadInt(stream);
d = stream.ReadByte();
e = StreamHelper.ReadInt(stream);
}
示例7: Read
public void Read(NetworkStream stream)
{
X = StreamHelper.ReadInt(stream);
Y = StreamHelper.ReadShort(stream);
Z = StreamHelper.ReadInt(stream);
Instrument = (InstrumentType)stream.ReadByte();
Pitch = (byte)stream.ReadByte();
}
示例8: Read
public void Read(NetworkStream stream)
{
X = StreamHelper.ReadInt(stream);
Y = stream.ReadByte();
Z = StreamHelper.ReadInt(stream);
BlockType = stream.ReadByte();
Metadata = stream.ReadByte();
}
示例9: Read
public void Read(NetworkStream stream)
{
EntityID = StreamHelper.ReadInt(stream);
Name = StreamHelper.ReadString(stream);
X = StreamHelper.ReadInt(stream);
Y = StreamHelper.ReadInt(stream);
Z = StreamHelper.ReadInt(stream);
Rotation = (byte)stream.ReadByte();
Pitch = (byte)stream.ReadByte();
CurrentItem = StreamHelper.ReadShort(stream);
}
示例10: Read
public void Read(NetworkStream stream)
{
EntityID = StreamHelper.ReadInt(stream);
MobType = (byte)stream.ReadByte();
X = StreamHelper.ReadInt(stream);
Y = StreamHelper.ReadInt(stream);
Z = StreamHelper.ReadInt(stream);
Yaw = (sbyte)stream.ReadByte();
Pitch = (sbyte)stream.ReadByte();
Metadata = DataWatcher.Read(stream);
}
示例11: Read
public void Read(NetworkStream stream)
{
EntityID = StreamHelper.ReadInt(stream);
ItemID = StreamHelper.ReadShort(stream);
Count = (byte)stream.ReadByte();
Secondary = StreamHelper.ReadShort(stream);
X = StreamHelper.ReadInt(stream);
Y = StreamHelper.ReadInt(stream);
Z = StreamHelper.ReadInt(stream);
Rotation = (byte)stream.ReadByte();
Pitch = (byte)stream.ReadByte();
Roll = (byte)stream.ReadByte();
}
示例12: Read
public void Read(NetworkStream stream)
{
Name = (byte)stream.ReadByte();
Length = StreamHelper.ReadShort(stream);
Items = new ItemStack[Length];
for (int i = 0; i < Length; i++)
{
short primary = StreamHelper.ReadShort(stream);
if (primary >= 0)
{
byte count = (byte)stream.ReadByte();
short secondary = StreamHelper.ReadShort(stream);
Items[i] = new ItemStack(primary, count, secondary);
}
}
}
示例13: Read
public void Read(NetworkStream stream)
{
WindowID = (byte)stream.ReadByte();
Slot = StreamHelper.ReadShort(stream);
short word0 = StreamHelper.ReadShort(stream);
if (word0 >= 0)
{
byte byte0 = (byte)stream.ReadByte();
short word1 = StreamHelper.ReadShort(stream);
Items = new ItemStack(word0, byte0, word1);
}
else
{
Items = null;
}
}
示例14: Session
public Session(string host, int port, string username, string pw)
{
socket = new TcpClient(host, port);
stream = socket.GetStream();
ehost = host;
string[] response = Receive().Split(':');
string nonce;
string code;
if (response.Length > 1)
{
code = username + ":" + response[0] + ":" + pw;
nonce = response[1];
}
else
{
code = pw;
nonce = response[0];
}
Send(username);
Send(MD5(MD5(code) + nonce));
if (stream.ReadByte() != 0)
{
throw new IOException("Access denied.");
}
}
示例15: Read
public void Read(NetworkStream stream)
{
Unknown1 = StreamHelper.ReadDouble(stream);
Unknown2 = StreamHelper.ReadDouble(stream);
Unknown3 = StreamHelper.ReadDouble(stream);
Unknown4 = StreamHelper.ReadFloat(stream);
Count = StreamHelper.ReadInt(stream);
Unknown5 = new HashSet<ChunkPosition>();
for (int i = 0; i < Count; i++)
{
Unknown5.Add(new ChunkPosition(
stream.ReadByte() + (int)Unknown1,
stream.ReadByte() + (int)Unknown2,
stream.ReadByte() + (int)Unknown3));
}
}