本文整理汇总了C#中BinarySerializer.SerializeEnum方法的典型用法代码示例。如果您正苦于以下问题:C# BinarySerializer.SerializeEnum方法的具体用法?C# BinarySerializer.SerializeEnum怎么用?C# BinarySerializer.SerializeEnum使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BinarySerializer
的用法示例。
在下文中一共展示了BinarySerializer.SerializeEnum方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Serialize
public void Serialize(BinarySerializer serializer)
{
serializer.Serialize(ref FilePath);
serializer.Serialize(ref Index);
serializer.Serialize(ref UVIndex);
serializer.Serialize(ref BlendFactor);
serializer.SerializeEnum(ref Operation);
serializer.SerializeEnum(ref WrapMode);
serializer.SerializeEnum(ref Flags);
}
示例2:
void IDataSerializable.Serialize(BinarySerializer serializer)
{
serializer.Serialize(ref FilePath);
serializer.Serialize(ref DependencyFilePath);
serializer.SerializeEnum(ref CompilerFlags);
serializer.Serialize(ref Macros, SerializeFlags.Nullable);
serializer.Serialize(ref IncludeDirectoryList, serializer.Serialize, SerializeFlags.Nullable);
}
示例3: SerializeMakeSpriteFont
/// <summary>
/// This method for loading/saving a font file generated from MakeSpriteFont.
/// </summary>
/// <param name="serializer">The binary serializer to use.</param>
/// <returns></returns>
private void SerializeMakeSpriteFont(BinarySerializer serializer)
{
FourCC magicCode2 = "font";
serializer.Serialize(ref magicCode2);
if (magicCode2 != "font")
return;
// Writes the version
if (serializer.Mode == SerializerMode.Read)
{
int version = serializer.Reader.ReadInt32();
if (version != Version)
{
throw new NotSupportedException(string.Format("SpriteFontData version [0x{0:X}] is not supported. Expecting [0x{1:X}]", version, Version));
}
}
else
{
serializer.Writer.Write(Version);
}
// Deserialize Glyphs
int glyphCount = 0;
serializer.Serialize(ref glyphCount);
// For MakeSpriteFont, there is only one GlyphPage.
Glyphs = new Glyph[glyphCount];
for (int i = 0; i < glyphCount; i++)
{
serializer.Serialize(ref Glyphs[i].Character);
serializer.Serialize(ref Glyphs[i].Subrect);
serializer.Serialize(ref Glyphs[i].Offset);
serializer.Serialize(ref Glyphs[i].XAdvance);
// Fix XAdvance with Right/Left for MakeSpriteFont
Glyphs[i].XAdvance += Glyphs[i].Subrect.Right - Glyphs[i].Subrect.Left;
}
serializer.Serialize(ref LineSpacing);
serializer.Serialize(ref DefaultCharacter);
var image = new BitmapData();
Bitmaps = new Bitmap[1] {new Bitmap()};
Bitmaps[0].Data = image;
serializer.Serialize(ref image.Width);
serializer.Serialize(ref image.Height);
serializer.SerializeEnum(ref image.PixelFormat);
serializer.Serialize(ref image.RowStride);
serializer.Serialize(ref image.CompressedHeight);
serializer.Serialize(ref image.Data, image.RowStride * image.CompressedHeight);
}
示例4: Serialize
public void Serialize(BinarySerializer serializer)
{
int expectedBlockSize = 0;
serializer.Serialize(ref expectedBlockSize);
var blockPosition = serializer.Stream.Position;
serializer.Serialize(ref LineHeight);
serializer.Serialize(ref Base);
serializer.Serialize(ref ScaleW);
serializer.Serialize(ref ScaleH);
serializer.Serialize(ref PageCount);
serializer.Serialize(ref BitField);
serializer.SerializeEnum(ref Alpha);
serializer.SerializeEnum(ref Red);
serializer.SerializeEnum(ref Green);
serializer.SerializeEnum(ref Blue);
var blockSize = serializer.Stream.Position - blockPosition;
if (blockSize != expectedBlockSize)
throw new NotSupportedException("Invalid BMF font format");
}
示例5: SerializeMakeSpriteFont
/// <summary>
/// This method for loading/saving a font file generated from MakeSpriteFont.
/// </summary>
/// <param name="serializer">The binaryserializer to use.</param>
/// <returns></returns>
private void SerializeMakeSpriteFont(BinarySerializer serializer)
{
FourCC magicCode2 = "font";
serializer.Serialize(ref magicCode2);
if (magicCode2 != "font")
return;
// Deserialize Glyphs
int glyphCount = 0;
serializer.Serialize(ref glyphCount);
// For MakeSpriteFont, there is only one GlyphPage.
Glyphs = new Glyph[glyphCount];
for (int i = 0; i < glyphCount; i++)
{
serializer.Serialize(ref Glyphs[i].Character);
serializer.Serialize(ref Glyphs[i].Subrect);
serializer.Serialize(ref Glyphs[i].Offset);
serializer.Serialize(ref Glyphs[i].XAdvance);
// Fix XAdvance with Right/Left for MakeSpriteFont
Glyphs[i].XAdvance += Glyphs[i].Subrect.Right - Glyphs[i].Subrect.Left;
}
serializer.Serialize(ref LineSpacing);
serializer.Serialize(ref DefaultCharacter);
var image = new BitmapData();
Bitmaps = new Bitmap[1] {new Bitmap()};
Bitmaps[0].Data = image;
serializer.Serialize(ref image.Width);
serializer.Serialize(ref image.Height);
serializer.SerializeEnum(ref image.PixelFormat);
serializer.Serialize(ref image.RowStride);
serializer.Serialize(ref image.CompressedHeight);
serializer.Serialize(ref image.Data, image.RowStride * image.CompressedHeight);
}
示例6:
void IDataSerializable.Serialize(BinarySerializer serializer)
{
serializer.Serialize(ref Width);
serializer.Serialize(ref Height);
serializer.SerializeEnum(ref PixelFormat);
serializer.Serialize(ref RowStride);
serializer.Serialize(ref CompressedHeight);
serializer.Serialize(ref Data, RowStride * CompressedHeight);
}
示例7:
void IDataSerializable.Serialize(BinarySerializer serializer)
{
serializer.Serialize(ref Name, SerializeFlags.Nullable);
serializer.SerializeEnum(ref Type);
serializer.SerializeEnum(ref CompilerFlags);
serializer.SerializeEnum(ref Level);
serializer.Serialize(ref Bytecode);
serializer.Serialize(ref Hashcode);
serializer.Serialize(ref InputSignature);
serializer.Serialize(ref OutputSignature);
serializer.Serialize(ref ConstantBuffers);
serializer.Serialize(ref ResourceParameters);
}
示例8: Serialize
public void Serialize(BinarySerializer serializer)
{
serializer.SerializeEnum(ref waveFormatTag);
serializer.Serialize(ref channels);
serializer.Serialize(ref sampleRate);
serializer.Serialize(ref averageBytesPerSecond);
serializer.Serialize(ref blockAlign);
serializer.Serialize(ref bitsPerSample);
}
示例9: Serialize
public void Serialize(BinarySerializer serializer)
{
serializer.SerializeEnum<WaveFormatEncoding>(ref this.waveFormatTag);
serializer.Serialize(ref this.channels);
serializer.Serialize(ref this.sampleRate);
serializer.Serialize(ref this.averageBytesPerSecond);
serializer.Serialize(ref this.blockAlign);
serializer.Serialize(ref this.bitsPerSample);
}