Ejemplo n.º 1
0
        public int GetArraySizeAt(CSVRow row, int columnIndex)
        {
            int rowIndex = this.m_vCSVRows.IndexOf(row);

            if (rowIndex == -1)
            {
                return(0);
            }
            CSVColumn c          = this.m_vCSVColumns[columnIndex];
            int       nextOffset = 0;

            if (rowIndex + 1 >= this.m_vCSVRows.Count)
            {
                nextOffset = c.GetSize();
            }
            else
            {
                CSVRow nextRow = this.m_vCSVRows[rowIndex + 1];
                nextOffset = nextRow.GetRowOffset();
            }

            int currentOffset = row.GetRowOffset();

            return(c.GetArraySize(currentOffset, nextOffset));
        }
Ejemplo n.º 2
0
 public DataTable(CSVTable table, int index)
 {
     this.m_vIndex = index;
     this.m_vData  = new List <Data>();
     for (int i = 0; i < table.GetRowCount(); i++)
     {
         CSVRow rowAt = table.GetRowAt(i);
         Data   item  = this.CreateItem(rowAt);
         this.m_vData.Add(item);
     }
 }
Ejemplo n.º 3
0
 public static void LoadData(Data obj, Type objectType, CSVRow row)
 {
     PropertyInfo[] properties = objectType.GetProperties();
     for (int i = 0; i < properties.Length; i++)
     {
         PropertyInfo propertyInfo = properties[i];
         if (propertyInfo.PropertyType.IsGenericType)
         {
             Type         arg_39_0         = typeof(List <>);
             Type[]       genericArguments = propertyInfo.PropertyType.GetGenericArguments();
             Type         expr_3E          = arg_39_0.MakeGenericType(genericArguments);
             object       obj2             = Activator.CreateInstance(expr_3E);
             MethodInfo   method           = expr_3E.GetMethod("Add");
             string       memberName       = ((DefaultMemberAttribute)obj2.GetType().GetCustomAttributes(typeof(DefaultMemberAttribute), true)[0]).MemberName;
             PropertyInfo property         = obj2.GetType().GetProperty(memberName);
             for (int j = row.GetRowOffset(); j < row.GetRowOffset() + row.GetArraySize(propertyInfo.Name); j++)
             {
                 string text = row.GetValue(propertyInfo.Name, j - row.GetRowOffset());
                 if (text == string.Empty && j != row.GetRowOffset())
                 {
                     text = property.GetValue(obj2, new object[]
                     {
                         j - row.GetRowOffset() - 1
                     }).ToString();
                 }
                 if (text == string.Empty)
                 {
                     object obj3 = genericArguments[0].IsValueType ? Activator.CreateInstance(genericArguments[0]) : string.Empty;
                     method.Invoke(obj2, new object[]
                     {
                         obj3
                     });
                 }
                 else
                 {
                     method.Invoke(obj2, new object[]
                     {
                         Convert.ChangeType(text, genericArguments[0])
                     });
                 }
             }
             propertyInfo.SetValue(obj, obj2);
         }
         else if (row.GetValue(propertyInfo.Name, 0) == string.Empty)
         {
             propertyInfo.SetValue(obj, null, null);
         }
         else
         {
             propertyInfo.SetValue(obj, Convert.ChangeType(row.GetValue(propertyInfo.Name, 0), propertyInfo.PropertyType), null);
         }
     }
 }
Ejemplo n.º 4
0
        public void LoadData(Data obj, Type objectType, CSVRow row)
        {
            foreach (var prop in objectType.GetProperties())
            {
                if (prop.PropertyType.IsGenericType)
                {
                    var listType     = typeof(List <>);
                    var genericArgs  = prop.PropertyType.GetGenericArguments();
                    var concreteType = listType.MakeGenericType(genericArgs);
                    var newList      = Activator.CreateInstance(concreteType);

                    var add = concreteType.GetMethod("Add");

                    var indexerName =
                        ((DefaultMemberAttribute)
                         newList.GetType().GetCustomAttributes(typeof(DefaultMemberAttribute), true)[0]).MemberName;
                    var indexerProp = newList.GetType().GetProperty(indexerName);

                    for (var i = row.GetRowOffset(); i < row.GetRowOffset() + row.GetArraySize(prop.Name); i++)
                    {
                        var v = row.GetValue(prop.Name, i - row.GetRowOffset());
                        if (v == string.Empty && i != row.GetRowOffset())
                        {
                            v = indexerProp.GetValue(newList, new object[] { i - row.GetRowOffset() - 1 }).ToString();
                        }

                        if (v == string.Empty)
                        {
                            var o = genericArgs[0].IsValueType ? Activator.CreateInstance(genericArgs[0]) : "";
                            add.Invoke(newList, new[] { o });
                        }
                        else
                        {
                            add.Invoke(newList, new[] { Convert.ChangeType(v, genericArgs[0]) });
                        }
                    }
                    prop.SetValue(obj, newList, null);
                }
                else
                {
                    if (row.GetValue(prop.Name, 0) == string.Empty)
                    {
                        prop.SetValue(obj, null, null);
                    }
                    else
                    {
                        prop.SetValue(obj, Convert.ChangeType(row.GetValue(prop.Name, 0), prop.PropertyType), null);
                    }
                }
            }
        }
