本文整理汇总了C#中BitReader.ReadUInt32方法的典型用法代码示例。如果您正苦于以下问题:C# BitReader.ReadUInt32方法的具体用法?C# BitReader.ReadUInt32怎么用?C# BitReader.ReadUInt32使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BitReader
的用法示例。
在下文中一共展示了BitReader.ReadUInt32方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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;
}
示例2: Deserialize
public static PrivateMatchSettings Deserialize(BitReader br)
{
var pms = new PrivateMatchSettings();
pms.Mutators = br.ReadString().Split(',').ToList();
pms.Unknown1 = br.ReadUInt32(); // GameNameId? Possibly referencing a string by id
pms.Unknown2 = br.ReadUInt32(); // Max players?
pms.GameName = br.ReadString();
pms.Password = br.ReadString();
pms.Unknown3 = br.ReadBit(); // Public?
return pms;
}
示例3: Deserialize
public static ReplicatedDemolish Deserialize(BitReader br)
{
var rd = new ReplicatedDemolish();
rd.Unknown1 = br.ReadBit();
rd.AttackerActorId = br.ReadUInt32();
rd.Unknown2 = br.ReadBit();
rd.VictimActorId = br.ReadUInt32();
rd.AttackerVelocity = Vector3D.Deserialize(br);
rd.VictimVelocity = Vector3D.Deserialize(br);
return rd;
}
示例4: Deserialize
public static ActiveActor Deserialize(BitReader br)
{
var aa = new ActiveActor();
aa.Active = br.ReadBit();
aa.ActorId = br.ReadUInt32();
return aa;
}
示例5: Deserialize
public static ClientLoadoutOnlineThing Deserialize(BitReader br)
{
var clot = new ClientLoadoutOnlineThing(); // ha, "clot"
clot.Unknown1 = br.ReadUInt32();
clot.Unknown2 = br.ReadUInt32Max(MAX_UNKNOWN2);
return clot;
}
示例6: 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;
}
示例7: DoDeserializeFromByteArray
/// <summary>
/// This method is used to deserialize the StreamObjectHeaderEnd16bit basic object from the specified byte array and start index.
/// </summary>
/// <param name="byteArray">Specify the byte array.</param>
/// <param name="startIndex">Specify the start index from the byte array.</param>
/// <returns>Return the length in byte of the StreamObjectHeaderEnd16bit basic object.</returns>
protected override int DoDeserializeFromByteArray(byte[] byteArray, int startIndex)
{
using (BitReader reader = new BitReader(byteArray, startIndex))
{
int headerType = reader.ReadInt32(2);
if (headerType != 0x3)
{
throw new InvalidOperationException(string.Format("Failed to get the StreamObjectHeaderEnd16bit header type value, expect value {0}, but actual value is {1}", 0x3, headerType));
}
uint typeValue = reader.ReadUInt32(14);
if (!Enum.IsDefined(typeof(StreamObjectTypeHeaderEnd), (int)typeValue))
{
throw new InvalidOperationException(string.Format("Failed to get the StreamObjectHeaderEnd16bit type value, the value {0} is not defined", typeValue));
}
this.Type = (StreamObjectTypeHeaderEnd)typeValue;
return 2;
}
}
示例8: DoDeserializeFromByteArray
/// <summary>
/// This method is used to deserialize the ExGuid basic object from the specified byte array and start index.
/// </summary>
/// <param name="byteArray">Specify the byte array.</param>
/// <param name="startIndex">Specify the start index from the byte array.</param>
/// <returns>Return the length in byte of the ExGuid basic object.</returns>
protected override int DoDeserializeFromByteArray(byte[] byteArray, int startIndex)
{
using (BitReader bitReader = new BitReader(byteArray, startIndex))
{
int numberOfContinousZeroBit = 0;
while (numberOfContinousZeroBit < 8 && bitReader.MoveNext())
{
if (bitReader.Current == false)
{
numberOfContinousZeroBit++;
}
else
{
break;
}
}
switch (numberOfContinousZeroBit)
{
case 2:
this.Value = bitReader.ReadUInt32(5);
this.GUID = bitReader.ReadGuid();
this.Type = ExtendedGUID5BitUintType;
return 17;
case 5:
this.Value = bitReader.ReadUInt32(10);
this.GUID = bitReader.ReadGuid();
this.Type = ExtendedGUID10BitUintType;
return 18;
case 6:
this.Value = bitReader.ReadUInt32(17);
this.GUID = bitReader.ReadGuid();
this.Type = ExtendedGUID17BitUintType;
return 19;
case 7:
this.Value = bitReader.ReadUInt32(32);
this.GUID = bitReader.ReadGuid();
this.Type = ExtendedGUID32BitUintType;
return 21;
case 8:
this.GUID = Guid.Empty;
this.Type = ExtendedGUIDNullType;
return 1;
default:
throw new InvalidOperationException("Failed to parse the ExGuid, the type value is unexpected");
}
}
}
示例9: GetCompressedSize
/// <summary>
/// This method is used to get the compressed size value from the data file signature.
/// </summary>
/// <param name="dataFileSignature">Specify the signature of the zip file content.</param>
/// <returns>Return the compressed size value.</returns>
private ulong GetCompressedSize(byte[] dataFileSignature)
{
using (BitReader reader = new BitReader(dataFileSignature, 0))
{
reader.ReadUInt32(32);
return reader.ReadUInt64(64);
}
}
示例10: UpdateItemStats
// Methods
public UpdateItemStats(byte[] data)
: base(data)
{
this.stats = new List<StatBase>();
this.unknown61b = -1;
this.unknown78b = -1;
BitReader reader = new BitReader(data, 1);
this.unknown8b = reader.ReadInt32(10);
this.uid = reader.ReadUInt32();
while (reader.ReadBoolean(1))
{
BaseStat stat = BaseStat.Get(reader.ReadInt32(9));
this.unknown60b = reader.ReadInt32(1);
if (stat.Type == StatType.ChargedSkill)
{
this.unknown61b = reader.ReadInt32(1);
int charges = reader.ReadInt32(8);
int maxCharges = reader.ReadInt32(8);
this.unknown78b = reader.ReadInt32(1);
int level = reader.ReadInt32(6);
int skill = reader.ReadInt32(10);
this.stats.Add(new ChargedSkillStat(stat, level, skill, charges, maxCharges));
}
else
{
if (stat.Signed)
{
this.stats.Add(new SignedStat(stat, reader.ReadInt32(stat.SendBits)));
continue;
}
this.stats.Add(new UnsignedStat(stat, reader.ReadUInt32(stat.SendBits)));
}
}
this.offset = reader.Position;
this.unknownEnd = reader.ReadByteArray();
}
示例11: ReadStat
private static StatBase ReadStat(BitReader br)
{
int index = br.ReadInt32(9);
if (index == 0x1ff)
{
return null;
}
BaseStat stat = BaseStat.Get(index);
if (stat.SaveParamBits == -1)
{
if (stat.OpBase == StatType.Level)
{
return new PerLevelStat(stat, br.ReadInt32(stat.SaveBits));
}
switch (stat.Type)
{
case StatType.MaxDamagePercent:
case StatType.MinDamagePercent:
return new DamageRangeStat(stat, br.ReadInt32(stat.SaveBits), br.ReadInt32(stat.SaveBits));
case StatType.FireMinDamage:
case StatType.LightMinDamage:
case StatType.MagicMinDamage:
return new DamageRangeStat(stat, br.ReadInt32(stat.SaveBits), br.ReadInt32(BaseStat.Get((int) (stat.Index + 1)).SaveBits));
case StatType.FireMaxDamage:
case StatType.LightMaxDamage:
case StatType.MagicMaxDamage:
goto Label_0350;
case StatType.ColdMinDamage:
return new ColdDamageStat(stat, br.ReadInt32(stat.SaveBits), br.ReadInt32(BaseStat.Get(StatType.ColdMaxDamage).SaveBits), br.ReadInt32(BaseStat.Get(StatType.ColdLength).SaveBits));
case StatType.ReplenishDurability:
case StatType.ReplenishQuantity:
return new ReplenishStat(stat, br.ReadInt32(stat.SaveBits));
case StatType.PoisonMinDamage:
return new PoisonDamageStat(stat, br.ReadInt32(stat.SaveBits), br.ReadInt32(BaseStat.Get(StatType.PoisonMaxDamage).SaveBits), br.ReadInt32(BaseStat.Get(StatType.PoisonLength).SaveBits));
}
}
else
{
switch (stat.Type)
{
case StatType.SingleSkill:
case StatType.NonClassSkill:
return new SkillBonusStat(stat, br.ReadInt32(stat.SaveParamBits), br.ReadInt32(stat.SaveBits));
case StatType.ElementalSkillBonus:
return new ElementalSkillsBonusStat(stat, br.ReadInt32(stat.SaveParamBits), br.ReadInt32(stat.SaveBits));
case StatType.ClassSkillsBonus:
return new ClassSkillsBonusStat(stat, br.ReadInt32(stat.SaveParamBits), br.ReadInt32(stat.SaveBits));
case StatType.Aura:
return new AuraStat(stat, br.ReadInt32(stat.SaveParamBits), br.ReadInt32(stat.SaveBits));
case StatType.Reanimate:
return new ReanimateStat(stat, br.ReadUInt32(stat.SaveParamBits), br.ReadUInt32(stat.SaveBits));
case StatType.SkillOnAttack:
case StatType.SkillOnKill:
case StatType.SkillOnDeath:
case StatType.SkillOnStriking:
case StatType.SkillOnLevelUp:
case StatType.SkillOnGetHit:
return new SkillOnEventStat(stat, br.ReadInt32(6), br.ReadInt32(10), br.ReadInt32(stat.SaveBits));
case StatType.ChargedSkill:
return new ChargedSkillStat(stat, br.ReadInt32(6), br.ReadInt32(10), br.ReadInt32(8), br.ReadInt32(8));
case StatType.SkillTabBonus:
return new SkillTabBonusStat(stat, br.ReadInt32(3), br.ReadInt32(3), br.ReadInt32(10), br.ReadInt32(stat.SaveBits));
}
throw new Exception("Invalid stat: " + stat.Index.ToString());
}
Label_0350:
if (stat.Signed)
{
int num2 = br.ReadInt32(stat.SaveBits);
if (stat.SaveAdd > 0)
{
num2 -= stat.SaveAdd;
}
return new SignedStat(stat, num2);
}
uint val = br.ReadUInt32(stat.SaveBits);
if (stat.SaveAdd > 0)
{
val -= (uint) stat.SaveAdd;
}
return new UnsignedStat(stat, val);
}
示例12: 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))
//.........这里部分代码省略.........
示例13: Deserialize
public static ActorStateProperty Deserialize(IClassNetCache classMap, string typeName, string[] objectIndexToName, UInt32 versionMajor, UInt32 versionMinor, BitReader br)
{
var asp = new ActorStateProperty();
var maxPropId = classMap.MaxPropertyId;
var className = objectIndexToName[classMap.ObjectIndex];
asp.PropertyId = br.ReadUInt32Max(maxPropId + 1);
#if DEBUG
asp.MaxPropertyId = (UInt32)maxPropId;
#endif
asp.PropertyName = objectIndexToName[classMap.GetProperty((int)asp.PropertyId).Index];
var startPosition = br.Position;
asp.Data = new List<object>();
switch (asp.PropertyName)
{
case "TAGame.GameEvent_TA:ReplicatedStateIndex":
asp.Data.Add(br.ReadUInt32Max(140)); // number is made up, I dont know the max yet // TODO: Revisit this. It might work well enough, but looks fishy
asp.MarkComplete();
break;
case "TAGame.RBActor_TA:ReplicatedRBState":
asp.Data.Add(RigidBodyState.Deserialize(br));
asp.MarkComplete();
break;
case "TAGame.CrowdActor_TA:ReplicatedOneShotSound":
case "TAGame.CrowdManager_TA:ReplicatedGlobalOneShotSound":
case "Engine.GameReplicationInfo:GameClass":
case "TAGame.CrowdManager_TA:GameEvent":
case "TAGame.CrowdActor_TA:GameEvent":
case "TAGame.Team_TA:LogoData":
case "TAGame.CameraSettingsActor_TA:PRI":
case "TAGame.PRI_TA:PersistentCamera":
case "TAGame.GameEvent_TA:MatchTypeClass":
case "TAGame.GameEvent_Soccar_TA:SubRulesArchetype":
// Theres a good chance that most of these can be moved to the next section
asp.Data.Add(br.ReadBit());
asp.Data.Add(br.ReadUInt32());
asp.MarkComplete();
break;
case "TAGame.Team_TA:GameEvent":
case "TAGame.Ball_TA:GameEvent":
case "Engine.PlayerReplicationInfo:Team":
case "Engine.Pawn:PlayerReplicationInfo":
case "TAGame.PRI_TA:ReplicatedGameEvent":
case "TAGame.CarComponent_TA:Vehicle":
case "TAGame.Car_TA:AttachedPickup":
case "TAGame.SpecialPickup_Targeted_TA:Targeted":
// TODO: Use a real class so it can be accessed normally.
// If Active == false, ActorId will be -1
asp.Data.Add(ActiveActor.Deserialize(br));
asp.MarkComplete();
break;
case "Engine.GameReplicationInfo:ServerName":
case "Engine.PlayerReplicationInfo:PlayerName":
case "TAGame.Team_TA:CustomTeamName":
case "Engine.PlayerReplicationInfo:RemoteUserData":
case "TAGame.GRI_TA:NewDedicatedServerIP":
asp.Data.Add(br.ReadString());
asp.MarkComplete();
break;
case "TAGame.GameEvent_Soccar_TA:SecondsRemaining":
case "TAGame.GameEvent_TA:ReplicatedGameStateTimeRemaining":
case "TAGame.CrowdActor_TA:ReplicatedCountDownNumber":
case "TAGame.GameEvent_Team_TA:MaxTeamSize":
case "Engine.PlayerReplicationInfo:PlayerID":
case "TAGame.PRI_TA:TotalXP":
case "TAGame.PRI_TA:MatchScore":
case "TAGame.GameEvent_Soccar_TA:RoundNum":
case "TAGame.GameEvent_TA:BotSkill":
case "TAGame.PRI_TA:MatchShots":
case "TAGame.PRI_TA:MatchSaves":
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":
//.........这里部分代码省略.........
示例14: Deserialize
public static ActorState Deserialize(int maxChannels, List<ActorState> existingActorStates, List<ActorState> frameActorStates, string[] objectIndexToName, IDictionary<string, ClassNetCache> classNetCacheByName, UInt32 versionMajor, UInt32 versionMinor, BitReader br)
{
var startPosition = br.Position;
ActorState a = new ActorState();
try
{
var actorId = br.ReadUInt32Max(maxChannels);
a.Id = actorId;
if (br.ReadBit())
{
if (br.ReadBit())
{
a.State = ActorStateState.New;
if (versionMajor > 868 || (versionMajor == 868 && versionMinor >= 14))
{
a.NameId = br.ReadUInt32();
}
a.Unknown1 = br.ReadBit();
a.TypeId = br.ReadUInt32();
a.TypeName = objectIndexToName[(int)a.TypeId.Value];
a._classNetCache = ObjectNameToClassNetCache(a.TypeName, classNetCacheByName);
a.ClassName = objectIndexToName[a._classNetCache.ObjectIndex];
if ( !ClassHasInitialPosition(a.ClassName))
{
#if DEBUG
a.KnownBits = br.GetBits(startPosition, br.Position - startPosition);
a.Complete = true;
#endif
return a;
}
a.Position = Vector3D.Deserialize(br);
if (ClassHasRotation(a.ClassName))
{
a.Rotation = Rotator.Deserialize(br);
}
#if DEBUG
a.Complete = true;
#endif
}
else
{
a.State = ActorStateState.Existing;
var oldState = existingActorStates.Where(x => x.Id == a.Id).Single();
a.TypeId = oldState.TypeId;
a.Properties = new List<ActorStateProperty>();
ActorStateProperty lastProp = null;
while (br.ReadBit())
{
lastProp = ActorStateProperty.Deserialize(oldState._classNetCache, oldState.TypeName, objectIndexToName, versionMajor, versionMinor, br);
a.Properties.Add(lastProp);
#if DEBUG
if (!lastProp.IsComplete)
{
break;
}
#endif
}
#if DEBUG
a.Complete = lastProp.IsComplete;
if (lastProp.Data.Count > 0 && lastProp.Data.Last().ToString() == "FAILED")
{
a.Failed = true;
}
#endif
var endPosition = br.Position;
}
}
else
{
a.State = ActorStateState.Deleted;
var actor = existingActorStates.Where(x => x.Id == a.Id).SingleOrDefault();
#if DEBUG
a.Complete = true;
#endif
var endPosition = br.Position;
}
#if DEBUG
if (!a.Complete)
{
// Read a bunch of data so we have something to look at in the logs
// Otherwise the logs may not show any data bits for whatever is broken, which is hard to interpret
br.ReadBytes(16);
}
a.KnownBits = br.GetBits(startPosition, br.Position - startPosition);
#endif
//.........这里部分代码省略.........