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


C# IWriter.WriteByte方法代码示例

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


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

示例1: WriteLocaleChanges

        private static void WriteLocaleChanges(Patch patch, IWriter writer)
        {
            if (patch.LanguageChanges.Count == 0)
                return;

            long startPos = writer.Position;
            writer.WriteInt32(AssemblyPatchBlockID.Locl);
            writer.WriteUInt32(0); // Size filled in later
            writer.WriteByte(0); // Version 0

            // Write change data for each language
            writer.WriteByte((byte)patch.LanguageChanges.Count);
            foreach (LanguageChange language in patch.LanguageChanges)
            {
                writer.WriteByte(language.LanguageIndex);

                // Write the change data for each string in the language
                writer.WriteInt32(language.LocaleChanges.Count);
                foreach (LocaleChange change in language.LocaleChanges)
                {
                    writer.WriteUInt16((ushort)change.Index);
                    writer.WriteUTF8(change.NewValue);
                }
            }

            // Fill in the block size
            long endPos = writer.Position;
            writer.SeekTo(startPos + 4);
            writer.WriteUInt32((uint)(endPos - startPos));
            writer.SeekTo(endPos);
        }
开发者ID:YxCREATURExY,项目名称:Assembly,代码行数:31,代码来源:AssemblyPatchWriter.cs

示例2: IncrementAndAppendChars

    private int IncrementAndAppendChars(
IWriter output,
char b1,
char b2,
char b3) {
      var count = 0;
      if (!this.unlimitedLineLength) {
        if (this.lineCount + 3 > 75) {
          // 76 including the final '='
          output.WriteByte(0x3d);
          output.WriteByte(0x0d);
          output.WriteByte(0x0a);
          this.lineCount = 0;
          count += 3;
        }
      }
      if (this.lineCount==0 && b1=='.') {
        output.WriteByte((byte)'=');
        output.WriteByte((byte)'2');
        output.WriteByte((byte)'E');
        this.lineCount += 2;
        count += 2;
      } else {
        output.WriteByte((byte)b1);
      }
      output.WriteByte((byte)b2);
      output.WriteByte((byte)b3);
      this.lineCount += 3;
      count += 3;
      return count;
    }
开发者ID:houzhenggang,项目名称:MailLib,代码行数:31,代码来源:QuotedPrintableEncoder.cs

示例3: IncrementAndAppend

 private int IncrementAndAppend(IWriter output, string appendStr) {
   var count = 0;
   if (!this.unlimitedLineLength) {
     if (this.lineCount + appendStr.Length > 75) {
       // 76 including the final '='
       output.WriteByte(0x3d);
       output.WriteByte(0x0d);
       output.WriteByte(0x0a);
       this.lineCount = 0;
       count += 3;
     }
   }
   for (int i = 0; i < appendStr.Length; ++i) {
     if (i==0 && this.lineCount == 0 && appendStr[i] == '.') {
       output.WriteByte((byte)'=');
       output.WriteByte((byte)'2');
       output.WriteByte((byte)'E');
       this.lineCount += 2;
       count += 2;
     } else {
       output.WriteByte((byte)appendStr[i]);
     }
     ++count;
   }
   this.lineCount += appendStr.Length;
   return count;
 }
开发者ID:houzhenggang,项目名称:MailLib,代码行数:27,代码来源:QuotedPrintableEncoder.cs

示例4: WritePatch

        public static void WritePatch(Patch patch, IWriter writer)
        {
            var startPos = WriteBlockHeader(writer, AssemblyPatchMagic);
            writer.WriteByte(0); // No compression

            WriteBlocks(patch, writer);

            EndBlock(writer, startPos);
        }
开发者ID:iBotPeaches,项目名称:Assembly,代码行数:9,代码来源:AssemblyPatchWriter.cs

示例5: Encode

    public int Encode(int c, IWriter s) {
      if (s == null) {
  throw new ArgumentNullException("s");
}
      if (c < 0) {
 return -1;
}
      c &= 0xff;
      s.WriteByte((byte)c);
      return 1;
    }
开发者ID:houzhenggang,项目名称:MailLib,代码行数:11,代码来源:IdentityEncoder.cs

示例6: WriteSegmentChanges

		private static void WriteSegmentChanges(Patch patch, ContainerWriter container, IWriter writer)
		{
			if (patch.SegmentChanges.Count == 0)
				return;

			container.StartBlock("segm", 0); // Version 0

			writer.WriteByte((byte) patch.SegmentChanges.Count);
			foreach (SegmentChange segment in patch.SegmentChanges)
			{
				writer.WriteUInt32(segment.OldOffset);
				writer.WriteInt32(segment.OldSize);
				writer.WriteUInt32(segment.NewOffset);
				writer.WriteInt32(segment.NewSize);
				writer.WriteByte(Convert.ToByte(segment.ResizeAtEnd));

				WriteDataChanges(segment.DataChanges, writer);
			}

			container.EndBlock();
		}
