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


C# ByteStream.ReadFixedLengthString方法代码示例

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


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

示例1: GetDoors

        override public List<Door> GetDoors()
        {
            List<Door> DoorList = new List<Door>();

            List<byte[]> SpawnDoorPacket = GetPacketsOfType("OP_SpawnDoor", PacketDirection.ServerToClient);

            if ((SpawnDoorPacket.Count == 0) || (SpawnDoorPacket[0].Length == 0))
                return DoorList;

            int DoorCount = SpawnDoorPacket[0].Length / 100;

            ByteStream Buffer = new ByteStream(SpawnDoorPacket[0]);

            for (int d = 0; d < DoorCount; ++d)
            {
                string DoorName = Buffer.ReadFixedLengthString(32, false);

                float YPos = Buffer.ReadSingle();

                float XPos = Buffer.ReadSingle();

                float ZPos = Buffer.ReadSingle();

                float Heading = Buffer.ReadSingle();

                UInt32 Incline = Buffer.ReadUInt32();

                Int32 Size = Buffer.ReadInt32();

                Buffer.SkipBytes(4); // Skip Unknown

                Byte DoorID = Buffer.ReadByte();

                Byte OpenType = Buffer.ReadByte();

                Byte StateAtSpawn = Buffer.ReadByte();

                Byte InvertState = Buffer.ReadByte();

                Int32 DoorParam = Buffer.ReadInt32();

                // Skip past the trailing unknowns in the door struct, moving to the next door in the packet.

                Buffer.SkipBytes(32);

                string DestZone = "NONE";

                Door NewDoor = new Door(DoorName, YPos, XPos, ZPos, Heading, Incline, Size, DoorID, OpenType, StateAtSpawn, InvertState,
                                        DoorParam, DestZone, 0, 0, 0, 0);

                DoorList.Add(NewDoor);

            }
            return DoorList;
        }
开发者ID:Codex-NG,项目名称:Server,代码行数:55,代码来源:PatchMarch13-2013.cs

示例2: GetZoneData

        public override NewZoneStruct GetZoneData()
        {
            NewZoneStruct NewZone = new NewZoneStruct();

            List<byte[]> ZonePackets = GetPacketsOfType("OP_NewZone", PacketDirection.ServerToClient);

            if (ZonePackets.Count < 1)
                return NewZone;

            // Assume there is only 1 packet and process the first one.

            ByteStream Buffer = new ByteStream(ZonePackets[0]);

            string CharName = Buffer.ReadFixedLengthString(64, false);

            NewZone.ShortName = Buffer.ReadFixedLengthString(32, false);

            Buffer.SkipBytes(96);   // Skip Unknown

            NewZone.LongName = Buffer.ReadFixedLengthString(278, true);

            NewZone.Type = Buffer.ReadByte();

            NewZone.FogRed = Buffer.ReadBytes(4);

            NewZone.FogGreen = Buffer.ReadBytes(4);

            NewZone.FogBlue = Buffer.ReadBytes(4);

            Buffer.SkipBytes(1);   // Unknown

            for (int i = 0; i < 4; ++i)
                NewZone.FogMinClip[i] = Buffer.ReadSingle();

            for (int i = 0; i < 4; ++i)
                NewZone.FogMaxClip[i] = Buffer.ReadSingle();

            NewZone.Gravity = Buffer.ReadSingle();

            NewZone.TimeType = Buffer.ReadByte();

            Buffer.SkipBytes(49);   // Unknown

            NewZone.Sky = Buffer.ReadByte();

            Buffer.SkipBytes(13);   // Unknown

            NewZone.ZEM = Buffer.ReadSingle();

            NewZone.SafeY = Buffer.ReadSingle();

            NewZone.SafeX = Buffer.ReadSingle();

            NewZone.SafeZ = Buffer.ReadSingle();

            NewZone.MinZ = Buffer.ReadSingle();

            NewZone.MaxZ = Buffer.ReadSingle();

            NewZone.UnderWorld = Buffer.ReadSingle();

            NewZone.MinClip = Buffer.ReadSingle();

            NewZone.MaxClip = Buffer.ReadSingle();

            Buffer.SkipBytes(84);   // Unknown

            NewZone.ShortName2 = Buffer.ReadFixedLengthString(96, false);

            Buffer.SkipBytes(52);   // Unknown

            NewZone.ZoneID = Buffer.ReadUInt16();

            NewZone.InstanceID = Buffer.ReadUInt16();

            Buffer.SkipBytes(38);   // Unknown

            NewZone.FallDamage = Buffer.ReadByte();

            Buffer.SkipBytes(21);   // Unknown

            NewZone.FogDensity = Buffer.ReadSingle();

            // Everything else after this point in the packet is unknown.

            return NewZone;
        }
