示例#1
0
        private void btnCustomCode_Click(object sender, EventArgs e)
        {
            var cit = lvIsos.SelectedRows[0];
            var bmi = new BootMenuItem(
                cit.Cells[0].Value?.ToString() ?? "",
                cit.Cells[3].Value?.ToString() ?? "",
                selectediline().EntryType,
                cit.Cells[4].Value?.ToString() ?? "")
            {
                Start = false
            };

            var cod = SelectedBootloader().GetCode(bmi);

            var edfrm = new EditCodeFrm("/images/" + Path.GetFileName(cit.Cells[4].Value.ToString()))
            {
                Code = cod
            };

            if (edfrm.ShowDialog(this) == DialogResult.OK)
            {
                lvIsos.SelectedRows[0].Cells[5].Value = edfrm.Code == cod ? "" : edfrm.Code;
                CurImages.First(x => x.Name == cit.Cells[0].Value.ToString()).CustomCode =
                    lvIsos.SelectedRows[0].Cells[5].Value.ToString();
            }
        }
示例#2
0
        public override string GetCode(BootMenuItem item)
        {
            if (item.CustomCode != "")
            {
                return(item.CustomCode);
            }

            var code = "";

            code += "title " + item.Name.RemoveAccent() + "\\n";

            code += item.Description.RemoveAccent().Trim().Replace("\r\n", "\n").Replace("\n", "\\n") + "\n";

            switch (item.Type)
            {
            case EntryType.BootHDD:
                code += "map (hd0) (hd1)\n";
                code += "map (hd1) (hd0)\n";
                code += "map --hook\n";
                code += "chainloader (hd0,0)\n";
                break;

            case EntryType.Category:
                code += "configfile /boot/grub4dos/" + item.IsoName + ".lst\n";
                break;

            case EntryType.ISO:
                code +=
                    string.Format(
                        "ls /images/{0} || find --set-root /images/{0}\nmap /images/{0} (0xff)\nmap --hook\nroot (0xff)\nchainloader (0xff)\n",
                        item.IsoName);
                break;

            case EntryType.IMG:
                code +=
                    string.Format(
                        "ls /images/{0} || find --set-root /images/{0}\nmap /images/{0} (fd0)\nmap --hook\nchainloader (fd0)+1\nrootnoverify (fd0)\n",
                        item.IsoName);
                break;

            case EntryType.NTLDR:
            case EntryType.GRLDR:
            case EntryType.CMLDR:
            case EntryType.FreeDOS:
            case EntryType.MS_DOS:
            case EntryType.MS_DOS_7:
            case EntryType.PC_DOS:
            case EntryType.DRMK:
            case EntryType.ReactOS:
                code += string.Format(
                    "ls /images/{0} || find --set-root /Images/{0}\nchainloader /images/{0}\n",
                    item.IsoName);
                break;
            }

            code += "\n";

            return(code);
        }
