Beispiel #1
0
/// <summary>
/// Reads the values from an <see cref="IDataReader"/> and assigns the read values to this
/// object's properties. Unlike ReadValues(), this method not only doesn't require
/// all values to be in the <see cref="IDataReader"/>, but also does not require the values in
/// the <see cref="IDataReader"/> to be a defined field for the table this class represents.
/// Because of this, you need to be careful when using this method because values
/// can easily be skipped without any indication.
/// </summary>
/// <param name="source">The object to add the extension method to.</param>
/// <param name="dataRecord">The <see cref="IDataReader"/> to read the values from. Must already be ready to be read from.</param>
        public static void TryReadValues(this QuestTable source, System.Data.IDataRecord dataRecord)
        {
            for (int i = 0; i < dataRecord.FieldCount; i++)
            {
                switch (dataRecord.GetName(i))
                {
                case "id":
                    source.ID = (NetGore.Features.Quests.QuestID)(NetGore.Features.Quests.QuestID) dataRecord.GetUInt16(i);
                    break;


                case "repeatable":
                    source.Repeatable = (System.Boolean)(System.Boolean) dataRecord.GetBoolean(i);
                    break;


                case "reward_cash":
                    source.RewardCash = (System.Int32)(System.Int32) dataRecord.GetInt32(i);
                    break;


                case "reward_exp":
                    source.RewardExp = (System.Int32)(System.Int32) dataRecord.GetInt32(i);
                    break;
                }
            }
        }
/// <summary>
/// Reads the values from an <see cref="IDataReader"/> and assigns the read values to this
/// object's properties. Unlike ReadValues(), this method not only doesn't require
/// all values to be in the <see cref="IDataReader"/>, but also does not require the values in
/// the <see cref="IDataReader"/> to be a defined field for the table this class represents.
/// Because of this, you need to be careful when using this method because values
/// can easily be skipped without any indication.
/// </summary>
/// <param name="source">The object to add the extension method to.</param>
/// <param name="dataRecord">The <see cref="IDataReader"/> to read the values from. Must already be ready to be read from.</param>
        public static void TryReadValues(this CharacterTemplateEquippedTable source, System.Data.IDataRecord dataRecord)
        {
            for (int i = 0; i < dataRecord.FieldCount; i++)
            {
                switch (dataRecord.GetName(i))
                {
                case "chance":
                    source.Chance = (DemoGame.ItemChance)(DemoGame.ItemChance) dataRecord.GetUInt16(i);
                    break;


                case "character_template_id":
                    source.CharacterTemplateID = (DemoGame.CharacterTemplateID)(DemoGame.CharacterTemplateID) dataRecord.GetUInt16(i);
                    break;


                case "id":
                    source.ID = (System.Int32)(System.Int32) dataRecord.GetInt32(i);
                    break;


                case "item_template_id":
                    source.ItemTemplateID = (DemoGame.ItemTemplateID)(DemoGame.ItemTemplateID) dataRecord.GetUInt16(i);
                    break;
                }
            }
        }
Beispiel #3
0
/// <summary>
/// Reads the values from an <see cref="IDataReader"/> and assigns the read values to this
/// object's properties. Unlike ReadValues(), this method not only doesn't require
/// all values to be in the <see cref="IDataReader"/>, but also does not require the values in
/// the <see cref="IDataReader"/> to be a defined field for the table this class represents.
/// Because of this, you need to be careful when using this method because values
/// can easily be skipped without any indication.
/// </summary>
/// <param name="source">The object to add the extension method to.</param>
/// <param name="dataRecord">The <see cref="IDataReader"/> to read the values from. Must already be ready to be read from.</param>
        public static void TryReadValues(this GuildTable source, System.Data.IDataRecord dataRecord)
        {
            for (int i = 0; i < dataRecord.FieldCount; i++)
            {
                switch (dataRecord.GetName(i))
                {
                case "created":
                    source.Created = (System.DateTime)(System.DateTime) dataRecord.GetDateTime(i);
                    break;


                case "id":
                    source.ID = (NetGore.Features.Guilds.GuildID)(NetGore.Features.Guilds.GuildID) dataRecord.GetUInt16(i);
                    break;


                case "name":
                    source.Name = (System.String)(System.String) dataRecord.GetString(i);
                    break;


                case "tag":
                    source.Tag = (System.String)(System.String) dataRecord.GetString(i);
                    break;
                }
            }
        }
/// <summary>
/// Reads the values from an <see cref="IDataReader"/> and assigns the read values to this
/// object's properties. Unlike ReadValues(), this method not only doesn't require
/// all values to be in the <see cref="IDataReader"/>, but also does not require the values in
/// the <see cref="IDataReader"/> to be a defined field for the table this class represents.
/// Because of this, you need to be careful when using this method because values
/// can easily be skipped without any indication.
/// </summary>
/// <param name="source">The object to add the extension method to.</param>
/// <param name="dataRecord">The <see cref="IDataReader"/> to read the values from. Must already be ready to be read from.</param>
        public static void TryReadValues(this CharacterQuestStatusTable source, System.Data.IDataRecord dataRecord)
        {
            for (int i = 0; i < dataRecord.FieldCount; i++)
            {
                switch (dataRecord.GetName(i))
                {
                case "character_id":
                    source.CharacterID = (DemoGame.CharacterID)(DemoGame.CharacterID) dataRecord.GetInt32(i);
                    break;


                case "completed_on":
                    source.CompletedOn = (System.Nullable <System.DateTime>)(System.Nullable <System.DateTime>)(dataRecord.IsDBNull(i) ? (System.Nullable <System.DateTime>)null : dataRecord.GetDateTime(i));
                    break;


                case "quest_id":
                    source.QuestID = (NetGore.Features.Quests.QuestID)(NetGore.Features.Quests.QuestID) dataRecord.GetUInt16(i);
                    break;


                case "started_on":
                    source.StartedOn = (System.DateTime)(System.DateTime) dataRecord.GetDateTime(i);
                    break;
                }
            }
        }
