當前位置: 首頁>>代碼示例>>C#>>正文


C# BitReader.ReadByte方法代碼示例

本文整理匯總了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;
        }
開發者ID:jjbott,項目名稱:RocketLeagueReplayParser,代碼行數:26,代碼來源:ClientLoadoutOnline.cs

示例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;
        }
開發者ID:jjbott,項目名稱:RocketLeagueReplayParser,代碼行數:12,代碼來源:TeamPaint.cs

示例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;
        }
開發者ID:jjbott,項目名稱:RocketLeagueReplayParser,代碼行數:31,代碼來源:Reservation.cs

示例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;
 }
開發者ID:jjbott,項目名稱:RocketLeagueReplayParser,代碼行數:17,代碼來源:Rotator.cs

示例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;
        }
開發者ID:jjbott,項目名稱:RocketLeagueReplayParser,代碼行數:20,代碼來源:ClientLoadout.cs

示例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))
//.........這裏部分代碼省略.........
開發者ID:killerbonzai,項目名稱:BlueVex2,代碼行數:101,代碼來源:GameServerPackets.cs

示例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":
開發者ID:jjbott,項目名稱:RocketLeagueReplayParser,代碼行數:67,代碼來源:ActorStateProperty.cs

示例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);
 }
開發者ID:treejames,項目名稱:carterminal,代碼行數:14,代碼來源:Protocol.cs

示例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);
 }
開發者ID:treejames,項目名稱:carterminal,代碼行數:18,代碼來源:Protocol.cs

示例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);
        }
開發者ID:treejames,項目名稱:carterminal,代碼行數:51,代碼來源:Protocol.cs


注:本文中的BitReader.ReadByte方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。