Beispiel #1
0
        public void ReloadContents()
        {
            var bodyWatch   = new Stopwatch();
            var stringWatch = new Stopwatch();

            bodyWatch.Start();
            Body   = new DBCBody();
            Reader = new DBCReader(_filePath);
            var name    = Path.GetFileNameWithoutExtension(_filePath);
            var binding = BindingManager.GetInstance().FindBinding(name);

            if (binding == null)
            {
                throw new Exception($"Binding not found: {name}.txt");
            }
            Header = Reader.ReadDBCHeader();
            Reader.ReadDBCRecords(Body, name);
            bodyWatch.Stop();
            stringWatch.Start();
            Reader.ReadStringBlock();
            stringWatch.Stop();
            var totalElapsed = stringWatch.ElapsedMilliseconds + bodyWatch.ElapsedMilliseconds;

            Console.WriteLine(
                $"Loaded {name}.dbc into memory in {totalElapsed}ms. Records: {bodyWatch.ElapsedMilliseconds}ms, strings: {stringWatch.ElapsedMilliseconds}ms");
        }
 protected void ReadDBCFile <RecordType>(string filePath)
 {
     Reader = new DBCReader(filePath);
     Header = Reader.ReadDBCHeader();
     Reader.ReadDBCRecords <RecordType>(Body, Marshal.SizeOf(typeof(RecordType)));
     Reader.ReadStringBlock();
 }
Beispiel #3
0
        public void ReloadContents()
        {
            Body   = new DBCBody();
            Reader = new DBCReader(_filePath);
            var name    = Path.GetFileNameWithoutExtension(_filePath);
            var binding = BindingManager.GetInstance().FindBinding(name);

            if (binding == null)
            {
                throw new Exception($"Binding not found: {name}.txt");
            }
            Header = Reader.ReadDBCHeader();
            Reader.ReadDBCRecords(Body, name);
            Reader.ReadStringBlock();
        }