aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS.WinForms/ShiftnetSites
diff options
context:
space:
mode:
Diffstat (limited to 'ShiftOS.WinForms/ShiftnetSites')
-rw-r--r--ShiftOS.WinForms/ShiftnetSites/AppscapeMain.cs30
-rw-r--r--ShiftOS.WinForms/ShiftnetSites/MainHomepage.cs57
-rw-r--r--ShiftOS.WinForms/ShiftnetSites/ShiftSoft_Ping.cs69
3 files changed, 55 insertions, 101 deletions
diff --git a/ShiftOS.WinForms/ShiftnetSites/AppscapeMain.cs b/ShiftOS.WinForms/ShiftnetSites/AppscapeMain.cs
index c7830d0..c9b6f64 100644
--- a/ShiftOS.WinForms/ShiftnetSites/AppscapeMain.cs
+++ b/ShiftOS.WinForms/ShiftnetSites/AppscapeMain.cs
@@ -207,33 +207,21 @@ namespace ShiftOS.WinForms.ShiftnetSites
if (result == true)
{
SaveSystem.CurrentSave.Codepoints -= upg.Cost;
- foreach (var exe in Directory.GetFiles(Environment.CurrentDirectory))
+ foreach (var type in ReflectMan.Types)
{
- if (exe.EndsWith(".exe") || exe.EndsWith(".dll"))
+ var attrib = type.GetCustomAttributes(false).FirstOrDefault(x => x is AppscapeEntryAttribute) as AppscapeEntryAttribute;
+ if (attrib != null)
{
- try
+ if (attrib.Name == upg.Name)
{
- var asm = Assembly.LoadFile(exe);
- foreach (var type in asm.GetTypes())
- {
- var attrib = type.GetCustomAttributes(false).FirstOrDefault(x => x is AppscapeEntryAttribute) as AppscapeEntryAttribute;
- if (attrib != null)
- {
- if (attrib.Name == upg.Name)
- {
- var installer = new Applications.Installer();
- var installation = new AppscapeInstallation(upg.Name, attrib.DownloadSize, upg.ID);
- AppearanceManager.SetupWindow(installer);
- installer.InitiateInstall(installation);
- return;
- }
- }
- }
+ var installer = new Applications.Installer();
+ var installation = new AppscapeInstallation(upg.Name, attrib.DownloadSize, upg.ID);
+ AppearanceManager.SetupWindow(installer);
+ installer.InitiateInstall(installation);
+ return;
}
- catch { }
}
}
-
}
});
}
diff --git a/ShiftOS.WinForms/ShiftnetSites/MainHomepage.cs b/ShiftOS.WinForms/ShiftnetSites/MainHomepage.cs
index 6e692a7..10ba809 100644
--- a/ShiftOS.WinForms/ShiftnetSites/MainHomepage.cs
+++ b/ShiftOS.WinForms/ShiftnetSites/MainHomepage.cs
@@ -39,49 +39,30 @@ namespace ShiftOS.WinForms.ShiftnetSites
{
//Get the Fundamentals List
flfundamentals.Controls.Clear();
- foreach (var exe in Directory.GetFiles(Environment.CurrentDirectory))
+ foreach (var type in Array.FindAll(ReflectMan.Types, t => t.GetInterfaces().Contains(typeof(IShiftnetSite)) && t.BaseType == typeof(UserControl) && Shiftorium.UpgradeAttributesUnlocked(t)))
{
- if (exe.EndsWith(".exe") || exe.EndsWith(".dll"))
+ var attrs = type.GetCustomAttributes(false);
+ var attribute = attrs.FirstOrDefault(x => x is ShiftnetSiteAttribute) as ShiftnetSiteAttribute;
+ if (attribute != null)
{
- try
+ if (attrs.OfType<ShiftnetFundamentalAttribute>().Any())
{
- var asm = Assembly.LoadFile(exe);
- foreach (var type in asm.GetTypes())
+ var dash = new Label();
+ dash.Text = " - ";
+ dash.AutoSize = true;
+ flfundamentals.Controls.Add(dash);
+ dash.Show();
+ var link = new LinkLabel();
+ link.Text = attribute.Name;
+ link.Click += (o, a) =>
{
- if (type.GetInterfaces().Contains(typeof(IShiftnetSite)))
- {
- if (type.BaseType == typeof(UserControl))
- {
- var attribute = type.GetCustomAttributes(false).FirstOrDefault(x => x is ShiftnetSiteAttribute) as ShiftnetSiteAttribute;
- if (attribute != null)
- {
- if (Shiftorium.UpgradeAttributesUnlocked(type))
- {
- if (type.GetCustomAttributes(false).FirstOrDefault(x => x is ShiftnetFundamentalAttribute) != null)
- {
- var dash = new Label();
- dash.Text = " - ";
- dash.AutoSize = true;
- flfundamentals.Controls.Add(dash);
- dash.Show();
- var link = new LinkLabel();
- link.Text = attribute.Name;
- link.Click += (o, a) =>
- {
- GoToUrl?.Invoke(attribute.Url);
- };
- flfundamentals.Controls.Add(link);
- flfundamentals.SetFlowBreak(link, true);
- link.Show();
- link.LinkColor = SkinEngine.LoadedSkin.ControlTextColor;
- }
- }
- }
- }
- }
- }
+ GoToUrl?.Invoke(attribute.Url);
+ };
+ flfundamentals.Controls.Add(link);
+ flfundamentals.SetFlowBreak(link, true);
+ link.Show();
+ link.LinkColor = SkinEngine.LoadedSkin.ControlTextColor;
}
- catch { }
}
}
diff --git a/ShiftOS.WinForms/ShiftnetSites/ShiftSoft_Ping.cs b/ShiftOS.WinForms/ShiftnetSites/ShiftSoft_Ping.cs
index 1593117..9b1c3b4 100644
--- a/ShiftOS.WinForms/ShiftnetSites/ShiftSoft_Ping.cs
+++ b/ShiftOS.WinForms/ShiftnetSites/ShiftSoft_Ping.cs
@@ -34,53 +34,38 @@ namespace ShiftOS.WinForms.ShiftnetSites
public void SetupListing()
{
fllist.Controls.Clear();
- foreach(var exec in Directory.GetFiles(Environment.CurrentDirectory))
+ foreach (var type in Array.FindAll(ReflectMan.Types, t => t.GetInterfaces().Contains(typeof(IShiftnetSite))))
{
- if(exec.ToLower().EndsWith(".exe") || exec.ToLower().EndsWith(".dll"))
+ var attr = type.GetCustomAttributes(false).FirstOrDefault(x => x is ShiftnetSiteAttribute) as ShiftnetSiteAttribute;
+ if (attr != null)
{
- try
+ if (attr.Url.StartsWith("shiftnet/"))
{
- var asm = Assembly.LoadFile(exec);
- var types = asm.GetTypes();
- foreach (var type in types)
+ var lnk = new LinkLabel();
+ lnk.LinkColor = SkinEngine.LoadedSkin.ControlTextColor;
+ lnk.Text = attr.Name;
+ var desc = new Label();
+ desc.AutoSize = true;
+ lnk.AutoSize = true;
+ desc.MaximumSize = new Size(this.Width / 3, 0);
+ desc.Text = attr.Description;
+ desc.Padding = new Padding
{
- if (type.GetInterfaces().Contains(typeof(IShiftnetSite)))
- {
- var attr = type.GetCustomAttributes(false).FirstOrDefault(x => x is ShiftnetSiteAttribute) as ShiftnetSiteAttribute;
- if (attr != null)
- {
- if (attr.Url.StartsWith("shiftnet/"))
- {
- var lnk = new LinkLabel();
- lnk.LinkColor = SkinEngine.LoadedSkin.ControlTextColor;
- lnk.Text = attr.Name;
- var desc = new Label();
- desc.AutoSize = true;
- lnk.AutoSize = true;
- desc.MaximumSize = new Size(this.Width / 3, 0);
- desc.Text = attr.Description;
- desc.Padding = new Padding
- {
- Bottom = 25,
- Top = 0,
- Left = 10,
- Right = 10
- };
- lnk.Click += (o, a) =>
- {
- GoToUrl?.Invoke(attr.Url);
- };
- fllist.Controls.Add(lnk);
- fllist.Controls.Add(desc);
- ControlManager.SetupControls(lnk);
- lnk.Show();
- desc.Show();
- }
- }
- }
- }
+ Bottom = 25,
+ Top = 0,
+ Left = 10,
+ Right = 10
+ };
+ lnk.Click += (o, a) =>
+ {
+ GoToUrl?.Invoke(attr.Url);
+ };
+ fllist.Controls.Add(lnk);
+ fllist.Controls.Add(desc);
+ ControlManager.SetupControls(lnk);
+ lnk.Show();
+ desc.Show();
}
- catch { }
}
}
}