示例#3
0
        public override string GetCode(BootMenuItem item)
        {
            if (item.CustomCode != "") return item.CustomCode;

            var code = "";

            code += "LABEL -\n";
            switch (item.Type)
            {
                case EntryType.BootHDD:
                    code += "localboot 0x80\n";
                    break;
                case EntryType.Category:
                    code += "KERNEL /boot/syslinux/vesamenu.c32\n";
                    code += "APPEND /boot/syslinux/" + item.IsoName + ".cfg\n";
                    break;
                case EntryType.ISO:
                    code += "LINUX /boot/syslinux/grub.exe\n";
                    code +=
                        string.Format(
                            "APPEND --config-file=\"ls /images/{0} || find --set-root /images/{0};map /images/{0} (0xff);map --hook;root (0xff);chainloader (0xff);boot\"\n",
                            item.IsoName);
                    break;
                case EntryType.IMG:
                    code += "LINUX /boot/syslinux/grub.exe\n";
                    code +=
                        string.Format(
                            "APPEND --config-file=\"ls /images/{0} || find --set-root /images/{0};map /images/{0} (fd0);map --hook;chainloader (fd0)+1;rootnoverify (fd0);boot\"\n",
                            item.IsoName);
                    break;
                case EntryType.NTLDR:
                    code += "COM32 /boot/syslinux/chain.c32\n";
                    code += "APPEND ntldr=/images/" + item.IsoName + "\n";
                    break;
                case EntryType.GRLDR:
                    code += "COM32 /boot/syslinux/chain.c32\n";
                    code += "APPEND grldr=/images/" + item.IsoName + "\n";
                    break;
                case EntryType.CMLDR:
                    code += "COM32 /boot/syslinux/chain.c32\n";
                    code += "APPEND cmldr=/images/" + item.IsoName + "\n";
                    break;
                case EntryType.FreeDOS:
                    code += "COM32 /boot/syslinux/chain.c32\n";
                    code += "APPEND freedos=/images/" + item.IsoName + "\n";
                    break;
                case EntryType.MS_DOS:
                    code += "COM32 /boot/syslinux/chain.c32\n";
                    code += "APPEND msdos=/images/" + item.IsoName + "\n";
                    break;
                case EntryType.MS_DOS_7:
                    code += "COM32 /boot/syslinux/chain.c32\n";
                    code += "APPEND msdos7=/images/" + item.IsoName + "\n";
                    break;
                case EntryType.PC_DOS:
                    code += "COM32 /boot/syslinux/chain.c32\n";
                    code += "APPEND pcdos=/images/" + item.IsoName + "\n";
                    break;
                case EntryType.DRMK:
                    code += "COM32 /boot/syslinux/chain.c32\n";
                    code += "APPEND drmk=/images/" + item.IsoName + "\n";
                    break;
                case EntryType.ReactOS:
                    code += "COM32 /boot/syslinux/chain.c32\n";
                    code += "APPEND reactos=/images/" + item.IsoName + "\n";
                    break;
            }

            code += "MENU LABEL " + item.Name.RemoveAccent() + "\n";

            if (item.Start)
            {
                code += "MENU START\n";
                code += "MENU DEFAULT\n";
            }

            code += "TEXT HELP\n";
            code += splitwidth(item.Description.RemoveAccent(), 78) + "\n";
            code += "ENDTEXT\n";

            return code;
        }
示例#4
0
        public override string GetCode(BootMenuItem item)
        {
            if (item.CustomCode != "") return item.CustomCode;

            var code = "";

            code += "menuentry \"" + item.Name.RemoveAccent() + "\" {\n";

            if (item.Type == EntryType.BootHDD)
            {
                code += "insmod part_msdos\n";
                code += "insmod chain\n";
                code += "chainloader (hd0,0)\n";
            }
            else if(item.Type == EntryType.Category)
            {
  code += "configfile /win32-loader/" + item.IsoName + ".cfg\n";
            }
            else
            {
                code += $"search -f \"--set-root /images/{item.IsoName}\"\n";
                switch (item.Type)
                {
                    case EntryType.ISO:
                        code += $"drivemap \"/images/{item.IsoName}\" '(hd32)'\ndrivemap '--hook' ''\nset root='(hd32)'\nchainloader +1\n";
                        break;
                    case EntryType.IMG:
                        code += $"linux /memdisk\ninitrd /images/{item.IsoName}\n";
                        break;
                    case EntryType.NTLDR:
                        code += $"insmod part_msdos\ninsmod ntldr\ninsmod ntfs\nntldr /images/{item.IsoName}";
                        break;
                    case EntryType.GRLDR:
                    case EntryType.CMLDR:
                    case EntryType.FreeDOS:
                    case EntryType.MS_DOS:
                    case EntryType.MS_DOS_7:
                    case EntryType.PC_DOS:
                    case EntryType.DRMK:
                    case EntryType.ReactOS:
                        code += string.Format(
                            "ls /images/{0} || find --set-root /images/{0}\nchainloader /images/{0}\n",
                            item.IsoName);
                        break;
                }
            }

            code += "}\n";

            return code;
        }
