本文整理汇总了C#中BitReader.ReadByte方法的典型用法代码示例。如果您正苦于以下问题:C# BitReader.ReadByte方法的具体用法?C# BitReader.ReadByte怎么用?C# BitReader.ReadByte使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BitReader
的用法示例。
在下文中一共展示了BitReader.ReadByte方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Deserialize
public static ClientLoadoutOnline Deserialize(BitReader br)
{
var clo = new ClientLoadoutOnline();
clo.ThingLists = new List<List<ClientLoadoutOnlineThing>>();
var listCount = br.ReadByte();
for (int i = 0; i < listCount; ++i)
{
var thingList = new List<ClientLoadoutOnlineThing>();
var thingCount = br.ReadByte();
for (int j = 0; j < thingCount; ++j)
{
thingList.Add(ClientLoadoutOnlineThing.Deserialize(br));
if ( i >= 21 )
{
thingList.Add(ClientLoadoutOnlineThing.Deserialize(br));
}
}
clo.ThingLists.Add(thingList);
}
return clo;
}
示例2: Deserialize
public static TeamPaint Deserialize(BitReader br)
{
var tp = new TeamPaint();
tp.TeamNumber = br.ReadByte();
tp.TeamColorId = br.ReadByte();
tp.CustomColorId = br.ReadByte();
tp.TeamFinishId = br.ReadUInt32();
tp.CustomFinishId = br.ReadUInt32();
return tp;
}
示例3: Deserialize
public static Reservation Deserialize(UInt32 versionMajor, UInt32 versionMinor, BitReader br)
{
var r = new Reservation();
r.Unknown1 = br.ReadUInt32FromBits(3);
r.PlayerId = UniqueId.Deserialize(br);
if (r.PlayerId.Type != UniqueId.UniqueIdType.Unknown)
{
r.PlayerName = br.ReadString();
}
if (versionMajor < 868 || versionMinor < 12)
{
r.Unknown2 = br.ReadBitsAsBytes(2)[0];
}
else
{
r.Unknown2 = br.ReadByte();
}
/*
ReservationStatus_None,
ReservationStatus_Reserved,
ReservationStatus_Joining,
ReservationStatus_InGame,
ReservationStatus_MAX
*/
return r;
}
示例4: Deserialize
public static Rotator Deserialize(BitReader br)
{
var r = new Rotator();
if (br.ReadBit())
{
r.Pitch = ByteToAxis(br.ReadByte());
}
if ( br.ReadBit() )
{
r.Yaw = ByteToAxis(br.ReadByte());
}
if (br.ReadBit())
{
r.Roll = ByteToAxis(br.ReadByte());
}
return r;
}
示例5: Deserialize
public static ClientLoadout Deserialize(BitReader br)
{
var cl = new ClientLoadout();
cl.Version = br.ReadByte();
cl.BodyProductId = br.ReadUInt32();
cl.SkinProductId = br.ReadUInt32();
cl.WheelProductId = br.ReadUInt32();
cl.BoostProductId = br.ReadUInt32();
cl.AntennaProductId = br.ReadUInt32();
cl.HatProductId = br.ReadUInt32();
cl.Unknown2 = br.ReadUInt32();
if (cl.Version > 10 )
{
cl.Unknown3 = br.ReadUInt32();
}
return cl;
}
示例6: ItemAction
// Methods
public ItemAction(byte[] data)
: base(data)
{
this.superiorType = SuperiorItemType.NotApplicable;
this.charClass = CharacterClass.NotApplicable;
this.level = -1;
this.usedSockets = -1;
this.use = -1;
this.graphic = -1;
this.color = -1;
this.stats = new List<StatBase>();
this.unknown1 = -1;
this.runewordID = -1;
this.runewordParam = -1;
BitReader br = new BitReader(data, 1);
this.action = (ItemActionType) br.ReadByte();
br.SkipBytes(1);
this.category = (ItemCategory) br.ReadByte();
this.uid = br.ReadUInt32();
if (data[0] == 0x9d)
{
br.SkipBytes(5);
}
this.flags = (ItemFlags) br.ReadUInt32();
this.version = (ItemVersion) br.ReadByte();
this.unknown1 = br.ReadByte(2);
this.destination = (ItemDestination) br.ReadByte(3);
if (this.destination == ItemDestination.Ground)
{
this.x = br.ReadUInt16();
this.y = br.ReadUInt16();
}
else
{
this.location = (EquipmentLocation) br.ReadByte(4);
this.x = br.ReadByte(4);
this.y = br.ReadByte(3);
this.container = (ItemContainer) br.ReadByte(4);
}
if ((this.action == ItemActionType.AddToShop) || (this.action == ItemActionType.RemoveFromShop))
{
int num = ((int) this.container) | 0x80;
if ((num & 1) == 1)
{
num--;
this.y += 8;
}
this.container = (ItemContainer) num;
}
else if (this.container == ItemContainer.Unspecified)
{
if (this.location == EquipmentLocation.NotApplicable)
{
if ((this.Flags & ItemFlags.InSocket) == ItemFlags.InSocket)
{
this.container = ItemContainer.Item;
this.y = -1;
}
else if ((this.action == ItemActionType.PutInBelt) || (this.action == ItemActionType.RemoveFromBelt))
{
this.container = ItemContainer.Belt;
this.y = this.x / 4;
this.x = this.x % 4;
}
}
else
{
this.x = -1;
this.y = -1;
}
}
if ((this.flags & ItemFlags.Ear) == ItemFlags.Ear)
{
this.charClass = (CharacterClass) br.ReadByte(3);
this.level = br.ReadByte(7);
this.name = br.ReadString(7, '\0', 0x10);
this.baseItem = BaseItem.Get(ItemType.Ear);
}
else
{
this.baseItem = BaseItem.GetByID(this.category, br.ReadUInt32());
if (this.baseItem.Type == ItemType.Gold)
{
this.stats.Add(new SignedStat(BaseStat.Get(StatType.Quantity), br.ReadInt32(br.ReadBoolean(1) ? 0x20 : 12)));
}
else
{
this.usedSockets = br.ReadByte(3);
if ((this.flags & (ItemFlags.Compact | ItemFlags.Gamble)) == ItemFlags.None)
{
BaseStat stat;
int num2;
this.level = br.ReadByte(7);
this.quality = (ItemQuality) br.ReadByte(4);
if (br.ReadBoolean(1))
{
this.graphic = br.ReadByte(3);
}
if (br.ReadBoolean(1))
//.........这里部分代码省略.........
示例7: Deserialize
//.........这里部分代码省略.........
case "ProjectX.GRI_X:ReplicatedGamePlaylist":
case "Engine.TeamInfo:Score":
case "Engine.PlayerReplicationInfo:Score":
case "TAGame.PRI_TA:MatchGoals":
case "TAGame.PRI_TA:MatchAssists":
case "ProjectX.GRI_X:ReplicatedGameMutatorIndex":
case "TAGame.PRI_TA:Title":
case "TAGame.GameEvent_TA:ReplicatedStateName":
case "TAGame.Team_Soccar_TA:GameScore":
case "TAGame.GameEvent_Soccar_TA:GameTime":
case "TAGame.CarComponent_Boost_TA:UnlimitedBoostRefCount":
case "TAGame.CrowdActor_TA:ReplicatedRoundCountDownNumber":
asp.Data.Add(br.ReadUInt32());
asp.MarkComplete();
break;
case "TAGame.VehiclePickup_TA:ReplicatedPickupData":
asp.Data.Add(br.ReadBit());
asp.Data.Add(br.ReadUInt32());
asp.Data.Add(br.ReadBit());
asp.MarkComplete();
break;
case "Engine.PlayerReplicationInfo:Ping":
case "TAGame.Vehicle_TA:ReplicatedSteer":
case "TAGame.Vehicle_TA:ReplicatedThrottle": // 0: full reverse, 128: No throttle. 255 full throttle/boosting
case "TAGame.PRI_TA:CameraYaw":
case "TAGame.PRI_TA:CameraPitch":
case "TAGame.Ball_TA:HitTeamNum":
case "TAGame.GameEvent_Soccar_TA:ReplicatedScoredOnTeam":
case "TAGame.CarComponent_Boost_TA:ReplicatedBoostAmount": // Always 255?
case "TAGame.CameraSettingsActor_TA:CameraPitch":
case "TAGame.CameraSettingsActor_TA:CameraYaw":
case "TAGame.PRI_TA:PawnType":
asp.Data.Add(br.ReadByte());
asp.MarkComplete();
break;
case "Engine.Actor:Location":
case "TAGame.CarComponent_Dodge_TA:DodgeTorque":
asp.Data.Add(Vector3D.Deserialize(br));
asp.MarkComplete();
break;
case "Engine.Actor:bCollideWorld":
case "Engine.PlayerReplicationInfo:bReadyToPlay":
case "TAGame.Vehicle_TA:bReplicatedHandbrake":
case "TAGame.Vehicle_TA:bDriving":
case "Engine.Actor:bNetOwner":
case "Engine.Actor:bBlockActors":
case "TAGame.GameEvent_TA:bHasLeaveMatchPenalty":
case "TAGame.PRI_TA:bUsingBehindView":
case "TAGame.PRI_TA:bUsingSecondaryCamera":
case "TAGame.GameEvent_TA:ActivatorCar":
case "TAGame.GameEvent_Soccar_TA:bOverTime":
case "ProjectX.GRI_X:bGameStarted":
case "Engine.Actor:bCollideActors":
case "TAGame.PRI_TA:bReady":
case "TAGame.RBActor_TA:bFrozen":
case "Engine.Actor:bHidden":
case "TAGame.CarComponent_FlipCar_TA:bFlipRight":
case "Engine.PlayerReplicationInfo:bBot":
case "Engine.PlayerReplicationInfo:bWaitingPlayer":
case "TAGame.RBActor_TA:bReplayActor":
case "TAGame.PRI_TA:bIsInSplitScreen":
case "Engine.GameReplicationInfo:bMatchIsOver":
case "TAGame.CarComponent_Boost_TA:bUnlimitedBoost":
case "Engine.PlayerReplicationInfo:bIsSpectator":
示例8: TerNormal
/// <summary>
/// 终端通用应答
/// </summary>
/// <param name="mes"></param>
private void TerNormal(Message mes)
{
var body = mes.BodyBytes;
var ms = new MemoryStream(body);
var read = new BitReader(ms);
var numseq = read.ReadUInt16();//应答流水号
var fromNum = read.ReadUInt16();//平台ID号
var result = read.ReadByte();//结果
Console.WriteLine(result);
}
示例9: GpsAppend
/// <summary>
/// GPS补录
/// </summary>
/// <param name="from"></param>
private void GpsAppend(Message from)
{
var ms = new MemoryStream(from.BodyBytes);
var read = new BitReader(ms);
var count = read.ReadUInt16();//位置信息个数
var type = read.ReadByte();//0:正常位置批量汇报,1:盲区补报
for (var i = 0; i < count; i++)
{
var gpsLength = read.ReadUInt16();
var bytes = read.ReadBytes(gpsLength);
this.ReadGPS(bytes);
}
this.NormalMes(from, 0);
}
示例10: Driver
/*
*
* 0x00:IC 卡读卡成功;
0x01:读卡失败,原因为卡片密钥认证未通过;
0x02:读卡失败,原因为卡片已被锁定;
0x03:读卡失败,原因为卡片被拔出;
0x04:读卡失败,原因为数据校验错误。
*
*
* */
private void Driver(Message from)
{
var body = from.BodyBytes;
MemoryStream ms = new MemoryStream(body);
BitReader br = new BitReader(ms);
var state=br.ReadByte();
var driver = new Driver();
var time = br.ReadDateTime();//读取打卡时间
driver.state = 0;
if (state == 0x01)//终端时间未校准 使用服务器时间
{
time = DateTime.Now;
}
var ic = br.ReadByte();
if (ic.Equals(0x00))//读卡成功
{
//只有certificate 序列号读到
var driverNameLength = br.ReadByte();
var driverName = br.ReadString(driverNameLength);
var certBytes = br.ReadBytes(20);//从业资格证
var nBytes=new byte[4];
Array.Copy(certBytes,16,nBytes,0,4);
var certificate = BitConverter.ToUInt32(nBytes,0)+"";
//certificate
var licenceLength = br.ReadByte();//发证机关名称长度
var licenceName = br.ReadString(licenceLength);//发证机关名称
var certificateVaDate = DateTime.Now; //br.ReadDate();//证件有效期 读不到
driver.driverName=driverName;
driver.certificate = certificate;
driver.licenceName=licenceName;
driver.certificateVaDate=certificateVaDate;
}
driver.time = time;
this.EventDriver(driver);
}