diff options
| author | Michael VanOverbeek <[email protected]> | 2017-06-11 11:57:31 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2017-06-11 11:57:31 +0000 |
| commit | 997a81457ebb6d6523c36ca552cee143e0d92244 (patch) | |
| tree | da98985ced112b6d238811f3ca770014d67e34fc /ShiftOS.WinForms/Applications/IconManager.cs | |
| parent | 0d75f701778a0900a58343c4c80c124279bc231f (diff) | |
| parent | 107a98686a105468b5f200ebcbd27343c1210ce4 (diff) | |
| download | shiftos_thereturn-997a81457ebb6d6523c36ca552cee143e0d92244.tar.gz shiftos_thereturn-997a81457ebb6d6523c36ca552cee143e0d92244.tar.bz2 shiftos_thereturn-997a81457ebb6d6523c36ca552cee143e0d92244.zip | |
Merge pull request #129 from RogueAI42/master
ReflectMan Saves The Day..............
Diffstat (limited to 'ShiftOS.WinForms/Applications/IconManager.cs')
| -rw-r--r-- | ShiftOS.WinForms/Applications/IconManager.cs | 99 |
1 files changed, 40 insertions, 59 deletions
diff --git a/ShiftOS.WinForms/Applications/IconManager.cs b/ShiftOS.WinForms/Applications/IconManager.cs index 0c6e119..7bbeb34 100644 --- a/ShiftOS.WinForms/Applications/IconManager.cs +++ b/ShiftOS.WinForms/Applications/IconManager.cs @@ -92,70 +92,51 @@ namespace ShiftOS.WinForms.Applications { flbody.Controls.Clear(); //Clear the icon list. - List<Type> types = new List<Type>(); + Type[] types = Array.FindAll(ReflectMan.Types, x => x.GetCustomAttributes(false).FirstOrDefault(y => y is DefaultIconAttribute) != null); - foreach(var exe in System.IO.Directory.GetFiles(Environment.CurrentDirectory)) - { - if(exe.ToLower().EndsWith(".exe") || exe.ToLower().EndsWith(".dll")) - { - try - { - var asm = Assembly.LoadFile(exe); + pageCount = types.GetPageCount(pageSize); - var typeList = asm.GetTypes().Where(x => x.GetCustomAttributes(false).FirstOrDefault(y => y is DefaultIconAttribute) != null); - types.AddRange(typeList); - - } - catch { } - } - } - - pageCount = types.ToArray().GetPageCount(pageSize); - - foreach (var type in types.ToArray().GetItemsOnPage(currentPage, pageSize)) + foreach (var type in Array.FindAll(types.GetItemsOnPage(currentPage, pageSize), t => Shiftorium.UpgradeAttributesUnlocked(t))) { - if (Shiftorium.UpgradeAttributesUnlocked(type)) + var pnl = new Panel(); + pnl.Height = 30; + pnl.Width = flbody.Width - 15; + flbody.Controls.Add(pnl); + pnl.Show(); + var pic = new PictureBox(); + pic.SizeMode = PictureBoxSizeMode.StretchImage; + pic.Size = new Size(24, 24); + pic.Image = GetIcon(type.Name); + pnl.Controls.Add(pic); + pic.Left = 5; + pic.Top = (pnl.Height - pic.Height) / 2; + pic.Show(); + var lbl = new Label(); + lbl.Tag = "header3"; + lbl.AutoSize = true; + lbl.Text = NameChangerBackend.GetNameRaw(type); + ControlManager.SetupControl(lbl); + pnl.Controls.Add(lbl); + lbl.CenterParent(); + lbl.Show(); + var btn = new Button(); + btn.Text = "Change..."; + btn.AutoSize = true; + btn.AutoSizeMode = AutoSizeMode.GrowAndShrink; + pnl.Controls.Add(btn); + btn.Left = (pnl.Width - btn.Width) - 5; + btn.Top = (pnl.Height - btn.Height) / 2; + btn.Click += (o, a) => { - var pnl = new Panel(); - pnl.Height = 30; - pnl.Width = flbody.Width - 15; - flbody.Controls.Add(pnl); - pnl.Show(); - var pic = new PictureBox(); - pic.SizeMode = PictureBoxSizeMode.StretchImage; - pic.Size = new Size(24, 24); - pic.Image = GetIcon(type.Name); - pnl.Controls.Add(pic); - pic.Left = 5; - pic.Top = (pnl.Height - pic.Height) / 2; - pic.Show(); - var lbl = new Label(); - lbl.Tag = "header3"; - lbl.AutoSize = true; - lbl.Text = NameChangerBackend.GetNameRaw(type); - ControlManager.SetupControl(lbl); - pnl.Controls.Add(lbl); - lbl.CenterParent(); - lbl.Show(); - var btn = new Button(); - btn.Text = "Change..."; - btn.AutoSize = true; - btn.AutoSizeMode = AutoSizeMode.GrowAndShrink; - pnl.Controls.Add(btn); - btn.Left = (pnl.Width - btn.Width) - 5; - btn.Top = (pnl.Height - btn.Height) / 2; - btn.Click += (o, a) => + var gfp = new GraphicPicker(pic.Image, lbl.Text + " icon", ImageLayout.Stretch, (raw, img, layout) => { - var gfp = new GraphicPicker(pic.Image, lbl.Text + " icon", ImageLayout.Stretch, (raw, img, layout) => - { - pic.Image = img; - SetIcon(type.Name, raw); - }); - AppearanceManager.SetupDialog(gfp); - }; - btn.Show(); - ControlManager.SetupControls(pnl); - } + pic.Image = img; + SetIcon(type.Name, raw); + }); + AppearanceManager.SetupDialog(gfp); + }; + btn.Show(); + ControlManager.SetupControls(pnl); } btnnext.Visible = (currentPage < pageCount - 1); |
