aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS.WinForms/Program.cs
diff options
context:
space:
mode:
authorMichael VanOverbeek <[email protected]>2017-06-11 11:57:31 +0000
committerGitHub <[email protected]>2017-06-11 11:57:31 +0000
commit997a81457ebb6d6523c36ca552cee143e0d92244 (patch)
treeda98985ced112b6d238811f3ca770014d67e34fc /ShiftOS.WinForms/Program.cs
parent0d75f701778a0900a58343c4c80c124279bc231f (diff)
parent107a98686a105468b5f200ebcbd27343c1210ce4 (diff)
downloadshiftos_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/Program.cs')
-rw-r--r--ShiftOS.WinForms/Program.cs70
1 files changed, 28 insertions, 42 deletions
diff --git a/ShiftOS.WinForms/Program.cs b/ShiftOS.WinForms/Program.cs
index b5fb731..d3530a0 100644
--- a/ShiftOS.WinForms/Program.cs
+++ b/ShiftOS.WinForms/Program.cs
@@ -114,53 +114,39 @@ namespace ShiftOS.WinForms
{
var defaultList = JsonConvert.DeserializeObject<List<ShiftoriumUpgrade>>(Properties.Resources.Shiftorium);
- foreach(var exe in Directory.GetFiles(Environment.CurrentDirectory))
+ foreach (var type in ReflectMan.Types)
{
- if (exe.EndsWith(".exe") || exe.EndsWith(".dll"))
+ var attribs = type.GetCustomAttributes(false);
+ var attrib = attribs.FirstOrDefault(x => x is AppscapeEntryAttribute) as AppscapeEntryAttribute;
+ if (attrib != null)
{
- try
+ var upgrade = new ShiftoriumUpgrade
{
- 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)
- {
- var upgrade = new ShiftoriumUpgrade
- {
- Id = attrib.Name.ToLower().Replace(" ", "_"),
- Name = attrib.Name,
- Description = attrib.Description,
- Cost = attrib.Cost,
- Category = attrib.Category,
- Dependencies = (string.IsNullOrWhiteSpace(attrib.DependencyString)) ? "appscape_handled_nodisplay" : "appscape_handled_nodisplay;" + attrib.DependencyString
- };
- defaultList.Add(upgrade);
- }
-
- var sattrib = type.GetCustomAttributes(false).FirstOrDefault(x => x is StpContents) as StpContents;
- if (sattrib != null)
- {
- var upgrade = new ShiftoriumUpgrade
- {
- Id = sattrib.Upgrade,
- Name = sattrib.Name,
- Description = "This is a hidden dummy upgrade for the .stp file installation attribute \"" + sattrib.Name + "\".",
- Cost = 0,
- Category = "If this is shown, there's a bug in the Shiftorium Provider or the user is a supreme Shifter.",
- Dependencies = "dummy_nodisplay"
- };
- defaultList.Add(upgrade);
- }
-
- }
-
-
-
+ Id = attrib.Name.ToLower().Replace(" ", "_"),
+ Name = attrib.Name,
+ Description = attrib.Description,
+ Cost = attrib.Cost,
+ Category = attrib.Category,
+ Dependencies = (string.IsNullOrWhiteSpace(attrib.DependencyString)) ? "appscape_handled_nodisplay" : "appscape_handled_nodisplay;" + attrib.DependencyString
+ };
+ defaultList.Add(upgrade);
+ }
- }
- catch { }
+ var sattrib = attribs.FirstOrDefault(x => x is StpContents) as StpContents;
+ if (sattrib != null)
+ {
+ var upgrade = new ShiftoriumUpgrade
+ {
+ Id = sattrib.Upgrade,
+ Name = sattrib.Name,
+ Description = "This is a hidden dummy upgrade for the .stp file installation attribute \"" + sattrib.Name + "\".",
+ Cost = 0,
+ Category = "If this is shown, there's a bug in the Shiftorium Provider or the user is a supreme Shifter.",
+ Dependencies = "dummy_nodisplay"
+ };
+ defaultList.Add(upgrade);
}
+
}
return defaultList;
}