Пример #1
0
        private void importThisWithPalBtn_Click(object sender, EventArgs e)
        {
            if (!(imageListBox.SelectedItem is PalettedImage))
            {
                MessageBox.Show(this, LanguageManager.Get("ImageManager", "noImageSelected")); return;
            }
            if (!(paletteListBox.SelectedItem is Palette))
            {
                MessageBox.Show(this, LanguageManager.Get("ImageManager", "noPaletteSelected")); return;
            }

            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Filter = LanguageManager.Get("Filters", "png");
            if (ofd.ShowDialog(this) == DialogResult.Cancel)
            {
                return;
            }

            Bitmap b = new Bitmap(ofd.FileName);

            (imageListBox.SelectedItem as PalettedImage).replaceImgAndPal(b, paletteListBox.SelectedItem as Palette);
            b.Dispose();
            updateImage();
        }
Пример #2
0
        private void editLevelButton_Click(object sender, EventArgs e)
        {
            // Make a caption
            string EditorCaption = "";

            if (levelTreeView.SelectedNode.Parent.Parent == null)
            {
                EditorCaption += levelTreeView.SelectedNode.Text;
            }
            else
            {
                EditorCaption += levelTreeView.SelectedNode.Parent.Text + ", " + levelTreeView.SelectedNode.Text;
            }

            // Open it
            try
            {
                LevelEditor NewEditor = new LevelEditor(new NSMBLevel(new InternalLevelSource((string)levelTreeView.SelectedNode.Tag, EditorCaption)));
                NewEditor.Show();
            }
            catch (AlreadyEditingException)
            {
                MessageBox.Show(LanguageManager.Get("Errors", "Level"));
            }
        }
Пример #3
0
        public bool export()
        {
            checkStuff();

            SaveFileDialog ofd = new SaveFileDialog();

            ofd.Filter = LanguageManager.Get("Filters", "png");
            if (ofd.ShowDialog(win) == DialogResult.Cancel)
            {
                return(false);
            }
            calcSizes();


            Bitmap   b    = new Bitmap(tx, ty);
            Graphics bgfx = Graphics.FromImage(b);
            int      x    = 0;

            foreach (PixelPalettedImage img in imgs)
            {
                int y = 0;
                foreach (Palette pal in pals)
                {
                    Bitmap bb = img.render(pal);
                    bgfx.DrawImage(bb, x, y, bb.Width, bb.Height);
                    bb.Dispose();
                    y += tys;
                }
                x += img.getWidth();
            }

            b.Save(ofd.FileName);
            b.Dispose();
            return(true);
        }
Пример #4
0
        public ExportedLevel(System.IO.BinaryReader br)
        {
            string Header = br.ReadString();

            if (!(Header == fileHeader || Header == oldFileHeader))
            {
                throw new Exception(LanguageManager.Get("NSMBLevel", "InvalidFile"));
            }

            ushort FileVersion = br.ReadUInt16();

            if (FileVersion > version)
            {
                throw new Exception(LanguageManager.Get("NSMBLevel", "OldVersion"));
            }

            LevelFileID = br.ReadUInt16();
            BGDatFileID = br.ReadUInt16();
            int LevelFileLength = br.ReadInt32();

            LevelFile = br.ReadBytes(LevelFileLength);

            int BGFileLength = br.ReadInt32();

            BGDatFile = br.ReadBytes(BGFileLength);
        }
Пример #5
0
        private void hexEditLevelButton_Click(object sender, EventArgs e)
        {
            if (levelTreeView.SelectedNode == null)
            {
                return;
            }

            // Make a caption
            string EditorCaption = LanguageManager.Get("General", "EditingSomething") + " ";

            if (levelTreeView.SelectedNode.Parent.Parent == null)
            {
                EditorCaption += levelTreeView.SelectedNode.Text;
            }
            else
            {
                EditorCaption += levelTreeView.SelectedNode.Parent.Text + ", " + levelTreeView.SelectedNode.Text;
            }

            // Open it
            try
            {
                LevelHexEditor NewEditor = new LevelHexEditor((string)levelTreeView.SelectedNode.Tag);
                NewEditor.Text = EditorCaption;
                NewEditor.Show();
            }
            catch (AlreadyEditingException)
            {
                MessageBox.Show(LanguageManager.Get("Errors", "Level"));
            }
        }