Ejemplo n.º 5
0
        public Data CreateItem(CSVRow row)
        {
            Data result = new Data(row, this);
            int  vIndex = this.m_vIndex;

            if (vIndex != 23)
            {
                if (vIndex == 24)
                {
                    result = new Data(row, this);
                }
            }
            else
            {
                result = new Data(row, this);
            }
            return(result);
        }
Ejemplo n.º 6
0
 public int GetArraySizeAt(CSVRow row, int columnIndex)
 {
     int rowIndex = m_vCSVRows.IndexOf(row);
     if (rowIndex == -1)
         return 0;
     CSVColumn c = m_vCSVColumns[columnIndex];
     int nextOffset = 0;
     if(rowIndex + 1 >= m_vCSVRows.Count)
     {
         nextOffset = c.GetSize();
     }
     else
     {
         CSVRow nextRow = m_vCSVRows[rowIndex + 1];
         nextOffset = nextRow.GetRowOffset();
     }
     int currentOffset = row.GetRowOffset();
     return c.GetArraySize(currentOffset, nextOffset);
 }
Ejemplo n.º 7
0
        public static void LoadData(Data obj, Type objectType, CSVRow row)
        {
            foreach (var prop in objectType.GetProperties())
            {
                if (prop.PropertyType.IsGenericType)
                {
                    var listType = typeof(List<>);
                    var genericArgs = prop.PropertyType.GetGenericArguments();
                    var concreteType = listType.MakeGenericType(genericArgs);
                    var newList = Activator.CreateInstance(concreteType);

                    var add = concreteType.GetMethod("Add");

                    var indexerName =
                        ((DefaultMemberAttribute)
                            newList.GetType().GetCustomAttributes(typeof(DefaultMemberAttribute), true)[0]).MemberName;
                    var indexerProp = newList.GetType().GetProperty(indexerName);

                    for (var i = row.GetRowOffset(); i < row.GetRowOffset() + row.GetArraySize(prop.Name); i++)
                    {
                        var v = row.GetValue(prop.Name, i - row.GetRowOffset());
                        if (v == string.Empty && i != row.GetRowOffset())
                            v = indexerProp.GetValue(newList, new object[] { i - row.GetRowOffset() - 1 }).ToString();

                        if (v == string.Empty)
                        {
                            var o = genericArgs[0].IsValueType ? Activator.CreateInstance(genericArgs[0]) : "";
                            add.Invoke(newList, new[] { o });
                        }
                        else
                            add.Invoke(newList, new[] { Convert.ChangeType(v, genericArgs[0]) });
                    }
                    prop.SetValue(obj, newList);
                }
                else
                {
                    if (row.GetValue(prop.Name, 0) == string.Empty)
                        prop.SetValue(obj, null, null);
                    else
                        prop.SetValue(obj, Convert.ChangeType(row.GetValue(prop.Name, 0), prop.PropertyType), null);
                }
            }
        }
Ejemplo n.º 8
0
        public int GetArraySizeAt(CSVRow row, int columnIndex)
        {
            int num = this.m_vCSVRows.IndexOf(row);

            if (num == -1)
            {
                return(0);
            }
            CSVColumn cSVColumn = this.m_vCSVColumns[columnIndex];
            int       nextOffset;

            if (num + 1 >= this.m_vCSVRows.Count)
            {
                nextOffset = cSVColumn.GetSize();
            }
            else
            {
                nextOffset = this.m_vCSVRows[num + 1].GetRowOffset();
            }
            return(CSVColumn.GetArraySize(row.GetRowOffset(), nextOffset));
        }
