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


C# PacketWriter.WriteByte方法代码示例

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


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

示例1: EnableEvent

 /*
  * EVENTS
  */
 internal int EnableEvent(EventType etype, SuspendPolicy suspend_policy, List<Modifier> mods)
 {
     var w = new PacketWriter ().WriteByte ((byte)etype).WriteByte ((byte)suspend_policy);
     if (mods != null) {
         if (mods.Count > 255)
             throw new NotImplementedException ();
         w.WriteByte ((byte)mods.Count);
         foreach (Modifier mod in mods) {
             if (mod is CountModifier) {
                 w.WriteByte ((byte)ModifierKind.COUNT);
                 w.WriteInt ((mod as CountModifier).Count);
             } else if (mod is LocationModifier) {
                 w.WriteByte ((byte)ModifierKind.LOCATION_ONLY);
                 w.WriteId ((mod as LocationModifier).Method);
                 w.WriteLong ((mod as LocationModifier).Location);
             } else if (mod is StepModifier) {
                 w.WriteByte ((byte)ModifierKind.STEP);
                 w.WriteId ((mod as StepModifier).Thread);
                 w.WriteInt ((mod as StepModifier).Size);
                 w.WriteInt ((mod as StepModifier).Depth);
                 if (Version.AtLeast (2, 16))
                     w.WriteInt ((mod as StepModifier).Filter);
             } else if (mod is ThreadModifier) {
                 w.WriteByte ((byte)ModifierKind.THREAD_ONLY);
                 w.WriteId ((mod as ThreadModifier).Thread);
             } else if (mod is ExceptionModifier) {
                 var em = mod as ExceptionModifier;
                 w.WriteByte ((byte)ModifierKind.EXCEPTION_ONLY);
                 w.WriteId (em.Type);
                 if (Version.MajorVersion > 2 || Version.MinorVersion > 0) {
                     /* This is only supported in protocol version 2.1 */
                     w.WriteBool (em.Caught);
                     w.WriteBool (em.Uncaught);
                 } else if (!em.Caught || !em.Uncaught) {
                     throw new NotSupportedException ("This request is not supported by the protocol version implemented by the debuggee.");
                 }
                 if (Version.MajorVersion > 2 || Version.MinorVersion > 24) {
                     w.WriteBool (em.Subclasses);
                 } else if (!em.Subclasses) {
                     throw new NotSupportedException ("This request is not supported by the protocol version implemented by the debuggee.");
                 }
             } else if (mod is AssemblyModifier) {
                 w.WriteByte ((byte)ModifierKind.ASSEMBLY_ONLY);
                 var amod = (mod as AssemblyModifier);
                 w.WriteInt (amod.Assemblies.Length);
                 foreach (var id in amod.Assemblies)
                     w.WriteId (id);
             } else if (mod is SourceFileModifier) {
                 w.WriteByte ((byte)ModifierKind.SOURCE_FILE_ONLY);
                 var smod = (mod as SourceFileModifier);
                 w.WriteInt (smod.SourceFiles.Length);
                 foreach (var s in smod.SourceFiles)
                     w.WriteString (s);
             } else if (mod is TypeNameModifier) {
                 w.WriteByte ((byte)ModifierKind.TYPE_NAME_ONLY);
                 var tmod = (mod as TypeNameModifier);
                 w.WriteInt (tmod.TypeNames.Length);
                 foreach (var s in tmod.TypeNames)
                     w.WriteString (s);
             } else {
                 throw new NotImplementedException ();
             }
         }
     } else {
         w.WriteByte (0);
     }
     return SendReceive (CommandSet.EVENT_REQUEST, (int)CmdEventRequest.SET, w).ReadInt ();
 }
开发者ID:nerzhulart,项目名称:debugger-libs,代码行数:71,代码来源:Connection.cs

示例2: Serialize

        public virtual void Serialize(PacketWriter writer, bool prefix)
        {
            if (prefix) {
                writer.BlockCopy(SteamPacket.Prefix);
            }

            writer.WriteByte((byte)PacketType);
        }