/// <summary>
/// Reads the values from an <see cref="IDataReader"/> and assigns the read values to this
/// object's properties. Unlike ReadValues(), this method not only doesn't require
/// all values to be in the <see cref="IDataReader"/>, but also does not require the values in
/// the <see cref="IDataReader"/> to be a defined field for the table this class represents.
/// Because of this, you need to be careful when using this method because values
/// can easily be skipped without any indication.
/// </summary>
/// <param name="source">The object to add the extension method to.</param>
/// <param name="dataRecord">The <see cref="IDataReader"/> to read the values from. Must already be ready to be read from.</param>
        public static void TryReadValues(this CharacterStatusEffectTable source, System.Data.IDataRecord dataRecord)
        {
            for (int i = 0; i < dataRecord.FieldCount; i++)
            {
                switch (dataRecord.GetName(i))
                {
                case "character_id":
                    source.CharacterID = (DemoGame.CharacterID)(DemoGame.CharacterID) dataRecord.GetInt32(i);
                    break;


                case "id":
                    source.ID = (DemoGame.ActiveStatusEffectID)(DemoGame.ActiveStatusEffectID) dataRecord.GetInt32(i);
                    break;


                case "power":
                    source.Power = (System.UInt16)(System.UInt16) dataRecord.GetUInt16(i);
                    break;


                case "status_effect_id":
                    source.StatusEffect = (DemoGame.StatusEffectType)(DemoGame.StatusEffectType) dataRecord.GetByte(i);
                    break;


                case "time_left_secs":
                    source.TimeLeftSecs = (System.UInt16)(System.UInt16) dataRecord.GetUInt16(i);
                    break;
                }
            }
        }
/// <summary>
/// Reads the values from an <see cref="IDataReader"/> and assigns the read values to this
/// object's properties. Unlike ReadValues(), this method not only doesn't require
/// all values to be in the <see cref="IDataReader"/>, but also does not require the values in
/// the <see cref="IDataReader"/> to be a defined field for the table this class represents.
/// Because of this, you need to be careful when using this method because values
/// can easily be skipped without any indication.
/// </summary>
/// <param name="source">The object to add the extension method to.</param>
/// <param name="dataRecord">The <see cref="IDataReader"/> to read the values from. Must already be ready to be read from.</param>
        public static void TryReadValues(this AccountIpsTable source, System.Data.IDataRecord dataRecord)
        {
            for (int i = 0; i < dataRecord.FieldCount; i++)
            {
                switch (dataRecord.GetName(i))
                {
                case "account_id":
                    source.AccountID = (DemoGame.AccountID)(DemoGame.AccountID) dataRecord.GetInt32(i);
                    break;


                case "id":
                    source.ID = (System.UInt32)(System.UInt32) dataRecord.GetUInt32(i);
                    break;


                case "ip":
                    source.Ip = (System.UInt32)(System.UInt32) dataRecord.GetUInt32(i);
                    break;


                case "time":
                    source.Time = (System.DateTime)(System.DateTime) dataRecord.GetDateTime(i);
                    break;
                }
            }
        }
Beispiel #7
0
/// <summary>
/// Reads the values from an <see cref="IDataReader"/> and assigns the read values to this
/// object's properties. Unlike ReadValues(), this method not only doesn't require
/// all values to be in the <see cref="IDataReader"/>, but also does not require the values in
/// the <see cref="IDataReader"/> to be a defined field for the table this class represents.
/// Because of this, you need to be careful when using this method because values
/// can easily be skipped without any indication.
/// </summary>
/// <param name="source">The object to add the extension method to.</param>
/// <param name="dataRecord">The <see cref="IDataReader"/> to read the values from. Must already be ready to be read from.</param>
        public static void TryReadValues(this CharacterQuestStatusKillsTable source, System.Data.IDataRecord dataRecord)
        {
            for (int i = 0; i < dataRecord.FieldCount; i++)
            {
                switch (dataRecord.GetName(i))
                {
                case "character_id":
                    source.CharacterID = (DemoGame.CharacterID)(DemoGame.CharacterID) dataRecord.GetInt32(i);
                    break;


                case "character_template_id":
                    source.CharacterTemplateID = (DemoGame.CharacterTemplateID)(DemoGame.CharacterTemplateID) dataRecord.GetUInt16(i);
                    break;


                case "count":
                    source.Count = (System.UInt16)(System.UInt16) dataRecord.GetUInt16(i);
                    break;


                case "quest_id":
                    source.QuestID = (NetGore.Features.Quests.QuestID)(NetGore.Features.Quests.QuestID) dataRecord.GetUInt16(i);
                    break;
                }
            }
        }
