コード例 #1
0
ファイル: LineEmitter.cs プロジェクト: thepirateclub/netgore
 /// <summary>
 /// When overridden in the derived class, reads all custom state values from the <paramref name="reader"/>.
 /// </summary>
 /// <param name="reader">The <see cref="IValueReader"/> to read the state values from.</param>
 protected override void ReadCustomValues(IValueReader reader)
 {
     Angle        = reader.ReadFloat(_angleKeyName);
     EmitBothWays = reader.ReadBool(_emitBothWaysKeyName);
     Length       = reader.ReadInt(_lengthKeyName);
     Rectilinear  = reader.ReadBool(_rectilinearKeyName);
 }
コード例 #2
0
        /// <summary>
        /// Reads the <see cref="ParticleModifier"/>'s custom values from the <see cref="reader"/>.
        /// </summary>
        /// <param name="reader"><see cref="IValueReader"/> to read the custom values from.</param>
        protected override void ReadCustomValues(IValueReader reader)
        {
            ModifyRed   = reader.ReadBool(_modifyRedKeyName);
            ModifyGreen = reader.ReadBool(_modifyGreenKeyName);
            ModifyBlue  = reader.ReadBool(_modifyBlueKeyName);
            ModifyAlpha = reader.ReadBool(_modifyAlphaKeyName);

            ReleaseColor  = reader.ReadColor(_releaseColorKeyName);
            UltimateColor = reader.ReadColor(_ultimateColorKeyName);
        }
コード例 #3
0
        public void ReadWriteBool()
        {
            IValueWriter writer = GetWriter();

            writer.WriteBool(true);
            writer.WriteBool(false);
            writer.Flush();

            IValueReader reader = GetReader(writer);

            Assert.IsTrue(reader.ReadBool());
            Assert.IsFalse(reader.ReadBool());
        }
コード例 #4
0
        /// <summary>
        /// Reads the values for this NPCChatDialogItemBase from an IValueReader.
        /// </summary>
        /// <param name="reader">IValueReader to read the values from.</param>
        protected void Read(IValueReader reader)
        {
            var id       = reader.ReadNPCChatDialogItemID("ID");
            var title    = reader.ReadString("Title");
            var text     = reader.ReadString("Text");
            var isBranch = reader.ReadBool("IsBranch");

            var responses = reader.ReadManyNodes("Responses", CreateResponse);

            NPCChatConditionalCollectionBase conditionals = null;

            if (isBranch)
            {
                var cReader         = reader.ReadNode("Conditionals");
                var hasConditionals = cReader.ReadBool("HasConditionals");
                if (hasConditionals)
                {
                    conditionals = CreateConditionalCollection();
                    if (conditionals != null)
                    {
                        conditionals.Read(cReader);
                    }
                }
            }

            SetReadValues(id, title, text, isBranch, responses, conditionals);

            AssertBranchHasTwoResponses();
            AssertNonBranchHasNoConditionals();
            AssertResponsesHaveValidValues();
        }
コード例 #5
0
ファイル: RSAAsymmetricKey.cs プロジェクト: terite/Tempest
        public void Deserialize(IValueReader reader, RSACrypto crypto)
        {
            if (reader == null)
            {
                throw new ArgumentNullException("reader");
            }
            if (crypto == null)
            {
                throw new ArgumentNullException("crypto");
            }

            if (reader.ReadBool())
            {
                byte[] exponent = crypto.Decrypt(reader.ReadBytes());

                byte[] modulus1 = crypto.Decrypt(reader.ReadBytes());
                byte[] modulus2 = crypto.Decrypt(reader.ReadBytes());
                byte[] modulus  = modulus1.Concat(modulus2).ToArray();

                this.exponentOffset = modulus.Length;
                this.publicKey      = new byte[exponent.Length + modulus.Length];
                Buffer.BlockCopy(modulus, 0, this.publicKey, 0, modulus.Length);
                Buffer.BlockCopy(exponent, 0, this.publicKey, exponentOffset, exponent.Length);
            }

            SetupSignature();
        }
コード例 #6
0
 public override void ReadPayload(ISerializationContext context, IValueReader reader)
 {
     if (Accepted = reader.ReadBool())
     {
         Target = new Target(context, reader);
     }
 }