Ejemplo n.º 9
0
        public Data CreateItem(CSVRow row)
        {
            var d = new Data(row, this);

            switch (m_vIndex)
            {
            case 13:
                d = new GlobalData(row, this);
                break;

            case 23:
                d = new Data(row, this);
                break;

            case 24:
                d = new Data(row, this);
                break;

            default:
                break;
            }
            return(d);
        }
Ejemplo n.º 10
0
        public int GetArraySizeAt(CSVRow row, int columnIndex)
        {
            var rowIndex = m_vCSVRows.IndexOf(row);

            if (rowIndex == -1)
            {
                return(0);
            }
            var c          = m_vCSVColumns[columnIndex];
            var nextOffset = 0;

            if (rowIndex + 1 >= m_vCSVRows.Count)
            {
                nextOffset = c.GetSize();
            }
            else
            {
                var nextRow = m_vCSVRows[rowIndex + 1];
                nextOffset = nextRow.GetRowOffset();
            }
            var currentOffset = row.GetRowOffset();

            return(c.GetArraySize(currentOffset, nextOffset));
        }
Ejemplo n.º 11
0
 public CombatItemData(CSVRow row, DataTable dt)
     : base(row, dt)
 {
 }
Ejemplo n.º 12
0
 public GlobalData(CSVRow row, DataTable dt)
     : base(row, dt)
 {
     LoadData(this, this.GetType(), row);
 }
Ejemplo n.º 13
0
        public Data CreateItem(CSVRow row)
        {
            var d = new Data(row, this);

            switch (m_vIndex)
            {
            case 0:
                d = new BuildingData(row, this);
                break;

            case 2:
                d = new ResourceData(row, this);
                break;

            case 3:
                d = new CharacterData(row, this);
                break;

            case 7:
                d = new ObstacleData(row, this);
                break;

            case 10:
                d = new ExperienceLevelData(row, this);
                break;

            case 11:
                d = new TrapData(row, this);
                break;

            case 12:
                d = new LeagueData(row, this);
                break;

            case 13:
                d = new GlobalData(row, this);
                break;

            case 14:
                d = new TownhallLevelData(row, this);
                break;

            case 16:
                d = new NpcData(row, this);
                break;

            case 17:
                d = new DecoData(row, this);
                break;

            case 19:
                d = new ShieldData(row, this);
                break;

            case 22:
                d = new AchievementData(row, this);
                break;

            case 23:
                d = new Data(row, this);
                break;

            case 24:
                d = new Data(row, this);
                break;

            case 25:
                d = new SpellData(row, this);
                break;

            case 27:
                d = new HeroData(row, this);
                break;

            case 28:
                d = new WarData(row, this);
                break;

            case 30:
                d = new AllianceBadgeLayersData(row, this);
                break;

            case 31:
                d = new AllianceBadgesData(row, this);
                break;

            case 32:
                d = new AllianceLevelsData(row, this);
                break;

            case 33:
                d = new AlliancePortalData(row, this);
                break;

            case 34:
                d = new BuildingClassesData(row, this);
                break;

            case 35:
                d = new EffectsData(row, this);
                break;

            case 36:
                d = new LocalesData(row, this);
                break;

            case 37:
                d = new MissionsData(row, this);
                break;

            case 38:
                d = new ProjectilesData(row, this);
                break;

            case 39:
                d = new RegionsData(row, this);
                break;

            case 40:
                d = new VariablesData(row, this);
                break;

            default:
                break;
            }
            return(d);
        }
Ejemplo n.º 14
0
 public BuildingData(CSVRow row, DataTable dt) : base(row, dt)
 {
     LoadData(this, GetType(), row);
 }
Ejemplo n.º 15
0
 public ExperienceLevelData(CSVRow row, DataTable dt)
     : base(row, dt)
 {
     LoadData(this, this.GetType(), row);
 }
Ejemplo n.º 16
0
 public Data(CSVRow row, DataTable dt)
 {
     m_vCSVRow = row;
     m_vDataTable = dt;
     m_vGlobalID = GlobalID.CreateGlobalID(dt.GetTableIndex() + 1, dt.GetItemCount());
 }
Ejemplo n.º 17
0
 public ConstructionItemData(CSVRow row, DataTable dt) : base(row, dt)
 {
 }