Beispiel #8
0
/// <summary>
/// Reads the values from an <see cref="IDataReader"/> and assigns the read values to this
/// object's properties. Unlike ReadValues(), this method not only doesn't require
/// all values to be in the <see cref="IDataReader"/>, but also does not require the values in
/// the <see cref="IDataReader"/> to be a defined field for the table this class represents.
/// Because of this, you need to be careful when using this method because values
/// can easily be skipped without any indication.
/// </summary>
/// <param name="source">The object to add the extension method to.</param>
/// <param name="dataRecord">The <see cref="IDataReader"/> to read the values from. Must already be ready to be read from.</param>
        public static void TryReadValues(this GuildMemberTable source, System.Data.IDataRecord dataRecord)
        {
            for (int i = 0; i < dataRecord.FieldCount; i++)
            {
                switch (dataRecord.GetName(i))
                {
                case "character_id":
                    source.CharacterID = (DemoGame.CharacterID)(DemoGame.CharacterID) dataRecord.GetInt32(i);
                    break;


                case "guild_id":
                    source.GuildID = (NetGore.Features.Guilds.GuildID)(NetGore.Features.Guilds.GuildID) dataRecord.GetUInt16(i);
                    break;


                case "joined":
                    source.Joined = (System.DateTime)(System.DateTime) dataRecord.GetDateTime(i);
                    break;


                case "rank":
                    source.Rank = (NetGore.Features.Guilds.GuildRank)(NetGore.Features.Guilds.GuildRank) dataRecord.GetByte(i);
                    break;
                }
            }
        }
/// <summary>
/// Reads the values from an <see cref="IDataReader"/> and assigns the read values to this
/// object's properties. Unlike ReadValues(), this method not only doesn't require
/// all values to be in the <see cref="IDataReader"/>, but also does not require the values in
/// the <see cref="IDataReader"/> to be a defined field for the table this class represents.
/// Because of this, you need to be careful when using this method because values
/// can easily be skipped without any indication.
/// </summary>
/// <param name="source">The object to add the extension method to.</param>
/// <param name="dataRecord">The <see cref="IDataReader"/> to read the values from. Must already be ready to be read from.</param>
        public static void TryReadValues(this WorldStatsCountNpcKillUserTable source, System.Data.IDataRecord dataRecord)
        {
            for (int i = 0; i < dataRecord.FieldCount; i++)
            {
                switch (dataRecord.GetName(i))
                {
                case "count":
                    source.Count = (System.Int32)(System.Int32) dataRecord.GetInt32(i);
                    break;


                case "last_update":
                    source.LastUpdate = (System.DateTime)(System.DateTime) dataRecord.GetDateTime(i);
                    break;


                case "npc_template_id":
                    source.NPCTemplateID = (DemoGame.CharacterTemplateID)(DemoGame.CharacterTemplateID) dataRecord.GetUInt16(i);
                    break;


                case "user_id":
                    source.UserID = (DemoGame.CharacterID)(DemoGame.CharacterID) dataRecord.GetInt32(i);
                    break;
                }
            }
        }
/// <summary>
/// Reads the values from an <see cref="IDataReader"/> and assigns the read values to this
/// object's properties. Unlike ReadValues(), this method not only doesn't require
/// all values to be in the <see cref="IDataReader"/>, but also does not require the values in
/// the <see cref="IDataReader"/> to be a defined field for the table this class represents.
/// Because of this, you need to be careful when using this method because values
/// can easily be skipped without any indication.
/// </summary>
/// <param name="source">The object to add the extension method to.</param>
/// <param name="dataRecord">The <see cref="IDataReader"/> to read the values from. Must already be ready to be read from.</param>
        public static void TryReadValues(this WorldStatsGuildUserChangeTable source, System.Data.IDataRecord dataRecord)
        {
            for (int i = 0; i < dataRecord.FieldCount; i++)
            {
                switch (dataRecord.GetName(i))
                {
                case "guild_id":
                    source.GuildID = (System.Nullable <NetGore.Features.Guilds.GuildID>)(System.Nullable <NetGore.Features.Guilds.GuildID>)(dataRecord.IsDBNull(i) ? (System.Nullable <System.UInt16>)null : dataRecord.GetUInt16(i));
                    break;


                case "id":
                    source.ID = (System.UInt32)(System.UInt32) dataRecord.GetUInt32(i);
                    break;


                case "user_id":
                    source.UserID = (DemoGame.CharacterID)(DemoGame.CharacterID) dataRecord.GetInt32(i);
                    break;


                case "when":
                    source.When = (System.DateTime)(System.DateTime) dataRecord.GetDateTime(i);
                    break;
                }
            }
        }
Beispiel #11
0
/// <summary>
/// Reads the values from an <see cref="IDataReader"/> and assigns the read values to this
/// object's properties. Unlike ReadValues(), this method not only doesn't require
/// all values to be in the <see cref="IDataReader"/>, but also does not require the values in
/// the <see cref="IDataReader"/> to be a defined field for the table this class represents.
/// Because of this, you need to be careful when using this method because values
/// can easily be skipped without any indication.
/// </summary>
/// <param name="source">The object to add the extension method to.</param>
/// <param name="dataRecord">The <see cref="IDataReader"/> to read the values from. Must already be ready to be read from.</param>
        public static void TryReadValues(this MapSpawnTable source, System.Data.IDataRecord dataRecord)
        {
            for (int i = 0; i < dataRecord.FieldCount; i++)
            {
                switch (dataRecord.GetName(i))
                {
                case "amount":
                    source.Amount = (System.Byte)(System.Byte) dataRecord.GetByte(i);
                    break;


                case "character_template_id":
                    source.CharacterTemplateID = (DemoGame.CharacterTemplateID)(DemoGame.CharacterTemplateID) dataRecord.GetUInt16(i);
                    break;


                case "direction_id":
                    source.DirectionId = (NetGore.Direction)(NetGore.Direction) dataRecord.GetInt16(i);
                    break;


                case "height":
                    source.Height = (System.Nullable <System.UInt16>)(System.Nullable <System.UInt16>)(dataRecord.IsDBNull(i) ? (System.Nullable <System.UInt16>)null : dataRecord.GetUInt16(i));
                    break;


                case "id":
                    source.ID = (DemoGame.MapSpawnValuesID)(DemoGame.MapSpawnValuesID) dataRecord.GetInt32(i);
                    break;


                case "map_id":
                    source.MapID = (NetGore.World.MapID)(NetGore.World.MapID) dataRecord.GetUInt16(i);
                    break;


                case "respawn":
                    source.Respawn = (System.UInt16)(System.UInt16) dataRecord.GetUInt16(i);
                    break;


                case "width":
                    source.Width = (System.Nullable <System.UInt16>)(System.Nullable <System.UInt16>)(dataRecord.IsDBNull(i) ? (System.Nullable <System.UInt16>)null : dataRecord.GetUInt16(i));
                    break;


                case "x":
                    source.X = (System.Nullable <System.UInt16>)(System.Nullable <System.UInt16>)(dataRecord.IsDBNull(i) ? (System.Nullable <System.UInt16>)null : dataRecord.GetUInt16(i));
                    break;


                case "y":
                    source.Y = (System.Nullable <System.UInt16>)(System.Nullable <System.UInt16>)(dataRecord.IsDBNull(i) ? (System.Nullable <System.UInt16>)null : dataRecord.GetUInt16(i));
                    break;
                }
            }
        }
