Exemplo n.º 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 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 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;
                }
            }
        }
Exemplo n.º 3
0
 public override void Load(System.Data.IDataRecord record)
 {
     Id    = record.GetInt32(0);
     OKPO  = record.GetString(1);
     SOATO = record.GetString(2);
     INN   = record.GetString(3);
     Name  = record.GetString(4);
     Type  = (OrgType)record.GetByte(5);
 }
/// <summary>
/// Reads the values from an <see cref="IDataRecord"/> and assigns the read values to this
/// object's properties. The database column's name is used to as the key, so the value
/// will not be found if any aliases are used or not all columns were selected.
/// </summary>
/// <param name="source">The object to add the extension method to.</param>
/// <param name="dataRecord">The <see cref="IDataRecord"/> to read the values from. Must already be ready to be read from.</param>
        public static void ReadValues(this AccountBanTable source, System.Data.IDataRecord dataRecord)
        {
            System.Int32 i;

            i = dataRecord.GetOrdinal("account_id");

            source.AccountID = (DemoGame.AccountID)(DemoGame.AccountID) dataRecord.GetInt32(i);

            i = dataRecord.GetOrdinal("end_time");

            source.EndTime = (System.DateTime)(System.DateTime) dataRecord.GetDateTime(i);

            i = dataRecord.GetOrdinal("expired");

            source.Expired = (System.Boolean)(System.Boolean) dataRecord.GetBoolean(i);

            i = dataRecord.GetOrdinal("id");

            source.ID = (System.Int32)(System.Int32) dataRecord.GetInt32(i);

            i = dataRecord.GetOrdinal("issued_by");

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

            i = dataRecord.GetOrdinal("reason");

            source.Reason = (System.String)(System.String) dataRecord.GetString(i);

            i = dataRecord.GetOrdinal("start_time");

            source.StartTime = (System.DateTime)(System.DateTime) dataRecord.GetDateTime(i);
        }
Exemplo n.º 5
0
        internal static Text Create(Pointer pointer, System.Data.IDataRecord reader, int fieldIndex)
        {
            // TODO: replace with GetChars work

            return(Text.Create(pointer, reader.GetString(fieldIndex)));
            //using(var text = Create())
            //{
            //    var bytes = text.bytes;
            //    var chars = text.chars;
            //    var encoder = text.Encoder;

            //    int fieldOffset = 0, charsRead, byteOffset = 0;
            //    do
            //    {
            //        charsRead = (int)reader.GetChars(fieldIndex, fieldOffset, chars, 0, MAX_CHARS_TO_ENCODE);
            //        int newBytes = encoder.GetBytes(chars, 0, charsRead, bytes, byteOffset, false);

            //        int availableBytes = newBytes + byteOffset;
            //        int fullWords = availableBytes >> 3;


            //    } while (charsRead != 0);

            //    throw new NotImplementedException();
            //}
        }
/// <summary>
/// Reads the values from an <see cref="IDataRecord"/> and assigns the read values to this
/// object's properties. The database column's name is used to as the key, so the value
/// will not be found if any aliases are used or not all columns were selected.
/// </summary>
/// <param name="source">The object to add the extension method to.</param>
/// <param name="dataRecord">The <see cref="IDataRecord"/> to read the values from. Must already be ready to be read from.</param>
        public static void ReadValues(this AccountTable source, System.Data.IDataRecord dataRecord)
        {
            System.Int32 i;

            i = dataRecord.GetOrdinal("creator_ip");

            source.CreatorIp = (System.UInt32)(System.UInt32) dataRecord.GetUInt32(i);

            i = dataRecord.GetOrdinal("current_ip");

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

            i = dataRecord.GetOrdinal("email");

            source.Email = (System.String)(System.String) dataRecord.GetString(i);

            i = dataRecord.GetOrdinal("friends");

            source.Friends = (System.String)(System.String) dataRecord.GetString(i);

            i = dataRecord.GetOrdinal("id");

            source.ID = (DemoGame.AccountID)(DemoGame.AccountID) dataRecord.GetInt32(i);

            i = dataRecord.GetOrdinal("name");

            source.Name = (System.String)(System.String) dataRecord.GetString(i);

            i = dataRecord.GetOrdinal("password");

            source.Password = (System.String)(System.String) dataRecord.GetString(i);

            i = dataRecord.GetOrdinal("permissions");

            source.Permissions = (DemoGame.UserPermissions)(DemoGame.UserPermissions) dataRecord.GetByte(i);

            i = dataRecord.GetOrdinal("time_created");

            source.TimeCreated = (System.DateTime)(System.DateTime) dataRecord.GetDateTime(i);

            i = dataRecord.GetOrdinal("time_last_login");

            source.TimeLastLogin = (System.DateTime)(System.DateTime) dataRecord.GetDateTime(i);
        }