コード例 #7
0
        /// <summary>
        /// Reads the SkeletonNode's values from an IValueReader.
        /// </summary>
        /// <param name="reader">IValueReader to read the values from.</param>
        /// <returns>The name of the parent SkeletonNode, or null if the SkeletonNode has no parent (root node).
        /// The SkeletonNode's parent must be set manually using this value.</returns>
        public string Read(IValueReader reader)
        {
            Name       = reader.ReadString(_nameValueKey);
            Position   = reader.ReadVector2(_positionValueKey);
            IsModifier = reader.ReadBool(_isModifierValueKey);
            var hasParent = reader.ReadBool(_hasParentValueKey);

            string parentName = null;

            if (hasParent)
            {
                parentName = reader.ReadString(_parentNameValueKey);
            }

            return(parentName);
        }
コード例 #8
0
ファイル: TextMessage.cs プロジェクト: ermau/Tempest.Social
		public override void ReadPayload (ISerializationContext context, IValueReader reader)
		{
			if (reader.ReadBool())
				SenderId = reader.ReadString();

			GroupId = reader.ReadInt32();
			Text = reader.ReadString();
		}
コード例 #9
0
ファイル: AudioSource.cs プロジェクト: ermau/Gablarski
 public void Deserialize(ISerializationContext context, IValueReader reader)
 {
     Name          = reader.ReadString();
     Id            = reader.ReadInt32();
     OwnerId       = reader.ReadInt32();
     IsMuted       = reader.ReadBool();
     CodecSettings = new AudioCodecArgs(context, reader);
 }
コード例 #10
0
 /// <summary>
 /// When overridden in the derived class, reads all custom state values from the <paramref name="reader"/>.
 /// </summary>
 /// <param name="reader">The <see cref="IValueReader"/> to read the state values from.</param>
 protected override void ReadCustomValues(IValueReader reader)
 {
     Closed        = reader.ReadBool(_closedKeyName);
     Scale         = reader.ReadFloat(_scaleKeyName);
     Rotation      = reader.ReadFloat(_rotationKeyName);
     PolygonOrigin = reader.ReadEnum <PolygonOrigin>(_polygonOriginKeyName);
     Points.Read(_pointsNodeName, reader);
 }
コード例 #11
0
        public void Deserialize(IValueReader reader)
        {
            this.NonCharacter = reader.ReadBool();
            this.PlayerID = reader.ReadInt32 ();

            int count = reader.ReadInt32 ();
            for(int i = 0; i < count; i++)
                this.path.Add ((Directions) reader.ReadInt32 ());
        }
コード例 #12
0
ファイル: ChannelInfo.cs プロジェクト: ermau/Gablarski
 public void Deserialize(ISerializationContext context, IValueReader reader)
 {
     this.ChannelId       = reader.ReadInt32();
     this.ParentChannelId = reader.ReadInt32();
     this.ReadOnly        = reader.ReadBool();
     this.UserLimit       = reader.ReadInt32();
     this.Name            = reader.ReadString();
     this.Description     = reader.ReadString();
 }
コード例 #13
0
        void Read(IValueReader r)
        {
            var position = r.ReadVector2(_positionValueKey);
            var size     = r.ReadVector2(_sizeValueKey);

            IsPlatform = r.ReadBool(_isPlatformValueKey);

            SetPositionRaw(position);
            SetSizeRaw(size);
        }
コード例 #14
0
ファイル: TextMessage.cs プロジェクト: ermau/Tempest.Social
        public override void ReadPayload(ISerializationContext context, IValueReader reader)
        {
            if (reader.ReadBool())
            {
                SenderId = reader.ReadString();
            }

            GroupId = reader.ReadInt32();
            Text    = reader.ReadString();
        }
コード例 #15
0
 public void Deserialize(ISerializationContext context, IValueReader reader)
 {
     UserId           = reader.ReadInt32();
     Username         = reader.ReadString();
     CurrentChannelId = reader.ReadInt32();
     Nickname         = reader.ReadString();
     Phonetic         = reader.ReadString();
     IsMuted          = reader.ReadBool();
     Status           = (UserStatus)reader.ReadByte();
     Comment          = reader.ReadString();
 }