示例#5
0
        public override string GetCode(BootMenuItem item)
        {
            if (item.CustomCode != "") return item.CustomCode;

            var code = "";

            code += "title " + item.Name.RemoveAccent() + "\\n";

            code += item.Description.RemoveAccent().Trim().Replace("\r\n", "\n").Replace("\n", "\\n") + "\n";

            switch (item.Type)
            {
                case EntryType.BootHDD:
                    code += "map (hd0) (hd1)\n";
                    code += "map (hd1) (hd0)\n";
                    code += "map --hook\n";
                    code += "chainloader (hd0,0)\n";
                    break;
                case EntryType.Category:
                    code += "configfile /boot/grub4dos/" + item.IsoName + ".lst\n";
                    break;
                case EntryType.ISO:
                    code +=
                        string.Format(
                            "ls /images/{0} || find --set-root /images/{0}\nmap /images/{0} (0xff)\nmap --hook\nroot (0xff)\nchainloader (0xff)\n",
                            item.IsoName);
                    break;
                case EntryType.IMG:
                    code +=
                        string.Format(
                            "ls /images/{0} || find --set-root /images/{0}\nmap /images/{0} (fd0)\nmap --hook\nchainloader (fd0)+1\nrootnoverify (fd0)\n",
                            item.IsoName);
                    break;
                case EntryType.NTLDR:
                case EntryType.GRLDR:
                case EntryType.CMLDR:
                case EntryType.FreeDOS:
                case EntryType.MS_DOS:
                case EntryType.MS_DOS_7:
                case EntryType.PC_DOS:
                case EntryType.DRMK:
                case EntryType.ReactOS:
                    code += string.Format(
                        "ls /images/{0} || find --set-root /Images/{0}\nchainloader /images/{0}\n",
                        item.IsoName);
                    break;
            }

            code += "\n";

            return code;
        }
示例#6
0
 public abstract string GetCode(BootMenuItem item);
示例#7
0
        private void btnCustomCode_Click(object sender, EventArgs e)
        {
            var cit = lvIsos.SelectedRows[0];
            var bmi = new BootMenuItem(
                cit.Cells[0].Value?.ToString() ?? "",
                cit.Cells[3].Value?.ToString() ?? "",
                selectediline().EntryType,
                cit.Cells[4].Value?.ToString() ?? "") {Start = false};

            var cod = SelectedBootloader().GetCode(bmi);

            var edfrm = new EditCodeFrm("/images/" + Path.GetFileName(cit.Cells[4].Value.ToString())) {Code = cod};
            if (edfrm.ShowDialog(this) == DialogResult.OK)
            {
                lvIsos.SelectedRows[0].Cells[5].Value = edfrm.Code == cod ? "" : edfrm.Code;
                CurImages.First(x => x.Name == cit.Cells[0].Value.ToString()).CustomCode =
                    lvIsos.SelectedRows[0].Cells[5].Value.ToString();
            }
        }
示例#8
0
        public override string GetCode(BootMenuItem item)
        {
            if (item.CustomCode != "")
            {
                return(item.CustomCode);
            }

            var code = "";

            code += "menuentry \"" + item.Name.RemoveAccent() + "\" {\n";

            switch (item.Type)
            {
            case EntryType.BootHDD:
                code += "insmod part_msdos\n";
                code += "insmod chain\n";
                code += "chainloader (hd0,0)\n";
                break;

            case EntryType.Category:
                code += "configfile /boot/grub/" + item.IsoName + ".cfg\n";
                break;

            default:
                code += $"search --file --set root --no-floppy \"/images/{item.IsoName}\"\n";
                switch (item.Type)
                {
                case EntryType.ISO:
                    code += string.Format("set opt='ls /images/{0} || find --set-root /images/{0};map /images/{0} (0xff);map --hook;root (0xff);chainloader (0xff);boot\"'\n", item.IsoName);
                    code += "linux /boot/grub/grub.exe --config-file=$opt\n";
                    break;

                case EntryType.IMG:
                    code += $"linux16 /boot/grub/memdisk\ninitrd16 /images/{item.IsoName}\n";
                    break;

                case EntryType.NTLDR:
                    code += $"insmod part_msdos\ninsmod ntldr\ninsmod ntfs\nntldr /images/{item.IsoName}";
                    break;

                case EntryType.GRLDR:
                case EntryType.CMLDR:
                case EntryType.FreeDOS:
                case EntryType.MS_DOS:
                case EntryType.MS_DOS_7:
                case EntryType.PC_DOS:
                case EntryType.DRMK:
                case EntryType.ReactOS:
                    code += string.Format(
                        "set opt='ls /images/{0} || find --set-root /images/{0};chainloader /images/{0};boot'\n",
                        item.IsoName);
                    code += "linux /boot/grub/grub.exe --config-file=$opt\n";
                    break;
                }
                break;
            }

            code += "}\n";

            return(code);
        }
