1
0
mirror of synced 2025-01-19 09:17:30 +01:00

Adjust compression menus to disable sub menus not functional yet

This commit is contained in:
KillzXGaming 2020-06-09 18:06:14 -04:00
parent 605d08bd46
commit c29f44dbbc

View File

@ -19,32 +19,33 @@ namespace Toolbox.Library.IO
private List<ToolStripMenuItem> MenuItems() private List<ToolStripMenuItem> MenuItems()
{ {
var items = new List<ToolStripMenuItem>(); var items = new List<ToolStripMenuItem>();
items.Add(CreateMenu("Yaz0"));
items.Add(new ToolStripMenuItem("Yaz0")); items.Add(CreateMenu("Gzip"));
items.Add(new ToolStripMenuItem("Gzip")); items.Add(CreateMenu("LZSS", false));
items.Add(new ToolStripMenuItem("LZSS")); items.Add(CreateMenu("lZMA"));
items.Add(new ToolStripMenuItem("lZMA")); items.Add(CreateMenu("lZ4"));
items.Add(new ToolStripMenuItem("lZ4")); items.Add(CreateMenu("lZ4F"));
items.Add(new ToolStripMenuItem("lZ4F")); items.Add(CreateMenu("ZSTD"));
items.Add(new ToolStripMenuItem("ZSTD")); items.Add(CreateMenu("ZLIB"));
items.Add(new ToolStripMenuItem("ZLIB")); items.Add(CreateMenu("ZLIB_GZ (Hyrule Warriors)"));
items.Add(new ToolStripMenuItem("ZLIB_GZ (Hyrule Warriors)"));
SetFunctions(items);
return items; return items;
} }
private void SetFunctions(List<ToolStripMenuItem> items)
private ToolStripMenuItem CreateMenu(string text, bool canCompress = true)
{ {
foreach (var item in items) var item = new ToolStripMenuItem(text);
item.DropDownItems.AddRange(FunctionItems()); item.DropDownItems.AddRange(FunctionItems(canCompress));
return item;
} }
private ToolStripItem[] FunctionItems()
private ToolStripItem[] FunctionItems(bool canCompress)
{ {
var items = new List<ToolStripItem>(); var items = new List<ToolStripItem>();
items.Add(new ToolStripMenuItem("Decompress", null, Decompress)); items.Add(new ToolStripMenuItem("Decompress", null, Decompress));
items.Add(new ToolStripMenuItem("Compress", null, Compress)); items.Add(new ToolStripMenuItem("Compress", null, Compress) { Enabled = canCompress });
return items.ToArray(); return items.ToArray();
} }
private void Decompress(object sender, EventArgs e) private void Decompress(object sender, EventArgs e)
{ {
ToolStripMenuItem curMenu = sender as ToolStripMenuItem; ToolStripMenuItem curMenu = sender as ToolStripMenuItem;