/// <summary>
/// Reads the values from an <see cref="IDataReader"/> and assigns the read values to this
/// object's properties. Unlike ReadValues(), this method not only doesn't require
/// all values to be in the <see cref="IDataReader"/>, but also does not require the values in
/// the <see cref="IDataReader"/> to be a defined field for the table this class represents.
/// Because of this, you need to be careful when using this method because values
/// can easily be skipped without any indication.
/// </summary>
/// <param name="source">The object to add the extension method to.</param>
/// <param name="dataRecord">The <see cref="IDataReader"/> to read the values from. Must already be ready to be read from.</param>
        public static void TryReadValues(this WorldStatsNpcKillUserTable source, System.Data.IDataRecord dataRecord)
        {
            for (int i = 0; i < dataRecord.FieldCount; i++)
            {
                switch (dataRecord.GetName(i))
                {
                case "id":
                    source.ID = (System.UInt32)(System.UInt32) dataRecord.GetUInt32(i);
                    break;


                case "map_id":
                    source.MapID = (System.Nullable <NetGore.World.MapID>)(System.Nullable <NetGore.World.MapID>)(dataRecord.IsDBNull(i) ? (System.Nullable <System.UInt16>)null : dataRecord.GetUInt16(i));
                    break;


                case "npc_template_id":
                    source.NPCTemplateID = (System.Nullable <DemoGame.CharacterTemplateID>)(System.Nullable <DemoGame.CharacterTemplateID>)(dataRecord.IsDBNull(i) ? (System.Nullable <System.UInt16>)null : dataRecord.GetUInt16(i));
                    break;


                case "npc_x":
                    source.NpcX = (System.UInt16)(System.UInt16) dataRecord.GetUInt16(i);
                    break;


                case "npc_y":
                    source.NpcY = (System.UInt16)(System.UInt16) dataRecord.GetUInt16(i);
                    break;


                case "user_id":
                    source.UserID = (DemoGame.CharacterID)(DemoGame.CharacterID) dataRecord.GetInt32(i);
                    break;


                case "user_level":
                    source.UserLevel = (System.Int16)(System.Int16) dataRecord.GetInt16(i);
                    break;


                case "user_x":
                    source.UserX = (System.UInt16)(System.UInt16) dataRecord.GetUInt16(i);
                    break;


                case "user_y":
                    source.UserY = (System.UInt16)(System.UInt16) dataRecord.GetUInt16(i);
                    break;


                case "when":
                    source.When = (System.DateTime)(System.DateTime) dataRecord.GetDateTime(i);
                    break;
                }
            }
        }
/// <summary>
/// Reads the values from an <see cref="IDataReader"/> and assigns the read values to this
/// object's properties. Unlike ReadValues(), this method not only doesn't require
/// all values to be in the <see cref="IDataReader"/>, but also does not require the values in
/// the <see cref="IDataReader"/> to be a defined field for the table this class represents.
/// Because of this, you need to be careful when using this method because values
/// can easily be skipped without any indication.
/// </summary>
/// <param name="source">The object to add the extension method to.</param>
/// <param name="dataRecord">The <see cref="IDataReader"/> to read the values from. Must already be ready to be read from.</param>
        public static void TryReadValues(this AccountTable source, System.Data.IDataRecord dataRecord)
        {
            for (int i = 0; i < dataRecord.FieldCount; i++)
            {
                switch (dataRecord.GetName(i))
                {
                case "creator_ip":
                    source.CreatorIp = (System.UInt32)(System.UInt32) dataRecord.GetUInt32(i);
                    break;


                case "current_ip":
                    source.CurrentIp = (System.Nullable <System.UInt32>)(System.Nullable <System.UInt32>)(dataRecord.IsDBNull(i) ? (System.Nullable <System.UInt32>)null : dataRecord.GetUInt32(i));
                    break;


                case "email":
                    source.Email = (System.String)(System.String) dataRecord.GetString(i);
                    break;


                case "friends":
                    source.Friends = (System.String)(System.String) dataRecord.GetString(i);
                    break;


                case "id":
                    source.ID = (DemoGame.AccountID)(DemoGame.AccountID) dataRecord.GetInt32(i);
                    break;


                case "name":
                    source.Name = (System.String)(System.String) dataRecord.GetString(i);
                    break;


                case "password":
                    source.Password = (System.String)(System.String) dataRecord.GetString(i);
                    break;


                case "permissions":
                    source.Permissions = (DemoGame.UserPermissions)(DemoGame.UserPermissions) dataRecord.GetByte(i);
                    break;


                case "time_created":
                    source.TimeCreated = (System.DateTime)(System.DateTime) dataRecord.GetDateTime(i);
                    break;


                case "time_last_login":
                    source.TimeLastLogin = (System.DateTime)(System.DateTime) dataRecord.GetDateTime(i);
                    break;
                }
            }
        }