Ejemplo n.º 18
0
 public Data CreateItem(CSVRow row)
 {
     Data d = new Data(row, this);
     switch (m_vIndex)
     {
         case 0:
             d = new BuildingData(row, this);
             break;
         case 2:
             d = new ResourceData(row, this);
             break;
         case 3:
             d = new CharacterData(row, this);
             break;
         case 7:
             d = new ObstacleData(row, this);
             break;
         case 10:
             d = new ExperienceLevelData(row, this);
             break;
         case 11:
             d = new TrapData(row, this);
             break;
         case 12:
             d = new LeagueData(row, this);
             break;
         case 13:
             d = new GlobalData(row, this);
             break;
         case 14:
             d = new TownhallLevelData(row, this);
             break;
         case 16:
             d = new NpcData(row, this);
             break;
         case 17:
             d = new DecoData(row, this);
             break;
         case 19:
             d = new ShieldData(row, this);
             break;
         case 22:
             d = new AchievementData(row, this);
             break;
         case 23:
             d = new Data(row, this);
             break;
         case 24:
             d = new Data(row, this);
             break;
         case 25:
             d = new SpellData(row, this);
             break;
         case 27:
             d = new HeroData(row, this);
             break;
         /*case 28:
             d = new WarData(dic);
             break;*/
         default:
             break;
     }
     return d;
 }
Ejemplo n.º 19
0
 public void AddRow(CSVRow row)
 {
     m_vCSVRows.Add(row);
 }
 public ExperienceLevelData(CSVRow row, DataTable dt)
     : base(row, dt)
 {
     LoadData(this, this.GetType(), row);
 }
Ejemplo n.º 21
0
 public ObstacleData(CSVRow row, DataTable dt)
     : base(row, dt)
 {
     LoadData(this, this.GetType(), row);
 }
 public CombatItemData(CSVRow row, DataTable dt)
     : base(row, dt)
 {
 }
Ejemplo n.º 23
0
 public AchievementData(CSVRow row, DataTable dt) : base(row, dt)
 {
     LoadData(this, this.GetType(), row);
 }
 public TownhallLevelData(CSVRow row, DataTable dt)
     : base(row, dt)
 {
     LoadData(this, this.GetType(), row);
 }
 public AchievementData(CSVRow row, DataTable dt) : base(row, dt)
 {
     LoadData(this, this.GetType(), row);
 }
Ejemplo n.º 26
0
        public Data CreateItem(CSVRow row)
        {
            var d = new Data(row, this);

            switch (m_vIndex)
            {
            case 0:
                d = new BuildingData(row, this);
                break;

            case 2:
                d = new ResourceData(row, this);
                break;

            case 3:
                d = new CharacterData(row, this);
                break;

            case 7:
                d = new ObstacleData(row, this);
                break;

            case 10:
                d = new ExperienceLevelData(row, this);
                break;

            case 11:
                d = new TrapData(row, this);
                break;

            case 12:
                d = new LeagueData(row, this);
                break;

            case 13:
                d = new GlobalData(row, this);
                break;

            case 14:
                d = new TownhallLevelData(row, this);
                break;

            case 16:
                d = new NpcData(row, this);
                break;

            case 17:
                d = new DecoData(row, this);
                break;

            case 19:
                d = new ShieldData(row, this);
                break;

            case 22:
                d = new AchievementData(row, this);
                break;

            case 23:
                d = new Data(row, this);
                break;

            case 24:
                d = new Data(row, this);
                break;

            case 25:
                d = new SpellData(row, this);
                break;

            case 27:
                d = new HeroData(row, this);
                break;

            /*case 28:
             *  d = new WarData(dic);
             *  break;*/
            default:
                break;
            }
            return(d);
        }
 public ConstructionItemData(CSVRow row, DataTable dt) : base(row, dt)
 {
 }
Ejemplo n.º 28
0
 public TownhallLevelData(CSVRow row, DataTable dt)
     : base(row, dt)
 {
     LoadData(this, this.GetType(), row);
 }
