Пример #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. ");
     }
 }
Пример #2
0
        public TdrError.ErrorType construct(long selector)
        {
            TdrError.ErrorType     result = TdrError.ErrorType.TDR_NO_ERROR;
            tsf4g_csharp_interface tsf4g_csharp_interface = this.select(selector);

            if (tsf4g_csharp_interface != null)
            {
                return(tsf4g_csharp_interface.construct());
            }
            if (selector == 0L)
            {
                this.iNilCmd = 0;
            }
            else if (selector == 1L)
            {
                if (this.szStrCmd == null)
                {
                    this.szStrCmd = new byte[64];
                }
            }
            else if (selector == 2L)
            {
                this.iIntCmd = 0;
            }
            return(result);
        }
Пример #3
0
        public TdrError.ErrorType construct(long selector)
        {
            TdrError.ErrorType     type       = TdrError.ErrorType.TDR_NO_ERROR;
            tsf4g_csharp_interface _interface = this.select(selector);

            if (_interface != null)
            {
                return(_interface.construct());
            }
            if (selector == 0)
            {
                this.iNilCmd = 0;
                return(type);
            }
            if (selector == 1L)
            {
                if (this.szStrCmd == null)
                {
                    this.szStrCmd = new byte[0x40];
                }
                return(type);
            }
            if (selector == 2L)
            {
                this.iIntCmd = 0;
            }
            return(type);
        }
Пример #4
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. ");
     }
 }