public bool CollectDataFromBinary(string file)
        {
            long        t1     = TimeUtility.Instance.GetElapsedTimeUs();
            bool        result = true;
            BinaryTable table  = new BinaryTable();

            table.Load(HomePath.Instance.GetAbsolutePath(file));
            long t2 = TimeUtility.Instance.GetElapsedTimeUs();

            long t3 = TimeUtility.Instance.GetElapsedTimeUs();

            for (int index = 0; index < table.Records.Count; ++index)
            {
                try
                {
                    TData data = new TData();
                    bool  ret  = data.CollectDataFromBinary(table, index);
                    if (ret && !m_DataContainer.ContainsKey(data.GetId()))
                    {
                        m_DataContainer.Add(data.GetId(), data);
                    }
                    else
                    {
                        string info = string.Format("DataTempalteMgr.CollectDataFromBinary collectData Row:{0} failed!", index);
                        LogUtil.Error(info);
                        LogUtil.CallStack();
                        result = false;
                    }
                }
                catch (System.Exception ex)
                {
                    LogUtil.Error("CollectData failed. file:{0} rowIndex:{1}\nException:{2}\n{3}", file, index, ex.Message, ex.StackTrace);
                }
            }
            long t4 = TimeUtility.Instance.GetElapsedTimeUs();

            LogUtil.Info("binary load {0} parse {1}, file {2}", t2 - t1, t4 - t3, file);
            return(result);
        }
Esempio n. 2
0
 public static float SetValue(BinaryTable table, float val, float defaultVal)
 {
     return(val);
 }
Esempio n. 3
0
 public static int SetValue(BinaryTable table, int val, int defaultVal)
 {
     return(val);
 }
Esempio n. 4
0
 public static int SetValue(BinaryTable table, long val, long defaultVal)
 {
     return((int)val);
 }
Esempio n. 5
0
 public static int SetValue(BinaryTable table, bool val, bool defaultVal)
 {
     return(val ? 1 : 0);
 }
Esempio n. 6
0
 public static bool ExtractBool(BinaryTable table, int recordVal, bool defaultVal)
 {
     return(recordVal != 0);
 }
Esempio n. 7
0
 public static float ExtractFloat(BinaryTable table, float recordVal, float defaultVal)
 {
     return(recordVal);
 }
Esempio n. 8
0
 public static long ExtractLong(BinaryTable table, int recordVal, long defaultVal)
 {
     return(recordVal);
 }
Esempio n. 9
0
 public static int ExtractInt(BinaryTable table, int recordVal, int defaultVal)
 {
     return(recordVal);
 }