The map form.
상속: System.Windows.Forms.Form
예제 #1
0
        public WinMetaEditor(MapForm sender, HaloMap.Map.Map map)
        {
            InitializeComponent();

            this.map = map;
            this.Owner = sender;
            mapForm = sender;
            this.Text = map.filePath.Substring(map.filePath.LastIndexOf('\\') + 1).ToUpper();
        }
예제 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MetaItemComparer"/> class.
        /// </summary>
        /// <param name="currentForm">The current form.</param>
        /// <remarks></remarks>
        public MetaItemComparer(MapForm currentForm)
        {
            Map map = currentForm.map;

            int counter = 0;
            for (counter = 0; counter < map.MapHeader.fileCount; counter++)
            {
                currentForm.SetProgressBar(counter * 100 / map.MapHeader.fileCount);

                ifpMeta = new Meta(map);
                manualMeta = new Meta(map);
                manualMeta.ReadMetaFromMap(counter, false);
                ifpMeta.ReadMetaFromMap(counter, false);

                // parse ifp and scan meta with it
                try
                {
                    IFPIO io = IFPHashMap.GetIfp(ifpMeta.type, map.HaloVersion);

                    ifpMeta.headersize = io.headerSize;
                    manualMeta.headersize = io.headerSize;
                    try
                    {
                        ifpMeta.scanner.ScanWithIFP(ref io);
                    }
                    catch (Exception ex)
                    {
                        Global.ShowErrorMsg("Broken IFP - " + ifpMeta.type, ex);
                    }

                    manualMeta.scanner.ScanManually();
                    check(map);
                }
                catch (Exception ex)
                {
                    Globals.Global.ShowErrorMsg(string.Empty, ex);
                }

            }

            currentForm.SetProgressBar(0);
        }
예제 #3
0
        /// <summary>
        /// Attempts to load a mapand bring up a map form for
        /// it. Function will fail if the map is corrupt and
        /// display an error message. Provide a null string to
        /// show openfileDialog. Returns a refernce to the created mapform
        /// if needed
        /// </summary>
        /// <param name="mapFileName">The map File Name.</param>
        /// <returns></returns>
        /// <remarks></remarks>
        public MapForm TryLoadMapForm(string mapFileName)
        {
            // Only allow for 10 map forms to be open at any one time, for
            // memory reasons
            if (MapCount >= 10)
            {
                MessageBox.Show("Too many maps open, close a map.");
                return null;
            }

            // show a dialog if null filename
            if (mapFileName == null)
            {
                openmapdialog.InitialDirectory = Prefs.pathMapsFolder;
                // if the user cancels out the dialog, no map to open
                if (openmapdialog.ShowDialog() == DialogResult.Cancel)
                {
                    return null;
                }
                Prefs.pathMapsFolder = openmapdialog.InitialDirectory;

                // set the file name to user chosen file
                mapFileName = openmapdialog.FileName;
            }

            // Check map isn't already loaded into a map form
            foreach (MapForm mapForm in this.MdiChildren)
            {
                if (mapForm.map.filePath == mapFileName)
                {
                    MessageBox.Show("This map is already open in this editor!..");
                    return mapForm;
                }
            }

            // Show a wait cursor while map is loading
            this.Cursor = Cursors.WaitCursor;

            // Attempt to load the map
            Map newMap = Map.LoadFromFile(mapFileName);
            // Restore our arrow cursor after map is loaded
            this.Cursor = Cursors.Arrow;
            // map failed to load for some reason
            if (newMap == null)
            {
                MessageBox.Show("Map failed to load...");
                return null;
            }

            // Show a wait cursor while map is loading
            this.Cursor = Cursors.WaitCursor;
            // create a map form for the map
            MapForm newMapForm = new MapForm(newMap);
            // Restore our arrow cursor after map is loaded
            this.Cursor = Cursors.Arrow;

            // set it to a child of this main form
            newMapForm.MdiParent = this;

            // keep track of open maps
            MapCount++;
            if (MapCount > 0)
            {
                closemapmenu.Enabled = true;
            }

            // store map in recent list
            UpdateRecentFiles(mapFileName);

            // give the form a close event
            newMapForm.FormClosed += newMapForm_FormClosed;
            // show form
            newMapForm.Show();

            return newMapForm;
        }
예제 #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Rebuilder"/> class.
 /// </summary>
 /// <param name="mapForm">The map form.</param>
 /// <remarks></remarks>
 public Rebuilder(MapForm mapForm)
 {
     this.map = mapForm.map;
     InitializeComponent();
     Application.DoEvents();
     mapForm.formFuncs.AddMetasToTreeView(map, treeView1, MapForm.FormFunctions.MetaView.FolderView, true);
 }