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


C# IValueReader.ReadString方法代码示例

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


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

示例1: ReadEntity

        private NetworkEntity ReadEntity(ISerializationContext context, IValueReader reader)
        {
            var entity = new NetworkEntity (reader.ReadString (), EntityType.Client);

            entity.NetworkID = reader.ReadUInt16 ();
            UInt16 fieldCount = reader.ReadUInt16 ();

            for (int f = 0; f < fieldCount; f++)
            {
                string name = reader.ReadString ();
                ushort typeID = reader.ReadUInt16 ();

                Type type;
                context.TypeMap.TryGetType (typeID, out type);

                object value;

                if (type == typeof (Vector2))
                    value = reader.Read (context, Vector2Serializer.Instance);
                else if (type == typeof (Vector3))
                    value = reader.Read (context, Vector3Serializer.Instance);
                else
                    value = reader.Read (context, type);

                entity.Fields.Add (name, new PropertyGroup (value, type));
            }

            return entity;
        }
开发者ID:NullSoldier,项目名称:Cinco,代码行数:29,代码来源:EntitySnapshotMessage.cs

示例2: ReadPayload

		public override void ReadPayload (ISerializationContext context, IValueReader reader)
		{
			if (reader.ReadBool())
				SenderId = reader.ReadString();

			GroupId = reader.ReadInt32();
			Text = reader.ReadString();
		}
开发者ID:ermau,项目名称:Tempest.Social,代码行数:8,代码来源:TextMessage.cs

示例3: Read

 public void Read(IValueReader reader)
 {
     GrhIndex = reader.ReadGrhIndex(_grhIndexValueKey);
     _sourceName = reader.ReadString(_sourceValueKey);
     _destName = reader.ReadString(_destValueKey);
     Offset = reader.ReadVector2(_offsetValueKey);
     Origin = reader.ReadVector2(_originValueKey);
 }
开发者ID:wtfcolt,项目名称:game,代码行数:8,代码来源:SkeletonBodyItemInfo.cs

示例4: ReadPayload

        public override void ReadPayload(IValueReader reader)
        {
            this.NetworkID = reader.ReadUInt32();
            this.CharacterName = reader.ReadString();

            this.Action = (PlayerUpdateAction)reader.ReadByte();
        }
开发者ID:heyitsanewb,项目名称:PokeWorld-Online,代码行数:7,代码来源:PlayerUpdateMessage.cs

示例5: ReadPayload

        public override void ReadPayload(ISerializationContext context, IValueReader reader)
        {
            int numUsers = reader.ReadInt32();
            IUser[] users = new IUser[numUsers];
            for (int i = 0; i < users.Length; ++i)
                users[i] = new User (reader.ReadInt32(), reader.ReadString());

            Users = users;
        }
开发者ID:ermau,项目名称:Gablarski,代码行数:9,代码来源:UserListMessage.cs

示例6: ReadPayload

        public override void ReadPayload(IValueReader reader)
        {
            this.NetworkID = reader.ReadUInt32 ();

            this.X = reader.ReadInt32 ();
            this.Y = reader.ReadInt32 ();
            this.Direction = reader.ReadInt32 ();

            this.Animation = reader.ReadString ();
        }
开发者ID:heyitsanewb,项目名称:PokeWorld-Online,代码行数:10,代码来源:ServerMovementMessage.cs

示例7: Read

        /// <summary>
        /// Reads and constructs a <see cref="DynamicEntity"/> from a stream.
        /// </summary>
        /// <param name="reader"><see cref="IValueReader"/> to read the <see cref="DynamicEntity"/> from.</param>
        /// <param name="compact">Whether or not the <see cref="DynamicEntity"/> is to be stored in a way that is optimized
        /// for size. The compact format is not guaranteed to remain stable. Because of this, the compact format should
        /// never be used for persistent storage. It is recommended to only use the compact format in network IO.
        /// The <paramref name="compact"/> value must be the same when reading and writing. That is, you cannot write
        /// with <paramref name="compact"/> set to true, then read back with it set to false, or vise versa.</param>
        /// <returns>
        /// The <see cref="DynamicEntity"/> created from the <paramref name="reader"/>.
        /// </returns>
        /// <exception cref="ArgumentNullException"><paramref name="reader"/> is null.</exception>
        public DynamicEntity Read(IValueReader reader, bool compact = false)
        {
            if (reader == null)
                throw new ArgumentNullException("reader");

            var typeName = reader.ReadString(_typeStringKey);

            var dEntity = (DynamicEntity)_typeCollection.GetTypeInstance(typeName);

            dEntity.ReadAll(reader);

            return dEntity;
        }
