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


C# BinaryWriter.WriteIntString方法代码示例

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


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

示例1: Save

        /// <summary>
        /// Saves the file to the specified stream.
        /// </summary>
        /// <param name="stream">The stream to save to.</param>
        public override void Save(Stream stream)
        {
            BinaryWriter writer = new BinaryWriter(stream, Encoding.GetEncoding("EUC-KR"));

            writer.Write(Sequences.Count);

            Sequences.ForEach(sequence => {
                writer.WriteIntString(sequence.Name);
                writer.Write(sequence.Lifetime.Minimum);
                writer.Write(sequence.Lifetime.Maximum);
                writer.Write(sequence.EmitRate.Minimum);
                writer.Write(sequence.EmitRate.Maximum);
                writer.Write(sequence.LoopCount);
                writer.Write(sequence.SpawnDirection.Minimum);
                writer.Write(sequence.SpawnDirection.Maximum);
                writer.Write(sequence.EmitRadius.Minimum);
                writer.Write(sequence.EmitRadius.Maximum);
                writer.Write(sequence.Gravity.Minimum);
                writer.Write(sequence.Gravity.Maximum);
                writer.WriteIntString(sequence.TextureFileName);
                writer.Write(sequence.ParticleCount);
                writer.Write((int)sequence.Alignment);
                writer.Write((int)sequence.UpdateCoordinate);
                writer.Write(sequence.TextureWidth);
                writer.Write(sequence.TextureHeight);
                writer.Write((int)sequence.Implementation);
                writer.Write((int)sequence.DestinationBlendMode);
                writer.Write((int)sequence.SourceBlendMode);
                writer.Write((int)sequence.BlendOperation);

                writer.Write(sequence.Events.Count);

                sequence.Events.ForEach(@event => {
                    writer.Write((int)@event.Type);
                    @event.Write(writer);
                });
            });
        }
开发者ID:Jiwan,项目名称:Revise,代码行数:42,代码来源:ParticleFile.cs

示例2: Save

        /// <summary>
        /// Saves the file to the specified stream.
        /// </summary>
        /// <param name="stream">The stream to save to.</param>
        public override void Save(Stream stream)
        {
            BinaryWriter writer = new BinaryWriter(stream, Encoding.GetEncoding("EUC-KR"));
            AlignedBinaryWriter alignedWriter = new AlignedBinaryWriter(stream, Encoding.GetEncoding("EUC-KR"));

            writer.Write(Patterns.Count);
            writer.Write(IdleInterval);
            writer.Write(DamageRate);
            writer.WriteIntString(Name);

            Patterns.ForEach(pattern => {
                writer.WriteString(pattern.Name, 32);
                writer.Write(pattern.Events.Count);

                pattern.Events.ForEach(@event => {
                    writer.WriteString(@event.Name, 32);
                    writer.Write(@event.Conditions.Count);

                    @event.Conditions.ForEach(condition => {
                        writer.Write(0);
                        writer.Write((int)condition.Type | CONDITION_MASK);

                        alignedWriter.Reset();
                        condition.Write(alignedWriter);
                        alignedWriter.Align();

                        int size = alignedWriter.TotalWrote + 8;

                        stream.Seek(-size, SeekOrigin.Current);
                        writer.Write(size);

                        stream.Seek(size - 4, SeekOrigin.Current);
                    });

                    writer.Write(@event.Actions.Count);

                    @event.Actions.ForEach(action => {
                        writer.Write(0);
                        writer.Write((int)action.Type | ACTION_MASK);

                        alignedWriter.Reset();
                        action.Write(alignedWriter);
                        alignedWriter.Align();

                        int size = alignedWriter.TotalWrote + 8;

                        stream.Seek(-size, SeekOrigin.Current);
                        writer.Write(size);

                        stream.Seek(size - 4, SeekOrigin.Current);
                    });
                });
            });
        }
开发者ID:Jiwan,项目名称:Revise,代码行数:58,代码来源:ArtificialIntelligenceFile.cs

示例3: Save

        /// <summary>
        /// Saves the file to the specified stream.
        /// </summary>
        /// <param name="stream">The stream to save to.</param>
        public override void Save(Stream stream)
        {
            BinaryWriter writer = new BinaryWriter(stream, Encoding.GetEncoding("EUC-KR"));

            writer.WriteIntString(Name);
            writer.Write(SoundEnabled ? 1 : 0);
            writer.WriteIntString(SoundFilePath);
            writer.Write(LoopCount);

            writer.Write(Particles.Count);

            Particles.ForEach(particle => {
                writer.WriteIntString(particle.Name);
                writer.WriteIntString(particle.UniqueIdentifier);
                writer.Write(particle.ParticleIndex);
                writer.WriteIntString(particle.FilePath);
                writer.Write(particle.AnimationEnabled ? 1 : 0);
                writer.WriteIntString(particle.AnimationName);
                writer.Write(particle.AnimationLoopCount);
                writer.Write(particle.AnimationIndex);
                writer.Write(particle.Position);
                writer.Write(particle.Rotation);
                writer.Write(particle.Delay);
                writer.Write(particle.LinkedToRoot ? 1 : 0);
            });

            writer.Write(Animations.Count);

            Animations.ForEach(animation => {
                writer.WriteIntString(animation.EffectName);
                writer.WriteIntString(animation.MeshName);
                writer.Write(animation.MeshIndex);
                writer.WriteIntString(animation.MeshFilePath);
                writer.WriteIntString(animation.AnimationFilePath);
                writer.WriteIntString(animation.TextureFilePath);
                writer.Write(animation.AlphaEnabled ? 1 : 0);
                writer.Write(animation.TwoSidedEnabled ? 1 : 0);
                writer.Write(animation.AlphaTestEnabled ? 1 : 0);
                writer.Write(animation.DepthTestEnabled ? 1 : 0);
                writer.Write(animation.DepthWriteEnabled ? 1 : 0);
                writer.Write(animation.SourceBlend);
                writer.Write(animation.DestinationBlend);
                writer.Write(animation.BlendOperation);
                writer.Write(animation.AnimationEnabled ? 1 : 0);
                writer.WriteIntString(animation.AnimationName);
                writer.Write(animation.AnimationLoopCount);
                writer.Write(animation.AnimationIndex);
                writer.Write(animation.Position);
                writer.Write(animation.Rotation);
                writer.Write(animation.Delay);
                writer.Write(animation.LoopCount);
                writer.Write(animation.LinkedToRoot ? 1 : 0);
            });
        }
开发者ID:Jiwan,项目名称:Revise,代码行数:58,代码来源:EffectFile.cs

示例4: Write

        /// <summary>
        /// Writes the condition data to the underlying stream.
        /// </summary>
        /// <param name="writer">The writer.</param>
        public void Write(BinaryWriter writer)
        {
            writer.Write((byte)MessageType);

            if (UseText) {
                writer.WriteIntString(Text);
            } else {
                writer.Write(StringID);
            }
        }
开发者ID:Jiwan,项目名称:Revise,代码行数:14,代码来源:SayMessageByTypeAction.cs


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