当前位置: 首页>>代码示例>>C#>>正文


C# BitWriter.Write方法代码示例

本文整理汇总了C#中BitWriter.Write方法的典型用法代码示例。如果您正苦于以下问题:C# BitWriter.Write方法的具体用法?C# BitWriter.Write怎么用?C# BitWriter.Write使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BitWriter的用法示例。


在下文中一共展示了BitWriter.Write方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GammaCode

        public static void GammaCode(ulong number, BitWriter writer)
        {
            // to allow zero
            number += 1;

            int size = 0;
            ulong tmp = number;

            while (tmp >= 1)
            {
                size++;
                tmp /= 2;
            }

            int zeroes = size - 1;

            for (int i = 0; i < zeroes; i++)
                writer.Write(false);

            for (int i = size - 1; i >= 0; i--)
            {
                bool bit = (number & (1UL << i)) != 0;
                writer.Write(bit);
            }
        }
开发者ID:svick,项目名称:Arithmetic-coding,代码行数:25,代码来源:Elias.cs

示例2: Serialize

 public void Serialize(BitWriter bw)
 {
     bw.Write(Active);
     bw.Write(ActorId);
     Offset.Serialize(bw);
     bw.Write(Mass);
     Rotation.Serialize(bw);
 }
开发者ID:jjbott,项目名称:RocketLeagueReplayParser,代码行数:8,代码来源:WeldedInfo.cs

示例3: Serialize

 public void Serialize(BitWriter bw)
 {
     bw.Write(TeamNumber);
     bw.Write(TeamColorId);
     bw.Write(CustomColorId);
     bw.Write(TeamFinishId);
     bw.Write(CustomFinishId);
 }
开发者ID:jjbott,项目名称:RocketLeagueReplayParser,代码行数:8,代码来源:TeamPaint.cs

示例4: Serialize

 public void Serialize(BitWriter bw)
 {
     string.Join(",", Mutators).Serialize(bw);
     bw.Write(Unknown1);
     bw.Write(Unknown2);
     GameName.Serialize();
     Password.Serialize();
     bw.Write(Unknown3);
 }
开发者ID:jjbott,项目名称:RocketLeagueReplayParser,代码行数:9,代码来源:PrivateMatchSettings.cs

示例5: Serialize

 public void Serialize(BitWriter bw)
 {
     bw.Write(Unknown1);
     bw.Write(AttackerActorId);
     bw.Write(Unknown2);
     bw.Write(VictimActorId);
     AttackerVelocity.Serialize(bw);
     VictimVelocity.Serialize(bw);
 }
开发者ID:jjbott,项目名称:RocketLeagueReplayParser,代码行数:9,代码来源:ReplicatedDemolish.cs

示例6: Serialize

 public void Serialize(BitWriter bw)
 {
     bw.Write((byte)ThingLists.Count);
     foreach (var thingList in ThingLists)
     {
         bw.Write((byte)thingList.Count);
         foreach(var thing in thingList)
         {
             thing.Serialize(bw);
             // "i >= 21" logic from Deserialize is handled automatically here. No special serialize logic needed.
         }
     }
 }
开发者ID:jjbott,项目名称:RocketLeagueReplayParser,代码行数:13,代码来源:ClientLoadoutOnline.cs

示例7: Serialize

        public void Serialize(BitWriter bw)
        {
            bw.Write(Sleeping);
            Position.Serialize(bw);
            Rotation.SerializeFixed(bw);

            if (!Sleeping)
            {
                LinearVelocity.Serialize(bw);
                AngularVelocity.Serialize(bw);
            }
        }
开发者ID:jjbott,项目名称:RocketLeagueReplayParser,代码行数:12,代码来源:RigidBodyState.cs

示例8: Serialize

 public void Serialize(BitWriter bw)
 {
     bw.Write(FieldOfView);
     bw.Write(Height);
     bw.Write(Pitch);
     bw.Write(Distance);
     bw.Write(Stiffness);
     bw.Write(SwivelSpeed);
 }
开发者ID:jjbott,项目名称:RocketLeagueReplayParser,代码行数:9,代码来源:CameraSettings.cs

示例9: Serialize

        public void Serialize(BitWriter bw)
        {
            bw.Write(Version);
            bw.Write(BodyProductId);
            bw.Write(SkinProductId);
            bw.Write(WheelProductId);
            bw.Write(BoostProductId);
            bw.Write(AntennaProductId);
            bw.Write(HatProductId);
            bw.Write(Unknown2);

            if (Version > 10)
            {
                bw.Write(Unknown3);
            }
        }
开发者ID:jjbott,项目名称:RocketLeagueReplayParser,代码行数:16,代码来源:ClientLoadout.cs

示例10: Serialize

        public void Serialize(UInt32 versionMajor, UInt32 versionMinor, BitWriter bw)
        {
            bw.WriteFixedBitCount(Unknown1, 3);
            PlayerId.Serialize(bw);
            if ( PlayerId.Type != UniqueId.UniqueIdType.Unknown)
            {
                PlayerName.Serialize(bw);
            }

            if (versionMajor < 868 || versionMinor < 12)
            {
                bw.WriteFixedBitCount(Unknown2, 2);
            }
            else
            {
                bw.Write(Unknown2);
            }
        }
开发者ID:jjbott,项目名称:RocketLeagueReplayParser,代码行数:18,代码来源:Reservation.cs