コード例 #16
0
ファイル: BodyInfo.cs プロジェクト: mateuscezar/netgore
 /// <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);
 }
コード例 #17
0
ファイル: BodyInfo.cs プロジェクト: wtfcolt/game
 /// <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);
 }
コード例 #18
0
        void Read(IValueReader r)
        {
            var position = r.ReadVector2(_positionValueKey);
            var size     = r.ReadVector2(_sizeValueKey);

            IsPlatform       = r.ReadBool(_isPlatformValueKey);
            BoundGrhIndex    = r.ReadGrhIndex(_boundGrhIndexValueKey);
            DirectionalBlock = r.ReadEnum <Direction>(_directionBlockValueKey);

            SetPositionRaw(position);
            SetSizeRaw(size);
        }
コード例 #19
0
        /// <summary>
        /// Initializes a new instance of the <see cref="StationaryGrhData"/> class.
        /// </summary>
        /// <param name="r">The <see cref="IValueReader"/>.</param>
        /// <param name="cm">The <see cref="IContentManager"/>.</param>
        /// <param name="grhIndex">The <see cref="GrhIndex"/>.</param>
        /// <param name="cat">The <see cref="SpriteCategorization"/>.</param>
        /// <exception cref="ArgumentNullException"><paramref name="cat"/> is null.</exception>
        /// <exception cref="ArgumentOutOfRangeException"><paramref name="grhIndex"/> is equal to GrhIndex.Invalid.</exception>
        StationaryGrhData(IValueReader r, IContentManager cm, GrhIndex grhIndex, SpriteCategorization cat) : base(grhIndex, cat)
        {
            _cm = cm;

            var automaticSize = r.ReadBool(_automaticSizeValueKey);
            var textureReader = r.ReadNode(_textureNodeName);
            var textureName   = textureReader.ReadTextureAssetName(_textureNameValueKey);
            var textureSource = textureReader.ReadRectangle(_textureSourceValueKey);

            _textureName = textureName;
            SetSourceRect(textureSource);
            _automaticSize = automaticSize;
        }
コード例 #20
0
        public void Deserialize(ISerializationContext context, IValueReader reader)
        {
            Name             = reader.ReadString();
            Description      = reader.ReadString();
            Logo             = reader.ReadString();
            Passworded       = reader.ReadBool();
            RegistrationMode = (UserRegistrationMode)reader.ReadByte();

            if (RegistrationMode != UserRegistrationMode.None)
            {
                RegistrationContent = reader.ReadString();
            }
        }
コード例 #21
0
        /// <summary>
        /// When overridden in the derived class, reads a value with the specified name from an <see cref="IValueReader"/>.
        /// </summary>
        /// <param name="name">Name of the value.</param>
        /// <param name="reader"><see cref="IValueReader"/> to read from.</param>
        /// <returns>Value read from the <see cref="IValueReader"/>.</returns>
        protected override T?Read(string name, IValueReader reader)
        {
            T?ret;

            if (reader.SupportsNodes)
            {
                bool hasValue;
                T    value;

                if (reader.SupportsNameLookup)
                {
                    var r = reader.ReadNode(name);
                    hasValue = r.ReadBool(_hasValueValueKey);
                    value    = _nonNullableSync.InternalRead(_valueValueKey, r);
                }
                else
                {
                    hasValue = reader.ReadBool("__" + name + "_HasValue__");
                    value    = _nonNullableSync.InternalRead(name, reader);
                }

                ret = (hasValue ? value : default(T?));
            }
            else
            {
                var hasValue = reader.ReadBool(null);
                if (hasValue)
                {
                    ret = _nonNullableSync.InternalRead(name, reader);
                }
                else
                {
                    ret = default(T?);
                }
            }

            return(ret);
        }
コード例 #22
0
        /// <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);
        }
コード例 #23
0
ファイル: RSAAsymmetricKey.cs プロジェクト: terite/Tempest
        public void Deserialize(ISerializationContext context, IValueReader reader)
        {
            if (reader == null)
            {
                throw new ArgumentNullException("reader");
            }

            if (reader.ReadBool())
            {
                this.publicKey      = reader.ReadBytes();
                this.exponentOffset = reader.ReadInt32();
            }

            SetupSignature();
        }
