Beispiel #1
0
        public void LoadMapInfo()
        {
            try
            {
                // Just a lazy way to validate the BLF file
                _blf = new PureBLF(_blfLocation);
                if (_blf.BLFChunks[1].ChunkMagic != "levl")
                    throw new Exception("The selected Map Info BLF is not a valid Map Info BLF file.");
                _blf.Close();

                _mapInfo = new MapInfo(_blfLocation);

                Dispatcher.Invoke(new Action(delegate
                {
                    // Add BLF Info
                    paneBLFInfo.Children.Insert(0, new Components.MapHeaderEntry("BLF Length:", "0x" + _mapInfo.Stream.Length.ToString("X8")));
                    paneBLFInfo.Children.Insert(1, new Components.MapHeaderEntry("BLF Chunks:", _blf.BLFChunks.Count.ToString()));

                    // Load Languages
                    LoadLanguages(_mapInfo.MapInformation.Game);

                    // Add Map Info
                    switch (_mapInfo.MapInformation.Game)
                    {
                        case MapInfo.GameIdentifier.Halo3:
                            txtGameName.Text = "Halo 3";
                            break;
                        case MapInfo.GameIdentifier.Halo3ODST:
                            txtGameName.Text = "Halo 3: ODST";
                            break;
                        case MapInfo.GameIdentifier.HaloReach:
                            txtGameName.Text = "Halo Reach";
                            break;
                        case MapInfo.GameIdentifier.Halo4:
                            txtGameName.Text = "Halo 4";
                            break;
                    }
                    txtMapID.Text = _mapInfo.MapInformation.MapID.ToString();
                    lblBLFNameFooter.Text = lblBLFname.Text = txtMapInternalName.Text = _mapInfo.MapInformation.InternalName;
                    txtMapPhysicalName.Text = _mapInfo.MapInformation.PhysicalName;

                    // Update UI
                    cbLanguages.SelectedIndex = 0;

                    if (Settings.startpageHideOnLaunch)
                        Settings.homeWindow.ExternalTabClose(Windows.Home.TabGenre.StartPage);

                    RecentFiles.AddNewEntry(new FileInfo(_blfLocation).Name, _blfLocation, "Map Info", Settings.RecentFileType.MapInfo);

                    _startEditing = true;
                }));
            }
            catch (Exception ex)
            {
                Dispatcher.Invoke(new Action(delegate
                {
                    MetroMessageBox.Show("Unable to open MapInfo", ex.Message.ToString());
                    Settings.homeWindow.ExternalTabClose((TabItem)this.Parent);
                }));
            }
        }
Beispiel #2
0
        // Load Languages
        private void LoadLanguages(MapInfo.GameIdentifier gameIdent)
        {
            if (gameIdent == MapInfo.GameIdentifier.Halo4)
            {
                // TODO: Add the new Halo 4 Languages
            }

            cbLanguages.DataContext = _languages;
        }