Exemplo n.º 7
0
/// <summary>
/// Reads the values from an <see cref="IDataRecord"/> and assigns the read values to this
/// object's properties. The database column's name is used to as the key, so the value
/// will not be found if any aliases are used or not all columns were selected.
/// </summary>
/// <param name="source">The object to add the extension method to.</param>
/// <param name="dataRecord">The <see cref="IDataRecord"/> to read the values from. Must already be ready to be read from.</param>
        public static void ReadValues(this GuildTable source, System.Data.IDataRecord dataRecord)
        {
            System.Int32 i;

            i = dataRecord.GetOrdinal("created");

            source.Created = (System.DateTime)(System.DateTime) dataRecord.GetDateTime(i);

            i = dataRecord.GetOrdinal("id");

            source.ID = (NetGore.Features.Guilds.GuildID)(NetGore.Features.Guilds.GuildID) dataRecord.GetUInt16(i);

            i = dataRecord.GetOrdinal("name");

            source.Name = (System.String)(System.String) dataRecord.GetString(i);

            i = dataRecord.GetOrdinal("tag");

            source.Tag = (System.String)(System.String) dataRecord.GetString(i);
        }
Exemplo n.º 8
0
/// <summary>
/// Reads the values from an <see cref="IDataRecord"/> and assigns the read values to this
/// object's properties. The database column's name is used to as the key, so the value
/// will not be found if any aliases are used or not all columns were selected.
/// </summary>
/// <param name="source">The object to add the extension method to.</param>
/// <param name="dataRecord">The <see cref="IDataRecord"/> to read the values from. Must already be ready to be read from.</param>
        public static void ReadValues(this MapTable source, System.Data.IDataRecord dataRecord)
        {
            System.Int32 i;

            i = dataRecord.GetOrdinal("id");

            source.ID = (NetGore.World.MapID)(NetGore.World.MapID) dataRecord.GetUInt16(i);

            i = dataRecord.GetOrdinal("name");

            source.Name = (System.String)(System.String) dataRecord.GetString(i);
        }
Exemplo n.º 9
0
/// <summary>
/// Reads the values from an <see cref="IDataRecord"/> and assigns the read values to this
/// object's properties. The database column's name is used to as the key, so the value
/// will not be found if any aliases are used or not all columns were selected.
/// </summary>
/// <param name="source">The object to add the extension method to.</param>
/// <param name="dataRecord">The <see cref="IDataRecord"/> to read the values from. Must already be ready to be read from.</param>
        public static void ReadValues(this AllianceTable source, System.Data.IDataRecord dataRecord)
        {
            System.Int32 i;

            i = dataRecord.GetOrdinal("id");

            source.ID = (DemoGame.AllianceID)(DemoGame.AllianceID) dataRecord.GetByte(i);

            i = dataRecord.GetOrdinal("name");

            source.Name = (System.String)(System.String) dataRecord.GetString(i);
        }
Exemplo n.º 10
0
/// <summary>
/// Reads the values from an <see cref="IDataRecord"/> and assigns the read values to this
/// object's properties. The database column's name is used to as the key, so the value
/// will not be found if any aliases are used or not all columns were selected.
/// </summary>
/// <param name="source">The object to add the extension method to.</param>
/// <param name="dataRecord">The <see cref="IDataRecord"/> to read the values from. Must already be ready to be read from.</param>
        public static void ReadValues(this AppliedPatchesTable source, System.Data.IDataRecord dataRecord)
        {
            System.Int32 i;

            i = dataRecord.GetOrdinal("date_applied");

            source.DateApplied = (System.DateTime)(System.DateTime) dataRecord.GetDateTime(i);

            i = dataRecord.GetOrdinal("file_name");

            source.FileName = (System.String)(System.String) dataRecord.GetString(i);
        }
Exemplo n.º 11
0
/// <summary>
/// Reads the values from an <see cref="IDataRecord"/> and assigns the read values to this
/// object's properties. The database column's name is used to as the key, so the value
/// will not be found if any aliases are used or not all columns were selected.
/// </summary>
/// <param name="source">The object to add the extension method to.</param>
/// <param name="dataRecord">The <see cref="IDataRecord"/> to read the values from. Must already be ready to be read from.</param>
        public static void ReadValues(this ShopTable source, System.Data.IDataRecord dataRecord)
        {
            System.Int32 i;

            i = dataRecord.GetOrdinal("can_buy");

            source.CanBuy = (System.Boolean)(System.Boolean) dataRecord.GetBoolean(i);

            i = dataRecord.GetOrdinal("id");

            source.ID = (NetGore.Features.Shops.ShopID)(NetGore.Features.Shops.ShopID) dataRecord.GetUInt16(i);

            i = dataRecord.GetOrdinal("name");

            source.Name = (System.String)(System.String) dataRecord.GetString(i);
        }
Exemplo n.º 12
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;
                }
            }
        }
Exemplo n.º 13
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;
                }
            }
        }
Exemplo n.º 14
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 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;
                }
            }
        }
/// <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;
                }
            }
        }
Exemplo n.º 16
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 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;
                }
            }
        }