コード例 #24
0
        /// <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);
        }
コード例 #25
0
ファイル: ConnectMessage.cs プロジェクト: ermau/Tempest
        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;
        }
コード例 #26
0
        private object SerializableDeserializer(IValueReader reader)
        {
            bool isNull = false;

            if (this.type.IsClass)
            {
                isNull = reader.ReadBool();
            }

            if (isNull)
            {
                return(null);
            }

            byte[] data = reader.ReadBytes();
            using (MemoryStream stream = new MemoryStream(data))
                return(new BinaryFormatter().Deserialize(stream, null));
        }
コード例 #27
0
        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;
        }
コード例 #28
0
ファイル: Light.cs プロジェクト: thepirateclub/netgore
        /// <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)
        {
            PositionProvider = null;
            Tag = null;

            Position  = reader.ReadVector2(_positionValueKey);
            Size      = reader.ReadVector2(_sizeValueKey);
            Color     = reader.ReadColor(_colorValueKey);
            Rotation  = reader.ReadFloat(_rotationValueKey);
            IsEnabled = reader.ReadBool(_isEnabledValueKey);

            var grhIndex = reader.ReadGrhIndex(_spriteValueKey);

            if (grhIndex.IsInvalid)
            {
                Sprite = new Grh(grhIndex, AnimType.Loop, 0);
            }
            else
            {
                Sprite = null;
            }
        }
コード例 #29
0
        /// <summary>
        /// Reads the values for this NPCChatDialogItemBase from an IValueReader.
        /// </summary>
        /// <param name="reader">IValueReader to read the values from.</param>
        protected void Read(IValueReader reader)
        {
            var id = reader.ReadNPCChatDialogItemID("ID");
            var title = reader.ReadString("Title");
            var text = reader.ReadString("Text");
            var isBranch = reader.ReadBool("IsBranch");

            var responses = reader.ReadManyNodes("Responses", CreateResponse);

            NPCChatConditionalCollectionBase conditionals = null;
            if (isBranch)
            {
                var cReader = reader.ReadNode("Conditionals");
                var hasConditionals = cReader.ReadBool("HasConditionals");
                if (hasConditionals)
                {
                    conditionals = CreateConditionalCollection();
                    if (conditionals != null)
                        conditionals.Read(cReader);
                }
            }

            SetReadValues(id, title, text, isBranch, responses, conditionals);

            AssertBranchHasTwoResponses();
            AssertNonBranchHasNoConditionals();
            AssertResponsesHaveValidValues();
        }
コード例 #30
0
 public override void ReadPayload(ISerializationContext context, IValueReader reader)
 {
     this.ServerInfoOnly = reader.ReadBool();
 }
コード例 #31
0
ファイル: SkeletonNode.cs プロジェクト: mateuscezar/netgore
        /// <summary>
        /// Reads the SkeletonNode's values from an IValueReader.
        /// </summary>
        /// <param name="reader">IValueReader to read the values from.</param>
        /// <returns>The name of the parent SkeletonNode, or null if the SkeletonNode has no parent (root node).
        /// The SkeletonNode's parent must be set manually using this value.</returns>
        public string Read(IValueReader reader)
        {
            Name = reader.ReadString(_nameValueKey);
            Position = reader.ReadVector2(_positionValueKey);
            IsModifier = reader.ReadBool(_isModifierValueKey);
            var hasParent = reader.ReadBool(_hasParentValueKey);

            string parentName = null;
            if (hasParent)
                parentName = reader.ReadString(_parentNameValueKey);

            return parentName;
        }
コード例 #32
0
ファイル: ParticleColorModifier.cs プロジェクト: wtfcolt/game
        /// <summary>
        /// Reads the <see cref="ParticleModifier"/>'s custom values from the <see cref="reader"/>.
        /// </summary>
        /// <param name="reader"><see cref="IValueReader"/> to read the custom values from.</param>
        protected override void ReadCustomValues(IValueReader reader)
        {
            ModifyRed = reader.ReadBool(_modifyRedKeyName);
            ModifyGreen = reader.ReadBool(_modifyGreenKeyName);
            ModifyBlue = reader.ReadBool(_modifyBlueKeyName);
            ModifyAlpha = reader.ReadBool(_modifyAlphaKeyName);

            ReleaseColor = reader.ReadColor(_releaseColorKeyName);
            UltimateColor = reader.ReadColor(_ultimateColorKeyName);
        }
