Esempio n. 1
0
 public void LoadTdrBin(byte[] rawData, System.Type InValueType)
 {
     if (rawData.Length > 0x88)
     {
         TdrReadBuf  srcBuf = new TdrReadBuf(ref rawData, rawData.Length);
         TResHeadAll all    = new TResHeadAll();
         all.load(ref srcBuf);
         int iCount = all.mHead.iCount;
         DebugHelper.Assert(iCount < 0x186a0, "有这么恐怖吗,超过10w条配置数据。。。。");
         for (int i = 0; i < iCount; i++)
         {
             tsf4g_csharp_interface data = Activator.CreateInstance(InValueType) as tsf4g_csharp_interface;
             object[] inParameters       = new object[] { InValueType.Name };
             DebugHelper.Assert(data != null, "Failed Create Object, Type:{0}", inParameters);
             data.load(ref srcBuf, 0);
             long dataKey = this.GetDataKey(data, InValueType);
             try
             {
                 this.mapItems.Add(dataKey, data);
             }
             catch (ArgumentException exception)
             {
                 DebugHelper.Assert(false, exception.Message);
                 object[] objArray2 = new object[] { dataKey, this.Name, InValueType.Name };
                 DebugHelper.Assert(false, "RecordTable<{2}>.LoadTdrBin: Key Repeat: {0}, DataBinName:{1}", objArray2);
             }
         }
     }
     else
     {
         Debug.Log("RecordTable<T>.LoadTdrBin:read record error! file length is zero. ");
     }
 }
Esempio n. 2
0
 public void LoadTdrBin(byte[] rawData)
 {
     if (rawData.Length > 136)
     {
         TdrReadBuf  tdrReadBuf  = new TdrReadBuf(ref rawData, rawData.Length);
         TResHeadAll tResHeadAll = new TResHeadAll();
         tResHeadAll.load(ref tdrReadBuf);
         int iCount = tResHeadAll.mHead.iCount;
         for (int i = 0; i < iCount; i++)
         {
             T t = Activator.CreateInstance <T>();
             t.load(ref tdrReadBuf, 0u);
             long dataKey = this.GetDataKey(t);
             this.mapItems.Add(dataKey, t);
         }
     }
     else
     {
         Debug.Log("RecordTable<T>.LoadTdrBin:read record error! file length is zero. ");
     }
 }
Esempio n. 3
0
 public void LoadTdrBin(byte[] rawData, Type InValueType)
 {
     if (rawData.Length > 136)
     {
         TdrReadBuf  tdrReadBuf  = new TdrReadBuf(ref rawData, rawData.Length);
         TResHeadAll tResHeadAll = new TResHeadAll();
         tResHeadAll.load(ref tdrReadBuf);
         int iCount = tResHeadAll.mHead.iCount;
         DebugHelper.Assert(iCount < 100000, "有这么恐怖吗,超过10w条配置数据。。。。");
         for (int i = 0; i < iCount; i++)
         {
             tsf4g_csharp_interface tsf4g_csharp_interface = Activator.CreateInstance(InValueType) as tsf4g_csharp_interface;
             DebugHelper.Assert(tsf4g_csharp_interface != null, "Failed Create Object, Type:{0}", new object[]
             {
                 InValueType.get_Name()
             });
             tsf4g_csharp_interface.load(ref tdrReadBuf, 0u);
             long dataKey = this.GetDataKey(tsf4g_csharp_interface, InValueType);
             try
             {
                 this.mapItems.Add(dataKey, tsf4g_csharp_interface);
             }
             catch (ArgumentException var_6_A3)
             {
                 DebugHelper.Assert(false, "RecordTable<{2}>.LoadTdrBin: Key Repeat: {0}, DataBinName:{1}", new object[]
                 {
                     dataKey,
                     this.Name,
                     InValueType.get_Name()
                 });
             }
         }
     }
     else
     {
         Debug.Log("RecordTable<T>.LoadTdrBin:read record error! file length is zero. ");
     }
 }