Пример #6
0
        private void updateParamTypeAndData()
        {
            List <ParamTypes> paramTypes = effectiveParamTypes(currentFlags, currentSubType);

            useParamType(paramTypes[0]);
            refreshParamData();

            if (paramTypes.Count == 1)
            {
                string typeName = LanguageManager.Get("BehaviorEditor",
                                                      "type_" + getInternalLangNameForParamType(paramTypes[0]));

                paramsLabel.Text = string.Format(
                    LanguageManager.Get("BehaviorEditor", "params_normal"),
                    typeName);
            }
            else
            {
                string[] typeNames = new string[paramTypes.Count];
                for (int i = 0; i < paramTypes.Count; i++)
                {
                    typeNames[i] = LanguageManager.Get("BehaviorEditor",
                                                       "type_" + getInternalLangNameForParamType(paramTypes[i]));
                }

                paramsLabel.Text = string.Format(
                    LanguageManager.Get("BehaviorEditor", "params_conflict"),
                    string.Join(", ", typeNames));
            }
        }
Пример #7
0
        public void load()
        {
            SelectTool(ToolType.Brush);

            hoverStatus.Text = "";
            imageStatus.Text = string.Format(LanguageManager.Get("GraphicsEditor", "imageStatus"), 8, img.getWidth(), img.getHeight());
        }
Пример #8
0
        private void SetZoomLevel(int zoom)
        {
            if (img == null || pal == null)
            {
                return;
            }
            ZoomLevel       = zoom;
            drawingBox.Size = new Size(img.getWidth() * zoom, img.getHeight() * zoom);
            ViewWidth       = drawingBox.Width; ViewHeight = drawingBox.Height;
            RenderZoomCache();

            zoomIn.Enabled         = true;
            zoomActualSize.Enabled = true;
            zoomOut.Enabled        = true;

            if (zoom == 1)
            {
                zoomActualSize.Enabled = false;
                zoomOut.Enabled        = false;
            }

            if (zoom == 8)
            {
                zoomIn.Enabled = false;
            }

            zoomLabel.Text = string.Format(LanguageManager.Get("GraphicsEditor", "zoomLabel"), ZoomLevel * 100);

            drawingBox.Invalidate();
        }