开发者ID:t3hm00kz,项目名称:Assembly,代码行数:21,代码来源:AssemblyPatchWriter.cs

示例7: WritePatchInfo

		private static void WritePatchInfo(Patch patch, ContainerWriter container, IWriter writer)
		{
			container.StartBlock("titl", 2); // Version 2

			// Write target map info
			writer.WriteInt32(patch.MapID);
			if (patch.MapInternalName != null)
				writer.WriteAscii(patch.MapInternalName);
			else
				writer.WriteByte(0);

			// Write patch info
			writer.WriteUTF16(patch.Name);
			writer.WriteUTF16(patch.Description);
			writer.WriteUTF16(patch.Author);

			// Write screenshot
			if (patch.Screenshot != null)
			{
				writer.WriteInt32(patch.Screenshot.Length);
				writer.WriteBlock(patch.Screenshot);
			}
			else
			{
				writer.WriteInt32(0);
			}

			// Write meta info
			writer.WriteUInt32(patch.MetaPokeBase);
			writer.WriteSByte((sbyte) patch.MetaChangesIndex);

			// Write output name
			if (patch.OutputName != null)
				writer.WriteAscii(patch.OutputName);
			else
				writer.WriteByte(0);

			container.EndBlock();
		}
开发者ID:t3hm00kz,项目名称:Assembly,代码行数:39,代码来源:AssemblyPatchWriter.cs

示例8: WriteBlfInfo

        private static void WriteBlfInfo(Patch patch, IWriter writer)
        {
            if (patch.CustomBlfContent == null)
                return;

            var startPos = WriteBlockHeader(writer, AssemblyPatchBlockID.Blfc);
            writer.WriteByte(0); // Version 0

            writer.WriteByte((byte)patch.CustomBlfContent.TargetGame);

            // Write mapinfo filename
            if (patch.CustomBlfContent.MapInfoFileName != null)
                writer.WriteAscii(patch.CustomBlfContent.MapInfoFileName);
            else
                writer.WriteByte(0);

            // Write mapinfo data
            if (patch.CustomBlfContent.MapInfo != null)
            {
                writer.WriteUInt32((uint)patch.CustomBlfContent.MapInfo.Length);
                writer.WriteBlock(patch.CustomBlfContent.MapInfo);
            }
            else
            {
                writer.WriteUInt32(0);
            }

            // Write BLF containers
            writer.WriteInt16((short)patch.CustomBlfContent.BlfContainerEntries.Count);
            foreach (var blfContainerEntry in patch.CustomBlfContent.BlfContainerEntries)
            {
                writer.WriteAscii(blfContainerEntry.FileName);
                writer.WriteUInt32((uint)blfContainerEntry.BlfContainer.Length);
                writer.WriteBlock(blfContainerEntry.BlfContainer);
            }

            EndBlock(writer, startPos);
        }
开发者ID:iBotPeaches,项目名称:Assembly,代码行数:38,代码来源:AssemblyPatchWriter.cs

示例9: WritePatch

        public static void WritePatch(Patch patch, IWriter writer)
        {
            writer.WriteInt32(AssemblyPatchMagic);
            writer.WriteUInt32(0); // File size filled in later
            writer.WriteByte(0); // No compression

            WriteBlocks(patch, writer);

            // Fill in the file size
            long fileSize = writer.Position;
            writer.SeekTo(4);
            writer.WriteUInt32((uint)fileSize - 8);
            writer.SeekTo(fileSize);
        }
开发者ID:YxCREATURExY,项目名称:Assembly,代码行数:14,代码来源:AssemblyPatchWriter.cs