示例#9
0
 public abstract string GetCode(BootMenuItem item);
示例#10
0
        public override string GetCode(BootMenuItem item)
        {
            if (item.CustomCode != "")
            {
                return(item.CustomCode);
            }

            var code = "";

            code += "LABEL -\n";
            switch (item.Type)
            {
            case EntryType.BootHDD:
                code += "localboot 0x80\n";
                break;

            case EntryType.Category:
                code += "KERNEL /boot/syslinux/vesamenu.c32\n";
                code += "APPEND /boot/syslinux/" + item.IsoName + ".cfg\n";
                break;

            case EntryType.ISO:
                code += "LINUX /boot/syslinux/grub.exe\n";
                code +=
                    string.Format(
                        "APPEND --config-file=\"ls /images/{0} || find --set-root /images/{0};map /images/{0} (0xff);map --hook;root (0xff);chainloader (0xff);boot\"\n",
                        item.IsoName);
                break;

            case EntryType.IMG:
                code += "LINUX /boot/syslinux/grub.exe\n";
                code +=
                    string.Format(
                        "APPEND --config-file=\"ls /images/{0} || find --set-root /images/{0};map /images/{0} (fd0);map --hook;chainloader (fd0)+1;rootnoverify (fd0);boot\"\n",
                        item.IsoName);
                break;

            case EntryType.NTLDR:
                code += "COM32 /boot/syslinux/chain.c32\n";
                code += "APPEND ntldr=/images/" + item.IsoName + "\n";
                break;

            case EntryType.GRLDR:
                code += "COM32 /boot/syslinux/chain.c32\n";
                code += "APPEND grldr=/images/" + item.IsoName + "\n";
                break;

            case EntryType.CMLDR:
                code += "COM32 /boot/syslinux/chain.c32\n";
                code += "APPEND cmldr=/images/" + item.IsoName + "\n";
                break;

            case EntryType.FreeDOS:
                code += "COM32 /boot/syslinux/chain.c32\n";
                code += "APPEND freedos=/images/" + item.IsoName + "\n";
                break;

            case EntryType.MS_DOS:
                code += "COM32 /boot/syslinux/chain.c32\n";
                code += "APPEND msdos=/images/" + item.IsoName + "\n";
                break;

            case EntryType.MS_DOS_7:
                code += "COM32 /boot/syslinux/chain.c32\n";
                code += "APPEND msdos7=/images/" + item.IsoName + "\n";
                break;

            case EntryType.PC_DOS:
                code += "COM32 /boot/syslinux/chain.c32\n";
                code += "APPEND pcdos=/images/" + item.IsoName + "\n";
                break;

            case EntryType.DRMK:
                code += "COM32 /boot/syslinux/chain.c32\n";
                code += "APPEND drmk=/images/" + item.IsoName + "\n";
                break;

            case EntryType.ReactOS:
                code += "COM32 /boot/syslinux/chain.c32\n";
                code += "APPEND reactos=/images/" + item.IsoName + "\n";
                break;
            }

            code += "MENU LABEL " + item.Name.RemoveAccent() + "\n";

            if (item.Start)
            {
                code += "MENU START\n";
                code += "MENU DEFAULT\n";
            }

            code += "TEXT HELP\n";
            code += splitwidth(item.Description.RemoveAccent(), 78) + "\n";
            code += "ENDTEXT\n";

            return(code);
        }