示例11: Serialize

        public void Serialize(BitWriter bw)
        {
            byte b = AxisToByte(Pitch);
            bw.Write(b != 0);
            if (b != 0)
            {
                bw.Write(b);
            }

            b = AxisToByte(Yaw);
            bw.Write(b != 0);
            if (b != 0)
            {
                bw.Write(b);
            }

            b = AxisToByte(Roll);
            bw.Write(b != 0);
            if (b != 0)
            {
                bw.Write(b);
            }
        }
开发者ID:jjbott,项目名称:RocketLeagueReplayParser,代码行数:23,代码来源:Rotator.cs

示例12: Serialize

 public void Serialize(BitWriter bw)
 {
     bw.Write(Active);
     bw.Write(ActorId);
 }
开发者ID:jjbott,项目名称:RocketLeagueReplayParser,代码行数:5,代码来源:ActiveActor.cs

示例13: Serialize

        public void Serialize(int maxPropId, UInt32 versionMajor, UInt32 versionMinor, BitWriter bw)
        {
            bw.Write(PropertyId, (UInt32)maxPropId + 1);

            // TODO: Make it so each property is typed better, so I serialize/deserialize types
            // instead of having separate serialize/deserialize logic for each property.
            // Will also make it do I dont have to do so much casting from object
            switch (PropertyName)
            {
                case "TAGame.GameEvent_TA:ReplicatedStateIndex":
                    bw.Write((UInt32)Data[0], 140); // number is made up, I dont know the max yet // TODO: Revisit this. It might work well enough, but looks fishy
                    break;
                case "TAGame.RBActor_TA:ReplicatedRBState":
                    ((RigidBodyState)Data[0]).Serialize(bw);
                    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":
                    // Theres a good chance that most of these can be moved to the next section
                    bw.Write((bool)Data[0]);
                    bw.Write((UInt32)Data[1]);
                    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":
                    ((ActiveActor)Data[0]).Serialize(bw);
                    break;
                case "Engine.GameReplicationInfo:ServerName":
                case "Engine.PlayerReplicationInfo:PlayerName":
                case "TAGame.Team_TA:CustomTeamName":
                case "Engine.PlayerReplicationInfo:RemoteUserData":
                case "TAGame.GRI_TA:NewDedicatedServerIP":
                    ((string)Data[0]).Serialize(bw);
                    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":
                    bw.Write((UInt32)Data[0]);
                    break;
                case "TAGame.VehiclePickup_TA:ReplicatedPickupData":
                    bw.Write((bool)Data[0]);
                    bw.Write((UInt32)Data[1]);
                    bw.Write((bool)Data[2]);
                    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":
                    bw.Write((byte)Data[0]);
                    break;
                case "Engine.Actor:Location":
                case "TAGame.CarComponent_Dodge_TA:DodgeTorque":
                    ((Vector3D)Data[0]).Serialize(bw);
                    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":
//.........这里部分代码省略.........
开发者ID:jjbott,项目名称:RocketLeagueReplayParser,代码行数:101,代码来源:ActorStateProperty.cs

示例14: Serialize

        public void Serialize(int maxChannels, Dictionary<UInt32, ActorState> newActorsById, UInt32 versionMajor, UInt32 versionMinor, BitWriter bw)
        {
            bw.Write(Id, (UInt32)maxChannels);

            bw.Write(State != ActorStateState.Deleted);
            if ( State == ActorStateState.Deleted)
            {
                return;
            }

            bw.Write(State == ActorStateState.New);

            if ( State == ActorStateState.New)
            {
                bw.Write(Unknown1);
                bw.Write(TypeId.Value);

                if (ClassHasInitialPosition(ClassName)) // Could just check if Position is null...
                {
                    Position.Serialize(bw);
                }

                if (ClassHasRotation(ClassName))
                {
                    Rotation.Serialize(bw);
                }
            }
            else if ( State == ActorStateState.Existing)
            {
                // Need to figure out what type we are, so we can tell the property serializer the max property id
                var oldState = newActorsById[Id];
                foreach (var property in Properties)
                {
                    bw.Write(true); // Here comes a property!
                    property.Serialize(oldState._classNetCache.MaxPropertyId, versionMajor, versionMinor, bw);
                }
                bw.Write(false);
            }
            else // Deleted
            {
                // Nothing to do
            }
        }
开发者ID:jjbott,项目名称:RocketLeagueReplayParser,代码行数:43,代码来源:ActorState.cs

示例15: Serialize

        public void Serialize(int maxChannels, ref Dictionary<UInt32, ActorState> newActorsById, UInt32 versionMajor, UInt32 versionMinor, BitWriter bw)
        {
            bw.Write(Time);
            bw.Write(Delta); // TODO: recalculate

            foreach (var deletedActor in ActorStates.Where(a => a.State == ActorStateState.Deleted))
            {
                bw.Write(true); // There is another actor state
                deletedActor.Serialize(maxChannels, null, versionMajor, versionMinor, bw);
            }

            foreach (var newActor in ActorStates.Where(a => a.State == ActorStateState.New))
            {
                bw.Write(true); // There is another actor state

                newActorsById[newActor.Id] = newActor;

                newActor.Serialize(maxChannels, null, versionMajor, versionMinor, bw);
            }

            foreach (var existingActor in ActorStates.Where(a => a.State == ActorStateState.Existing))
            {
                bw.Write(true); // There is another actor state

                existingActor.Serialize(maxChannels, newActorsById, versionMajor, versionMinor, bw);
            }

            bw.Write(false); // No more actor states
        }
开发者ID:jjbott,项目名称:RocketLeagueReplayParser,代码行数:29,代码来源:Frame.cs


注:本文中的BitWriter.Write方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。