示例10: WriteBlfInfo

        private static void WriteBlfInfo(Patch patch, ContainerWriter container, IWriter writer)
        {
            if (patch.CustomBlfContent == null)
                return;

            container.StartBlock("blfc", 0); // Version 0

            writer.WriteByte((byte) patch.CustomBlfContent.TargetGame);

            // Write mapinfo filename
            if (patch.CustomBlfContent.MapInfoFileName != null)
                writer.WriteAscii(patch.CustomBlfContent.MapInfoFileName);
            else
                writer.WriteByte(0);

            // Write mapinfo data
            if (patch.CustomBlfContent.MapInfo != null)
            {
                writer.WriteUInt32((uint) patch.CustomBlfContent.MapInfo.Length);
                writer.WriteBlock(patch.CustomBlfContent.MapInfo);
            }
            else
            {
                writer.WriteUInt32(0);
            }

            // Write BLF containers
            writer.WriteInt16((short) patch.CustomBlfContent.BlfContainerEntries.Count);
            foreach (BlfContainerEntry blfContainerEntry in patch.CustomBlfContent.BlfContainerEntries)
            {
                writer.WriteAscii(blfContainerEntry.FileName);
                writer.WriteUInt32((uint) blfContainerEntry.BlfContainer.Length);
                writer.WriteBlock(blfContainerEntry.BlfContainer);
            }

            container.EndBlock();
        }
开发者ID:ChadSki,项目名称:Assembly,代码行数:37,代码来源:AssemblyPatchWriter.cs

示例11: WriteMetaChanges

        private static void WriteMetaChanges(Patch patch, IWriter writer)
        {
            if (patch.MetaChanges.Count == 0)
                return;

            long startPos = writer.Position;
            writer.WriteInt32(AssemblyPatchBlockID.Meta);
            writer.WriteUInt32(0); // Size filled in later
            writer.WriteByte(0); // Version 0

            // Filter meta changes by size (as a file size optimization)
            List<MetaChange> fourByteChanges = new List<MetaChange>();
            List<MetaChange> otherChanges = new List<MetaChange>();
            foreach (MetaChange change in patch.MetaChanges)
            {
                if (change.Data.Length == 4)
                    fourByteChanges.Add(change);
                else
                    otherChanges.Add(change);
            }

            // Write 4-byte changes
            writer.WriteUInt32((uint)fourByteChanges.Count);
            foreach (MetaChange change in fourByteChanges)
            {
                writer.WriteUInt32(change.Address);
                writer.WriteBlock(change.Data);
            }

            // Write other changes
            writer.WriteUInt32((uint)otherChanges.Count);
            foreach (MetaChange change in otherChanges)
            {
                writer.WriteUInt32(change.Address);
                writer.WriteUInt32((uint)change.Data.Length);
                writer.WriteBlock(change.Data);
            }

            // Fill in the block size
            long endPos = writer.Position;
            writer.SeekTo(startPos + 4);
            writer.WriteUInt32((uint)(endPos - startPos));
            writer.SeekTo(endPos);
        }
开发者ID:YxCREATURExY,项目名称:Assembly,代码行数:44,代码来源:AssemblyPatchWriter.cs

示例12: WriteResources

        private static void WriteResources(TagContainer tags, ContainerWriter container, IWriter writer)
        {
            foreach (ExtractedResourceInfo resource in tags.Resources)
            {
                container.StartBlock("rsrc", 1);

                writer.WriteUInt32(resource.OriginalIndex.Value);
                writer.WriteUInt32(resource.Flags);
                if (resource.Type != null)
                    writer.WriteAscii(resource.Type);
                else
                    writer.WriteByte(0);
                WriteByteArray(resource.Info, writer);
                writer.WriteUInt32(resource.OriginalParentTagIndex.Value);
                if (resource.Location != null)
                {
                    writer.WriteByte(1);
                    writer.WriteInt32(resource.Location.OriginalPrimaryPageIndex);
                    writer.WriteInt32(resource.Location.PrimaryOffset);
                    writer.WriteInt32(resource.Location.PrimaryUnknown);
                    writer.WriteInt32(resource.Location.OriginalSecondaryPageIndex);
                    writer.WriteInt32(resource.Location.SecondaryOffset);
                    writer.WriteInt32(resource.Location.SecondaryUnknown);
                }
                else
                {
                    writer.WriteByte(0);
                }
                writer.WriteInt32(resource.Unknown1);
                writer.WriteInt32(resource.Unknown2);
                writer.WriteInt32(resource.Unknown3);

                writer.WriteInt32(resource.ResourceFixups.Count);
                foreach (ResourceFixup fixup in resource.ResourceFixups)
                {
                    writer.WriteInt32(fixup.Offset);
                    writer.WriteUInt32(fixup.Address);
                }

                writer.WriteInt32(resource.DefinitionFixups.Count);
                foreach (ResourceDefinitionFixup fixup in resource.DefinitionFixups)
                {
                    writer.WriteInt32(fixup.Offset);
                    writer.WriteInt32(fixup.Type);
                }

                container.EndBlock();
            }
        }
开发者ID:Cloms,项目名称:Assembly,代码行数:49,代码来源:TagContainerWriter.cs