Beispiel #14
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="dictionary"></param>
        /// <param name="record"></param>
        public static void SetValues(this IDictionary <String, Object> dictionary, System.Data.IDataRecord record)
        {
            var fieldCount = record.FieldCount;

            for (int i = 0; i < fieldCount; i++)
            {
                var key = record.GetName(i);
                dictionary[key] = record[key];
            }
        }
/// <summary>
/// Reads the values from an <see cref="IDataReader"/> and assigns the read values to this
/// object's properties. Unlike ReadValues(), this method not only doesn't require
/// all values to be in the <see cref="IDataReader"/>, but also does not require the values in
/// the <see cref="IDataReader"/> to be a defined field for the table this class represents.
/// Because of this, you need to be careful when using this method because values
/// can easily be skipped without any indication.
/// </summary>
/// <param name="source">The object to add the extension method to.</param>
/// <param name="dataRecord">The <see cref="IDataReader"/> to read the values from. Must already be ready to be read from.</param>
        public static void TryReadValues(this ServerTimeTable source, System.Data.IDataRecord dataRecord)
        {
            for (int i = 0; i < dataRecord.FieldCount; i++)
            {
                switch (dataRecord.GetName(i))
                {
                case "server_time":
                    source.ServerTime = (System.DateTime)(System.DateTime) dataRecord.GetDateTime(i);
                    break;
                }
            }
        }
Beispiel #16
0
        public static T SetToDisctionary <T>(this System.Data.IDataRecord record, T dictionary)
            where T : IDictionary <String, Object>, new()
        {
            var fieldCount = record.FieldCount;

            for (int i = 0; i < fieldCount; i++)
            {
                var key = record.GetName(i);
                dictionary[key] = record[key];
            }
            return(dictionary);
        }
/// <summary>
/// Reads the values from an <see cref="IDataReader"/> and assigns the read values to this
/// object's properties. Unlike ReadValues(), this method not only doesn't require
/// all values to be in the <see cref="IDataReader"/>, but also does not require the values in
/// the <see cref="IDataReader"/> to be a defined field for the table this class represents.
/// Because of this, you need to be careful when using this method because values
/// can easily be skipped without any indication.
/// </summary>
/// <param name="source">The object to add the extension method to.</param>
/// <param name="dataRecord">The <see cref="IDataReader"/> to read the values from. Must already be ready to be read from.</param>
        public static void TryReadValues(this WorldStatsNetworkTable source, System.Data.IDataRecord dataRecord)
        {
            for (int i = 0; i < dataRecord.FieldCount; i++)
            {
                switch (dataRecord.GetName(i))
                {
                case "connections":
                    source.Connections = (System.UInt16)(System.UInt16) dataRecord.GetUInt16(i);
                    break;


                case "id":
                    source.ID = (System.UInt32)(System.UInt32) dataRecord.GetUInt32(i);
                    break;


                case "recv_bytes":
                    source.RecvBytes = (System.UInt32)(System.UInt32) dataRecord.GetUInt32(i);
                    break;


                case "recv_messages":
                    source.RecvMessages = (System.UInt32)(System.UInt32) dataRecord.GetUInt32(i);
                    break;


                case "recv_packets":
                    source.RecvPackets = (System.UInt32)(System.UInt32) dataRecord.GetUInt32(i);
                    break;


                case "sent_bytes":
                    source.SentBytes = (System.UInt32)(System.UInt32) dataRecord.GetUInt32(i);
                    break;


                case "sent_messages":
                    source.SentMessages = (System.UInt32)(System.UInt32) dataRecord.GetUInt32(i);
                    break;


                case "sent_packets":
                    source.SentPackets = (System.UInt32)(System.UInt32) dataRecord.GetUInt32(i);
                    break;


                case "when":
                    source.When = (System.DateTime)(System.DateTime) dataRecord.GetDateTime(i);
                    break;
                }
            }
        }
Beispiel #18
0
/// <summary>
/// Reads the values from an <see cref="IDataReader"/> and assigns the read values to this
/// object's properties. Unlike ReadValues(), this method not only doesn't require
/// all values to be in the <see cref="IDataReader"/>, but also does not require the values in
/// the <see cref="IDataReader"/> to be a defined field for the table this class represents.
/// Because of this, you need to be careful when using this method because values
/// can easily be skipped without any indication.
/// </summary>
/// <param name="source">The object to add the extension method to.</param>
/// <param name="dataRecord">The <see cref="IDataReader"/> to read the values from. Must already be ready to be read from.</param>
        public static void TryReadValues(this GuildEventTable source, System.Data.IDataRecord dataRecord)
        {
            for (int i = 0; i < dataRecord.FieldCount; i++)
            {
                switch (dataRecord.GetName(i))
                {
                case "arg0":
                    source.Arg0 = (System.String)(System.String)(dataRecord.IsDBNull(i) ? (System.String)null : dataRecord.GetString(i));
                    break;


                case "arg1":
                    source.Arg1 = (System.String)(System.String)(dataRecord.IsDBNull(i) ? (System.String)null : dataRecord.GetString(i));
                    break;


                case "arg2":
                    source.Arg2 = (System.String)(System.String)(dataRecord.IsDBNull(i) ? (System.String)null : dataRecord.GetString(i));
                    break;


                case "character_id":
                    source.CharacterID = (DemoGame.CharacterID)(DemoGame.CharacterID) dataRecord.GetInt32(i);
                    break;


                case "created":
                    source.Created = (System.DateTime)(System.DateTime) dataRecord.GetDateTime(i);
                    break;


                case "event_id":
                    source.EventID = (System.Byte)(System.Byte) dataRecord.GetByte(i);
                    break;


                case "guild_id":
                    source.GuildID = (NetGore.Features.Guilds.GuildID)(NetGore.Features.Guilds.GuildID) dataRecord.GetUInt16(i);
                    break;


                case "id":
                    source.ID = (System.Int32)(System.Int32) dataRecord.GetInt32(i);
                    break;


                case "target_character_id":
                    source.TargetCharacterID = (System.Nullable <DemoGame.CharacterID>)(System.Nullable <DemoGame.CharacterID>)(dataRecord.IsDBNull(i) ? (System.Nullable <System.Int32>)null : dataRecord.GetInt32(i));
                    break;
                }
            }
        }