开发者ID:mateuscezar,项目名称:netgore,代码行数:26,代码来源:DynamicEntityFactoryBase.cs

示例8: ReadState

        /// <summary>
        /// Reads the state of the object from an <see cref="IValueReader"/>. Values should be read in the exact
        /// same order as they were written.
        /// </summary>
        /// <param name="reader">The <see cref="IValueReader"/> to read the values from.</param>
        public void ReadState(IValueReader reader)
        {
            PersistableHelper.Read(this, reader);

            // Equipped bodies

            int count = reader.ReadByte("EquippedBodiesCount");
            _equippedBodies.Clear();

            for (var i = 0; i < count; i++)
            {
                var s = reader.ReadString("EquippedBody_" + i);
                _equippedBodies.Add(s);
            }
        }
开发者ID:wtfcolt,项目名称:game,代码行数:20,代码来源:AccountCharacterInfo.cs

示例9: Read

        /// <summary>
        /// Reads the values for this <see cref="NPCChatConditionalCollectionItemBase"/> from an <see cref="IValueReader"/>.
        /// </summary>
        /// <param name="reader"><see cref="IValueReader"/> to read the values from.</param>
        /// <exception cref="ArgumentException">The read <see cref="NPCChatConditionalBase"/> was invalid.</exception>
        protected void Read(IValueReader reader)
        {
            var not = reader.ReadBool("Not");
            var conditionalName = reader.ReadString("ConditionalName");
            var parameters = reader.ReadManyNodes("Parameters", NPCChatConditionalParameter.Read);

            var conditional = NPCChatConditionalBase.GetConditional(conditionalName);
            if (conditional == null)
            {
                const string errmsg = "Failed to get conditional `{0}`.";
                throw new ArgumentException(string.Format(errmsg, conditionalName), "reader");
            }

            SetReadValues(conditional, not, parameters);
        }
开发者ID:wtfcolt,项目名称:game,代码行数:20,代码来源:NPCChatConditionalCollectionItemBase.cs

示例10: BodyInfo

 /// <summary>
 /// Initializes a new instance of the <see cref="BodyInfo"/> class.
 /// </summary>
 /// <param name="reader">The <see cref="IValueReader"/> to read the values from.</param>
 public BodyInfo(IValueReader reader)
 {
     ID = reader.ReadBodyID(_idValueKey);
     Body = reader.ReadString(_bodyValueKey);
     Fall = reader.ReadString(_fallValueKey);
     Jump = reader.ReadString(_jumpValueKey);
     Punch = reader.ReadString(_punchValueKey);
     Stand = reader.ReadString(_standValueKey);
     Walk = reader.ReadString(_walkValueKey);
     Size = reader.ReadVector2(_sizeValueKey);
 }
开发者ID:Vizzini,项目名称:netgore,代码行数:15,代码来源:BodyInfo.cs

示例11: ReadPayload

        public override void ReadPayload(ISerializationContext context, IValueReader reader)
        {
            if (reader.ReadBool())
            {
                string[] algs = new string[reader.ReadInt32()];
                for (int i = 0; i < algs.Length; ++i)
                    algs[i] = reader.ReadString();

                SignatureHashAlgorithms = algs;
            }

            Protocol[] protocols = new Protocol[reader.ReadInt32()];
            for (int i = 0; i < protocols.Length; ++i)
                protocols[i] = new Protocol (context, reader);

            Protocols = protocols;
        }