Exemplo n.º 17
0
/// <summary>
/// Reads the values from an <see cref="IDataRecord"/> and assigns the read values to this
/// object's properties. The database column's name is used to as the key, so the value
/// will not be found if any aliases are used or not all columns were selected.
/// </summary>
/// <param name="source">The object to add the extension method to.</param>
/// <param name="dataRecord">The <see cref="IDataRecord"/> to read the values from. Must already be ready to be read from.</param>
        public static void ReadValues(this GuildEventTable source, System.Data.IDataRecord dataRecord)
        {
            System.Int32 i;

            i = dataRecord.GetOrdinal("arg0");

            source.Arg0 = (System.String)(System.String)(dataRecord.IsDBNull(i) ? (System.String)null : dataRecord.GetString(i));

            i = dataRecord.GetOrdinal("arg1");

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

            i = dataRecord.GetOrdinal("arg2");

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

            i = dataRecord.GetOrdinal("character_id");

            source.CharacterID = (DemoGame.CharacterID)(DemoGame.CharacterID) dataRecord.GetInt32(i);

            i = dataRecord.GetOrdinal("created");

            source.Created = (System.DateTime)(System.DateTime) dataRecord.GetDateTime(i);

            i = dataRecord.GetOrdinal("event_id");

            source.EventID = (System.Byte)(System.Byte) dataRecord.GetByte(i);

            i = dataRecord.GetOrdinal("guild_id");

            source.GuildID = (NetGore.Features.Guilds.GuildID)(NetGore.Features.Guilds.GuildID) dataRecord.GetUInt16(i);

            i = dataRecord.GetOrdinal("id");

            source.ID = (System.Int32)(System.Int32) dataRecord.GetInt32(i);

            i = dataRecord.GetOrdinal("target_character_id");

            source.TargetCharacterID = (System.Nullable <DemoGame.CharacterID>)(System.Nullable <DemoGame.CharacterID>)(dataRecord.IsDBNull(i) ? (System.Nullable <System.Int32>)null : dataRecord.GetInt32(i));
        }
Exemplo n.º 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;
                }
            }
        }
Exemplo n.º 19
0
/// <summary>
/// Reads the values from an <see cref="IDataRecord"/> and assigns the read values to this
/// object's properties. The database column's name is used to as the key, so the value
/// will not be found if any aliases are used or not all columns were selected.
/// </summary>
/// <param name="source">The object to add the extension method to.</param>
/// <param name="dataRecord">The <see cref="IDataRecord"/> to read the values from. Must already be ready to be read from.</param>
        public static void ReadValues(this ItemTable source, System.Data.IDataRecord dataRecord)
        {
            System.Int32 i;

            i = dataRecord.GetOrdinal("action_display_id");

            source.ActionDisplayID = (System.Nullable <NetGore.Features.ActionDisplays.ActionDisplayID>)(System.Nullable <NetGore.Features.ActionDisplays.ActionDisplayID>)(dataRecord.IsDBNull(i) ? (System.Nullable <System.UInt16>)null : dataRecord.GetUInt16(i));

            i = dataRecord.GetOrdinal("amount");

            source.Amount = (System.Byte)(System.Byte) dataRecord.GetByte(i);

            i = dataRecord.GetOrdinal("description");

            source.Description = (System.String)(System.String) dataRecord.GetString(i);

            i = dataRecord.GetOrdinal("equipped_body");

            source.EquippedBody = (System.String)(System.String)(dataRecord.IsDBNull(i) ? (System.String)null : dataRecord.GetString(i));

            i = dataRecord.GetOrdinal("graphic");

            source.Graphic = (NetGore.GrhIndex)(NetGore.GrhIndex) dataRecord.GetUInt16(i);

            i = dataRecord.GetOrdinal("height");

            source.Height = (System.Byte)(System.Byte) dataRecord.GetByte(i);

            i = dataRecord.GetOrdinal("hp");

            source.HP = (DemoGame.SPValueType)(DemoGame.SPValueType) dataRecord.GetInt16(i);

            i = dataRecord.GetOrdinal("id");

            source.ID = (DemoGame.ItemID)(DemoGame.ItemID) dataRecord.GetInt32(i);

            i = dataRecord.GetOrdinal("item_template_id");

            source.ItemTemplateID = (System.Nullable <DemoGame.ItemTemplateID>)(System.Nullable <DemoGame.ItemTemplateID>)(dataRecord.IsDBNull(i) ? (System.Nullable <System.UInt16>)null : dataRecord.GetUInt16(i));

            i = dataRecord.GetOrdinal("mp");

            source.MP = (DemoGame.SPValueType)(DemoGame.SPValueType) dataRecord.GetInt16(i);

            i = dataRecord.GetOrdinal("name");

            source.Name = (System.String)(System.String) dataRecord.GetString(i);

            i = dataRecord.GetOrdinal("range");

            source.Range = (System.UInt16)(System.UInt16) dataRecord.GetUInt16(i);

            i = dataRecord.GetOrdinal("skill_id");

            source.SkillID = (System.Nullable <DemoGame.SkillType>)(System.Nullable <DemoGame.SkillType>)(dataRecord.IsDBNull(i) ? (System.Nullable <System.Byte>)null : dataRecord.GetByte(i));

            i = dataRecord.GetOrdinal("stat_agi");

            source.SetStat((DemoGame.StatType)DemoGame.StatType.Agi, (System.Int32)(System.Int16) dataRecord.GetInt16(i));

            i = dataRecord.GetOrdinal("stat_defence");

            source.SetStat((DemoGame.StatType)DemoGame.StatType.Defence, (System.Int32)(System.Int16) dataRecord.GetInt16(i));

            i = dataRecord.GetOrdinal("stat_int");

            source.SetStat((DemoGame.StatType)DemoGame.StatType.Int, (System.Int32)(System.Int16) dataRecord.GetInt16(i));

            i = dataRecord.GetOrdinal("stat_maxhit");

            source.SetStat((DemoGame.StatType)DemoGame.StatType.MaxHit, (System.Int32)(System.Int16) dataRecord.GetInt16(i));

            i = dataRecord.GetOrdinal("stat_maxhp");

            source.SetStat((DemoGame.StatType)DemoGame.StatType.MaxHP, (System.Int32)(System.Int16) dataRecord.GetInt16(i));

            i = dataRecord.GetOrdinal("stat_maxmp");

            source.SetStat((DemoGame.StatType)DemoGame.StatType.MaxMP, (System.Int32)(System.Int16) dataRecord.GetInt16(i));

            i = dataRecord.GetOrdinal("stat_minhit");

            source.SetStat((DemoGame.StatType)DemoGame.StatType.MinHit, (System.Int32)(System.Int16) dataRecord.GetInt16(i));

            i = dataRecord.GetOrdinal("stat_req_agi");

            source.SetReqStat((DemoGame.StatType)DemoGame.StatType.Agi, (System.Int32)(System.Int16) dataRecord.GetInt16(i));

            i = dataRecord.GetOrdinal("stat_req_int");

            source.SetReqStat((DemoGame.StatType)DemoGame.StatType.Int, (System.Int32)(System.Int16) dataRecord.GetInt16(i));

            i = dataRecord.GetOrdinal("stat_req_str");

            source.SetReqStat((DemoGame.StatType)DemoGame.StatType.Str, (System.Int32)(System.Int16) dataRecord.GetInt16(i));

            i = dataRecord.GetOrdinal("stat_str");

            source.SetStat((DemoGame.StatType)DemoGame.StatType.Str, (System.Int32)(System.Int16) dataRecord.GetInt16(i));

            i = dataRecord.GetOrdinal("type");

            source.Type = (DemoGame.ItemType)(DemoGame.ItemType) dataRecord.GetByte(i);

            i = dataRecord.GetOrdinal("value");

            source.Value = (System.Int32)(System.Int32) dataRecord.GetInt32(i);

            i = dataRecord.GetOrdinal("weapon_type");

            source.WeaponType = (DemoGame.WeaponType)(DemoGame.WeaponType) dataRecord.GetByte(i);

            i = dataRecord.GetOrdinal("width");

            source.Width = (System.Byte)(System.Byte) dataRecord.GetByte(i);
        }