Пример #9
0
 private void deleteDescriptions_Click(object sender, EventArgs e)
 {
     if (!descExists)
     {
         return;
     }
     if (MessageBox.Show(LanguageManager.Get("TilesetEditor", "sureDelDescriptions"), LanguageManager.Get("TilesetEditor", "titleDelDescriptions"), MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.No)
     {
         return;
     }
     ROM.UserInfo.descriptions.Remove(TilesetID);
     createDescriptions.Visible           = true;
     deleteDescriptions.Visible           = false;
     tilesetObjectEditor1.descBox.Visible = false;
     tilesetObjectEditor1.descLbl.Visible = false;
     if (TilesetID != 65535) // The Jyotyu tileset
     {
         t.UseNotes = false;
     }
     else //Restore the original notes
     {
         t.ObjNotes = NSMBGraphics.GetDescriptions(LanguageManager.GetList("ObjNotes"));
     }
     descExists = false;
     objectPickerControl1.Invalidate(true);
 }
Пример #10
0
        void objectHovered(NSMBObject obj)
        {
            if (obj == hover)
            {
                return;
            }
            hover = obj;

            if (obj == null)
            {
                toolTip1.Hide(this);
            }
            else
            {
                int x = Width - 16;
                int y = obj.Y * 16 - 8 + obj.Height * 8 - vScrollBar1.Value;
                toolTip1.ToolTipTitle = LanguageManager.Get("ObjectPickerControl", "Object") + obj.ObjNum;
                string text = "";
                if (gfx.Tilesets[tileset].UseNotes && obj.ObjNum < gfx.Tilesets[tileset].ObjNotes.Length)
                {
                    text = gfx.Tilesets[tileset].ObjNotes[obj.ObjNum];
                }

                toolTip1.Show(text + " ", this, x, y);
            }
        }
Пример #11
0
        private void exportTilesetBtn_Click(object sender, EventArgs e)
        {
            getFiles();

            if (GFXFile == null)
            {
                return;
            }
            if (PalFile == null)
            {
                return;
            }
            if (LayoutFile == null)
            {
                return;
            }

            SaveFileDialog sfd = new SaveFileDialog();

            sfd.Filter = LanguageManager.Get("Filters", "background");
            if (sfd.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            System.IO.BinaryWriter bw = new System.IO.BinaryWriter(
                new System.IO.FileStream(sfd.FileName, System.IO.FileMode.Create, System.IO.FileAccess.Write));
            bw.Write(fileHeader);
            writeFileContents(GFXFile, bw);
            writeFileContents(PalFile, bw);
            writeFileContents(LayoutFile, bw);
            bw.Close();
        }
Пример #12
0
        public ErrorMSGBox(string title = "", string text = "", string subtext = "", string error = null)
        {
            InitializeComponent();

            if (string.IsNullOrEmpty(title))
            {
                this.Text = LanguageManager.Get("SpriteData", "ErrorTitle");
            }
            else
            {
                this.Text = title;
            }

            if (!string.IsNullOrEmpty(text))
            {
                textLabel.Text = text;
            }

            if (!string.IsNullOrEmpty(subtext))
            {
                subtextLabel.Text = subtext;
            }

            if (error != null)
            {
                richTextBox1.Text = error;
            }
        }
Пример #13
0
        private void populateListBox(ListBox listBox, int maxID, string listName)
        {
            List <String> strings = LanguageManager.GetList(listName);

            listBox.BeginUpdate();
            listBox.Items.Clear();
            for (int i = 0; i < maxID; i++)
            {
                listBox.Items.Add(string.Format(LanguageManager.Get("BehaviorEditor", "unknown"), i));
            }

            foreach (string item in strings)
            {
                int where = item.IndexOf('=');

                int idx;
                if (item.StartsWith("0x"))
                {
                    idx = int.Parse(item.Substring(2, where - 2), System.Globalization.NumberStyles.AllowHexSpecifier);
                }
                else
                {
                    idx = int.Parse(item.Substring(0, where));
                }

                string text = item.Substring(where + 1);

                listBox.Items[idx] = text;
            }
            listBox.EndUpdate();
        }
Пример #14
0
        private void Xdelta_export_Click(object sender, EventArgs e)
        {
            MessageBox.Show(LanguageManager.Get("Patch", "SelectROM"), LanguageManager.Get("Patch", "XExport"), MessageBoxButtons.OK, MessageBoxIcon.Information);

            OpenFileDialog cleanROM_openFileDialog = new OpenFileDialog();

            cleanROM_openFileDialog.Title  = "Please select a clean NDS file";
            cleanROM_openFileDialog.Filter = "Nintendo DS ROM (*.nds)|*.nds|All files (*.*)|*.*";

            if (cleanROM_openFileDialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            SaveFileDialog xdelta_saveFileDialog = new SaveFileDialog();

            xdelta_saveFileDialog.Title  = "Please select where to save the XDelta";
            xdelta_saveFileDialog.Filter = "XDelta Patch (*.xdelta)|*.xdelta|All files (*.*)|*.*";

            if (xdelta_saveFileDialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            string tempROMname = "_TEMP_ProcessUnlockedROM.nds";

            try
            {
                System.IO.File.Copy(Properties.Settings.Default.ROMPath, tempROMname);

                string  str     = " -f -s \"" + cleanROM_openFileDialog.FileName + "\" \"" + tempROMname + "\" \"" + xdelta_saveFileDialog.FileName + "\"";
                Process process = new Process();
                process.StartInfo.UseShellExecute       = false;
                process.StartInfo.FileName              = "xdelta3.exe";
                process.StartInfo.Arguments             = str;
                process.StartInfo.CreateNoWindow        = true;
                process.StartInfo.RedirectStandardError = true;
                process.Start();
                string end = process.StandardError.ReadToEnd();
                if (end == "")
                {
                    MessageBox.Show("Patch created successfully!", "Success!");
                }
                else
                {
                    MessageBox.Show(end, "Something went wrong!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                process.WaitForExit();
            }
            catch (Exception ex)
            {
                MessageBox.Show("An unexpected exception has occured!\nDetails:\n" + ex, LanguageManager.Get("SpriteData", "ErrorTitle"), MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                System.IO.File.Delete(tempROMname);
            }
        }
Пример #15
0
        private void Setproperties_btn_Click(object sender, EventArgs e)
        {
            bg = (BackgroundEntry)tilesetListBox.SelectedItem;

            bool IsLevelBG = true;

            if (bg.id > 75 || bg.mappedTileset)
            {
                IsLevelBG = false;
            }
            SetBGPropertiesDialog newBg = new SetBGPropertiesDialog(bg.id, bg.name.Split(':')[1].Remove(0, 1), bg.GFXFileID, bg.PalFileID, bg.LayoutFileID, bg.BitmapOffset, bg.PaletteOffsets, IsLevelBG);

            if (newBg.Canceled)
            {
                return;
            }

            string listName = bg.topLayer ? "Foregrounds" : "Backgrounds";

            if (bg.mappedTileset)
            {
                listName = "MappedTileset";
            }

            if (string.IsNullOrWhiteSpace(newBg.bgName))
            {
                ROM.UserInfo.removeListItem(listName, bg.id, true);
                string newName = LanguageManager.GetList(listName)[bg.id];
                bool   empty   = false;
                if (string.IsNullOrWhiteSpace(newName.Split(':')[1]))
                {
                    newName += " " + LanguageManager.Get("BackgroundList", "empty");
                    empty    = true;
                }

                tilesetListBox.Items[tilesetListBox.SelectedIndex] = new BackgroundEntry(bg.topLayer, bg.id, newName, bg.mappedTileset, empty);
                return;
            }

            string NewFullName = string.Format("{0}: {1}", bg.id, newBg.bgName);

            if (!IsLevelBG)
            {
                NewFullName = string.Format("{0}: {1}@{2}@{3}@{4}@{5}@{6}@not_level_bg", bg.id, newBg.bgName, newBg.bgNCGID, newBg.bgNCLID, newBg.bgNSCID, newBg.bgBMPOffs, newBg.bgPALOffs);
            }
            else
            {
                ROM.SetFileIDFromTable(bg.id, bg.topLayer ? ROM.Data.Table_FG_NCG : ROM.Data.Table_BG_NCG, (ushort)newBg.bgNCGID);
                ROM.SetFileIDFromTable(bg.id, bg.topLayer ? ROM.Data.Table_FG_NCL : ROM.Data.Table_BG_NCL, (ushort)newBg.bgNCLID);
                ROM.SetFileIDFromTable(bg.id, bg.topLayer ? ROM.Data.Table_FG_NSC : ROM.Data.Table_BG_NSC, (ushort)newBg.bgNSCID);
            }

            ROM.UserInfo.setListItem(listName, bg.id, NewFullName, true);
            tilesetListBox.Items[tilesetListBox.SelectedIndex] = new BackgroundEntry(bg.topLayer, bg.id, NewFullName, false);
        }
Пример #16
0
 private void deleteBackups_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show((LanguageManager.Get("LevelChooser", "delbackup")), (LanguageManager.Get("LevelChooser", "delbacktitle")), MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
     {
         String backupPath = Path.Combine(Application.StartupPath, "Backup");
         if (System.IO.Directory.Exists(backupPath))
         {
             System.IO.Directory.Delete(backupPath, true);
         }
     }
 }
Пример #17
0
        private void openRomButton_Click(object sender, EventArgs e)
        {
            string path = "";

            string[] backups = null;

            if (Properties.Settings.Default.BackupFiles != "" &&
                MessageBox.Show(LanguageManager.Get("StartForm", "OpenBackups"), LanguageManager.Get("StartForm", "OpenBackupsTitle"), MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                backups = Properties.Settings.Default.BackupFiles.Split(';');
                path    = backups[0];
            }
            else
            {
                OpenFileDialog openROMDialog = new OpenFileDialog();
                openROMDialog.Filter = LanguageManager.Get("Filters", "rom");
                if (Properties.Settings.Default.ROMFolder != "")
                {
                    openROMDialog.InitialDirectory = Properties.Settings.Default.ROMFolder;
                }
                if (openROMDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    path = openROMDialog.FileName;
                }
            }

            if (path == "")
            {
                return;
            }

            try
            {
                NitroROMFilesystem fs = new NitroROMFilesystem(path);
                Properties.Settings.Default.ROMPath = path;
                Properties.Settings.Default.Save();
                Properties.Settings.Default.ROMFolder = System.IO.Path.GetDirectoryName(path);
                Properties.Settings.Default.Save();

                if (backups != null)
                {
                    for (int l = 1; l < backups.Length; l++)
                    {
                        ROM.fileBackups.Add(backups[l]);
                    }
                }

                run(fs);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Пример #18
0
        public SpriteEventsViewer(LevelEditorControl ed)
        {
            InitializeComponent();
            this.ed = ed;
            spriteTable.DataSource = spriteList;

            LanguageManager.ApplyToContainer(this, "SpriteEvents");
            this.EventID.HeaderText    = LanguageManager.Get("SpriteEvents", "EventID");
            this.SpriteNum.HeaderText  = LanguageManager.Get("SpriteEvents", "SpriteNumber");
            this.SpriteName.HeaderText = LanguageManager.Get("SpriteEvents", "SpriteName");
        }
Пример #19
0
 private void openClipboard_Click(object sender, EventArgs e)
 {
     try
     {
         new LevelEditor(new NSMBLevel(new ClipboardLevelSource())).Show();
     }
     catch (Exception ex)
     {
         MessageBox.Show(LanguageManager.Get("LevelChooser", "clipinvalidlevel"));
     }
 }
Пример #20
0
 private void editTileset_Click(object sender, EventArgs e)
 {
     try
     {
         new TilesetEditor(Level.Blocks[0][0xC], "").Show();
     }
     catch (AlreadyEditingException)
     {
         MessageBox.Show(LanguageManager.Get("Errors", "Tileset"));
     }
 }
Пример #21
0
        private void changeLanguageButton_Click(object sender, EventArgs e)
        {
            if (languageListBox.SelectedItem != null)
            {
                Properties.Settings.Default.LanguageFile = languageListBox.SelectedItem.ToString();
                Properties.Settings.Default.Save();

                MessageBox.Show(
                    LanguageManager.Get("LevelChooser", "LangChanged"),
                    LanguageManager.Get("LevelChooser", "LangChangedTitle"),
                    MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Пример #22
0
        private void exportTilesetBtn_Click(object sender, EventArgs e)
        {
            SaveFileDialog sfd = new SaveFileDialog();

            sfd.Filter = LanguageManager.Get("Filters", "tileset");
            if (sfd.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            NSMBTileset t = loadTileset(getSelectedID());

            t.exportTileset(sfd.FileName);
        }
Пример #23
0
        public bool import()
        {
            checkStuff();

            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Filter = LanguageManager.Get("Filters", "png");
            if (ofd.ShowDialog() == DialogResult.Cancel)
            {
                return(false);
            }

            calcSizes();

            Bitmap b = new Bitmap(ofd.FileName);

            if (b.Width != tx || b.Height != ty)
            {
                throw new Exception("Wrong input image size");
            }

            List <Bitmap> bl = new List <Bitmap>();

            for (int i = 0; i < pals.Count; i++)
            {
                Bitmap   bbb    = new Bitmap(b.Width, tys);
                Graphics bbbgfx = Graphics.FromImage(bbb);
                bbbgfx.DrawImage(b, 0, -i * tys, b.Width, b.Height);
                bl.Add(bbb);
            }
            b.Dispose();

            ImageIndexer ii = new ImageIndexer(bl, pals[0].pal.Length, true, 0);


            int x = 0;

            foreach (PixelPalettedImage i in imgs)
            {
                i.setPixelData(ii.imageData, x, 0);
                x += i.getWidth();
            }

            for (int i = 0; i < pals.Count; i++)
            {
                pals[i].pal = ii.palettes[i];
            }

            return(false);
        }
Пример #24
0
        private void mpPatch_Click(object sender, EventArgs e)
        {
            NarcReplace("Dat_Field.narc", "J01_1.bin");
            NarcReplace("Dat_Basement.narc", "J02_1.bin");
            NarcReplace("Dat_Ice.narc", "J03_1.bin");
            NarcReplace("Dat_Pipe.narc", "J04_1.bin");
            NarcReplace("Dat_Fort.narc", "J05_1.bin");
            NarcReplace("Dat_Field.narc", "J01_1_bgdat.bin");
            NarcReplace("Dat_Basement.narc", "J02_1_bgdat.bin");
            NarcReplace("Dat_Ice.narc", "J03_1_bgdat.bin");
            NarcReplace("Dat_Pipe.narc", "J04_1_bgdat.bin");
            NarcReplace("Dat_Fort.narc", "J05_1_bgdat.bin");

            MessageBox.Show(LanguageManager.Get("General", "Completed"));
        }
Пример #25
0
        private void importTilesetBtn_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Filter          = LanguageManager.Get("Filters", "tileset");
            ofd.CheckFileExists = true;

            if (ofd.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            NSMBTileset t = loadTileset(getSelectedID());

            t.importTileset(ofd.FileName);
        }
Пример #26
0
        private void RenameBtn_Click(object sender, EventArgs e)
        {
            string          newName;
            BackgroundEntry bg       = tilesetListBox.SelectedItem as BackgroundEntry;
            string          listName = bg.topLayer ? "Foregrounds" : "Backgrounds";

            if (textForm.ShowDialog(LanguageManager.Get("BackgroundList", "renamePrompt"), bg.name, out newName) == DialogResult.OK)
            {
                if (newName == string.Empty)
                {
                    ROM.UserInfo.removeListItem(listName, bg.id, true);
                    tilesetListBox.Items[tilesetListBox.SelectedIndex] = new BackgroundEntry(bg.topLayer, bg.id, LanguageManager.GetList(listName)[bg.id], false);
                    return;
                }
                ROM.UserInfo.setListItem(listName, bg.id, newName, true);
                tilesetListBox.Items[tilesetListBox.SelectedIndex] = new BackgroundEntry(bg.topLayer, bg.id, newName, false);
            }
        }
Пример #27
0
        public bool ForceClose()
        {
            if (Dirty)
            {
                DialogResult dr;
                dr = MessageBox.Show(LanguageManager.Get("LevelHexEditor", "UnsavedLevel"), LanguageManager.Get("General", "Question"), MessageBoxButtons.YesNoCancel, MessageBoxIcon.Information);
                if (dr == DialogResult.Yes)
                {
                    Save();
                }
                else if (dr == DialogResult.Cancel)
                {
                    return(true);
                }
            }

            return(false);
        }
Пример #28
0
        private void importTilesetBtn_Click(object sender, EventArgs e)
        {
            getFiles();

            if (GFXFile == null)
            {
                return;
            }
            if (PalFile == null)
            {
                return;
            }
            if (LayoutFile == null)
            {
                return;
            }

            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Filter          = LanguageManager.Get("Filters", "background");
            ofd.CheckFileExists = true;

            if (ofd.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            System.IO.BinaryReader br = new System.IO.BinaryReader(
                new System.IO.FileStream(ofd.FileName, System.IO.FileMode.Open, System.IO.FileAccess.Read));
            string header = br.ReadString();

            if (header != fileHeader)
            {
                MessageBox.Show(
                    LanguageManager.Get("NSMBLevel", "InvalidFile"),
                    LanguageManager.Get("NSMBLevel", "Unreadable"),
                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            readFileContents(GFXFile, br);
            readFileContents(PalFile, br);
            readFileContents(LayoutFile, br);
            br.Close();
        }
Пример #29
0
        private void setBgImageButton_Click(object sender, EventArgs e)
        {
            if (openImage.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            try
            {
                Image i = Image.FromFile(openImage.FileName, false);
                removeBgButton_Click(null, null);
                levelEditorControl1.bgImage = i;
            }
            catch (Exception ex)
            {
                MessageBox.Show(String.Format(LanguageManager.Get("LevelEditor", "ImageError"), ex.Message));
            }
            levelEditorControl1.repaint();
        }
Пример #30
0
 private void importClipboard_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show((LanguageManager.Get("LevelChooser", "replaceclipboard")), (LanguageManager.Get("LevelChooser", "replaceclipboardtitle")), MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.No)
     {
         return;
     }
     try
     {
         string               LevelFilename = (string)levelTreeView.SelectedNode.Tag;
         DSFileSystem.File    LevelFile     = ROM.getLevelFile(LevelFilename);
         DSFileSystem.File    BGFile        = ROM.getBGDatFile(LevelFilename);
         ClipboardLevelSource level         = new ClipboardLevelSource();
         level.level.Import(LevelFile, BGFile);
     }
     catch (Exception ex)
     {
         MessageBox.Show((LanguageManager.Get("LevelChooser", "clipinvalidlevel")));
     }
 }