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


C# BinarySerializer.SerializeEnum方法代码示例

本文整理汇总了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);
 }
开发者ID:QuantumDeveloper,项目名称:SharpDX,代码行数:10,代码来源:ModelData.MaterialTexture.cs

示例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);
 }
开发者ID:GrafSeismo,项目名称:SharpDX,代码行数:8,代码来源:EffectData.CompilerArguments.cs

示例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);
        }
开发者ID:numo16,项目名称:SharpDX,代码行数:57,代码来源:SpriteFontData.MakeSpriteFontLoader.cs

示例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");
            }
开发者ID:Ziriax,项目名称:SharpDX,代码行数:22,代码来源:SpriteFontData.AngelCodeBMFontLoader.cs

示例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);
        }
开发者ID:rbwhitaker,项目名称:SharpDX,代码行数:43,代码来源:SpriteFontData.MakeSpriteFontLoader.cs

示例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);
 }
开发者ID:QuantumDeveloper,项目名称:SharpDX,代码行数:9,代码来源:SpriteFontData.Bitmap.cs

示例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);
 }
开发者ID:QuantumDeveloper,项目名称:SharpDX,代码行数:13,代码来源:EffectData.Shader.cs

示例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);
 }
开发者ID:numo16,项目名称:SharpDX,代码行数:9,代码来源:WaveFormat.cs

示例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);
 }
开发者ID:tanis2000,项目名称:FEZ,代码行数:9,代码来源:WaveFormat.cs


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