/// <summary>
/// Reads the values from an <see cref="IDataReader"/> and assigns the read values to this
/// object's properties. Unlike ReadValues(), this method not only doesn't require
/// all values to be in the <see cref="IDataReader"/>, but also does not require the values in
/// the <see cref="IDataReader"/> to be a defined field for the table this class represents.
/// Because of this, you need to be careful when using this method because values
/// can easily be skipped without any indication.
/// </summary>
/// <param name="source">The object to add the extension method to.</param>
/// <param name="dataRecord">The <see cref="IDataReader"/> to read the values from. Must already be ready to be read from.</param>
        public static void TryReadValues(this AllianceHostileTable source, System.Data.IDataRecord dataRecord)
        {
            for (int i = 0; i < dataRecord.FieldCount; i++)
            {
                switch (dataRecord.GetName(i))
                {
                case "alliance_id":
                    source.AllianceID = (DemoGame.AllianceID)(DemoGame.AllianceID) dataRecord.GetByte(i);
                    break;


                case "hostile_id":
                    source.HostileID = (DemoGame.AllianceID)(DemoGame.AllianceID) dataRecord.GetByte(i);
                    break;
                }
            }
        }
Beispiel #20
0
/// <summary>
/// Reads the values from an <see cref="IDataReader"/> and assigns the read values to this
/// object's properties. Unlike ReadValues(), this method not only doesn't require
/// all values to be in the <see cref="IDataReader"/>, but also does not require the values in
/// the <see cref="IDataReader"/> to be a defined field for the table this class represents.
/// Because of this, you need to be careful when using this method because values
/// can easily be skipped without any indication.
/// </summary>
/// <param name="source">The object to add the extension method to.</param>
/// <param name="dataRecord">The <see cref="IDataReader"/> to read the values from. Must already be ready to be read from.</param>
        public static void TryReadValues(this AppliedPatchesTable source, System.Data.IDataRecord dataRecord)
        {
            for (int i = 0; i < dataRecord.FieldCount; i++)
            {
                switch (dataRecord.GetName(i))
                {
                case "date_applied":
                    source.DateApplied = (System.DateTime)(System.DateTime) dataRecord.GetDateTime(i);
                    break;


                case "file_name":
                    source.FileName = (System.String)(System.String) dataRecord.GetString(i);
                    break;
                }
            }
        }
Beispiel #21
0
/// <summary>
/// Reads the values from an <see cref="IDataReader"/> and assigns the read values to this
/// object's properties. Unlike ReadValues(), this method not only doesn't require
/// all values to be in the <see cref="IDataReader"/>, but also does not require the values in
/// the <see cref="IDataReader"/> to be a defined field for the table this class represents.
/// Because of this, you need to be careful when using this method because values
/// can easily be skipped without any indication.
/// </summary>
/// <param name="source">The object to add the extension method to.</param>
/// <param name="dataRecord">The <see cref="IDataReader"/> to read the values from. Must already be ready to be read from.</param>
        public static void TryReadValues(this CharacterTemplateSkillTable source, System.Data.IDataRecord dataRecord)
        {
            for (int i = 0; i < dataRecord.FieldCount; i++)
            {
                switch (dataRecord.GetName(i))
                {
                case "character_template_id":
                    source.CharacterTemplateID = (DemoGame.CharacterTemplateID)(DemoGame.CharacterTemplateID) dataRecord.GetUInt16(i);
                    break;


                case "skill_id":
                    source.SkillID = (DemoGame.SkillType)(DemoGame.SkillType) dataRecord.GetByte(i);
                    break;
                }
            }
        }
/// <summary>
/// Reads the values from an <see cref="IDataReader"/> and assigns the read values to this
/// object's properties. Unlike ReadValues(), this method not only doesn't require
/// all values to be in the <see cref="IDataReader"/>, but also does not require the values in
/// the <see cref="IDataReader"/> to be a defined field for the table this class represents.
/// Because of this, you need to be careful when using this method because values
/// can easily be skipped without any indication.
/// </summary>
/// <param name="source">The object to add the extension method to.</param>
/// <param name="dataRecord">The <see cref="IDataReader"/> to read the values from. Must already be ready to be read from.</param>
        public static void TryReadValues(this AllianceTable source, System.Data.IDataRecord dataRecord)
        {
            for (int i = 0; i < dataRecord.FieldCount; i++)
            {
                switch (dataRecord.GetName(i))
                {
                case "id":
                    source.ID = (DemoGame.AllianceID)(DemoGame.AllianceID) dataRecord.GetByte(i);
                    break;


                case "name":
                    source.Name = (System.String)(System.String) dataRecord.GetString(i);
                    break;
                }
            }
        }