Exemplo n.º 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 ItemTable source, System.Data.IDataRecord dataRecord)
        {
            for (int i = 0; i < dataRecord.FieldCount; i++)
            {
                switch (dataRecord.GetName(i))
                {
                case "action_display_id":
                    source.ActionDisplayID = (System.Nullable <NetGore.Features.ActionDisplays.ActionDisplayID>)(System.Nullable <NetGore.Features.ActionDisplays.ActionDisplayID>)(dataRecord.IsDBNull(i) ? (System.Nullable <System.UInt16>)null : dataRecord.GetUInt16(i));
                    break;


                case "amount":
                    source.Amount = (System.Byte)(System.Byte) dataRecord.GetByte(i);
                    break;


                case "description":
                    source.Description = (System.String)(System.String) dataRecord.GetString(i);
                    break;


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


                case "graphic":
                    source.Graphic = (NetGore.GrhIndex)(NetGore.GrhIndex) dataRecord.GetUInt16(i);
                    break;


                case "height":
                    source.Height = (System.Byte)(System.Byte) dataRecord.GetByte(i);
                    break;


                case "hp":
                    source.HP = (DemoGame.SPValueType)(DemoGame.SPValueType) dataRecord.GetInt16(i);
                    break;


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


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


                case "mp":
                    source.MP = (DemoGame.SPValueType)(DemoGame.SPValueType) dataRecord.GetInt16(i);
                    break;


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


                case "range":
                    source.Range = (System.UInt16)(System.UInt16) dataRecord.GetUInt16(i);
                    break;


                case "skill_id":
                    source.SkillID = (System.Nullable <DemoGame.SkillType>)(System.Nullable <DemoGame.SkillType>)(dataRecord.IsDBNull(i) ? (System.Nullable <System.Byte>)null : dataRecord.GetByte(i));
                    break;


                case "stat_agi":
                    source.SetStat((DemoGame.StatType)DemoGame.StatType.Agi, (System.Int32)(System.Int16) dataRecord.GetInt16(i));
                    break;


                case "stat_defence":
                    source.SetStat((DemoGame.StatType)DemoGame.StatType.Defence, (System.Int32)(System.Int16) dataRecord.GetInt16(i));
                    break;


                case "stat_int":
                    source.SetStat((DemoGame.StatType)DemoGame.StatType.Int, (System.Int32)(System.Int16) dataRecord.GetInt16(i));
                    break;


                case "stat_maxhit":
                    source.SetStat((DemoGame.StatType)DemoGame.StatType.MaxHit, (System.Int32)(System.Int16) dataRecord.GetInt16(i));
                    break;


                case "stat_maxhp":
                    source.SetStat((DemoGame.StatType)DemoGame.StatType.MaxHP, (System.Int32)(System.Int16) dataRecord.GetInt16(i));
                    break;


                case "stat_maxmp":
                    source.SetStat((DemoGame.StatType)DemoGame.StatType.MaxMP, (System.Int32)(System.Int16) dataRecord.GetInt16(i));
                    break;


                case "stat_minhit":
                    source.SetStat((DemoGame.StatType)DemoGame.StatType.MinHit, (System.Int32)(System.Int16) dataRecord.GetInt16(i));
                    break;


                case "stat_req_agi":
                    source.SetReqStat((DemoGame.StatType)DemoGame.StatType.Agi, (System.Int32)(System.Int16) dataRecord.GetInt16(i));
                    break;


                case "stat_req_int":
                    source.SetReqStat((DemoGame.StatType)DemoGame.StatType.Int, (System.Int32)(System.Int16) dataRecord.GetInt16(i));
                    break;


                case "stat_req_str":
                    source.SetReqStat((DemoGame.StatType)DemoGame.StatType.Str, (System.Int32)(System.Int16) dataRecord.GetInt16(i));
                    break;


                case "stat_str":
                    source.SetStat((DemoGame.StatType)DemoGame.StatType.Str, (System.Int32)(System.Int16) dataRecord.GetInt16(i));
                    break;


                case "type":
                    source.Type = (DemoGame.ItemType)(DemoGame.ItemType) dataRecord.GetByte(i);
                    break;


                case "value":
                    source.Value = (System.Int32)(System.Int32) dataRecord.GetInt32(i);
                    break;


                case "weapon_type":
                    source.WeaponType = (DemoGame.WeaponType)(DemoGame.WeaponType) dataRecord.GetByte(i);
                    break;


                case "width":
                    source.Width = (System.Byte)(System.Byte) 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 CharacterTemplateTable source, System.Data.IDataRecord dataRecord)
        {
            for (int i = 0; i < dataRecord.FieldCount; i++)
            {
                switch (dataRecord.GetName(i))
                {
                case "ai_id":
                    source.AIID = (System.Nullable <NetGore.AI.AIID>)(System.Nullable <NetGore.AI.AIID>)(dataRecord.IsDBNull(i) ? (System.Nullable <System.UInt16>)null : dataRecord.GetUInt16(i));
                    break;


                case "alliance_id":
                    source.AllianceID = (DemoGame.AllianceID)(DemoGame.AllianceID) dataRecord.GetByte(i);
                    break;


                case "body_id":
                    source.BodyID = (DemoGame.BodyID)(DemoGame.BodyID) dataRecord.GetUInt16(i);
                    break;


                case "chat_dialog":
                    source.ChatDialog = (System.Nullable <NetGore.Features.NPCChat.NPCChatDialogID>)(System.Nullable <NetGore.Features.NPCChat.NPCChatDialogID>)(dataRecord.IsDBNull(i) ? (System.Nullable <System.UInt16>)null : dataRecord.GetUInt16(i));
                    break;


                case "exp":
                    source.Exp = (System.Int32)(System.Int32) dataRecord.GetInt32(i);
                    break;


                case "give_cash":
                    source.GiveCash = (System.Int32)(System.Int32) dataRecord.GetInt32(i);
                    break;


                case "give_exp":
                    source.GiveExp = (System.Int32)(System.Int32) dataRecord.GetInt32(i);
                    break;


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


                case "level":
                    source.Level = (System.Int16)(System.Int16) dataRecord.GetInt16(i);
                    break;


                case "move_speed":
                    source.MoveSpeed = (System.UInt16)(System.UInt16) dataRecord.GetUInt16(i);
                    break;


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


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


                case "shop_id":
                    source.ShopID = (System.Nullable <NetGore.Features.Shops.ShopID>)(System.Nullable <NetGore.Features.Shops.ShopID>)(dataRecord.IsDBNull(i) ? (System.Nullable <System.UInt16>)null : dataRecord.GetUInt16(i));
                    break;


                case "statpoints":
                    source.StatPoints = (System.Int32)(System.Int32) dataRecord.GetInt32(i);
                    break;


                case "stat_agi":
                    source.SetStat((DemoGame.StatType)DemoGame.StatType.Agi, (System.Int32)(System.Int16) dataRecord.GetInt16(i));
                    break;


                case "stat_defence":
                    source.SetStat((DemoGame.StatType)DemoGame.StatType.Defence, (System.Int32)(System.Int16) dataRecord.GetInt16(i));
                    break;


                case "stat_int":
                    source.SetStat((DemoGame.StatType)DemoGame.StatType.Int, (System.Int32)(System.Int16) dataRecord.GetInt16(i));
                    break;


                case "stat_maxhit":
                    source.SetStat((DemoGame.StatType)DemoGame.StatType.MaxHit, (System.Int32)(System.Int16) dataRecord.GetInt16(i));
                    break;


                case "stat_maxhp":
                    source.SetStat((DemoGame.StatType)DemoGame.StatType.MaxHP, (System.Int32)(System.Int16) dataRecord.GetInt16(i));
                    break;


                case "stat_maxmp":
                    source.SetStat((DemoGame.StatType)DemoGame.StatType.MaxMP, (System.Int32)(System.Int16) dataRecord.GetInt16(i));
                    break;


                case "stat_minhit":
                    source.SetStat((DemoGame.StatType)DemoGame.StatType.MinHit, (System.Int32)(System.Int16) dataRecord.GetInt16(i));
                    break;


                case "stat_str":
                    source.SetStat((DemoGame.StatType)DemoGame.StatType.Str, (System.Int32)(System.Int16) dataRecord.GetInt16(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 ViewNpcCharacterTable source, System.Data.IDataRecord dataRecord)
        {
            for (int i = 0; i < dataRecord.FieldCount; i++)
            {
                switch (dataRecord.GetName(i))
                {
                case "ai_id":
                    source.AIID = (System.Nullable <NetGore.AI.AIID>)(System.Nullable <NetGore.AI.AIID>)(dataRecord.IsDBNull(i) ? (System.Nullable <System.UInt16>)null : dataRecord.GetUInt16(i));
                    break;


                case "body_id":
                    source.BodyID = (DemoGame.BodyID)(DemoGame.BodyID) dataRecord.GetUInt16(i);
                    break;


                case "cash":
                    source.Cash = (System.Int32)(System.Int32) dataRecord.GetInt32(i);
                    break;


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


                case "chat_dialog":
                    source.ChatDialog = (System.Nullable <NetGore.Features.NPCChat.NPCChatDialogID>)(System.Nullable <NetGore.Features.NPCChat.NPCChatDialogID>)(dataRecord.IsDBNull(i) ? (System.Nullable <System.UInt16>)null : dataRecord.GetUInt16(i));
                    break;


                case "exp":
                    source.Exp = (System.Int32)(System.Int32) dataRecord.GetInt32(i);
                    break;


                case "hp":
                    source.HP = (DemoGame.SPValueType)(DemoGame.SPValueType) dataRecord.GetInt16(i);
                    break;


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


                case "level":
                    source.Level = (System.Int16)(System.Int16) dataRecord.GetInt16(i);
                    break;


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


                case "load_x":
                    source.LoadX = (System.UInt16)(System.UInt16) dataRecord.GetUInt16(i);
                    break;


                case "load_y":
                    source.LoadY = (System.UInt16)(System.UInt16) dataRecord.GetUInt16(i);
                    break;


                case "move_speed":
                    source.MoveSpeed = (System.UInt16)(System.UInt16) dataRecord.GetUInt16(i);
                    break;


                case "mp":
                    source.MP = (DemoGame.SPValueType)(DemoGame.SPValueType) dataRecord.GetInt16(i);
                    break;


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


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


                case "respawn_x":
                    source.RespawnX = (System.Single)(System.Single) dataRecord.GetFloat(i);
                    break;


                case "respawn_y":
                    source.RespawnY = (System.Single)(System.Single) dataRecord.GetFloat(i);
                    break;


                case "shop_id":
                    source.ShopID = (System.Nullable <NetGore.Features.Shops.ShopID>)(System.Nullable <NetGore.Features.Shops.ShopID>)(dataRecord.IsDBNull(i) ? (System.Nullable <System.UInt16>)null : dataRecord.GetUInt16(i));
                    break;


                case "statpoints":
                    source.StatPoints = (System.Int32)(System.Int32) dataRecord.GetInt32(i);
                    break;


                case "stat_agi":
                    source.StatAgi = (System.Int16)(System.Int16) dataRecord.GetInt16(i);
                    break;


                case "stat_defence":
                    source.StatDefence = (System.Int16)(System.Int16) dataRecord.GetInt16(i);
                    break;


                case "stat_int":
                    source.StatInt = (System.Int16)(System.Int16) dataRecord.GetInt16(i);
                    break;


                case "stat_maxhit":
                    source.StatMaxhit = (System.Int16)(System.Int16) dataRecord.GetInt16(i);
                    break;


                case "stat_maxhp":
                    source.StatMaxhp = (System.Int16)(System.Int16) dataRecord.GetInt16(i);
                    break;


                case "stat_maxmp":
                    source.StatMaxmp = (System.Int16)(System.Int16) dataRecord.GetInt16(i);
                    break;


                case "stat_minhit":
                    source.StatMinhit = (System.Int16)(System.Int16) dataRecord.GetInt16(i);
                    break;


                case "stat_str":
                    source.StatStr = (System.Int16)(System.Int16) dataRecord.GetInt16(i);
                    break;
                }
            }
        }
/// <summary>
/// Reads the values from an <see cref="IDataRecord"/> and assigns the read values to this
/// object's properties. The database column's name is used to as the key, so the value
/// will not be found if any aliases are used or not all columns were selected.
/// </summary>
/// <param name="source">The object to add the extension method to.</param>
/// <param name="dataRecord">The <see cref="IDataRecord"/> to read the values from. Must already be ready to be read from.</param>
        public static void ReadValues(this ViewNpcCharacterTable source, System.Data.IDataRecord dataRecord)
        {
            System.Int32 i;

            i = dataRecord.GetOrdinal("ai_id");

            source.AIID = (System.Nullable <NetGore.AI.AIID>)(System.Nullable <NetGore.AI.AIID>)(dataRecord.IsDBNull(i) ? (System.Nullable <System.UInt16>)null : dataRecord.GetUInt16(i));

            i = dataRecord.GetOrdinal("body_id");

            source.BodyID = (DemoGame.BodyID)(DemoGame.BodyID) dataRecord.GetUInt16(i);

            i = dataRecord.GetOrdinal("cash");

            source.Cash = (System.Int32)(System.Int32) dataRecord.GetInt32(i);

            i = dataRecord.GetOrdinal("character_template_id");

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

            i = dataRecord.GetOrdinal("chat_dialog");

            source.ChatDialog = (System.Nullable <NetGore.Features.NPCChat.NPCChatDialogID>)(System.Nullable <NetGore.Features.NPCChat.NPCChatDialogID>)(dataRecord.IsDBNull(i) ? (System.Nullable <System.UInt16>)null : dataRecord.GetUInt16(i));

            i = dataRecord.GetOrdinal("exp");

            source.Exp = (System.Int32)(System.Int32) dataRecord.GetInt32(i);

            i = dataRecord.GetOrdinal("hp");

            source.HP = (DemoGame.SPValueType)(DemoGame.SPValueType) dataRecord.GetInt16(i);

            i = dataRecord.GetOrdinal("id");

            source.ID = (System.Int32)(System.Int32) dataRecord.GetInt32(i);

            i = dataRecord.GetOrdinal("level");

            source.Level = (System.Int16)(System.Int16) dataRecord.GetInt16(i);

            i = dataRecord.GetOrdinal("load_map_id");

            source.LoadMapID = (NetGore.World.MapID)(NetGore.World.MapID) dataRecord.GetUInt16(i);

            i = dataRecord.GetOrdinal("load_x");

            source.LoadX = (System.UInt16)(System.UInt16) dataRecord.GetUInt16(i);

            i = dataRecord.GetOrdinal("load_y");

            source.LoadY = (System.UInt16)(System.UInt16) dataRecord.GetUInt16(i);

            i = dataRecord.GetOrdinal("move_speed");

            source.MoveSpeed = (System.UInt16)(System.UInt16) dataRecord.GetUInt16(i);

            i = dataRecord.GetOrdinal("mp");

            source.MP = (DemoGame.SPValueType)(DemoGame.SPValueType) dataRecord.GetInt16(i);

            i = dataRecord.GetOrdinal("name");

            source.Name = (System.String)(System.String) dataRecord.GetString(i);

            i = dataRecord.GetOrdinal("respawn_map_id");

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

            i = dataRecord.GetOrdinal("respawn_x");

            source.RespawnX = (System.Single)(System.Single) dataRecord.GetFloat(i);

            i = dataRecord.GetOrdinal("respawn_y");

            source.RespawnY = (System.Single)(System.Single) dataRecord.GetFloat(i);

            i = dataRecord.GetOrdinal("shop_id");

            source.ShopID = (System.Nullable <NetGore.Features.Shops.ShopID>)(System.Nullable <NetGore.Features.Shops.ShopID>)(dataRecord.IsDBNull(i) ? (System.Nullable <System.UInt16>)null : dataRecord.GetUInt16(i));

            i = dataRecord.GetOrdinal("statpoints");

            source.StatPoints = (System.Int32)(System.Int32) dataRecord.GetInt32(i);

            i = dataRecord.GetOrdinal("stat_agi");

            source.StatAgi = (System.Int16)(System.Int16) dataRecord.GetInt16(i);

            i = dataRecord.GetOrdinal("stat_defence");

            source.StatDefence = (System.Int16)(System.Int16) dataRecord.GetInt16(i);

            i = dataRecord.GetOrdinal("stat_int");

            source.StatInt = (System.Int16)(System.Int16) dataRecord.GetInt16(i);

            i = dataRecord.GetOrdinal("stat_maxhit");

            source.StatMaxhit = (System.Int16)(System.Int16) dataRecord.GetInt16(i);

            i = dataRecord.GetOrdinal("stat_maxhp");

            source.StatMaxhp = (System.Int16)(System.Int16) dataRecord.GetInt16(i);

            i = dataRecord.GetOrdinal("stat_maxmp");

            source.StatMaxmp = (System.Int16)(System.Int16) dataRecord.GetInt16(i);

            i = dataRecord.GetOrdinal("stat_minhit");

            source.StatMinhit = (System.Int16)(System.Int16) dataRecord.GetInt16(i);

            i = dataRecord.GetOrdinal("stat_str");

            source.StatStr = (System.Int16)(System.Int16) dataRecord.GetInt16(i);
        }
/// <summary>
/// Reads the values from an <see cref="IDataRecord"/> and assigns the read values to this
/// object's properties. The database column's name is used to as the key, so the value
/// will not be found if any aliases are used or not all columns were selected.
/// </summary>
/// <param name="source">The object to add the extension method to.</param>
/// <param name="dataRecord">The <see cref="IDataRecord"/> to read the values from. Must already be ready to be read from.</param>
        public static void ReadValues(this CharacterTemplateTable source, System.Data.IDataRecord dataRecord)
        {
            System.Int32 i;

            i = dataRecord.GetOrdinal("ai_id");

            source.AIID = (System.Nullable <NetGore.AI.AIID>)(System.Nullable <NetGore.AI.AIID>)(dataRecord.IsDBNull(i) ? (System.Nullable <System.UInt16>)null : dataRecord.GetUInt16(i));

            i = dataRecord.GetOrdinal("alliance_id");

            source.AllianceID = (DemoGame.AllianceID)(DemoGame.AllianceID) dataRecord.GetByte(i);

            i = dataRecord.GetOrdinal("body_id");

            source.BodyID = (DemoGame.BodyID)(DemoGame.BodyID) dataRecord.GetUInt16(i);

            i = dataRecord.GetOrdinal("chat_dialog");

            source.ChatDialog = (System.Nullable <NetGore.Features.NPCChat.NPCChatDialogID>)(System.Nullable <NetGore.Features.NPCChat.NPCChatDialogID>)(dataRecord.IsDBNull(i) ? (System.Nullable <System.UInt16>)null : dataRecord.GetUInt16(i));

            i = dataRecord.GetOrdinal("exp");

            source.Exp = (System.Int32)(System.Int32) dataRecord.GetInt32(i);

            i = dataRecord.GetOrdinal("give_cash");

            source.GiveCash = (System.Int32)(System.Int32) dataRecord.GetInt32(i);

            i = dataRecord.GetOrdinal("give_exp");

            source.GiveExp = (System.Int32)(System.Int32) dataRecord.GetInt32(i);

            i = dataRecord.GetOrdinal("id");

            source.ID = (DemoGame.CharacterTemplateID)(DemoGame.CharacterTemplateID) dataRecord.GetUInt16(i);

            i = dataRecord.GetOrdinal("level");

            source.Level = (System.Int16)(System.Int16) dataRecord.GetInt16(i);

            i = dataRecord.GetOrdinal("move_speed");

            source.MoveSpeed = (System.UInt16)(System.UInt16) dataRecord.GetUInt16(i);

            i = dataRecord.GetOrdinal("name");

            source.Name = (System.String)(System.String) dataRecord.GetString(i);

            i = dataRecord.GetOrdinal("respawn");

            source.Respawn = (System.UInt16)(System.UInt16) dataRecord.GetUInt16(i);

            i = dataRecord.GetOrdinal("shop_id");

            source.ShopID = (System.Nullable <NetGore.Features.Shops.ShopID>)(System.Nullable <NetGore.Features.Shops.ShopID>)(dataRecord.IsDBNull(i) ? (System.Nullable <System.UInt16>)null : dataRecord.GetUInt16(i));

            i = dataRecord.GetOrdinal("statpoints");

            source.StatPoints = (System.Int32)(System.Int32) dataRecord.GetInt32(i);

            i = dataRecord.GetOrdinal("stat_agi");

            source.SetStat((DemoGame.StatType)DemoGame.StatType.Agi, (System.Int32)(System.Int16) dataRecord.GetInt16(i));

            i = dataRecord.GetOrdinal("stat_defence");

            source.SetStat((DemoGame.StatType)DemoGame.StatType.Defence, (System.Int32)(System.Int16) dataRecord.GetInt16(i));

            i = dataRecord.GetOrdinal("stat_int");

            source.SetStat((DemoGame.StatType)DemoGame.StatType.Int, (System.Int32)(System.Int16) dataRecord.GetInt16(i));

            i = dataRecord.GetOrdinal("stat_maxhit");

            source.SetStat((DemoGame.StatType)DemoGame.StatType.MaxHit, (System.Int32)(System.Int16) dataRecord.GetInt16(i));

            i = dataRecord.GetOrdinal("stat_maxhp");

            source.SetStat((DemoGame.StatType)DemoGame.StatType.MaxHP, (System.Int32)(System.Int16) dataRecord.GetInt16(i));

            i = dataRecord.GetOrdinal("stat_maxmp");

            source.SetStat((DemoGame.StatType)DemoGame.StatType.MaxMP, (System.Int32)(System.Int16) dataRecord.GetInt16(i));

            i = dataRecord.GetOrdinal("stat_minhit");

            source.SetStat((DemoGame.StatType)DemoGame.StatType.MinHit, (System.Int32)(System.Int16) dataRecord.GetInt16(i));

            i = dataRecord.GetOrdinal("stat_str");

            source.SetStat((DemoGame.StatType)DemoGame.StatType.Str, (System.Int32)(System.Int16) dataRecord.GetInt16(i));
        }