本文整理汇总了C#中EndianBinaryReader.ReadByte方法的典型用法代码示例。如果您正苦于以下问题:C# EndianBinaryReader.ReadByte方法的具体用法?C# EndianBinaryReader.ReadByte怎么用?C# EndianBinaryReader.ReadByte使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EndianBinaryReader
的用法示例。
在下文中一共展示了EndianBinaryReader.ReadByte方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: POTIRoute
public POTIRoute(EndianBinaryReader er)
{
NrPoints = er.ReadUInt16();
Setting1 = er.ReadByte();
Setting2 = er.ReadByte();
for (int i = 0; i < NrPoints; i++) Points.Add(new POTIPoint(er));
}
示例2: wnd1
public wnd1(EndianBinaryReader er)
: base(er)
{
long basepos = er.BaseStream.Position - 0x4C;
InflationLeft = er.ReadUInt16() / 16f;
InflationRight = er.ReadUInt16() / 16f;
InflationTop = er.ReadUInt16() / 16f;
InflationBottom = er.ReadUInt16() / 16f;
FrameSizeLeft = er.ReadUInt16();
FrameSizeRight = er.ReadUInt16();
FrameSizeTop = er.ReadUInt16();
FrameSizeBottom = er.ReadUInt16();
NrFrames = er.ReadByte();
byte tmp = er.ReadByte();
UseLTMaterial = (tmp & 1) == 1;
UseVtxColorForAllWindow = (tmp & 2) == 2;
Kind = (WindowKind)((tmp >> 2) & 3);
DontDrawContent = (tmp & 8) == 16;
Padding = er.ReadUInt16();
ContentOffset = er.ReadUInt32();
FrameOffsetTableOffset = er.ReadUInt32();
er.BaseStream.Position = basepos + ContentOffset;
Content = new WindowContent(er);
er.BaseStream.Position = basepos + FrameOffsetTableOffset;
WindowFrameOffsets = er.ReadUInt32s(NrFrames);
WindowFrames = new WindowFrame[NrFrames];
for (int i = 0; i < NrFrames; i++)
{
er.BaseStream.Position = basepos + WindowFrameOffsets[i];
WindowFrames[i] = new WindowFrame(er);
}
er.BaseStream.Position = basepos + SectionSize;
}
示例3: read
public void read(EndianBinaryReader r) {
Solo = r.ReadByte();
Disparity = r.ReadByte();
Ignore = r.ReadByte();
Padding = r.ReadByte();
MaxDifficulty = r.ReadInt32();
PhraseIterationLinks = r.ReadInt32();
Name = r.ReadBytes(32);
}
示例4: Parse
protected override void Parse(EndianBinaryReader r)
{
BlockPosition = CoordInt.Read(r);
FaceDirection = (Face)r.ReadByte();
Item = SlotItem.Read(r);
CursorX = r.ReadByte();
CursorY = r.ReadByte();
CursorZ = r.ReadByte();
}
示例5: Load
public override void Load()
{
using (
var reader = new EndianBinaryReader(EndianBitConverter.Little, File.Open(FilePath, FileMode.Open, FileAccess.Read)))
{
while ((reader.BaseStream.Length - reader.BaseStream.Position) >= 3)
{
byte r = reader.ReadByte();
byte g = reader.ReadByte();
byte b = reader.ReadByte();
Add(new NamedColor("Unnamed", Color.FromArgb(255, r, g, b)));
}
}
Dirty = false;
}
示例6: Deserialize
public void Deserialize(PacketChecksumType checksumType, byte[] data)
{
MemoryStream ms = new MemoryStream(data);
EndianBinaryReader reader = new EndianBinaryReader(EndianBitConverter.Little, ms);
if (reader.ReadByte() != 0x01)
throw new InvalidDataException("Message start byte must be 0x01");
StatusCode status = (StatusCode) reader.ReadByte();
if (status != StatusCode.CYRET_SUCCESS)
throw new BootloaderError(status);
ushort length = reader.ReadUInt16();
if (length > data.Length - 7)
throw new InvalidDataException("Invalid data length");
this.DeserializePayload(reader, length);
ushort checksum = reader.ReadUInt16();
if (checksum != PacketChecksum.ComputeChecksum(checksumType, data, length + 4))
throw new InvalidDataException("Invalid checksum");
if (reader.ReadByte() != 0x17)
throw new InvalidDataException("Message end byte must be 0x17");
}
示例7: STAG
public STAG(EndianBinaryReader er)
{
Signature = er.ReadString(Encoding.ASCII, 4);
if (Signature != "STAG") throw new SignatureNotCorrectException(Signature, "STAG", er.BaseStream.Position - 4);
Unknown1 = er.ReadUInt16();
NrLaps = er.ReadInt16();
Unknown2 = er.ReadByte();
FogEnabled = er.ReadByte() == 1;
FogTableGenMode = er.ReadByte();
FogSlope = er.ReadByte();
UnknownData1 = er.ReadBytes(0x8);
FogDensity = er.ReadFx32();
FogColor = Color.FromArgb((int)GFXUtil.ConvertColorFormat(er.ReadUInt16(), ColorFormat.XBGR1555, ColorFormat.ARGB8888));
FogAlpha = er.ReadUInt16();
KclColor1 = Color.FromArgb((int)GFXUtil.ConvertColorFormat(er.ReadUInt16(), ColorFormat.XBGR1555, ColorFormat.ARGB8888));
KclColor2 = Color.FromArgb((int)GFXUtil.ConvertColorFormat(er.ReadUInt16(), ColorFormat.XBGR1555, ColorFormat.ARGB8888));
KclColor3 = Color.FromArgb((int)GFXUtil.ConvertColorFormat(er.ReadUInt16(), ColorFormat.XBGR1555, ColorFormat.ARGB8888));
KclColor4 = Color.FromArgb((int)GFXUtil.ConvertColorFormat(er.ReadUInt16(), ColorFormat.XBGR1555, ColorFormat.ARGB8888));
FrustumFar = er.ReadFx32();
UnknownData2 = er.ReadBytes(0x4);
}
示例8: txt1
public txt1(EndianBinaryReader er)
: base(er)
{
long baseoffset = er.BaseStream.Position - 0x4C;
NrCharacters = er.ReadUInt16();
NrCharacters2 = er.ReadUInt16();
MaterialId = er.ReadUInt16();
FontId = er.ReadUInt16();
PositionType = er.ReadByte();
TextAlignment = er.ReadByte();
TextFlags = er.ReadByte();
Padding = er.ReadByte();
StringOffset = er.ReadUInt32();
TopColor = er.ReadColor8();
BottomColor = er.ReadColor8();
FontSize = er.ReadVector2();
CharSpace = er.ReadSingle();
LineSpace = er.ReadSingle();
er.BaseStream.Position = baseoffset + StringOffset;
Text = er.ReadStringNT(Encoding.Unicode);
er.BaseStream.Position = baseoffset + SectionSize;
}
示例9: readDmfFile
private DmfFile readDmfFile(EndianBinaryReader reader)
{
validateFile(reader);
ushort width = BitConverter.ToUInt16(reader.ReadBytes(2), 0);
debugLine("width: " + width);
ushort height = BitConverter.ToUInt16(reader.ReadBytes(2), 0);
debugLine("width: " + height);
byte wrapFlag = reader.ReadByte();
DmfFile file = new DmfFile(width, height, wrapFlag == 1 ? true : false);
readPixels(reader, width, height, file);
return file;
}
示例10: Load
public void Load(Stream stream)
{
var reader = new EndianBinaryReader(EndianBitConverter.Big, stream);
//Header
reader.ReadBytes(3); // "FLV"
Version = reader.ReadByte();
Bitmask = (BitmaskTypes) reader.ReadByte();
HeaderSize = reader.ReadUInt32();
//Start reading tags
while(stream.Position < stream.Length)
{
var footer = reader.ReadUInt32();
if(stream.Position >= stream.Length)
{
break;
}
var tag = new FlvTag();
tag.Load(reader);
Tags.Add(tag);
}
}
示例11: Update
public virtual void Update()
{
if (CanReceiveData())
{
var data = ReceivedData();
var memory = new MemoryStream(data);
var reader = new EndianBinaryReader(EndianBitConverter.Big, memory);
while (memory.Position < memory.Length)
{
switch (CurrentState)
{
case ClientStates.Handshake_WaitForS0:
{
reader.ReadByte();
CurrentState = ClientStates.Handshake_WaitForS1;
}
break;
case ClientStates.Handshake_WaitForS1:
{
var s1Chunk = reader.ReadBytes(Globals.Handshake_Length);
SendData(Handshake.GenerateC2(s1Chunk));
CurrentState = ClientStates.Handshake_WaitForS2;
}
break;
case ClientStates.Handshake_WaitForS2:
{
var s2Chunk = reader.ReadBytes(Globals.Handshake_Length);
CurrentState = ClientStates.Handshake_Done;
}
break;
case ClientStates.Handshake_Done:
{
var chunk = new Chunk();
chunk.Load(memory);
ParseChunk(chunk);
}
break;
}
}
}
}
示例12: Read
public static SlotItem Read(EndianBinaryReader r)
{
SlotItem i = new SlotItem();
i.ItemID = (BlockID)r.ReadInt16();
if (i.ItemID < 0)
return null;
#if DEBUGPACKET
if (((int)i.ItemID).ToString() == i.ItemID.ToString())
throw new NotImplementedException("BlockID: " + (int)i.ItemID);
#endif
i.Count = r.ReadByte();
i.Uses = r.ReadInt16();
//Metadata
i.Data = Tag.ReadTag(r);
//Debug.WriteLine(i + ": " + i.Data);
return i;
}
示例13: Load
public void Load(MemoryStream memory)
{
var reader = new EndianBinaryReader(EndianBitConverter.Big, memory);
var format = reader.ReadByte();
var copyByte = format;
format &= 0xC0;
format >>= 6;
Format = (HeaderFormats)format;
copyByte &= 0x3F;
ChunkStreamId = copyByte;
/*
switch ((HeaderFormats) format)
{
case HeaderFormats.F0:
{
copyByte &= 0x3F;
ChunkStreamId = copyByte;
}
break;
case HeaderFormats.F1:
{
ChunkStreamId = reader.ReadByte();
}
break;
case HeaderFormats.F2:
{
ChunkStreamId = reader.ReadUInt16();
}
break;
case HeaderFormats.F3:
break;
default:
break;
}*/
}
示例14: read
public void read(EndianBinaryReader r)
{
Time = r.ReadSingle();
Step = r.ReadSingle();
Unk3_0 = r.ReadInt16();
Unk4_0 = r.ReadByte();
Unk5 = r.ReadByte();
}
示例15: MatFile
public MatFile(string filename)
{
Stream file = OpenDataFile(filename);
if (!Exists)
return;
EndianBinaryReader reader = new EndianBinaryReader(EndianBitConverter.Big, file);
CMaterial currentMaterial = null;
while (true)
{
int blockLength = 0;
MaterialBlockType blockType = (MaterialBlockType)reader.ReadInt32();
blockLength = reader.ReadInt32();
byte[] flags;
switch (blockType)
{
case MaterialBlockType.Attributes:
currentMaterial = new CMaterial();
_materials.Add(currentMaterial);
byte[] color = reader.ReadBytes(4);
byte[] otherColors = reader.ReadBytes(16);
flags = reader.ReadBytes(2);
byte[] transform = reader.ReadBytes(24);
currentMaterial.SimpMatPixelIndex = reader.ReadByte();
currentMaterial.SimpMatGradientCount = reader.ReadByte();
currentMaterial.DoubleSided = flags[0] == 0x10;
currentMaterial.Name = ReadNullTerminatedString(reader);
break;
case MaterialBlockType.AttributesV2:
currentMaterial = new CMaterial();
_materials.Add(currentMaterial);
reader.ReadBytes(4); //color
reader.ReadBytes(16); //othercolors
flags = reader.ReadBytes(4); // flags
reader.ReadBytes(24); //transform
reader.ReadBytes(4); //unk
currentMaterial.DoubleSided = flags[0] == 0x10;
reader.BaseStream.Position += 13;
currentMaterial.Name = ReadNullTerminatedString(reader);
break;
case MaterialBlockType.TextureName:
currentMaterial.PixName = ReadNullTerminatedString(reader);
break;
case MaterialBlockType.TabName:
string tabName = ReadNullTerminatedString(reader);
break;
case MaterialBlockType.Null:
break;
default:
reader.Seek(blockLength, SeekOrigin.Current);
break;
}
if (reader.BaseStream.Position == reader.BaseStream.Length)
break;
}
reader.Close();
}