Ejemplo n.º 1
0
        public void testInit()
        {
            EdataManager dataManager = new EdataManager(NDF_PATH);

            dataManager.ParseEdataFile();
            NdfbinManager everything = dataManager.ReadNdfbin(EVERYTHING_NDFBIN);

            List <NdfObject> unitInstances = everything.GetClass("TUniteAuSolDescriptor").Instances;

            // setup localisation/unites.dic reader
            EdataManager dataManager2 = new EdataManager(ZZ_PATH);

            dataManager2.ParseEdataFile();
            TradManager dict = dataManager2.ReadDictionary(UNITES_DIC);

            // unit icons
            EdataManager zz4File = new EdataManager(ZZ4_PATH);

            zz4File.ParseEdataFile();
            EdataManager iconPackage = zz4File.ReadPackage(ICON_PACKAGE);

            UnitDatabase unitDatabase = new UnitDatabase(unitInstances, dict, iconPackage, PACT_ICONS_DIRPREFIX, NATO_ICONS_DIRPREFIX);

            List <String> countries = unitDatabase.getAllCountries();

            CollectionAssert.AllItemsAreUnique(countries);
            Assert.IsTrue(countries.Count > 0);
        }
Ejemplo n.º 2
0
        public void LoadTGVFromZZ4()
        {
            string zz4 = @"C:\Users\mja\Documents\perso\mods\ZZ_4.dat";

            EdataManager zz4File = new EdataManager(zz4);

            zz4File.ParseEdataFile();

            string filename = @"pc\texture\assets\2d\interface\common\unitsicons\cs\m8_losat_upb.tgv";

            string       ICON_PACKAGE = @"pc\texture\pack\commoninterface.ppk";
            EdataManager pack         = zz4File.ReadPackage(ICON_PACKAGE);


            Bitmap bitmap = null;

            Assert.IsTrue(pack.TryToLoadTgv(filename, out bitmap));
            Assert.IsNotNull(bitmap);
            bitmap.Save("UnitDXT1.png");
        }
Ejemplo n.º 3
0
        private static void readIcons()
        {
            EdataManager zz4File = new EdataManager(singleton.paths.getZz4Path());

            try {
                zz4File.ParseEdataFile();
            }
            catch (System.IO.IOException) {
                Program.warning("IOException thrown, could not parse " + singleton.paths.getZz4Path()
                                + ".\nIf wargame is running, you'll have to close it to use the tool. You can avoid this by copying the files listed in settings.ini and then editing settings.ini to point to the copies.");
                singleton = null;
            }

            singleton.iconPackage = null;
            try {
                singleton.iconPackage = zz4File.ReadPackage(ICON_PACKAGE);
            }
            catch (Exception) {
                Program.warning("Failed reading ZZ_4.dat. May have selected an incomplete one - try pointing settings.ini to a complete ZZ_4.dat file.");
                singleton = null;
            }
        }
Ejemplo n.º 4
0
 public bool TryGetPackFileFromFolder(string folder, string filename, string packfile, out EdataManager pack)
 {
     pack = null;
     DirectoryInfo folderInfo = new DirectoryInfo(folder);
     FileInfo[] fileInfos = folderInfo.GetFiles(filename, SearchOption.TopDirectoryOnly);
     if (fileInfos.Length <= 0)
         return false;
     EdataManager dataManager = new EdataManager(fileInfos[0].FullName);
     dataManager.ParseEdataFile();
     try
     {
         pack = dataManager.ReadPackage(packfile);
         return true;
     }
     catch
     {
     }
     return false;
 }
Ejemplo n.º 5
0
        static void Main()
        {
            // Print all uncaught exceptions.
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(
                delegate(Object sender, UnhandledExceptionEventArgs e) {
                warning(e.ExceptionObject.ToString());
            }
                );

            // Free resources before exiting.
            AppDomain.CurrentDomain.ProcessExit += new EventHandler(cleanup);

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            PathFinder paths = new PathFinder();

            // setup everything.ndfbin reader
            // EdataManager dataManager = new EdataManager(AppDomain.CurrentDomain.BaseDirectory + "NDF_Win.dat");
            EdataManager dataManager = new EdataManager(paths.getNdfPath());

            try {
                dataManager.ParseEdataFile();
            }
            catch (System.IO.IOException) {
                warning("IOException thrown, could not parse " + paths.getNdfPath()
                        + ".\nIf wargame is running, you'll have to close it to use the tool. You can avoid this by copying the files listed in settings.ini and then editing settings.ini to point to the copies.");
                Application.Exit();
                Environment.Exit(0);
            }
            NdfbinManager everything = dataManager.ReadNdfbin(EVERYTHING_NDFBIN);

            List <NdfObject> unitInstances = everything.GetClass("TUniteAuSolDescriptor").Instances;

            // setup localisation/unites.dic reader
            EdataManager dataManager2 = new EdataManager(paths.getZzPath());

            try {
                dataManager2.ParseEdataFile();
            }
            catch (System.IO.IOException) {
                warning("IOException thrown, could not parse " + paths.getZzPath()
                        + ".\nIf wargame is running, you'll have to close it to use the tool. You can avoid this by copying the files listed in settings.ini and then editing settings.ini to point to the copies.");
                Application.Exit();
                Environment.Exit(0);
            }

            TradManager dict = null;

            try {
                dict = dataManager2.ReadDictionary(UNITES_DIC);
            } catch (Exception) {
                warning("Failed reading ZZ_Win.dat. May have selected an incomplete one - try pointing settings.ini to a complete ZZ_Win.dat file.");
                Application.Exit();
                Environment.Exit(0);
            }

            // unit icons
            EdataManager zz4File = new EdataManager(paths.getZz4Path());

            try {
                zz4File.ParseEdataFile();
            }
            catch (System.IO.IOException) {
                warning("IOException thrown, could not parse " + paths.getZz4Path()
                        + ".\nIf wargame is running, you'll have to close it to use the tool. You can avoid this by copying the files listed in settings.ini and then editing settings.ini to point to the copies.");
                Application.Exit();
                Environment.Exit(0);
            }

            EdataManager iconPackage = null;

            try {
                iconPackage = zz4File.ReadPackage(ICON_PACKAGE);
            } catch (Exception) {
                warning("Failed reading ZZ_4.dat. May have selected an incomplete one - try pointing settings.ini to a complete ZZ_4.dat file.");
                Application.Exit();
                Environment.Exit(0);
            }

            UnitDatabase unitDatabase = new UnitDatabase(unitInstances, dict, iconPackage, PACT_ICONS_DIRPREFIX, NATO_ICONS_DIRPREFIX);

            Application.Run(new Form1(unitDatabase, paths.autoUpdate));
        }