aboutsummaryrefslogtreecommitdiff
path: root/source/WindowsFormsApplication1/IconManager.cs
diff options
context:
space:
mode:
authorMichaelTheShifter <[email protected]>2016-06-25 08:10:03 -0400
committerMichaelTheShifter <[email protected]>2016-06-25 08:10:03 -0400
commit84f689b91a73e512b035df40bbcf556b008a3b81 (patch)
treeda1020b2b5866c7ce300ac7b9c97112fe80fa1b3 /source/WindowsFormsApplication1/IconManager.cs
parent6707e2076a63dafab686fd533c95fb8ceb6c23fa (diff)
downloadshiftos-c--84f689b91a73e512b035df40bbcf556b008a3b81.tar.gz
shiftos-c--84f689b91a73e512b035df40bbcf556b008a3b81.tar.bz2
shiftos-c--84f689b91a73e512b035df40bbcf556b008a3b81.zip
Sort source code into folders.
It feels better to know what's responsible for what... Plus I removed some un-needed C# stuff.
Diffstat (limited to 'source/WindowsFormsApplication1/IconManager.cs')
-rw-r--r--source/WindowsFormsApplication1/IconManager.cs125
1 files changed, 0 insertions, 125 deletions
diff --git a/source/WindowsFormsApplication1/IconManager.cs b/source/WindowsFormsApplication1/IconManager.cs
deleted file mode 100644
index 2ffa24a..0000000
--- a/source/WindowsFormsApplication1/IconManager.cs
+++ /dev/null
@@ -1,125 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Drawing;
-using System.IO;
-using System.IO.Compression;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows.Forms;
-
-namespace ShiftOS
-{
- public partial class IconManager : Form
- {
- public IconManager()
- {
- InitializeComponent();
- }
-
- private void IconManager_Load(object sender, EventArgs e)
- {
- GetAllIcons();
- }
-
- public void GetAllIcons()
- {
- pnlicons.Controls.Clear();
- pnlicons.Margin = new Padding(0);
- foreach(var kv in API.IconRegistry)
- {
- var ctrl = new IconControl();
- ctrl.Margin = new Padding(0);
- ctrl.IconName = kv.Key;
- ctrl.LargeImage = kv.Value;
- pnlicons.Controls.Add(ctrl);
- ctrl.Show();
- }
- }
-
- private void btnsave_Click(object sender, EventArgs e)
- {
- foreach (Control ctrl in pnlicons.Controls)
- {
- try
- {
- IconControl ic = (IconControl)ctrl;
- Skinning.Utilities.IconRegistry[ic.IconName] = ic.LargeImage;
- }
- catch
- {
- IconControl ic = (IconControl)ctrl;
- Skinning.Utilities.IconRegistry.Add(ic.IconName, ic.LargeImage);
- }
- }
-
- var rnd = new Random();
- int cp = rnd.Next(0, 10);
- Skinning.Utilities.saveimages();
- API.AddCodepoints(cp);
- if(API.CurrentSession != null)
- {
- API.CurrentSession.SetupAppLauncher();
- API.CurrentSession.SetupDesktopIcons();
- }
- GetAllIcons();
- API.CreateInfoboxSession("Icon pack set.", $"Your icon pack has been set successfully. You have earned {cp} Codepoints.", infobox.InfoboxMode.Info);
- }
-
- private void button2_Click(object sender, EventArgs e)
- {
- API.CreateFileSkimmerSession(".icn", File_Skimmer.FileSkimmerMode.Save);
- API.FileSkimmerSession.FormClosing += (object s, FormClosingEventArgs a) =>
- {
- var res = API.GetFSResult();
- if(res != "fail")
- {
- ZipFile.CreateFromDirectory(Paths.Icons, res);
- }
- };
- }
-
- private void button1_Click(object sender, EventArgs e)
- {
- API.CreateFileSkimmerSession(".icn", File_Skimmer.FileSkimmerMode.Open);
- API.FileSkimmerSession.FormClosing += (object s, FormClosingEventArgs a) =>
- {
- var res = API.GetFSResult();
- if (res != "fail")
- {
- if(Directory.Exists(Paths.Mod_Temp + "icn"))
- {
- Directory.Delete(Paths.Mod_Temp + "icn", true);
- }
- ZipFile.ExtractToDirectory(res, Paths.Mod_Temp + "icn");
- foreach (var f in Directory.GetFiles(Paths.Mod_Temp + "icn"))
- {
- var finf = new FileInfo(f);
- try
- {
- var bytes = File.ReadAllBytes(finf.FullName);
- using (var stream = new MemoryStream(bytes))
- {
- API.IconRegistry[finf.Name] = Image.FromStream(stream);
- }
- }
- catch
- {
- API.IconRegistry.Add(finf.Name, Image.FromFile(finf.FullName));
- }
- finf = null;
- }
- if (API.CurrentSession != null)
- {
- API.CurrentSession.SetupAppLauncher();
- API.CurrentSession.SetupDesktopIcons();
- }
- GetAllIcons();
- Directory.Delete(Paths.Mod_Temp + "icn", true);
- }
- };
- }
- }
-}