Exemplo n.º 1
0
        private void btnPackU8WithIMET_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog fld = new FolderBrowserDialog();
            fld.Description = Messages[94];

            if (fld.ShowDialog() == DialogResult.OK)
            {
                SaveFileDialog sfd = new SaveFileDialog();
                sfd.Filter = "U8|*.bin; *.app; *.bnr; *.u8; *.arc|*.*|*.*";
                sfd.FileName = fld.SelectedPath.Remove(0, fld.SelectedPath.LastIndexOf('\\') + 1) + ".bin";

                if (sfd.ShowDialog() == DialogResult.OK)
                {
                    try
                    {
                        int[] sizes = new int[3];
                        byte[] u8 = Wii.U8.PackU8(fld.SelectedPath, out sizes[0], out sizes[1], out sizes[2]);

                        if (sizes[0] > 0 && sizes[1] > 0 && sizes[2] > 0)
                        {
                            ChannelNameDialog cnd = new ChannelNameDialog();
                            cnd.btnCancelText = Messages[27];
                            cnd.FormCaption = Messages[123];

                            if (cnd.ShowDialog() == DialogResult.OK)
                            {
                                string[] channeltitles = cnd.Titles;
                                u8 = Wii.U8.AddHeaderIMET(u8, channeltitles, sizes);
                                Wii.Tools.SaveFileFromByteArray(u8, sfd.FileName);
                                InfoBox(Messages[124]);
                            }
                        }
                        else
                        {
                            Wii.Tools.SaveFileFromByteArray(u8, sfd.FileName);
                            InfoBox(Messages[125].Replace("<s>", "\r\n"));
                        }
                    }
                    catch (Exception ex) { ErrorBox(ex.Message); }
                }
            }
        }
Exemplo n.º 2
0
        private void cmChannelName_Click(object sender, EventArgs e)
        {
            if (lvWads.SelectedItems.Count == 1)
            {
                if (!lvWads.SelectedItems[0].SubItems[8].Text.Contains("System:") || !lvWads.SelectedItems[0].SubItems[8].Text.Contains("Hidden"))
                {
                    if (File.Exists(ckey) || File.Exists(key))
                    {
                        string wadfile = lvWads.SelectedItems[0].Group.Tag.ToString() + "\\" + lvWads.SelectedItems[0].Text;
                        string[] oldtitles = Wii.WadInfo.GetChannelTitles(lvWads.SelectedItems[0].Group.Tag.ToString() + "\\" + lvWads.SelectedItems[0].Text);

                        if (oldtitles[1].Length != 0)
                        {
                            string[] oldvalues = new string[] { oldtitles[0], oldtitles[1], oldtitles[2], oldtitles[3], oldtitles[4], oldtitles[5], oldtitles[6], oldtitles[7] };
                            ChannelNameDialog cld = new ChannelNameDialog();
                            cld.FormCaption = Messages[73];
                            cld.btnCancelText = Messages[27];
                            cld.Titles = oldtitles;
                            cld.ShowDialog();

                            if (cld.DialogResult == DialogResult.OK)
                            {
                                string[] newtitles = cld.Titles;
                                bool[] samesame = new bool[] { true, true, true, true, true, true, true, true };

                                for (int z = 0; z < 8; z++)
                                {
                                    if (oldvalues[z] != newtitles[z])
                                    {
                                        samesame[z] = false;
                                    }
                                }

                                if (samesame[0] != true || samesame[1] != true || samesame[2] != true || samesame[3] != true || samesame[4] != true || samesame[5] != true || samesame[6] != true || samesame[7] != true)
                                {
                                    Cursor.Current = Cursors.WaitCursor;
                                    CreateBackup(wadfile);

                                    Wii.WadEdit.ChangeChannelTitle(wadfile, newtitles);
                                    lvWads.SelectedItems[0].Remove();
                                    SaveList();
                                    LoadNew();

                                    Cursor.Current = Cursors.Default;
                                }
                            }
                        }
                        else
                        {
                            ErrorBox(Messages[75]);
                        }
                    }
                    else
                    {
                        InfoBox(Messages[52], Messages[53]);
                    }
                }
                else
                {
                    ErrorBox(Messages[62]);
                }

                pbProgress.Value = 100;
            }
        }