Ejemplo n.º 29
0
        /// <summary>
        /// Create the item.
        /// </summary>
        /// <param name="row">The row.</param>
        /// <returns>The Data.</returns>
        public Data CreateItem(CSVRow row)
        {
            Data _Data;

            // Data _Data = new Data(row, this);
            switch (this.m_vIndex)
            {
            case 1:
            {
                _Data = new Achievements(row, this);
                break;
            }

            case 2:
            {
                _Data = new Alliance_Badges(row, this);
                break;
            }

            case 3:
            {
                _Data = new Alliance_Roles(row, this);
                break;
            }

            case 4:
            {
                _Data = new Area_Effect_Objects(row, this);
                break;
            }

            case 5:
            {
                _Data = new Arenas(row, this);
                break;
            }

            case 6:
            {
                _Data = new Buildings(row, this);
                break;
            }

            case 7:
            {
                _Data = new Character_Buffs(row, this);
                break;
            }

            case 8:
            {
                _Data = new CharacterData(row, this);
                break;
            }

            case 9:
            {
                _Data = new Chest_Order(row, this);
                break;
            }

            case 10:
            {
                _Data = new Content_Tests(row, this);
                break;
            }

            case 11:
            {
                _Data = new Damage_Types(row, this);
                break;
            }

            case 12:
            {
                _Data = new Decos(row, this);
                break;
            }

            case 13:
            {
                _Data = new Exp_Levels(row, this);
                break;
            }

            case 14:
            {
                _Data = new Gamble_Chests(row, this);
                break;
            }

            case 15:
            {
                _Data = new GlobalData(row, this);
                break;
            }

            case 16:
            {
                _Data = new Locales(row, this);
                break;
            }

            case 17:
            {
                _Data = new Locations(row, this);
                break;
            }

            case 18:
            {
                _Data = new Npcs(row, this);
                break;
            }

            case 19:
            {
                _Data = new Predefined_Decks(row, this);
                break;
            }

            case 20:
            {
                _Data = new Projectiles(row, this);
                break;
            }

            case 21:
            {
                _Data = new Rarities(row, this);
                break;
            }

            case 22:
            {
                _Data = new Regions(row, this);
                break;
            }

            case 23:
            {
                _Data = new Resource_Packs(row, this);
                break;
            }

            case 24:
            {
                _Data = new ResourceData(row, this);
                break;
            }

            case 25:
            {
                _Data = new Shop(row, this);
                break;
            }

            case 26:
            {
                _Data = new Spawn_Points(row, this);
                break;
            }

            case 27:
            {
                _Data = new Spell_Sets(row, this);
                break;
            }

            case 28:
            {
                _Data = new Spells_Buildings(row, this);
                break;
            }

            case 29:
            {
                _Data = new Spells_Characters(row, this);
                break;
            }

            case 30:
            {
                _Data = new Spells_Other(row, this);
                break;
            }

            case 31:
            {
                _Data = new Survival_Modes(row, this);
                break;
            }

            case 32:
            {
                _Data = new Taunts(row, this);
                break;
            }

            case 33:
            {
                _Data = new Tournament_Tiers(row, this);
                break;
            }

            case 34:
            {
                _Data = new Treasure_Chests(row, this);
                break;
            }

            case 35:
            {
                _Data = new Tutorials_Home(row, this);
                break;
            }

            case 36:
            {
                _Data = new Tutorials_Npc(row, this);
                break;
            }

            default:
            {
                _Data = new Data(row, this);
                break;
            }

                // default:
                // break;
            }

            return(_Data);
        }
Ejemplo n.º 30
0
 public void AddRow(CSVRow row)
 {
     m_vCSVRows.Add(row);
 }
Ejemplo n.º 31
0
 public BuildingData(CSVRow row, DataTable dt)
     : base(row, dt)
 {
     LoadData(this, this.GetType(), row);
 }
Ejemplo n.º 32
0
 public Rarities(CSVRow row, DataTable dt) : base(row, dt)
 {
     this.LoadData(this, this.GetType(), row);
 }
Ejemplo n.º 33
0
 public Data(CSVRow row, DataTable dt)
 {
     m_vCSVRow    = row;
     m_vDataTable = dt;
     m_vGlobalID  = GlobalID.CreateGlobalID(dt.GetTableIndex() + 1, dt.GetItemCount());
 }
 public ResourceData(CSVRow row, DataTable dt)
     : base(row, dt)
 {
     LoadData(this, this.GetType(), row); 
 }
Ejemplo n.º 35
0
 public SpellData(CSVRow row, DataTable dt)
     : base(row, dt)
 {
     LoadData(this, this.GetType(), row);
 }
 public CharacterData(CSVRow row, DataTable dt)
     : base(row, dt)
 {
     LoadData(this, this.GetType(), row);
 }
Ejemplo n.º 37
0
 public ResourceData(CSVRow row, DataTable dt)
     : base(row, dt)
 {
     LoadData(this, this.GetType(), row);
 }
Ejemplo n.º 38
0
 public CharacterData(CSVRow row, DataTable dt)
     : base(row, dt)
 {
     LoadData(this, this.GetType(), row);
 }
Ejemplo n.º 39
0
 public LeagueData(CSVRow row, DataTable dt)
     : base(row, dt)
 {
     LoadData(this, GetType(), row);
 }
 public ObstacleData(CSVRow row, DataTable dt)
     : base(row, dt)
 {
     LoadData(this, this.GetType(), row);
 }