aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS.WinForms/ShiftnetSites/MainHomepage.cs
diff options
context:
space:
mode:
authorwilliam341 <[email protected]>2017-06-18 16:43:30 -0700
committerGitHub <[email protected]>2017-06-18 16:43:30 -0700
commitba80dcf3f80018cbb041b62ad8a40268427d1311 (patch)
treef0bd18b2355d34c07c744c3cd82a4725a799eecd /ShiftOS.WinForms/ShiftnetSites/MainHomepage.cs
parent771c20cfb3a703e0f1550fdcf9eb07b78298c944 (diff)
parent12acff8742f4c64976bfabee1b70dc515190fc7c (diff)
downloadshiftos_thereturn-ba80dcf3f80018cbb041b62ad8a40268427d1311.tar.gz
shiftos_thereturn-ba80dcf3f80018cbb041b62ad8a40268427d1311.tar.bz2
shiftos_thereturn-ba80dcf3f80018cbb041b62ad8a40268427d1311.zip
Merge pull request #2 from shiftos-game/master
wew
Diffstat (limited to 'ShiftOS.WinForms/ShiftnetSites/MainHomepage.cs')
-rw-r--r--ShiftOS.WinForms/ShiftnetSites/MainHomepage.cs57
1 files changed, 19 insertions, 38 deletions
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 { }
}
}