コード例 #33
0
ファイル: ChannelEditMessage.cs プロジェクト: ermau/Gablarski
 public override void ReadPayload(ISerializationContext context, IValueReader reader)
 {
     this.channel = new ChannelInfo (context, reader);
     Delete = reader.ReadBool ();
     MakeDefault = reader.ReadBool();
 }
コード例 #34
0
ファイル: MachineStateMessage.cs プロジェクト: HaKDMoDz/Alloy
 public override void ReadPayload(ISerializationContext context, IValueReader reader)
 {
     this.IsActive = reader.ReadBool();
 }
コード例 #35
0
ファイル: BanUserMessage.cs プロジェクト: ermau/Gablarski
 public override void ReadPayload(ISerializationContext context, IValueReader reader)
 {
     Removing = reader.ReadBool();
     BanInfo = new BanInfo (context, reader);
 }
コード例 #36
0
 public override void ReadPayload(ISerializationContext context, IValueReader reader)
 {
     UserId     = reader.ReadInt32();
     FromServer = reader.ReadBool();
 }
コード例 #37
0
ファイル: WallEntityBase.cs プロジェクト: wtfcolt/game
        void Read(IValueReader r)
        {
            var position = r.ReadVector2(_positionValueKey);
            var size = r.ReadVector2(_sizeValueKey);
            IsPlatform = r.ReadBool(_isPlatformValueKey);
            BoundGrhIndex = r.ReadGrhIndex(_boundGrhIndexValueKey);

            SetPositionRaw(position);
            SetSizeRaw(size);
        }
コード例 #38
0
ファイル: ServerInfo.cs プロジェクト: ermau/Gablarski
        public void Deserialize(ISerializationContext context, IValueReader reader)
        {
            Name = reader.ReadString();
            Description = reader.ReadString();
            Logo = reader.ReadString();
            Passworded = reader.ReadBool();
            RegistrationMode = (UserRegistrationMode)reader.ReadByte();

            if (RegistrationMode != UserRegistrationMode.None)
                RegistrationContent = reader.ReadString();
        }
コード例 #39
0
        public void Deserialize(IValueReader reader, RSACrypto crypto)
        {
            if (reader == null)
                throw new ArgumentNullException ("reader");
            if (crypto == null)
                throw new ArgumentNullException ("crypto");

            if (reader.ReadBool())
            {
                byte[] exponent = crypto.Decrypt (reader.ReadBytes());

                byte[] modulus1 = crypto.Decrypt (reader.ReadBytes());
                byte[] modulus2 = crypto.Decrypt (reader.ReadBytes());
                byte[] modulus = modulus1.Concat (modulus2).ToArray();

                this.exponentOffset = modulus.Length;
                this.publicKey = new byte[exponent.Length + modulus.Length];
                Buffer.BlockCopy (modulus, 0, this.publicKey, 0, modulus.Length);
                Buffer.BlockCopy (exponent, 0, this.publicKey, exponentOffset, exponent.Length);
            }

            SetupSignature();
        }
コード例 #40
0
 public override void ReadPayload(ISerializationContext context, IValueReader reader)
 {
     Result = (ConnectResult)reader.ReadByte();
     KeyboardEncryption = reader.ReadBool();
     MouseEncryption = reader.ReadBool();
 }
コード例 #41
0
ファイル: Light.cs プロジェクト: mateuscezar/netgore
        /// <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)
        {
            PositionProvider = null;
            Tag = null;

            Position = reader.ReadVector2(_positionValueKey);
            Size = reader.ReadVector2(_sizeValueKey);
            Color = reader.ReadColor(_colorValueKey);
            Rotation = reader.ReadFloat(_rotationValueKey);
            IsEnabled = reader.ReadBool(_isEnabledValueKey);

            var grhIndex = reader.ReadGrhIndex(_spriteValueKey);
            if (!grhIndex.IsInvalid)
                Sprite = new Grh(grhIndex, AnimType.Loop, 0);
            else
                Sprite = null;
        }