开发者ID:ermau,项目名称:Tempest,代码行数:17,代码来源:ConnectMessage.cs

示例12: BodyInfo

 /// <summary>
 /// Initializes a new instance of the <see cref="BodyInfo"/> class.
 /// </summary>
 /// <param name="reader">The <see cref="IValueReader"/> to read the values from.</param>
 public BodyInfo(IValueReader reader)
 {
     ID = reader.ReadBodyID(_idValueKey);
     Body = reader.ReadString(_bodyValueKey);
     Fall = reader.ReadString(_fallValueKey);
     Jump = reader.ReadString(_jumpValueKey);
     Attack = reader.ReadString(_attackValueKey);
     Stand = reader.ReadString(_standValueKey);
     Walk = reader.ReadString(_walkValueKey);
     Size = reader.ReadVector2(_sizeValueKey);
     Paperdoll = reader.ReadBool(_paperdollValueKey);
 }
开发者ID:mateuscezar,项目名称:netgore,代码行数:16,代码来源:BodyInfo.cs

示例13: Read

        /// <summary>
        /// Reads a <see cref="EmitterModifier"/> from an <see cref="IValueReader"/>.
        /// </summary>
        /// <param name="reader">The <see cref="IValueReader"/> to read the values from.</param>
        /// <returns>The <see cref="EmitterModifier"/> instance created from the values read from the
        /// <paramref name="reader"/>.</returns>
        /// <exception cref="ParticleEmitterLoadEmitterModifierException">The <see cref="EmitterModifier"/> could not be
        /// loaded.</exception>
        public static EmitterModifier Read(IValueReader reader)
        {
            // Get the type
            var typeName = reader.ReadString(_typeKeyName);

            // Create the instance
            EmitterModifier modifier;
            try
            {
                modifier = (EmitterModifier)_typeFactory.GetTypeInstance(typeName);
            }
            catch (KeyNotFoundException ex)
            {
                throw new ParticleEmitterLoadEmitterModifierException(typeName, ex);
            }

            // Read the custom values
            var customValueReader = reader.ReadNode(_customValuesNodeName);
            modifier.ReadState(customValueReader);

            return modifier;
        }
开发者ID:mateuscezar,项目名称:netgore,代码行数:30,代码来源:EmitterModifier.cs

示例14: Read

        /// <summary>
        /// Reads a <see cref="ParticleEmitter"/> from an <see cref="IValueReader"/>.
        /// </summary>
        /// <param name="reader">The <see cref="IValueReader"/> to read from.</param>
        /// <param name="owner">The <see cref="IParticleEffect"/> to add the read <see cref="ParticleEmitter"/> to.</param>
        /// <returns>
        /// The <see cref="ParticleEmitter"/> read from the <paramref name="reader"/>.
        /// </returns>
        /// <exception cref="ParticleEmitterLoadEmitterException">The <see cref="ParticleEmitter"/> could not be loaded.</exception>
        public static ParticleEmitter Read(IValueReader reader, IParticleEffect owner)
        {
            // Get the type name
            var emitterTypeString = reader.ReadString(_emitterTypeKeyName);

            // Create the instance using the type name
            ParticleEmitter emitter;
            try
            {
                emitter = (ParticleEmitter)Instance.GetTypeInstance(emitterTypeString, owner);
            }
            catch (KeyNotFoundException ex)
            {
                throw new ParticleEmitterLoadEmitterException(emitterTypeString, ex);
            }

            // Grab the reader for the emitter node, then read the values into the emitter
            var emitterReader = reader.ReadNode(_emitterNodeName);
            emitter.ReadState(emitterReader);

            return emitter;
        }
开发者ID:mateuscezar,项目名称:netgore,代码行数:31,代码来源:ParticleEmitterFactory.cs

示例15: ReadPayload

 public override void ReadPayload(ISerializationContext context, IValueReader reader)
 {
     this.Name = reader.ReadString();
     AudioSettings = new AudioCodecArgs (context, reader);
 }
开发者ID:ermau,项目名称:Gablarski,代码行数:5,代码来源:RequestSourceMessage.cs


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