示例13: Encode

   public int Encode(
 int c,
 IWriter output)
   {
       if (output == null) {
       throw new ArgumentNullException("output");
         }
         var count = 0;
         if (c >= 0) {
       c &= 0xff;
         }
         while (true) {
       switch (this.machineState) {
         case 0: {
         // Normal
         if (c < 0) {
           return -1;
         }
         if (c == 0xd) {
           if (this.lineBreakMode == 0) {
             return count + this.IncrementAndAppend(output, "=0D");
           } else {
             this.machineState = 1;
             return count;
           }
         } else if (c == 0xa) {
           if (this.lineBreakMode == 2) {
             output.WriteByte((byte)0x0d);
             output.WriteByte((byte)0x0a);
             this.lineCount = 0;
             return 2 + count;
           } else {
             return count + this.IncrementAndAppend(output, "=0A");
           }
         } else if (c == 0x09) {
           return count + this.IncrementAndAppend(output, "=09");
         } else if (c == 0x3d) {
           return count + this.IncrementAndAppend(output, "=3D");
         } else if (c == 0x2e && this.lineCount == 0) {
           return count + this.IncrementAndAppend(output, "=2E");
         } else if (c == 0x46 && this.lineCount == 0) {
           this.machineState = 3;
           return count;
         } else if (c == 0x20) {
           this.machineState = 7;
           return count;
         } else if ((c >= 'A' && c <= 'Z') ||
           (c >= '0' && c <= '9') || (c >= 'a' && c <= 'z') ||
           "()'+-.,/?:".IndexOf((char)c) >= 0) {
           return count + this.IncrementAndAppendChar(output, (char)c);
         } else {
           count += this.IncrementAndAppendChars(
         output,
         (char)0x3d,
         HexAlphabet[(c >> 4) & 15],
         HexAlphabet[c & 15]);
           return count;
         }
       }
         case 1: {
         // Carriage return
         if (c == 0x0a) {
           output.WriteByte((byte)0x0d);
           output.WriteByte((byte)0x0a);
           this.lineCount = 0;
           count += 2;
           this.machineState = 0;
           return count;
         } else {
           if (this.lineBreakMode == 2) {
             output.WriteByte((byte)0x0d);
             output.WriteByte((byte)0x0a);
             this.lineCount = 0;
             this.machineState = 0;
             count += 2;
             continue;
           } else {
             count += this.IncrementAndAppend(output, "=0D");
             this.machineState = 0;
             continue;
           }
         }
       }
         case 3: {
         // Capital F at beginning of line
         // See page 7-8 of RFC 2049
         if (c == (byte)'r') {
           this.machineState = 4;
           return count;
         } else {
           count += this.IncrementAndAppendChar(output, (char)'F');
           this.machineState = 0;
           continue;
         }
       }
         case 4: {
         // 'Fr' at beginning of line
         if (c == (byte)'o') {
           this.machineState = 5;
           return count;
//.........这里部分代码省略.........
开发者ID:peteroupc,项目名称:MailLib,代码行数:101,代码来源:QuotedPrintableEncoder.cs

示例14: IncrementAndAppendChar

 private int IncrementAndAppendChar(IWriter output, char ch)
 {
     var count = 1;
       if (!this.unlimitedLineLength) {
     if (this.lineCount + 1 > 75) {
       // 76 including the final '='
       byte[] buf;
       if (ch == '.') {
     buf = new byte[] { 0x3d, 0x0d, 0x0a, (byte)'=',
     (byte)'2', (byte)'E' };
       } else {
     buf = new byte[] { 0x3d, 0x0d, 0x0a, (byte)ch };
       }
       output.Write(buf, 0, buf.Length);
       this.lineCount = buf.Length - 3;
       return buf.Length;
     }
       }
       if (this.lineCount == 0 && ch == '.') {
     output.WriteByte((byte)'=');
     output.WriteByte((byte)'2');
     output.WriteByte((byte)'E');
     this.lineCount += 2;
     count += 2;
       } else {
     output.WriteByte((byte)ch);
       }
       ++this.lineCount;
       return count;
 }
开发者ID:peteroupc,项目名称:MailLib,代码行数:30,代码来源:QuotedPrintableEncoder.cs

示例15: AppendAscii

 private static void AppendAscii(IWriter output, string str) {
   for (var i = 0; i < str.Length; ++i) {
     char c = str[i];
     if (c >= 0x80) {
       throw new MessageDataException("ASCII expected");
     }
     output.WriteByte((byte)c);
   }
 }
开发者ID:peteroupc,项目名称:MailLib,代码行数:9,代码来源:Message.cs


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