Beispiel #23
0
/// <summary>
/// Reads the values from an <see cref="IDataReader"/> and assigns the read values to this
/// object's properties. Unlike ReadValues(), this method not only doesn't require
/// all values to be in the <see cref="IDataReader"/>, but also does not require the values in
/// the <see cref="IDataReader"/> to be a defined field for the table this class represents.
/// Because of this, you need to be careful when using this method because values
/// can easily be skipped without any indication.
/// </summary>
/// <param name="source">The object to add the extension method to.</param>
/// <param name="dataRecord">The <see cref="IDataReader"/> to read the values from. Must already be ready to be read from.</param>
        public static void TryReadValues(this MapTable source, System.Data.IDataRecord dataRecord)
        {
            for (int i = 0; i < dataRecord.FieldCount; i++)
            {
                switch (dataRecord.GetName(i))
                {
                case "id":
                    source.ID = (NetGore.World.MapID)(NetGore.World.MapID) dataRecord.GetUInt16(i);
                    break;


                case "name":
                    source.Name = (System.String)(System.String) dataRecord.GetString(i);
                    break;
                }
            }
        }
/// <summary>
/// Reads the values from an <see cref="IDataReader"/> and assigns the read values to this
/// object's properties. Unlike ReadValues(), this method not only doesn't require
/// all values to be in the <see cref="IDataReader"/>, but also does not require the values in
/// the <see cref="IDataReader"/> to be a defined field for the table this class represents.
/// Because of this, you need to be careful when using this method because values
/// can easily be skipped without any indication.
/// </summary>
/// <param name="source">The object to add the extension method to.</param>
/// <param name="dataRecord">The <see cref="IDataReader"/> to read the values from. Must already be ready to be read from.</param>
        public static void TryReadValues(this ShopItemTable source, System.Data.IDataRecord dataRecord)
        {
            for (int i = 0; i < dataRecord.FieldCount; i++)
            {
                switch (dataRecord.GetName(i))
                {
                case "item_template_id":
                    source.ItemTemplateID = (DemoGame.ItemTemplateID)(DemoGame.ItemTemplateID) dataRecord.GetUInt16(i);
                    break;


                case "shop_id":
                    source.ShopID = (NetGore.Features.Shops.ShopID)(NetGore.Features.Shops.ShopID) dataRecord.GetUInt16(i);
                    break;
                }
            }
        }
/// <summary>
/// Reads the values from an <see cref="IDataReader"/> and assigns the read values to this
/// object's properties. Unlike ReadValues(), this method not only doesn't require
/// all values to be in the <see cref="IDataReader"/>, but also does not require the values in
/// the <see cref="IDataReader"/> to be a defined field for the table this class represents.
/// Because of this, you need to be careful when using this method because values
/// can easily be skipped without any indication.
/// </summary>
/// <param name="source">The object to add the extension method to.</param>
/// <param name="dataRecord">The <see cref="IDataReader"/> to read the values from. Must already be ready to be read from.</param>
        public static void TryReadValues(this QuestRequireFinishQuestTable source, System.Data.IDataRecord dataRecord)
        {
            for (int i = 0; i < dataRecord.FieldCount; i++)
            {
                switch (dataRecord.GetName(i))
                {
                case "quest_id":
                    source.QuestID = (NetGore.Features.Quests.QuestID)(NetGore.Features.Quests.QuestID) dataRecord.GetUInt16(i);
                    break;


                case "req_quest_id":
                    source.ReqQuestID = (NetGore.Features.Quests.QuestID)(NetGore.Features.Quests.QuestID) dataRecord.GetUInt16(i);
                    break;
                }
            }
        }
/// <summary>
/// Reads the values from an <see cref="IDataReader"/> and assigns the read values to this
/// object's properties. Unlike ReadValues(), this method not only doesn't require
/// all values to be in the <see cref="IDataReader"/>, but also does not require the values in
/// the <see cref="IDataReader"/> to be a defined field for the table this class represents.
/// Because of this, you need to be careful when using this method because values
/// can easily be skipped without any indication.
/// </summary>
/// <param name="source">The object to add the extension method to.</param>
/// <param name="dataRecord">The <see cref="IDataReader"/> to read the values from. Must already be ready to be read from.</param>
        public static void TryReadValues(this ActiveTradeItemTable source, System.Data.IDataRecord dataRecord)
        {
            for (int i = 0; i < dataRecord.FieldCount; i++)
            {
                switch (dataRecord.GetName(i))
                {
                case "character_id":
                    source.CharacterID = (DemoGame.CharacterID)(DemoGame.CharacterID) dataRecord.GetInt32(i);
                    break;


                case "item_id":
                    source.ItemID = (DemoGame.ItemID)(DemoGame.ItemID) dataRecord.GetInt32(i);
                    break;
                }
            }
        }
