/// <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); }
/// <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); }
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()); }
/// <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(); }
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(); }
public override void ReadPayload(ISerializationContext context, IValueReader reader) { if (Accepted = reader.ReadBool()) { Target = new Target(context, reader); } }
/// <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); }
public override void ReadPayload (ISerializationContext context, IValueReader reader) { if (reader.ReadBool()) SenderId = reader.ReadString(); GroupId = reader.ReadInt32(); Text = reader.ReadString(); }
public void Deserialize(ISerializationContext context, IValueReader reader) { Name = reader.ReadString(); Id = reader.ReadInt32(); OwnerId = reader.ReadInt32(); IsMuted = reader.ReadBool(); CodecSettings = new AudioCodecArgs(context, reader); }
/// <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); }
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 ()); }
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(); }
void Read(IValueReader r) { var position = r.ReadVector2(_positionValueKey); var size = r.ReadVector2(_sizeValueKey); IsPlatform = r.ReadBool(_isPlatformValueKey); SetPositionRaw(position); SetSizeRaw(size); }
public override void ReadPayload(ISerializationContext context, IValueReader reader) { if (reader.ReadBool()) { SenderId = reader.ReadString(); } GroupId = reader.ReadInt32(); Text = reader.ReadString(); }
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(); }
/// <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); }
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); }
/// <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; }
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(); } }
/// <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); }
/// <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); }
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(); }
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; }
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)); }
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; }
/// <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; } }
/// <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(); }
public override void ReadPayload(ISerializationContext context, IValueReader reader) { this.ServerInfoOnly = reader.ReadBool(); }
/// <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; }
public override void ReadPayload(ISerializationContext context, IValueReader reader) { this.channel = new ChannelInfo (context, reader); Delete = reader.ReadBool (); MakeDefault = reader.ReadBool(); }
public override void ReadPayload(ISerializationContext context, IValueReader reader) { this.IsActive = reader.ReadBool(); }
public override void ReadPayload(ISerializationContext context, IValueReader reader) { Removing = reader.ReadBool(); BanInfo = new BanInfo (context, reader); }
public override void ReadPayload(ISerializationContext context, IValueReader reader) { UserId = reader.ReadInt32(); FromServer = reader.ReadBool(); }
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); }
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(); }
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(); }
public override void ReadPayload(ISerializationContext context, IValueReader reader) { Result = (ConnectResult)reader.ReadByte(); KeyboardEncryption = reader.ReadBool(); MouseEncryption = reader.ReadBool(); }
/// <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; }
public override void ReadPayload(ISerializationContext context, IValueReader reader) { this.Unmuted = reader.ReadBool(); this.UserId = reader.ReadInt32(); }
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 (); }
/// <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); }
/// <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); }
/// <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); }
public override void ReadPayload(ISerializationContext context, IValueReader reader) { if (Accepted = reader.ReadBool()) Target = new Target (context, reader); }
public override void ReadPayload(ISerializationContext context, IValueReader reader) { FromServer = reader.ReadBool(); UserId = reader.ReadInt32(); }
/// <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); }
public override void ReadPayload(ISerializationContext context, IValueReader reader) { this.Unmuted = reader.ReadBool(); this.SourceId = reader.ReadInt32(); }
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(); }
public override void ReadPayload(ISerializationContext context, IValueReader reader) { UserId = reader.ReadInt32(); Username = reader.ReadString(); Approved = reader.ReadBool(); }
/// <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); }
public override void ReadPayload(ISerializationContext context, IValueReader reader) { this.Starting = reader.ReadBool(); this.SourceId = reader.ReadInt32(); }