Пример #1
0
        public static void Main(string[] args)
        {
            LogUtil.SetupConsoleLogging();
            TerrainDisplayConfig.Initialize();
            NativeMethods.StormLibFolder = TerrainDisplayConfig.LibDir;
            NativeMethods.InitAPI();

            WDTExtractor.ExportAll();
        }
Пример #2
0
        static void Main(string[] args)
        {
            Version = Assembly.GetExecutingAssembly().GetName().Version;
            SetDefaultTitle();
            PrintHeader();

            if (!DBCExtractor.ExtractDBC())
            {
                Console.WriteLine("Unable to extract DBC files, exiting...");
                Console.ReadLine();
                Environment.Exit(0);
            }

            if (!DBCStorage.Initialize())
            {
                Console.WriteLine("Unable to initialize DBC Storage, exiting...");
                Console.ReadLine();
                Environment.Exit(0);
            }

            List <string> WDTFiles;

            if (!WDTExtractor.ExtractWDTFiles(out WDTFiles))
            {
                Console.WriteLine("Unable to extract WDT files, exiting...");
                Console.ReadLine();
                Environment.Exit(0);
            }

            // For test only, extract only Azeroth.
            // TODO: We need to process, build map files, and release memory ASAP.
            // Right now, loading all data we are parsing would result in around 10gb.

            //Begin loading all wdt information.
            if (!Globals.LoadAsync)
            {
                foreach (var wdt in WDTFiles)
                {
                    var map = new CMapObj(wdt, null);
                    map.LoadData();
                    LoadedMaps.Add(map);
                    break;
                }
            }
            else
            {
                foreach (var wdt in WDTFiles)
                {
                    AsyncMapLoader loadMapTask = new AsyncMapLoader(wdt);
                    loadMapTask.OnMapLoaded += OnMapLoaded;
                    loadMapTask.RunWorkerAsync();
                    break;
                }
            }

            Console.ReadLine();
        }
Пример #3
0
        private static void StartProcess()
        {
            Version = Assembly.GetExecutingAssembly().GetName().Version;
            SetDefaultTitle();
            PrintHeader();

            try
            {
                // Extract Map.dbc and AreaTable.dbc
                if (!DBCExtractor.ExtractDBC())
                {
                    Logger.Error("Unable to extract DBC files, exiting...");
                    Console.ReadLine();
                    Environment.Exit(0);
                }

                // Load both files in memory.
                if (!DBCStorage.Initialize())
                {
                    Logger.Error("Unable to initialize DBC Storage, exiting...");
                    Console.ReadLine();
                    Environment.Exit(0);
                }

                // Extract available maps inside MPQ
                Dictionary <DBCMap, string> WDTFiles;
                if (!WDTExtractor.ExtractWDTFiles(out WDTFiles))
                {
                    Logger.Error("Unable to extract WDT files, exiting...");
                    Console.ReadLine();
                    Environment.Exit(0);
                }

                // Flush .map files output dir.
                Directory.Delete(Paths.OutputMapsPath, true);

                //Begin parsing adt files and generate .map files.
                foreach (var entry in WDTFiles)
                {
                    using (CMapObj map = new CMapObj(entry.Key, entry.Value)) // Key:DbcMap Value:FilePath
                    {
                        MapFilesGenerator.GenerateMapFiles(map);
                        LoadedMaps.Add(entry.Key);
                    }

                    GC.Collect(GC.MaxGeneration, GCCollectionMode.Forced, true);
                }

                WDTFiles?.Clear();
                Console.WriteLine();
                Logger.Success("Process Complete, press any key to exit...");
            }
            catch (Exception ex)
            {
                Logger.Error(ex.Message);
                Logger.Error(ex.StackTrace);
            }
            finally
            {
                IsRunning = false;
            }
        }