From 300e0423409e9c1dd7a477cb5e2dfb9da8a96867 Mon Sep 17 00:00:00 2001 From: Colin Date: Sun, 29 Sep 2019 23:00:44 +0100 Subject: [PATCH] Code inspections --- Meade.net/Localization/LocalisationHelper.cs | 36 ---------- Meade.net/Meade.net.csproj | 1 - Meade.net/SharedResources.cs | 72 -------------------- Meade.net/Win32Utilities.cs | 1 + 4 files changed, 1 insertion(+), 109 deletions(-) delete mode 100644 Meade.net/Localization/LocalisationHelper.cs diff --git a/Meade.net/Localization/LocalisationHelper.cs b/Meade.net/Localization/LocalisationHelper.cs deleted file mode 100644 index 5d46f73..0000000 --- a/Meade.net/Localization/LocalisationHelper.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Globalization; -using System.Reflection; -using System.Resources; -using System.Threading; - -namespace ASCOM.Meade.net.Localization -{ - internal class LocalisationHelper - { - private const string LocalizationNamespace = "LocalisationTest.Localization.Resources.Localization"; - private readonly ResourceManager _resourceManager; - - public LocalisationHelper() - { - _resourceManager = new ResourceManager(LocalizationNamespace, Assembly.GetExecutingAssembly()); - - SetLocalisation(CultureInfo.CurrentCulture.Name); - } - - private void SetLocalisation(string name) - { - var cultureInfo = new CultureInfo(name); - - //CultureInfo.DefaultThreadCurrentCulture = cultureInfo; - //CultureInfo.DefaultThreadCurrentUICulture = cultureInfo; - - Thread.CurrentThread.CurrentCulture = cultureInfo; - Thread.CurrentThread.CurrentUICulture = cultureInfo; - } - - internal string GetString(string key) - { - return _resourceManager.GetString(key); - } - } -} diff --git a/Meade.net/Meade.net.csproj b/Meade.net/Meade.net.csproj index 6a41f03..8156cd2 100644 --- a/Meade.net/Meade.net.csproj +++ b/Meade.net/Meade.net.csproj @@ -132,7 +132,6 @@ frmMain.cs - diff --git a/Meade.net/SharedResources.cs b/Meade.net/SharedResources.cs index 90bf9fe..acd5256 100644 --- a/Meade.net/SharedResources.cs +++ b/Meade.net/SharedResources.cs @@ -78,12 +78,6 @@ namespace ASCOM.Meade.net } } - public static bool SendBool(string message) - { - SharedSerial.ClearBuffers(); - return SendChar(message) == "1"; - } - /// /// Example of a shared SendMessage method, the lock /// prevents different drivers tripping over one another. @@ -128,39 +122,6 @@ namespace ASCOM.Meade.net } } - /// - /// Example of handling connecting to and disconnection from the - /// shared serial port. - /// Needs error handling - /// the port name etc. needs to be set up first, this could be done by the driver - /// checking Connected and if it's false setting up the port before setting connected to true. - /// It could also be put here. - /// - public static bool Connected - { - set - { - lock (LockObject) - { - if (value) - { - if (Connections == 0) - SharedSerial.Connected = true; - Connections++; - } - else - { - Connections--; - if (Connections <= 0) - { - SharedSerial.Connected = false; - } - } - } - } - get => SharedSerial.Connected; - } - #endregion #region Profile @@ -353,13 +314,6 @@ namespace ASCOM.Meade.net return false; } - public static bool IsConnected(string deviceId) - { - if (ConnectedDevices.ContainsKey(deviceId)) - return ConnectedDevices[deviceId].Count > 0; - return false; - } - #endregion public static void Lock(Action action) @@ -391,31 +345,5 @@ namespace ASCOM.Meade.net Count = 0; } } - - //#region ServedClassName attribute - ///// - ///// This is only needed if the driver is targeted at platform 5.5, it is included with Platform 6 - ///// - //[global::System.AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] - //public sealed class ServedClassNameAttribute : Attribute - //{ - // // See the attribute guidelines at - // // http://go.microsoft.com/fwlink/?LinkId=85236 - - // /// - // /// Gets or sets the 'friendly name' of the served class, as registered with the ASCOM Chooser. - // /// - // /// The 'friendly name' of the served class. - // public string DisplayName { get; private set; } - // /// - // /// Initializes a new instance of the class. - // /// - // /// The 'friendly name' of the served class. - // public ServedClassNameAttribute(string servedClassName) - // { - // DisplayName = servedClassName; - // } - //} - //#endregion } } \ No newline at end of file diff --git a/Meade.net/Win32Utilities.cs b/Meade.net/Win32Utilities.cs index b5b5ffa..4c7a396 100644 --- a/Meade.net/Win32Utilities.cs +++ b/Meade.net/Win32Utilities.cs @@ -1,6 +1,7 @@ using System; using System.Runtime.InteropServices; using System.Text; +// ReSharper disable UnusedMember.Global namespace ASCOM.Meade.net {