Exemple #1
0
        public static UnitDatabasePool getUnitDatabasePool()
        {
            if (singleton == null)
            {
                singleton = new UnitDatabasePool();

                singleton.paths = PathFinder.getPathFinder();

                readDictionaries();
                readIcons();
            }

            return(singleton);
        }
Exemple #2
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;
            }
        }
Exemple #3
0
        private static void readDictionaries()
        {
            EdataManager dataManager2 = new EdataManager(singleton.paths.getZzPath());

            try {
                dataManager2.ParseEdataFile();
            }
            catch (System.IO.IOException) {
                Program.warning("IOException thrown, could not parse " + singleton.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.");
                singleton = null;
            }

            singleton.dict = null;
            try {
                singleton.dict = dataManager2.ReadDictionary(UNITES_DIC);
            }
            catch (Exception) {
                Program.warning("Failed reading ZZ_Win.dat. May have selected an incomplete one - try pointing settings.ini to a complete ZZ_Win.dat file.");
                singleton = null;
            }
        }
Exemple #4
0
        public Form1(String defaultGameVersion, List <String> gameVersions, bool checkUpdates)
        {
            unitDatabase = UnitDatabasePool.getUnitDatabasePool().getUnitDatabase(this, defaultGameVersion);

            InitializeComponent();

            versionDropdown.DataSource   = gameVersions;
            versionDropdown.SelectedItem = defaultGameVersion;

            countrySelect.DataSource = unitDatabase.getAllCountries();

            List <String> categories = new List <String>(unitDatabase.categories);

            categories.Sort();
            categories.Insert(0, ALL);
            categorySelect.DataSource = categories;
            autoUpdate = checkUpdates;

            // Manually register these handlers beause their execution order is important
            unitList.SelectedIndexChanged             += unitList_SelectedIndexChanged;
            weaponDropdownSimple.SelectedIndexChanged += weaponDropdownSimple_SelectedIndexChanged;
            weaponDropdown.SelectedIndexChanged       += weaponDropdown_SelectedIndexChanged;
            customQueryInput.TextChanged += customQueryInput_TextChanged;
        }
Exemple #5
0
 private void versionDropdown_SelectedIndexChanged(object sender, EventArgs e)
 {
     unitDatabase = UnitDatabasePool.getUnitDatabasePool().getUnitDatabase(this, versionDropdown.GetItemText(versionDropdown.SelectedItem));
 }