From 12e46edc7421c6bc2f566ad8287d6f5b36a1b522 Mon Sep 17 00:00:00 2001 From: Colin Date: Tue, 1 Oct 2019 18:55:20 +0100 Subject: [PATCH] Code inspections --- FocuserTestConsole/Program.cs | 4 ++-- Meade.net.Telescope/Telescope.cs | 2 +- Meade.net/LocalServer.cs | 2 ++ TelescopeTestConsole/Program.cs | 4 ++-- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/FocuserTestConsole/Program.cs b/FocuserTestConsole/Program.cs index d7cfce5..12742f1 100644 --- a/FocuserTestConsole/Program.cs +++ b/FocuserTestConsole/Program.cs @@ -14,9 +14,9 @@ using ASCOM.DriverAccess; namespace ASCOM.MeadeGeneric { - class Program + public class Program { - static void Main(string[] args) + public static void Main() { // Uncomment the code that's required #if UseChooser diff --git a/Meade.net.Telescope/Telescope.cs b/Meade.net.Telescope/Telescope.cs index 0ae1f15..e86b9bf 100644 --- a/Meade.net.Telescope/Telescope.cs +++ b/Meade.net.Telescope/Telescope.cs @@ -42,7 +42,7 @@ namespace ASCOM.Meade.net /// The DeviceID is used by ASCOM applications to load the driver at runtime. /// //internal static string driverID = "ASCOM.Meade.net.Telescope"; - private static readonly string DriverId = Marshal.GenerateProgIdForType(MethodBase.GetCurrentMethod().DeclaringType); + private static readonly string DriverId = Marshal.GenerateProgIdForType(MethodBase.GetCurrentMethod().DeclaringType ?? throw new System.InvalidOperationException()); // TODO Change the descriptive string for your driver then remove this line /// diff --git a/Meade.net/LocalServer.cs b/Meade.net/LocalServer.cs index 0c70f53..641dbe7 100644 --- a/Meade.net/LocalServer.cs +++ b/Meade.net/LocalServer.cs @@ -175,6 +175,8 @@ namespace ASCOM.Meade.net // put everything into one folder, the same as the server. string assyPath = Assembly.GetEntryAssembly().Location; assyPath = Path.GetDirectoryName(assyPath); + if (assyPath == null) + throw new System.InvalidOperationException(); DirectoryInfo d = new DirectoryInfo(assyPath); foreach (FileInfo fi in d.GetFiles("*.dll")) diff --git a/TelescopeTestConsole/Program.cs b/TelescopeTestConsole/Program.cs index 4ad640d..bedb192 100644 --- a/TelescopeTestConsole/Program.cs +++ b/TelescopeTestConsole/Program.cs @@ -13,9 +13,9 @@ using ASCOM.DriverAccess; namespace ASCOM.Meade.net { - class Program + public class Program { - static void Main(string[] args) + public static void Main() { // Uncomment the code that's required #if UseChooser