public List <T2> readObjList <T1, T2>() { if (_pos == 0) { _pos = 8; } int _loc2_ = readShort();//ReadShort(_barr, _pos); int _loc1_ = 0; //int endpos = _pos + 2; List <T2> thelst = new List <T2>(); while (_loc1_ < _loc2_ && this._pos < this._barr.Length) { #region xxx if (typeof(T1) == typeof(LongC)) { LongC _itemId = readLong(); T2 tt = (T2)Convert.ChangeType(_itemId, typeof(T2)); thelst.Add(tt); } else if (typeof(T1) == typeof(Int32) || typeof(T1) == typeof(int)) { int _itemId = readInt(); T2 tt = (T2)Convert.ChangeType(_itemId, typeof(T2)); thelst.Add(tt); } else if (typeof(T1) == typeof(string)) { string _itemId = readString(); T2 tt = (T2)Convert.ChangeType(_itemId, typeof(T2)); thelst.Add(tt); } else if (typeof(T1) == typeof(byte) || typeof(T1) == typeof(Byte)) { int val = readByte(); T2 tt = (T2)Convert.ChangeType(val, typeof(T2)); thelst.Add(tt);// } else if (typeof(T1) == typeof(SoulfactInfo)) { SoulfactInfo bb = new SoulfactInfo(); bb._barr = this._barr; bb._pos = this._pos; bb.reading(); this._pos = bb._pos; T2 tt = (T2)Convert.ChangeType(bb, typeof(T2)); thelst.Add(tt); } else if (typeof(T1) == typeof(BuffPara)) { BuffPara bb = new BuffPara(); bb._barr = this._barr; bb._pos = this._pos; bb.reading(); this._pos = bb._pos; T2 tt = (T2)Convert.ChangeType(bb, typeof(T2)); thelst.Add(tt); } else if (typeof(T1) == typeof(Position)) { Position bb = new Position(); bb._barr = this._barr; bb._pos = this._pos; bb.reading(); this._pos = bb._pos; T2 tt = (T2)Convert.ChangeType(bb, typeof(T2)); thelst.Add(tt); } else if (typeof(T1) == typeof(MailSummaryInfo)) { MailSummaryInfo bb = new MailSummaryInfo(); bb._barr = this._barr; bb._pos = this._pos; bb.reading(); this._pos = bb._pos; T2 tt = (T2)Convert.ChangeType(bb, typeof(T2)); thelst.Add(tt); } else if (typeof(T1) == typeof(AttackResultInfos)) { AttackResultInfos bb = new AttackResultInfos(); bb._barr = this._barr; bb._pos = this._pos; bb.reading(); this._pos = bb._pos; T2 tt = (T2)Convert.ChangeType(bb, typeof(T2)); thelst.Add(tt); } else if (typeof(T1) == typeof(GoodsAttribute)) { GoodsAttribute bb = new GoodsAttribute(); bb._barr = this._barr; bb._pos = this._pos; bb.reading(); this._pos = bb._pos; T2 tt = (T2)Convert.ChangeType(bb, typeof(T2)); thelst.Add(tt); } else if (typeof(T1) == typeof(Slot)) { Slot bb = new Slot(); bb._barr = this._barr; bb._pos = this._pos; bb.reading(); this._pos = bb._pos; T2 tt = (T2)Convert.ChangeType(bb, typeof(T2)); thelst.Add(tt);//GemInfo } else if (typeof(T1) == typeof(GemInfo)) { GemInfo bb = new GemInfo(); bb._barr = this._barr; bb._pos = this._pos; bb.reading(); this._pos = bb._pos; T2 tt = (T2)Convert.ChangeType(bb, typeof(T2)); thelst.Add(tt);//GoodsInfoRes } else if (typeof(T1) == typeof(GoodsInfoRes)) { GoodsInfoRes bb = new GoodsInfoRes(); bb._barr = this._barr; bb._pos = this._pos; bb.reading(); this._pos = bb._pos; T2 tt = (T2)Convert.ChangeType(bb, typeof(T2)); thelst.Add(tt);//BossEventInfo } else if (typeof(T1) == typeof(BossEventInfo)) { BossEventInfo bb = new BossEventInfo(); bb._barr = this._barr; bb._pos = this._pos; bb.reading(); this._pos = bb._pos; T2 tt = (T2)Convert.ChangeType(bb, typeof(T2)); thelst.Add(tt);//BossEventInfo } else if (typeof(T1) == typeof(PandoraEventInfo)) { PandoraEventInfo bb = new PandoraEventInfo(); bb._barr = this._barr; bb._pos = this._pos; bb.reading(); this._pos = bb._pos; T2 tt = (T2)Convert.ChangeType(bb, typeof(T2)); thelst.Add(tt);//ZoneTeamInfo } else if (typeof(T1) == typeof(ZoneTeamInfo)) { ZoneTeamInfo bb = new ZoneTeamInfo(); bb._barr = this._barr; bb._pos = this._pos; bb.reading(); this._pos = bb._pos; T2 tt = (T2)Convert.ChangeType(bb, typeof(T2)); thelst.Add(tt);//CharacterInfo } else if (typeof(T1) == typeof(CharacterInfo)) { CharacterInfo bb = new CharacterInfo(); bb._barr = this._barr; bb._pos = this._pos; bb.reading(); this._pos = bb._pos; T2 tt = (T2)Convert.ChangeType(bb, typeof(T2)); thelst.Add(tt);//SkillLevelInfo } else if (typeof(T1) == typeof(SkillLevelInfo)) { SkillLevelInfo bb = new SkillLevelInfo(); bb._barr = this._barr; bb._pos = this._pos; bb.reading(); this._pos = bb._pos; T2 tt = (T2)Convert.ChangeType(bb, typeof(T2)); thelst.Add(tt);//CSSkillInfo } else if (typeof(T1) == typeof(CSSkillInfo)) { CSSkillInfo bb = new CSSkillInfo(); bb._barr = this._barr; bb._pos = this._pos; bb.reading(); this._pos = bb._pos; T2 tt = (T2)Convert.ChangeType(bb, typeof(T2)); thelst.Add(tt);//PokemonInfo } else if (typeof(T1) == typeof(PokemonInfo)) { PokemonInfo bb = new PokemonInfo(); bb._barr = this._barr; bb._pos = this._pos; bb.reading(); this._pos = bb._pos; T2 tt = (T2)Convert.ChangeType(bb, typeof(T2)); thelst.Add(tt);//ActivityItemInfo } else if (typeof(T1) == typeof(ActivityItemInfo)) { ActivityItemInfo bb = new ActivityItemInfo(); bb._barr = this._barr; bb._pos = this._pos; bb.reading(); this._pos = bb._pos; T2 tt = (T2)Convert.ChangeType(bb, typeof(T2)); thelst.Add(tt);//CSMonsterInfo } else if (typeof(T1) == typeof(CSMonsterInfo)) { CSMonsterInfo bb = new CSMonsterInfo(); bb._barr = this._barr; bb._pos = this._pos; bb.reading(); this._pos = bb._pos; T2 tt = (T2)Convert.ChangeType(bb, typeof(T2)); thelst.Add(tt);//DropGoodsInfo } else if (typeof(T1) == typeof(DropGoodsInfo)) { DropGoodsInfo bb = new DropGoodsInfo(); bb._barr = this._barr; bb._pos = this._pos; bb.reading(); this._pos = bb._pos; T2 tt = (T2)Convert.ChangeType(bb, typeof(T2)); thelst.Add(tt);//HorseSkillBean } else if (typeof(T1) == typeof(HorseSkillBean)) { HorseSkillBean bb = new HorseSkillBean(); bb._barr = this._barr; bb._pos = this._pos; bb.reading(); this._pos = bb._pos; T2 tt = (T2)Convert.ChangeType(bb, typeof(T2)); thelst.Add(tt);//CSPlayerInfo } else if (typeof(T1) == typeof(CSPlayerInfo)) { CSPlayerInfo bb = new CSPlayerInfo(); bb._barr = this._barr; bb._pos = this._pos; bb.reading(); this._pos = bb._pos; T2 tt = (T2)Convert.ChangeType(bb, typeof(T2)); thelst.Add(tt);//PetInfo } else if (typeof(T1) == typeof(PetInfo)) { PetInfo bb = new PetInfo(); bb._barr = this._barr; bb._pos = this._pos; bb.reading(); this._pos = bb._pos; T2 tt = (T2)Convert.ChangeType(bb, typeof(T2)); thelst.Add(tt);//NpcInfo } else if (typeof(T1) == typeof(NpcInfo)) { NpcInfo bb = new NpcInfo(); bb._barr = this._barr; bb._pos = this._pos; bb.reading(); this._pos = bb._pos; T2 tt = (T2)Convert.ChangeType(bb, typeof(T2)); thelst.Add(tt);//EffectInfo } else if (typeof(T1) == typeof(EffectInfo)) { EffectInfo bb = new EffectInfo(); bb._barr = this._barr; bb._pos = this._pos; bb.reading(); this._pos = bb._pos; T2 tt = (T2)Convert.ChangeType(bb, typeof(T2)); thelst.Add(tt);//SummonPetInfo } else if (typeof(T1) == typeof(SummonPetInfo)) { SummonPetInfo bb = new SummonPetInfo(); bb._barr = this._barr; bb._pos = this._pos; bb.reading(); this._pos = bb._pos; T2 tt = (T2)Convert.ChangeType(bb, typeof(T2)); thelst.Add(tt);//CSBuffInfo } else if (typeof(T1) == typeof(CSBuffInfo)) { CSBuffInfo bb = new CSBuffInfo(); bb._barr = this._barr; bb._pos = this._pos; bb.reading(); this._pos = bb._pos; T2 tt = (T2)Convert.ChangeType(bb, typeof(T2)); thelst.Add(tt);//CSHorseSkillInfo } else if (typeof(T1) == typeof(CSHorseSkillInfo)) { CSHorseSkillInfo bb = new CSHorseSkillInfo(); bb._barr = this._barr; bb._pos = this._pos; bb.reading(); this._pos = bb._pos; T2 tt = (T2)Convert.ChangeType(bb, typeof(T2)); thelst.Add(tt);//EquipInfo } else if (typeof(T1) == typeof(EquipInfo)) { EquipInfo bb = new EquipInfo(); bb._barr = this._barr; bb._pos = this._pos; bb.reading(); this._pos = bb._pos; T2 tt = (T2)Convert.ChangeType(bb, typeof(T2)); thelst.Add(tt);//EquipAttribute } else if (typeof(T1) == typeof(EquipAttribute)) { EquipAttribute bb = new EquipAttribute(); bb._barr = this._barr; bb._pos = this._pos; bb.reading(); this._pos = bb._pos; T2 tt = (T2)Convert.ChangeType(bb, typeof(T2)); thelst.Add(tt);//CSHorseInfo } else if (typeof(T1) == typeof(CSHorseInfo)) { CSHorseInfo bb = new CSHorseInfo(); bb._barr = this._barr; bb._pos = this._pos; bb.reading(); this._pos = bb._pos; T2 tt = (T2)Convert.ChangeType(bb, typeof(T2)); thelst.Add(tt);//UseInfoBean } else if (typeof(T1) == typeof(UseInfoBean)) { UseInfoBean bb = new UseInfoBean(); bb._barr = this._barr; bb._pos = this._pos; bb.reading(); this._pos = bb._pos; T2 tt = (T2)Convert.ChangeType(bb, typeof(T2)); thelst.Add(tt);//CosmicGateBean } else if (typeof(T1) == typeof(CosmicGateBean)) { CosmicGateBean bb = new CosmicGateBean(); bb._barr = this._barr; bb._pos = this._pos; bb.reading(); this._pos = bb._pos; T2 tt = (T2)Convert.ChangeType(bb, typeof(T2)); thelst.Add(tt);// } else { ConsoleLog.Instance.writeInformationLog("readobjlist Class can't be read=" + typeof(T1).ToString()); } #endregion _loc1_++; } //_pos = endpos; return(thelst); }
public T readBean <T>() where T : new() { T tt; if (typeof(T) == typeof(LongC)) { LongC _itemId = readLong(); tt = (T)Convert.ChangeType(_itemId, typeof(T)); } else if (typeof(T) == typeof(string)) { string _itemId = readString(); tt = (T)Convert.ChangeType(_itemId, typeof(T)); } else if (typeof(T) == typeof(byte)) { int val = readByte(); tt = (T)Convert.ChangeType(val, typeof(T)); } else if (typeof(T) == typeof(BuffPara)) { BuffPara bb = new BuffPara(); bb._barr = this._barr; bb._pos = this._pos; bb.reading(); this._pos = bb._pos; tt = (T)Convert.ChangeType(bb, typeof(T)); } else if (typeof(T) == typeof(MailSummaryInfo)) { MailSummaryInfo bb = new MailSummaryInfo(); bb._barr = this._barr; bb._pos = this._pos; bb.reading(); this._pos = bb._pos; tt = (T)Convert.ChangeType(bb, typeof(T)); } else if (typeof(T) == typeof(AttackResultInfos)) { AttackResultInfos bb = new AttackResultInfos(); bb._barr = this._barr; bb._pos = this._pos; bb.reading(); this._pos = bb._pos; tt = (T)Convert.ChangeType(bb, typeof(T)); } else if (typeof(T) == typeof(GoodsAttribute)) { GoodsAttribute bb = new GoodsAttribute(); bb._barr = this._barr; bb._pos = this._pos; bb.reading(); this._pos = bb._pos; tt = (T)Convert.ChangeType(bb, typeof(T)); } else if (typeof(T) == typeof(Slot)) { Slot bb = new Slot(); bb._barr = this._barr; bb._pos = this._pos; bb.reading(); this._pos = bb._pos; tt = (T)Convert.ChangeType(bb, typeof(T)); } else if (typeof(T) == typeof(GemInfo)) { GemInfo bb = new GemInfo(); bb._barr = this._barr; bb._pos = this._pos; bb.reading(); this._pos = bb._pos; tt = (T)Convert.ChangeType(bb, typeof(T)); } else if (typeof(T) == typeof(GoodsInfoRes)) { GoodsInfoRes bb = new GoodsInfoRes(); bb._barr = this._barr; bb._pos = this._pos; bb.reading(); this._pos = bb._pos; tt = (T)Convert.ChangeType(bb, typeof(T)); } else if (typeof(T) == typeof(BossEventInfo)) { BossEventInfo bb = new BossEventInfo(); bb._barr = this._barr; bb._pos = this._pos; bb.reading(); this._pos = bb._pos; tt = (T)Convert.ChangeType(bb, typeof(T)); } else if (typeof(T) == typeof(PandoraEventInfo)) { PandoraEventInfo bb = new PandoraEventInfo(); bb._barr = this._barr; bb._pos = this._pos; bb.reading(); this._pos = bb._pos; tt = (T)Convert.ChangeType(bb, typeof(T)); } else if (typeof(T) == typeof(ZoneTeamInfo)) { ZoneTeamInfo bb = new ZoneTeamInfo(); bb._barr = this._barr; bb._pos = this._pos; bb.reading(); this._pos = bb._pos; tt = (T)Convert.ChangeType(bb, typeof(T)); } else if (typeof(T) == typeof(CharacterInfo)) { CharacterInfo bb = new CharacterInfo(); bb._barr = this._barr; bb._pos = this._pos; bb.reading(); this._pos = bb._pos; tt = (T)Convert.ChangeType(bb, typeof(T)); } else if (typeof(T) == typeof(SkillLevelInfo)) { SkillLevelInfo bb = new SkillLevelInfo(); bb._barr = this._barr; bb._pos = this._pos; bb.reading(); this._pos = bb._pos; tt = (T)Convert.ChangeType(bb, typeof(T)); } else if (typeof(T) == typeof(CSSkillInfo)) { CSSkillInfo bb = new CSSkillInfo(); bb._barr = this._barr; bb._pos = this._pos; bb.reading(); this._pos = bb._pos; tt = (T)Convert.ChangeType(bb, typeof(T)); } else if (typeof(T) == typeof(PokemonInfo)) { PokemonInfo bb = new PokemonInfo(); bb._barr = this._barr; bb._pos = this._pos; bb.reading(); this._pos = bb._pos; tt = (T)Convert.ChangeType(bb, typeof(T)); } else if (typeof(T) == typeof(ActivityItemInfo)) { ActivityItemInfo bb = new ActivityItemInfo(); bb._barr = this._barr; bb._pos = this._pos; bb.reading(); this._pos = bb._pos; tt = (T)Convert.ChangeType(bb, typeof(T)); } else if (typeof(T) == typeof(CSMonsterInfo)) { CSMonsterInfo bb = new CSMonsterInfo(); bb._barr = this._barr; bb._pos = this._pos; bb.reading(); this._pos = bb._pos; tt = (T)Convert.ChangeType(bb, typeof(T)); } else if (typeof(T) == typeof(DropGoodsInfo)) { DropGoodsInfo bb = new DropGoodsInfo(); bb._barr = this._barr; bb._pos = this._pos; bb.reading(); this._pos = bb._pos; tt = (T)Convert.ChangeType(bb, typeof(T)); } else if (typeof(T) == typeof(HorseSkillBean)) { HorseSkillBean bb = new HorseSkillBean(); bb._barr = this._barr; bb._pos = this._pos; bb.reading(); this._pos = bb._pos; tt = (T)Convert.ChangeType(bb, typeof(T)); } else if (typeof(T) == typeof(CSPlayerInfo)) { CSPlayerInfo bb = new CSPlayerInfo(); bb._barr = this._barr; bb._pos = this._pos; bb.reading(); this._pos = bb._pos; tt = (T)Convert.ChangeType(bb, typeof(T)); } else if (typeof(T) == typeof(PetInfo)) { PetInfo bb = new PetInfo(); bb._barr = this._barr; bb._pos = this._pos; bb.reading(); this._pos = bb._pos; tt = (T)Convert.ChangeType(bb, typeof(T)); } else if (typeof(T) == typeof(NpcInfo)) { NpcInfo bb = new NpcInfo(); bb._barr = this._barr; bb._pos = this._pos; bb.reading(); this._pos = bb._pos; tt = (T)Convert.ChangeType(bb, typeof(T)); } else if (typeof(T) == typeof(EffectInfo)) { EffectInfo bb = new EffectInfo(); bb._barr = this._barr; bb._pos = this._pos; bb.reading(); this._pos = bb._pos; tt = (T)Convert.ChangeType(bb, typeof(T)); } else if (typeof(T) == typeof(SummonPetInfo)) { SummonPetInfo bb = new SummonPetInfo(); bb._barr = this._barr; bb._pos = this._pos; bb.reading(); this._pos = bb._pos; tt = (T)Convert.ChangeType(bb, typeof(T)); } else if (typeof(T) == typeof(CSBuffInfo)) { CSBuffInfo bb = new CSBuffInfo(); bb._barr = this._barr; bb._pos = this._pos; bb.reading(); this._pos = bb._pos; tt = (T)Convert.ChangeType(bb, typeof(T)); } else if (typeof(T) == typeof(CSHorseSkillInfo)) { CSHorseSkillInfo bb = new CSHorseSkillInfo(); bb._barr = this._barr; bb._pos = this._pos; bb.reading(); this._pos = bb._pos; tt = (T)Convert.ChangeType(bb, typeof(T)); } else if (typeof(T) == typeof(EquipInfo)) { EquipInfo bb = new EquipInfo(); bb._barr = this._barr; bb._pos = this._pos; bb.reading(); this._pos = bb._pos; tt = (T)Convert.ChangeType(bb, typeof(T)); } else if (typeof(T) == typeof(EquipAttribute)) { EquipAttribute bb = new EquipAttribute(); bb._barr = this._barr; bb._pos = this._pos; bb.reading(); this._pos = bb._pos; tt = (T)Convert.ChangeType(bb, typeof(T)); } else if (typeof(T) == typeof(CSHorseInfo)) { CSHorseInfo bb = new CSHorseInfo(); bb._barr = this._barr; bb._pos = this._pos; bb.reading(); this._pos = bb._pos; tt = (T)Convert.ChangeType(bb, typeof(T)); } else if (typeof(T) == typeof(UseInfoBean)) { UseInfoBean bb = new UseInfoBean(); bb._barr = this._barr; bb._pos = this._pos; bb.reading(); this._pos = bb._pos; tt = (T)Convert.ChangeType(bb, typeof(T)); } else if (typeof(T) == typeof(CosmicGateBean)) { CosmicGateBean bb = new CosmicGateBean(); bb._barr = this._barr; bb._pos = this._pos; bb.reading(); this._pos = bb._pos; tt = (T)Convert.ChangeType(bb, typeof(T)); } else if (typeof(T) == typeof(ItemInfo)) { ItemInfo bb = new ItemInfo(); bb._barr = this._barr; bb._pos = this._pos; bb.reading(); this._pos = bb._pos; tt = (T)Convert.ChangeType(bb, typeof(T)); } else if (typeof(T) == typeof(Position)) { Position bb = new Position(); bb._barr = this._barr; bb._pos = this._pos; bb.reading(); this._pos = bb._pos; tt = (T)Convert.ChangeType(bb, typeof(T));// } else if (typeof(T) == typeof(SoulfactInfo)) { SoulfactInfo bb = new SoulfactInfo(); bb._barr = this._barr; bb._pos = this._pos; bb.reading(); this._pos = bb._pos; tt = (T)Convert.ChangeType(bb, typeof(T));//DetailActivityInfo } else if (typeof(T) == typeof(DetailActivityInfo)) { DetailActivityInfo bb = new DetailActivityInfo(); bb._barr = this._barr; bb._pos = this._pos; bb.reading(); this._pos = bb._pos; tt = (T)Convert.ChangeType(bb, typeof(T));//MainTaskInfo } else if (typeof(T) == typeof(ImageDescrypt.Entity.MainTaskInfo)) { ImageDescrypt.Entity.MainTaskInfo bb = new ImageDescrypt.Entity.MainTaskInfo(); bb._barr = this._barr; bb._pos = this._pos; bb.reading(); this._pos = bb._pos; tt = (T)Convert.ChangeType(bb, typeof(T));// } else { tt = default(T); ConsoleLog.Instance.writeInformationLog("Class can't be read=" + typeof(T).ToString()); } /* * Type type = Type.GetType(className); * T ib = type.Assembly.CreateInstance(className) as T; */ //T tt = new T(); //Bean _loc2_ = (Bean)Convert.ChangeType(tt, typeof(Bean)); //_loc2_._barr = this._barr; //_loc2_._pos = this._pos; //_loc2_.reading(); //this._pos = _loc2_._pos; return((T)Convert.ChangeType(tt, typeof(T))); }