示例#1
0
        private static async Task <ParsedDBCFile <TDBCEntryType> > ParseDBCFile <TDBCEntryType>(string filePath, Stopwatch watch) where TDBCEntryType : IDBCEntryIdentifiable
        {
            ParsedDBCFile <TDBCEntryType> dbc = null;

            using (FileStream fileStream = new FileStream(filePath, FileMode.Open, FileAccess.Read))
            {
                DBCEntryReader <TDBCEntryType> reader = new DBCEntryReader <TDBCEntryType>(fileStream, new NullLogger <DBCEntryReader <TDBCEntryType> >());

                watch.Start();
                dbc = await reader.Parse();
            }

            return(dbc);
        }
        private static async Task <ParsedDBCFile <TDBCEntryType> > ParseDBCFile <TDBCEntryType>(string filePath, Stopwatch watch) where TDBCEntryType : IDBCEntryIdentifiable
        {
            ParsedDBCFile <TDBCEntryType> dbc = null;

            using (FileStream fileStream = new FileStream(filePath, FileMode.Open, FileAccess.Read))
            {
                SerializerService serializer = new SerializerService();
                foreach (Type t in DBCEntryReader.RequiredSerializeableTypes)
                {
                    serializer.RegisterType(t);
                }

                serializer.RegisterType <TDBCEntryType>();
                serializer.Compile();

                DBCEntryReader <TDBCEntryType> reader = new DBCEntryReader <TDBCEntryType>(fileStream, serializer);

                watch.Start();
                dbc = await reader.Parse();
            }

            return(dbc);
        }