开发者ID:nefarius,项目名称:steam-condenser-csharp,代码行数:8,代码来源:SteamPacket.cs

示例3: WritePacket

        public void WritePacket(PacketWriter writer)
        {
            var offset = 0x2A;
            writer.WriteInt32((int)LastVisit.TotalSeconds);
            writer.WriteInt32(Unknown1);
            writer.WriteInt32((int)DateTimeConverter.ToUnixTimestamp(Timestamp));
            writer.WriteInt32(Unknown2);
            writer.WriteInt64(UserID);
            writer.WriteInt32((int)ShieldDuration.TotalSeconds);
            writer.WriteInt32(Unknown3);
            writer.WriteInt32(Unknown4);
            writer.WriteBoolean(Compressed);
            Home.Write(writer);
            writer.WriteInt32(Unknown6);
            writer.WriteInt64(UserID1);
            writer.WriteInt64(UserID2);

            if (Avatar.Clan != null)
            {
                writer.WriteBoolean(true);
                writer.WriteInt64(Avatar.Clan.ID);
                writer.WriteString(Avatar.Clan.Name);
                writer.WriteInt64(Avatar.Clan.Badge);
                writer.WriteInt32(0); // TODO: Make unknown.
                writer.WriteInt64(Avatar.Clan.Level);
                offset += 1;
            }

            writer.WriteBoolean(Unknown7);
            if (Unknown7)
                writer.WriteInt64(Unknown8);
            writer.WriteBoolean(Unknown9);
            if (Unknown9)
                writer.WriteInt64(Unknown10);

            writer.Write(new byte[offset]);
            writer.WriteInt32(Unknown11);
            writer.WriteInt32(AllianceCastleLevel);
            writer.WriteInt32(AllianceCastleUnitCapacity);
            writer.WriteInt32(AllianceCastleUnitCount);
            writer.WriteInt32(Avatar.TownHallLevel);
            writer.WriteString(Avatar.Username);
            writer.WriteString(FacebookID);
            writer.WriteInt32(Unknown14);
            writer.WriteInt32(Unknown15);
            writer.WriteInt32(Avatar.Trophies);
            writer.WriteInt32(Avatar.AttacksWon);
            writer.WriteInt32(Avatar.AttacksLost);
            writer.WriteInt32(Avatar.DefencesWon);
            writer.WriteInt32(Avatar.DefencesLost);
            writer.WriteInt32(Unknown16);
            writer.WriteInt32(Unknown17);
            writer.WriteInt32(Unknown18);
            writer.WriteBoolean(Unknown19);
            if (Unknown19)
                writer.WriteInt64(Unknown20);
            writer.WriteByte(Unknown21);
            writer.WriteInt32(Unknown22);
            writer.WriteInt32(Unknown23);
            writer.WriteInt32(Unknown24);
            writer.WriteInt32(Unknown25);
            for (int i = 0; i < 16; i++)
                writer.WriteInt32(0);
        }
开发者ID:castelbuilder123,项目名称:CoCSharp,代码行数:64,代码来源:OwnHomeDataPacket.cs

示例4: WritePacket

 public void WritePacket(PacketWriter writer)
 {
     writer.WriteInt32((int)FailureReason);
     if (Fingerprint != null)
         writer.WriteString(Fingerprint.ToJson());
     else
         writer.WriteString(null);
     writer.WriteString(HostName);
     writer.WriteString(AssetsRootUrl);
     writer.WriteString(iTunesUrl);
     writer.WriteString(Unknown1);
     writer.WriteInt32(RemainingTime);
     writer.WriteByte(Unknown2);
     writer.WriteByteArray(CompressedFingerprintJson);
     writer.WriteString(Unknown3);
     writer.WriteString(Unknown4);
     File.WriteAllBytes("dump", ((MemoryStream)writer.BaseStream).ToArray());
 }
开发者ID:maithanhtan,项目名称:CoCSharp,代码行数:18,代码来源:LoginFailedPacket.cs


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