コード例 #42
0
ファイル: UserMutedMessage.cs プロジェクト: ermau/Gablarski
 public override void ReadPayload(ISerializationContext context, IValueReader reader)
 {
     this.Unmuted = reader.ReadBool();
     this.UserId  = reader.ReadInt32();
 }
コード例 #43
0
ファイル: ChannelInfo.cs プロジェクト: ermau/Gablarski
 public void Deserialize(ISerializationContext context, IValueReader reader)
 {
     this.ChannelId = reader.ReadInt32();
     this.ParentChannelId = reader.ReadInt32();
     this.ReadOnly = reader.ReadBool();
     this.UserLimit = reader.ReadInt32 ();
     this.Name = reader.ReadString ();
     this.Description = reader.ReadString ();
 }
コード例 #44
0
ファイル: PolygonEmitter.cs プロジェクト: wtfcolt/game
 /// <summary>
 /// When overridden in the derived class, reads all custom state values from the <paramref name="reader"/>.
 /// </summary>
 /// <param name="reader">The <see cref="IValueReader"/> to read the state values from.</param>
 protected override void ReadCustomValues(IValueReader reader)
 {
     Closed = reader.ReadBool(_closedKeyName);
     Scale = reader.ReadFloat(_scaleKeyName);
     Rotation = reader.ReadFloat(_rotationKeyName);
     PolygonOrigin = reader.ReadEnum<PolygonOrigin>(_polygonOriginKeyName);
     Points.Read(_pointsNodeName, reader);
 }
コード例 #45
0
 /// <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 virtual void ReadState(IValueReader reader)
 {
     Checked = reader.ReadBool(_checkedValueKey);
     PersistableHelper.Read(this, reader);
 }
コード例 #46
0
ファイル: PersistableTextBox.cs プロジェクト: wtfcolt/game
 /// <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 virtual void ReadState(IValueReader reader)
 {
     Multiline = reader.ReadBool(_multilineValueKey);
     Text      = reader.ReadString(_textValueKey);
     PersistableHelper.Read(this, reader);
 }
コード例 #47
0
 public override void ReadPayload(ISerializationContext context, IValueReader reader)
 {
     if (Accepted = reader.ReadBool())
         Target = new Target (context, reader);
 }
コード例 #48
0
ファイル: UserKickedMessage.cs プロジェクト: ermau/Gablarski
 public override void ReadPayload(ISerializationContext context, IValueReader reader)
 {
     FromServer = reader.ReadBool();
     UserId = reader.ReadInt32();
 }
コード例 #49
0
ファイル: RectEmitter.cs プロジェクト: wtfcolt/game
 /// <summary>
 /// When overridden in the derived class, reads all custom state values from the <paramref name="reader"/>.
 /// </summary>
 /// <param name="reader">The <see cref="IValueReader"/> to read the state values from.</param>
 protected override void ReadCustomValues(IValueReader reader)
 {
     Height = reader.ReadInt(_heightKeyName);
     Width = reader.ReadInt(_widthKeyName);
     Perimeter = reader.ReadBool(_perimeterKeyName);
 }
コード例 #50
0
ファイル: SourceMutedMessage.cs プロジェクト: ermau/Gablarski
 public override void ReadPayload(ISerializationContext context, IValueReader reader)
 {
     this.Unmuted = reader.ReadBool();
     this.SourceId = reader.ReadInt32();
 }
コード例 #51
0
 /// <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 virtual void ReadState(IValueReader reader)
 {
     Multiline = reader.ReadBool(_multilineValueKey);
     Text = reader.ReadString(_textValueKey);
     PersistableHelper.Read(this, reader);
 }
コード例 #52
0
        public void Deserialize(ISerializationContext context, IValueReader reader)
        {
            if (reader == null)
                throw new ArgumentNullException ("reader");

            if (reader.ReadBool())
            {
                this.publicKey = reader.ReadBytes();
                this.exponentOffset = reader.ReadInt32();
            }

            SetupSignature();
        }
