From 57c5260da9923520ec61e689c093e26cad3e537c Mon Sep 17 00:00:00 2001 From: troy0h Date: Fri, 14 May 2021 14:18:40 +0100 Subject: [PATCH 1/5] Moved SPLASH_LIST to a seperate file --- .../AM2RLauncher/MainForm/MainForm.UI.cs | 40 +-------------- .../AM2RLauncher/MainForm/SPLASH_LIST.cs | 49 +++++++++++++++++++ 2 files changed, 50 insertions(+), 39 deletions(-) create mode 100644 AM2RLauncher/AM2RLauncher/MainForm/SPLASH_LIST.cs diff --git a/AM2RLauncher/AM2RLauncher/MainForm/MainForm.UI.cs b/AM2RLauncher/AM2RLauncher/MainForm/MainForm.UI.cs index a139045..07e486b 100644 --- a/AM2RLauncher/AM2RLauncher/MainForm/MainForm.UI.cs +++ b/AM2RLauncher/AM2RLauncher/MainForm/MainForm.UI.cs @@ -52,44 +52,6 @@ namespace AM2RLauncher /// /// A - of custom splashes. /// - static readonly private string[] SPLASH_LIST = { - "The real Ridley is the friends we made along the way.", - "Now with 100% more Septoggs!", - "Now with 100% more Blob Throwers!", - "Speedrun THIS, I dare you.", - "The broken pipe is a lie.", - "Overcommitting to April Fool's since 2018.", - "Also try Metroid II: Return of Samus!", - "Also try Metroid: Samus Returns!", - "Also try Prime 2D!", - "Trust me, it's an 'unintentional feature.'", - "Coming soon to a PC near you!", - "This ain't your parents' Metroid 2!", - "Now setting boss pattern to S P E E N", - "You S P E E N me right round, baby!", - "Wait, I thought Metroid was a guy!", - "jellyfish is helping yes", - "Why can't Metroid crawl?", - "When in doubt, blame GameMaker.", - "It just works™", - "Reject C++, return to ABSTRACTION", - "C# is just C++++ with Windows support.", - "Use of the Launcher has now been authorized!", - // GTK splashes begin here - "Sorry this is ugly, but at least it works.", - "GTK + QT = 💣", - "I hope you use Arch, btw", - "All your Ubuntu are belong to Arch btw.", - "Help, how do I quit vim!?", - "The bloat isn't our fault, YoYo Games forced 1GB dependencies!", - "The quieter you are, the more Metroids you can hear.", - "What you are referring to as AM2R, is in fact, GNU/AM2R.", - "GNOME be gone!", - "Go compile your own girlfriend. This one doesn't count, she's out of your league.", - "Year 3115, NVIDIA still doesn't support Wayland.", - "Was a mouse really that expensive, i3 users!?", - "Imagine using non-free software." - }; /// /// The current Launcher version. @@ -201,7 +163,7 @@ namespace AM2RLauncher // Custom splash texts Random rng = new Random(); // Some fanciness so we can have Gtk-only quips, because Gtk visuals are lame. - string splash = SPLASH_LIST[rng.Next(0, SPLASH_LIST.Length - (Platform.IsGtk ? 0 : 13))]; + string splash = SPLASH.SPLASH_LIST[rng.Next(0, SPLASH.SPLASH_LIST.Length - (Platform.IsGtk ? 0 : 13))]; log.Info("Randomly chosen splash: " + splash); // Load bitmaps diff --git a/AM2RLauncher/AM2RLauncher/MainForm/SPLASH_LIST.cs b/AM2RLauncher/AM2RLauncher/MainForm/SPLASH_LIST.cs new file mode 100644 index 0000000..364c7c7 --- /dev/null +++ b/AM2RLauncher/AM2RLauncher/MainForm/SPLASH_LIST.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace AM2RLauncher +{ + class SPLASH + { + public static readonly string[] SPLASH_LIST = + { + "The real Ridley is the friends we made along the way.", + "Now with 100% more Septoggs!", + "Now with 100% more Blob Throwers!", + "Speedrun THIS, I dare you.", + "The broken pipe is a lie.", + "Overcommitting to April Fool's since 2018.", + "Also try Metroid II: Return of Samus!", + "Also try Metroid: Samus Returns!", + "Also try Prime 2D!", + "Trust me, it's an 'unintentional feature.'", + "Coming soon to a PC near you!", + "This ain't your parents' Metroid 2!", + "Now setting boss pattern to S P E E N", + "You S P E E N me right round, baby!", + "Wait, I thought Metroid was a guy!", + "jellyfish is helping yes", + "Why can't Metroid crawl?", + "When in doubt, blame GameMaker.", + "It just works™", + "Reject C++, return to ABSTRACTION", + "C# is just C++++ with Windows support.", + "Use of the Launcher has now been authorized!", + // GTK splashes begin here + "Sorry this is ugly, but at least it works.", + "GTK + QT = 💣", + "I hope you use Arch, btw", + "All your Ubuntu are belong to Arch btw.", + "Help, how do I quit vim!?", + "The bloat isn't our fault, YoYo Games forced 1GB dependencies!", + "The quieter you are, the more Metroids you can hear.", + "What you are referring to as AM2R, is in fact, GNU/AM2R.", + "GNOME be gone!", + "Go compile your own girlfriend. This one doesn't count, she's out of your league.", + "Year 3115, NVIDIA still doesn't support Wayland.", + "Was a mouse really that expensive, i3 users!?", + "Imagine using non-free software." + }; + } +} From a3eec0074e96f2ff8a383f9a71c750562347949d Mon Sep 17 00:00:00 2001 From: Troy Date: Fri, 14 May 2021 14:29:32 +0100 Subject: [PATCH 2/5] Changes suggested by Miepee Co-authored-by: Miepee <38186597+Miepee@users.noreply.github.com> --- AM2RLauncher/AM2RLauncher/MainForm/MainForm.UI.cs | 2 +- AM2RLauncher/AM2RLauncher/MainForm/SPLASH_LIST.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/AM2RLauncher/AM2RLauncher/MainForm/MainForm.UI.cs b/AM2RLauncher/AM2RLauncher/MainForm/MainForm.UI.cs index 07e486b..35ad8be 100644 --- a/AM2RLauncher/AM2RLauncher/MainForm/MainForm.UI.cs +++ b/AM2RLauncher/AM2RLauncher/MainForm/MainForm.UI.cs @@ -163,7 +163,7 @@ namespace AM2RLauncher // Custom splash texts Random rng = new Random(); // Some fanciness so we can have Gtk-only quips, because Gtk visuals are lame. - string splash = SPLASH.SPLASH_LIST[rng.Next(0, SPLASH.SPLASH_LIST.Length - (Platform.IsGtk ? 0 : 13))]; + string splash = Splash.SPLASH_LIST[rng.Next(0, Splash.SPLASH_LIST.Length - (Platform.IsGtk ? 0 : 13))]; log.Info("Randomly chosen splash: " + splash); // Load bitmaps diff --git a/AM2RLauncher/AM2RLauncher/MainForm/SPLASH_LIST.cs b/AM2RLauncher/AM2RLauncher/MainForm/SPLASH_LIST.cs index 364c7c7..ad09d13 100644 --- a/AM2RLauncher/AM2RLauncher/MainForm/SPLASH_LIST.cs +++ b/AM2RLauncher/AM2RLauncher/MainForm/SPLASH_LIST.cs @@ -4,7 +4,7 @@ using System.Text; namespace AM2RLauncher { - class SPLASH + class Splash { public static readonly string[] SPLASH_LIST = { From 4e10493d31b08b59e3f40cb8a6021e8b44571edc Mon Sep 17 00:00:00 2001 From: troy0h Date: Tue, 18 May 2021 22:48:24 +0100 Subject: [PATCH 3/5] Added GetSplash method (WONT BUILD) --- .../AM2RLauncher/MainForm/MainForm.UI.cs | 8 ++------ .../MainForm/{SPLASH_LIST.cs => Splash.cs} | 16 ++++++++++++---- 2 files changed, 14 insertions(+), 10 deletions(-) rename AM2RLauncher/AM2RLauncher/MainForm/{SPLASH_LIST.cs => Splash.cs} (84%) diff --git a/AM2RLauncher/AM2RLauncher/MainForm/MainForm.UI.cs b/AM2RLauncher/AM2RLauncher/MainForm/MainForm.UI.cs index 35ad8be..1e7dc03 100644 --- a/AM2RLauncher/AM2RLauncher/MainForm/MainForm.UI.cs +++ b/AM2RLauncher/AM2RLauncher/MainForm/MainForm.UI.cs @@ -119,9 +119,6 @@ namespace AM2RLauncher Environment.Exit(0); } - - - log.Info("Mutex check passed. Entering main thread."); log.Info("Current Launcher Version: " + VERSION); log.Info("Current Platform-ID is: " + Platform.ID); @@ -161,9 +158,8 @@ namespace AM2RLauncher } // Custom splash texts - Random rng = new Random(); - // Some fanciness so we can have Gtk-only quips, because Gtk visuals are lame. - string splash = Splash.SPLASH_LIST[rng.Next(0, Splash.SPLASH_LIST.Length - (Platform.IsGtk ? 0 : 13))]; + var Splash = new Splash() ; + string splash = Splash.GetSplash(); log.Info("Randomly chosen splash: " + splash); // Load bitmaps diff --git a/AM2RLauncher/AM2RLauncher/MainForm/SPLASH_LIST.cs b/AM2RLauncher/AM2RLauncher/MainForm/Splash.cs similarity index 84% rename from AM2RLauncher/AM2RLauncher/MainForm/SPLASH_LIST.cs rename to AM2RLauncher/AM2RLauncher/MainForm/Splash.cs index ad09d13..0bd652e 100644 --- a/AM2RLauncher/AM2RLauncher/MainForm/SPLASH_LIST.cs +++ b/AM2RLauncher/AM2RLauncher/MainForm/Splash.cs @@ -1,12 +1,12 @@ -using System; -using System.Collections.Generic; -using System.Text; +using Eto; +using System; namespace AM2RLauncher { class Splash { - public static readonly string[] SPLASH_LIST = + // Splash strings + readonly string[] splashList = { "The real Ridley is the friends we made along the way.", "Now with 100% more Septoggs!", @@ -45,5 +45,13 @@ namespace AM2RLauncher "Was a mouse really that expensive, i3 users!?", "Imagine using non-free software." }; + + // Get random splash string + public string GetSplash() + { + Random rng = new Random(); + string splashString = splashList[rng.Next(0, splashList.Length - (Platform.IsGtk ? 0 : 13))]; + return splashString; + } } } From d3812de3265ff2da8e68bc216a1db1cfc26173e6 Mon Sep 17 00:00:00 2001 From: troy0h Date: Sat, 22 May 2021 14:11:23 +0100 Subject: [PATCH 4/5] Working GetSplash method, split up splash array --- .../AM2RLauncher/MainForm/MainForm.UI.cs | 2 +- AM2RLauncher/AM2RLauncher/MainForm/Splash.cs | 27 +++++++++++++++---- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/AM2RLauncher/AM2RLauncher/MainForm/MainForm.UI.cs b/AM2RLauncher/AM2RLauncher/MainForm/MainForm.UI.cs index 1e7dc03..51d22e0 100644 --- a/AM2RLauncher/AM2RLauncher/MainForm/MainForm.UI.cs +++ b/AM2RLauncher/AM2RLauncher/MainForm/MainForm.UI.cs @@ -158,7 +158,7 @@ namespace AM2RLauncher } // Custom splash texts - var Splash = new Splash() ; + var Splash = new Splash(); string splash = Splash.GetSplash(); log.Info("Randomly chosen splash: " + splash); diff --git a/AM2RLauncher/AM2RLauncher/MainForm/Splash.cs b/AM2RLauncher/AM2RLauncher/MainForm/Splash.cs index 0bd652e..2ab704b 100644 --- a/AM2RLauncher/AM2RLauncher/MainForm/Splash.cs +++ b/AM2RLauncher/AM2RLauncher/MainForm/Splash.cs @@ -1,12 +1,14 @@ using Eto; using System; +using System.Collections.Generic; +using System.Linq; namespace AM2RLauncher { class Splash { - // Splash strings - readonly string[] splashList = + // Cross-Platform splash strings + readonly string[] generalSplash = { "The real Ridley is the friends we made along the way.", "Now with 100% more Septoggs!", @@ -30,7 +32,11 @@ namespace AM2RLauncher "Reject C++, return to ABSTRACTION", "C# is just C++++ with Windows support.", "Use of the Launcher has now been authorized!", - // GTK splashes begin here + }; + + // Linux only splash strings + readonly string[] linuxSplash = + { "Sorry this is ugly, but at least it works.", "GTK + QT = 💣", "I hope you use Arch, btw", @@ -46,11 +52,22 @@ namespace AM2RLauncher "Imagine using non-free software." }; - // Get random splash string + /// + /// Get random splash string + /// Checks if platform is using GTK, and gets splash text accordingly + /// + public string GetSplash() { + string[] combinedSplash; Random rng = new Random(); - string splashString = splashList[rng.Next(0, splashList.Length - (Platform.IsGtk ? 0 : 13))]; + + if (Platform.Instance.IsGtk) + combinedSplash = generalSplash.Concat(linuxSplash).ToArray(); + else + combinedSplash = generalSplash; + + string splashString = combinedSplash[rng.Next(0, combinedSplash.Length)]; return splashString; } } From 15f7cddb202bdf6e10417f24695403bb63f9c4dd Mon Sep 17 00:00:00 2001 From: Miepee <38186597+Miepee@users.noreply.github.com> Date: Sat, 22 May 2021 15:20:11 +0200 Subject: [PATCH 5/5] add documentation + make class static --- .../AM2RLauncher/MainForm/MainForm.UI.cs | 1 - AM2RLauncher/AM2RLauncher/MainForm/Splash.cs | 24 ++++++++++++------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/AM2RLauncher/AM2RLauncher/MainForm/MainForm.UI.cs b/AM2RLauncher/AM2RLauncher/MainForm/MainForm.UI.cs index 51d22e0..d22d00c 100644 --- a/AM2RLauncher/AM2RLauncher/MainForm/MainForm.UI.cs +++ b/AM2RLauncher/AM2RLauncher/MainForm/MainForm.UI.cs @@ -158,7 +158,6 @@ namespace AM2RLauncher } // Custom splash texts - var Splash = new Splash(); string splash = Splash.GetSplash(); log.Info("Randomly chosen splash: " + splash); diff --git a/AM2RLauncher/AM2RLauncher/MainForm/Splash.cs b/AM2RLauncher/AM2RLauncher/MainForm/Splash.cs index 2ab704b..60859fc 100644 --- a/AM2RLauncher/AM2RLauncher/MainForm/Splash.cs +++ b/AM2RLauncher/AM2RLauncher/MainForm/Splash.cs @@ -5,10 +5,15 @@ using System.Linq; namespace AM2RLauncher { - class Splash + /// + /// Class only for providing Splashes + /// + static class Splash { - // Cross-Platform splash strings - readonly string[] generalSplash = + /// + /// Cross-Platform splash strings + /// + static readonly string[] generalSplash = { "The real Ridley is the friends we made along the way.", "Now with 100% more Septoggs!", @@ -34,8 +39,10 @@ namespace AM2RLauncher "Use of the Launcher has now been authorized!", }; - // Linux only splash strings - readonly string[] linuxSplash = + /// + /// Linux only splash strings + /// + static readonly string[] linuxSplash = { "Sorry this is ugly, but at least it works.", "GTK + QT = 💣", @@ -53,11 +60,10 @@ namespace AM2RLauncher }; /// - /// Get random splash string - /// Checks if platform is using GTK, and gets splash text accordingly + /// Get a random splash string, according to the current OS. /// - - public string GetSplash() + /// The randomly chosen splash as a . + static public string GetSplash() { string[] combinedSplash; Random rng = new Random();