开发者ID:Vaion,项目名称:Server,代码行数:87,代码来源:PatchSoD.cs

示例3: GetGroundSpawns

        public override List<GroundSpawnStruct> GetGroundSpawns()
        {
            List<GroundSpawnStruct> GroundSpawns = new List<GroundSpawnStruct>();

            List<byte[]> GroundSpawnPackets = GetPacketsOfType("OP_GroundSpawn", PacketDirection.ServerToClient);

            foreach (byte[] GroundSpawnPacket in GroundSpawnPackets)
            {
                GroundSpawnStruct GroundSpawn = new GroundSpawnStruct();

                ByteStream Buffer = new ByteStream(GroundSpawnPacket);

                Buffer.SkipBytes(12);

                GroundSpawn.DropID = Buffer.ReadUInt32();

                GroundSpawn.ZoneID = Buffer.ReadUInt16();

                GroundSpawn.InstanceID = Buffer.ReadUInt16();

                Buffer.SkipBytes(8);

                GroundSpawn.Heading = Buffer.ReadSingle();

                Buffer.SkipBytes(12);

                GroundSpawn.z = Buffer.ReadSingle();

                GroundSpawn.x = Buffer.ReadSingle();

                GroundSpawn.y = Buffer.ReadSingle();

                GroundSpawn.Name = Buffer.ReadFixedLengthString(16, false);

                Buffer.SkipBytes(20);

                GroundSpawn.ObjectType = Buffer.ReadUInt32();

                GroundSpawns.Add(GroundSpawn);
            }
            return GroundSpawns;
        }
开发者ID:Vaion,项目名称:Server,代码行数:42,代码来源:PatchSoD.cs

示例4: ExploreSpawnDoor

        public void ExploreSpawnDoor(StreamWriter OutputStream, ByteStream Buffer, PacketDirection Direction)
        {
            uint DoorCount = Buffer.Length() / 96;

            OutputStream.WriteLine("Door Count: {0}", DoorCount);

            for (int d = 0; d < DoorCount; ++d)
            {
                string DoorName = Buffer.ReadFixedLengthString(32, false);


                float YPos = Buffer.ReadSingle();

                float XPos = Buffer.ReadSingle();

                float ZPos = Buffer.ReadSingle();

                float Heading = Buffer.ReadSingle();

                UInt32 Incline = Buffer.ReadUInt32();

                Int32 Size = Buffer.ReadInt32();

                Buffer.SkipBytes(4); // Skip Unknown

                Byte DoorID = Buffer.ReadByte();

                Byte OpenType = Buffer.ReadByte();

                Byte StateAtSpawn = Buffer.ReadByte();

                Byte InvertState = Buffer.ReadByte();

                Int32 DoorParam = Buffer.ReadInt32();

                OutputStream.WriteLine(" Name: {0} ID: {1} OT: {2} SAS: {3} IS: {4} DP: {5}",
                                        DoorName, DoorID, OpenType, StateAtSpawn, InvertState, DoorParam);

                // Skip past the trailing unknowns in the door struct, moving to the next door in the packet.

                Buffer.SkipBytes(28);
            }

        }
开发者ID:Xackery,项目名称:eqemuserver,代码行数:44,代码来源:PatchMay12-2011.cs


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