コード例 #53
0
ファイル: RectEmitter.cs プロジェクト: thepirateclub/netgore
 /// <summary>
 /// When overridden in the derived class, reads all custom state values from the <paramref name="reader"/>.
 /// </summary>
 /// <param name="reader">The <see cref="IValueReader"/> to read the state values from.</param>
 protected override void ReadCustomValues(IValueReader reader)
 {
     Height    = reader.ReadInt(_heightKeyName);
     Width     = reader.ReadInt(_widthKeyName);
     Perimeter = reader.ReadBool(_perimeterKeyName);
 }
コード例 #54
0
ファイル: UserInfo.cs プロジェクト: ermau/Gablarski
 public void Deserialize(ISerializationContext context, IValueReader reader)
 {
     UserId = reader.ReadInt32();
     Username = reader.ReadString();
     CurrentChannelId = reader.ReadInt32();
     Nickname = reader.ReadString();
     Phonetic = reader.ReadString();
     IsMuted = reader.ReadBool();
     Status = (UserStatus)reader.ReadByte();
     Comment = reader.ReadString();
 }
コード例 #55
0
 public override void ReadPayload(ISerializationContext context, IValueReader reader)
 {
     UserId = reader.ReadInt32();
     Username = reader.ReadString();
     Approved = reader.ReadBool();
 }
コード例 #56
0
ファイル: LineEmitter.cs プロジェクト: mateuscezar/netgore
 /// <summary>
 /// When overridden in the derived class, reads all custom state values from the <paramref name="reader"/>.
 /// </summary>
 /// <param name="reader">The <see cref="IValueReader"/> to read the state values from.</param>
 protected override void ReadCustomValues(IValueReader reader)
 {
     Angle = reader.ReadFloat(_angleKeyName);
     EmitBothWays = reader.ReadBool(_emitBothWaysKeyName);
     Length = reader.ReadInt(_lengthKeyName);
     Rectilinear = reader.ReadBool(_rectilinearKeyName);
 }
コード例 #57
0
ファイル: CircleEmitter.cs プロジェクト: mateuscezar/netgore
 /// <summary>
 /// When overridden in the derived class, reads all custom state values from the <paramref name="reader"/>.
 /// </summary>
 /// <param name="reader">The <see cref="IValueReader"/> to read the state values from.</param>
 protected override void ReadCustomValues(IValueReader reader)
 {
     Perimeter = reader.ReadBool(_perimeterKeyName);
     Radiate = reader.ReadBool(_radiateKeyName);
     Radius = reader.ReadVariableFloat(_radiusKeyName);
 }
コード例 #58
0
ファイル: StationaryGrhData.cs プロジェクト: Furt/netgore
        /// <summary>
        /// Initializes a new instance of the <see cref="StationaryGrhData"/> class.
        /// </summary>
        /// <param name="r">The <see cref="IValueReader"/>.</param>
        /// <param name="cm">The <see cref="IContentManager"/>.</param>
        /// <param name="grhIndex">The <see cref="GrhIndex"/>.</param>
        /// <param name="cat">The <see cref="SpriteCategorization"/>.</param>
        /// <exception cref="ArgumentNullException"><paramref name="cat"/> is null.</exception>
        /// <exception cref="ArgumentOutOfRangeException"><paramref name="grhIndex"/> is equal to GrhIndex.Invalid.</exception>
        StationaryGrhData(IValueReader r, IContentManager cm, GrhIndex grhIndex, SpriteCategorization cat) : base(grhIndex, cat)
        {
            _cm = cm;

            var automaticSize = r.ReadBool(_automaticSizeValueKey);
            var textureReader = r.ReadNode(_textureNodeName);
            var textureName = textureReader.ReadTextureAssetName(_textureNameValueKey);
            var textureSource = textureReader.ReadRectangle(_textureSourceValueKey);

            _textureName = textureName;
            SetSourceRect(textureSource);
            _automaticSize = automaticSize;
        }
コード例 #59
0
 public override void ReadPayload(ISerializationContext context, IValueReader reader)
 {
     this.Starting = reader.ReadBool();
     this.SourceId = reader.ReadInt32();
 }