diff options
| author | william341 <[email protected]> | 2017-05-28 12:37:00 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2017-05-28 12:37:00 -0700 |
| commit | 771c20cfb3a703e0f1550fdcf9eb07b78298c944 (patch) | |
| tree | 59cb532e15ebff313fdba2be264d78ec0033f407 /ShiftOS.WinForms/Program.cs | |
| parent | 496b0cbf8659c99203f48210fd39c572400ae623 (diff) | |
| parent | c7ba7d733c756d196f98dd4533289a1ef4db715f (diff) | |
| download | shiftos_thereturn-771c20cfb3a703e0f1550fdcf9eb07b78298c944.tar.gz shiftos_thereturn-771c20cfb3a703e0f1550fdcf9eb07b78298c944.tar.bz2 shiftos_thereturn-771c20cfb3a703e0f1550fdcf9eb07b78298c944.zip | |
Merge pull request #1 from shiftos-game/master
welp, no longer a dev.
Diffstat (limited to 'ShiftOS.WinForms/Program.cs')
| -rw-r--r-- | ShiftOS.WinForms/Program.cs | 81 |
1 files changed, 71 insertions, 10 deletions
diff --git a/ShiftOS.WinForms/Program.cs b/ShiftOS.WinForms/Program.cs index 0578389..8f65265 100644 --- a/ShiftOS.WinForms/Program.cs +++ b/ShiftOS.WinForms/Program.cs @@ -34,6 +34,7 @@ using static ShiftOS.Objects.ShiftFS.Utils; using ShiftOS.WinForms.Applications; using ShiftOS.WinForms.Tools; using System.Reflection; +using System.IO; namespace ShiftOS.WinForms { @@ -48,28 +49,38 @@ namespace ShiftOS.WinForms Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); //if ANYONE puts code before those two winforms config lines they will be declared a drunky. - Michael + SkinEngine.SetPostProcessor(new DitheringSkinPostProcessor()); + SaveSystem.PreDigitalSocietyConnection += () => + { + Action completed = null; + completed = () => + { + SaveSystem.Ready = true; + Engine.AudioManager.PlayCompleted -= completed; + AudioManager.StartAmbientLoop(); + }; + Engine.AudioManager.PlayCompleted += completed; + Engine.AudioManager.PlayStream(Properties.Resources.dial_up_modem_02); + + }; + LoginManager.Init(new GUILoginFrontend()); CrashHandler.SetGameMetadata(Assembly.GetExecutingAssembly()); SkinEngine.SetIconProber(new ShiftOSIconProvider()); ShiftOS.Engine.AudioManager.Init(new ShiftOSAudioProvider()); Localization.RegisterProvider(new WFLanguageProvider()); - Shiftorium.RegisterProvider(new WinformsShiftoriumProvider()); - AppearanceManager.OnExit += () => - { - Environment.Exit(0); - }; - + TutorialManager.RegisterTutorial(new Oobe()); TerminalBackend.TerminalRequested += () => { AppearanceManager.SetupWindow(new Applications.Terminal()); }; - AppearanceManager.Initiate(new WinformsWindowManager()); - OutOfBoxExperience.Init(new Oobe()); Infobox.Init(new Dialog()); FileSkimmerBackend.Init(new WinformsFSFrontend()); var desk = new WinformsDesktop(); Desktop.Init(desk); + OutOfBoxExperience.Init(new Oobe()); + AppearanceManager.Initiate(new WinformsWindowManager()); Application.Run(desk); } } @@ -94,15 +105,65 @@ namespace ShiftOS.WinForms } } + [ShiftoriumProvider] internal class WinformsShiftoriumProvider : IShiftoriumProvider { public List<ShiftoriumUpgrade> GetDefaults() { - return JsonConvert.DeserializeObject<List<ShiftoriumUpgrade>>(Properties.Resources.Shiftorium); + var defaultList = JsonConvert.DeserializeObject<List<ShiftoriumUpgrade>>(Properties.Resources.Shiftorium); + + foreach(var exe in Directory.GetFiles(Environment.CurrentDirectory)) + { + if (exe.EndsWith(".exe") || exe.EndsWith(".dll")) + { + try + { + 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); + } + + } + + + + + } + catch { } + } + } + return defaultList; } } - public class WinformsFSFrontend : IFileSkimmer { |