Beispiel #27
0
/// <summary>
/// Reads the values from an <see cref="IDataReader"/> and assigns the read values to this
/// object's properties. Unlike ReadValues(), this method not only doesn't require
/// all values to be in the <see cref="IDataReader"/>, but also does not require the values in
/// the <see cref="IDataReader"/> to be a defined field for the table this class represents.
/// Because of this, you need to be careful when using this method because values
/// can easily be skipped without any indication.
/// </summary>
/// <param name="source">The object to add the extension method to.</param>
/// <param name="dataRecord">The <see cref="IDataReader"/> to read the values from. Must already be ready to be read from.</param>
        public static void TryReadValues(this WorldStatsQuestCompleteTable source, System.Data.IDataRecord dataRecord)
        {
            for (int i = 0; i < dataRecord.FieldCount; i++)
            {
                switch (dataRecord.GetName(i))
                {
                case "id":
                    source.ID = (System.UInt32)(System.UInt32) dataRecord.GetUInt32(i);
                    break;


                case "map_id":
                    source.MapID = (System.Nullable <NetGore.World.MapID>)(System.Nullable <NetGore.World.MapID>)(dataRecord.IsDBNull(i) ? (System.Nullable <System.UInt16>)null : dataRecord.GetUInt16(i));
                    break;


                case "quest_id":
                    source.QuestID = (NetGore.Features.Quests.QuestID)(NetGore.Features.Quests.QuestID) dataRecord.GetUInt16(i);
                    break;


                case "user_id":
                    source.UserID = (DemoGame.CharacterID)(DemoGame.CharacterID) dataRecord.GetInt32(i);
                    break;


                case "when":
                    source.When = (System.DateTime)(System.DateTime) dataRecord.GetDateTime(i);
                    break;


                case "x":
                    source.X = (System.UInt16)(System.UInt16) dataRecord.GetUInt16(i);
                    break;


                case "y":
                    source.Y = (System.UInt16)(System.UInt16) dataRecord.GetUInt16(i);
                    break;
                }
            }
        }
/// <summary>
/// Reads the values from an <see cref="IDataReader"/> and assigns the read values to this
/// object's properties. Unlike ReadValues(), this method not only doesn't require
/// all values to be in the <see cref="IDataReader"/>, but also does not require the values in
/// the <see cref="IDataReader"/> to be a defined field for the table this class represents.
/// Because of this, you need to be careful when using this method because values
/// can easily be skipped without any indication.
/// </summary>
/// <param name="source">The object to add the extension method to.</param>
/// <param name="dataRecord">The <see cref="IDataReader"/> to read the values from. Must already be ready to be read from.</param>
        public static void TryReadValues(this AccountBanTable source, System.Data.IDataRecord dataRecord)
        {
            for (int i = 0; i < dataRecord.FieldCount; i++)
            {
                switch (dataRecord.GetName(i))
                {
                case "account_id":
                    source.AccountID = (DemoGame.AccountID)(DemoGame.AccountID) dataRecord.GetInt32(i);
                    break;


                case "end_time":
                    source.EndTime = (System.DateTime)(System.DateTime) dataRecord.GetDateTime(i);
                    break;


                case "expired":
                    source.Expired = (System.Boolean)(System.Boolean) dataRecord.GetBoolean(i);
                    break;


                case "id":
                    source.ID = (System.Int32)(System.Int32) dataRecord.GetInt32(i);
                    break;


                case "issued_by":
                    source.IssuedBy = (System.String)(System.String)(dataRecord.IsDBNull(i) ? (System.String)null : dataRecord.GetString(i));
                    break;


                case "reason":
                    source.Reason = (System.String)(System.String) dataRecord.GetString(i);
                    break;


                case "start_time":
                    source.StartTime = (System.DateTime)(System.DateTime) dataRecord.GetDateTime(i);
                    break;
                }
            }
        }
/// <summary>
/// Reads the values from an <see cref="IDataReader"/> and assigns the read values to this
/// object's properties. Unlike ReadValues(), this method not only doesn't require
/// all values to be in the <see cref="IDataReader"/>, but also does not require the values in
/// the <see cref="IDataReader"/> to be a defined field for the table this class represents.
/// Because of this, you need to be careful when using this method because values
/// can easily be skipped without any indication.
/// </summary>
/// <param name="source">The object to add the extension method to.</param>
/// <param name="dataRecord">The <see cref="IDataReader"/> to read the values from. Must already be ready to be read from.</param>
        public static void TryReadValues(this WorldStatsCountShopBuyTable source, System.Data.IDataRecord dataRecord)
        {
            for (int i = 0; i < dataRecord.FieldCount; i++)
            {
                switch (dataRecord.GetName(i))
                {
                case "count":
                    source.Count = (System.Int32)(System.Int32) dataRecord.GetInt32(i);
                    break;


                case "last_update":
                    source.LastUpdate = (System.DateTime)(System.DateTime) dataRecord.GetDateTime(i);
                    break;


                case "shop_id":
                    source.ShopID = (NetGore.Features.Shops.ShopID)(NetGore.Features.Shops.ShopID) dataRecord.GetUInt16(i);
                    break;
                }
            }
        }
/// <summary>
/// Reads the values from an <see cref="IDataReader"/> and assigns the read values to this
/// object's properties. Unlike ReadValues(), this method not only doesn't require
/// all values to be in the <see cref="IDataReader"/>, but also does not require the values in
/// the <see cref="IDataReader"/> to be a defined field for the table this class represents.
/// Because of this, you need to be careful when using this method because values
/// can easily be skipped without any indication.
/// </summary>
/// <param name="source">The object to add the extension method to.</param>
/// <param name="dataRecord">The <see cref="IDataReader"/> to read the values from. Must already be ready to be read from.</param>
        public static void TryReadValues(this ShopTable source, System.Data.IDataRecord dataRecord)
        {
            for (int i = 0; i < dataRecord.FieldCount; i++)
            {
                switch (dataRecord.GetName(i))
                {
                case "can_buy":
                    source.CanBuy = (System.Boolean)(System.Boolean) dataRecord.GetBoolean(i);
                    break;


                case "id":
                    source.ID = (NetGore.Features.Shops.ShopID)(NetGore.Features.Shops.ShopID) dataRecord.GetUInt16(i);
                    break;


                case "name":
                    source.Name = (System.String)(System.String) dataRecord.GetString(i);
                    break;
                }
            }
        }