From 0e0ea2d2b085aa693c867273433f9610c1cd63c4 Mon Sep 17 00:00:00 2001 From: Colin Date: Sun, 29 Sep 2019 19:51:19 +0100 Subject: [PATCH] Code inspections --- .../FocuserUnitTests.cs | 3 +- .../TelescopeUnitTests.cs | 27 ++++---- .../Properties/Resources.Designer.cs | 44 ++++++------ .../Properties/Settings.Designer.cs | 12 ++-- Meade.net.Telescope/Rates.cs | 6 +- Meade.net.Telescope/Telescope.cs | 68 ++++++++++--------- Meade.net.focuser/Focuser.cs | 8 +-- .../Properties/Resources.Designer.cs | 44 ++++++------ .../Properties/Settings.Designer.cs | 12 ++-- Meade.net/AssemblyInfo.cs | 2 +- Meade.net/ClassFactory.cs | 3 +- Meade.net/LocalServer.cs | 18 ++--- Meade.net/Localization/LocalisationHelper.cs | 4 +- Meade.net/Properties/AssemblyInfo.cs | 2 +- Meade.net/Properties/Resources.Designer.cs | 40 ++++++----- Meade.net/SetupDialogForm.cs | 6 +- Meade.net/SetupDialogForm.designer.cs | 31 +++++---- Meade.net/SetupDialogForm.resx | 2 +- Meade.net/SharedResources.cs | 9 +-- Meade.net/frmMain.Designer.cs | 7 +- Meade.net/frmMain.resx | 2 +- TelescopeTestConsole/Program.cs | 5 +- 22 files changed, 195 insertions(+), 160 deletions(-) diff --git a/Meade.net.Focuser.UnitTests/FocuserUnitTests.cs b/Meade.net.Focuser.UnitTests/FocuserUnitTests.cs index 19e1115..1c9d18c 100644 --- a/Meade.net.Focuser.UnitTests/FocuserUnitTests.cs +++ b/Meade.net.Focuser.UnitTests/FocuserUnitTests.cs @@ -1,4 +1,5 @@ using System; +using System.Reflection; using ASCOM; using ASCOM.DeviceInterface; using ASCOM.Meade.net; @@ -239,7 +240,7 @@ namespace Meade.net.Focuser.UnitTests [Test] public void DriverVersion_Get() { - Version version = System.Reflection.Assembly.GetAssembly(typeof(ASCOM.Meade.net.Focuser)).GetName().Version; + Version version = Assembly.GetAssembly(typeof(ASCOM.Meade.net.Focuser)).GetName().Version; string exptectedDriverInfo = $"{version.Major}.{version.Minor}.{version.Build}.{version.Revision}"; diff --git a/Meade.net.Telescope.UnitTests/TelescopeUnitTests.cs b/Meade.net.Telescope.UnitTests/TelescopeUnitTests.cs index 4fa7bfd..820561c 100644 --- a/Meade.net.Telescope.UnitTests/TelescopeUnitTests.cs +++ b/Meade.net.Telescope.UnitTests/TelescopeUnitTests.cs @@ -1,4 +1,5 @@ using System; +using System.Reflection; using ASCOM; using ASCOM.Astrometry.AstroUtils; using ASCOM.DeviceInterface; @@ -45,8 +46,8 @@ namespace Meade.net.Telescope.UnitTests _sharedResourcesWrapperMock.Setup(x => x.ReadProfile()).Returns(() =>_profileProperties); _sharedResourcesWrapperMock.Setup(x => x.Lock(It.IsAny())).Callback(action => { action(); }); - _sharedResourcesWrapperMock.Setup(x => x.Lock(It.IsAny>())).Returns>( (func) => func()); - _sharedResourcesWrapperMock.Setup(x => x.Lock(It.IsAny>())).Returns>((func) => func()); + _sharedResourcesWrapperMock.Setup(x => x.Lock(It.IsAny>())).Returns>( func => func()); + _sharedResourcesWrapperMock.Setup(x => x.Lock(It.IsAny>())).Returns>(func => func()); _connectionInfo = new ConnectionInfo {Connections = 1, SameDevice = 1}; @@ -243,7 +244,7 @@ namespace Meade.net.Telescope.UnitTests { ConnectTelescope(); - string parameters = $"unknown"; + string parameters = "unknown"; var exception = Assert.Throws(() => { _telescope.Action("site", parameters); }); Assert.That(exception.Message, Is.EqualTo($"Site parameters {parameters} not known")); @@ -514,7 +515,7 @@ namespace Meade.net.Telescope.UnitTests [Test] public void DriverVersion_Get() { - Version version = System.Reflection.Assembly.GetAssembly(typeof(ASCOM.Meade.net.Telescope)).GetName().Version; + Version version = Assembly.GetAssembly(typeof(ASCOM.Meade.net.Telescope)).GetName().Version; string exptectedDriverInfo = $"{version.Major}.{version.Minor}.{version.Build}.{version.Revision}"; @@ -1183,7 +1184,7 @@ namespace Meade.net.Telescope.UnitTests var exception = Assert.Throws(() => { _telescope.MoveAxis(TelescopeAxes.axisTertiary, testRate); }); - Assert.That(exception.Message, Is.EqualTo($"Can not move this axis.")); + Assert.That(exception.Message, Is.EqualTo("Can not move this axis.")); } [Test] @@ -2190,8 +2191,7 @@ namespace Meade.net.Telescope.UnitTests slewCounter++; if (slewCounter <= iterations) return "|"; - else - return ""; + return ""; }); _telescope.SlewToTarget(); @@ -2259,8 +2259,7 @@ namespace Meade.net.Telescope.UnitTests slewCounter++; if (slewCounter <= iterations) return "|"; - else - return ""; + return ""; }); _telescope.SlewToCoordinates(rightAscension, declination); @@ -2330,7 +2329,7 @@ namespace Meade.net.Telescope.UnitTests _astroMathsMock .Setup(x => x.ConvertHozToEq(It.IsAny(), It.IsAny(), It.IsAny(), - It.IsAny())).Returns(new EquatorialCoordinates(){ Declination = declination, RightAscension = rightAscension }); + It.IsAny())).Returns(new EquatorialCoordinates { Declination = declination, RightAscension = rightAscension }); _sharedResourcesWrapperMock.Setup(x => x.SendChar(":MS#")).Returns("0"); @@ -2364,7 +2363,7 @@ namespace Meade.net.Telescope.UnitTests _astroMathsMock .Setup(x => x.ConvertHozToEq(It.IsAny(), It.IsAny(), It.IsAny(), - It.IsAny())).Returns(new EquatorialCoordinates() { Declination = declination, RightAscension = rightAscension }); + It.IsAny())).Returns(new EquatorialCoordinates { Declination = declination, RightAscension = rightAscension }); _sharedResourcesWrapperMock.Setup(x => x.SendChar(":MS#")).Returns("0"); @@ -2375,8 +2374,7 @@ namespace Meade.net.Telescope.UnitTests slewCounter++; if (slewCounter <= iterations) return "|"; - else - return ""; + return ""; }); _telescope.SlewToAltAz( azimuth, altitude); @@ -2499,5 +2497,4 @@ namespace Meade.net.Telescope.UnitTests _sharedResourcesWrapperMock.Verify( x => x.SendString(":D#"), Times.Once); } } -} -; \ No newline at end of file +} \ No newline at end of file diff --git a/Meade.net.Telescope/Properties/Resources.Designer.cs b/Meade.net.Telescope/Properties/Resources.Designer.cs index 659e1a1..4038f60 100644 --- a/Meade.net.Telescope/Properties/Resources.Designer.cs +++ b/Meade.net.Telescope/Properties/Resources.Designer.cs @@ -8,10 +8,16 @@ // //------------------------------------------------------------------------------ +using System.CodeDom.Compiler; +using System.ComponentModel; +using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; +using System.Drawing; +using System.Globalization; +using System.Resources; +using System.Runtime.CompilerServices; + namespace ASCOM.Meade.net.Properties { - using System; - - /// /// A strongly-typed resource class, for looking up localized strings, etc. /// @@ -19,27 +25,27 @@ namespace ASCOM.Meade.net.Properties { // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] + [DebuggerNonUserCode()] + [CompilerGenerated()] internal class Resources { - private static global::System.Resources.ResourceManager resourceMan; + private static ResourceManager resourceMan; - private static global::System.Globalization.CultureInfo resourceCulture; + private static CultureInfo resourceCulture; - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] internal Resources() { } /// /// Returns the cached ResourceManager instance used by this class. /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { + [EditorBrowsable(EditorBrowsableState.Advanced)] + internal static ResourceManager ResourceManager { get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ASCOM.Meade.net.Properties.Resources", typeof(Resources).Assembly); + if (ReferenceEquals(resourceMan, null)) { + ResourceManager temp = new ResourceManager("ASCOM.Meade.net.Properties.Resources", typeof(Resources).Assembly); resourceMan = temp; } return resourceMan; @@ -50,8 +56,8 @@ namespace ASCOM.Meade.net.Properties { /// Overrides the current thread's CurrentUICulture property for all /// resource lookups using this strongly typed resource class. /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { + [EditorBrowsable(EditorBrowsableState.Advanced)] + internal static CultureInfo Culture { get { return resourceCulture; } @@ -63,20 +69,20 @@ namespace ASCOM.Meade.net.Properties { /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// - internal static System.Drawing.Bitmap ASCOM { + internal static Bitmap ASCOM { get { object obj = ResourceManager.GetObject("ASCOM", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); + return ((Bitmap)(obj)); } } /// /// Looks up a localized resource of type System.Drawing.Icon similar to (Icon). /// - internal static System.Drawing.Icon DefaultIcon { + internal static Icon DefaultIcon { get { object obj = ResourceManager.GetObject("DefaultIcon", resourceCulture); - return ((System.Drawing.Icon)(obj)); + return ((Icon)(obj)); } } diff --git a/Meade.net.Telescope/Properties/Settings.Designer.cs b/Meade.net.Telescope/Properties/Settings.Designer.cs index 67ea42d..81d4ba1 100644 --- a/Meade.net.Telescope/Properties/Settings.Designer.cs +++ b/Meade.net.Telescope/Properties/Settings.Designer.cs @@ -8,14 +8,18 @@ // //------------------------------------------------------------------------------ +using System.CodeDom.Compiler; +using System.Configuration; +using System.Runtime.CompilerServices; + namespace ASCOM.Meade.net.Properties { - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.0.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + [CompilerGenerated()] + [GeneratedCode("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.0.0.0")] + internal sealed partial class Settings : ApplicationSettingsBase { - private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + private static Settings defaultInstance = ((Settings)(Synchronized(new Settings()))); public static Settings Default { get { diff --git a/Meade.net.Telescope/Rates.cs b/Meade.net.Telescope/Rates.cs index ca60466..432c85a 100644 --- a/Meade.net.Telescope/Rates.cs +++ b/Meade.net.Telescope/Rates.cs @@ -1,7 +1,7 @@ -using System.Runtime.InteropServices; -using ASCOM.DeviceInterface; -using System.Collections; +using System.Collections; +using System.Runtime.InteropServices; using System.Threading; +using ASCOM.DeviceInterface; namespace ASCOM.Meade.net { diff --git a/Meade.net.Telescope/Telescope.cs b/Meade.net.Telescope/Telescope.cs index 406cb34..63d36ff 100644 --- a/Meade.net.Telescope/Telescope.cs +++ b/Meade.net.Telescope/Telescope.cs @@ -1,16 +1,18 @@ #define Telescope using System; -using System.Runtime.InteropServices; -using ASCOM.Astrometry.AstroUtils; -using ASCOM.Utilities; -using ASCOM.DeviceInterface; using System.Collections; using System.Globalization; using System.Reflection; +using System.Runtime.InteropServices; +using ASCOM.Astrometry; +using ASCOM.Astrometry.AstroUtils; +using ASCOM.Astrometry.NOVAS; +using ASCOM.DeviceInterface; using ASCOM.Meade.net.AstroMaths; using ASCOM.Meade.net.Properties; using ASCOM.Meade.net.Wrapper; +using ASCOM.Utilities; using ASCOM.Utilities.Interfaces; namespace ASCOM.Meade.net @@ -538,7 +540,7 @@ namespace ASCOM.Meade.net if (site < 1) throw new ArgumentOutOfRangeException(nameof(site),site,Resources.Telescope_SelectSite_Site_cannot_be_lower_than_1); - else if (site > 4) + if (site > 4) throw new ArgumentOutOfRangeException(nameof(site), site, Resources.Telescope_SelectSite_Site_cannot_be_higher_than_4); _sharedResourcesWrapper.SendBlind($":W{site}#"); @@ -553,7 +555,7 @@ namespace ASCOM.Meade.net if (site < 1) throw new ArgumentOutOfRangeException(nameof(site), site, Resources.Telescope_SelectSite_Site_cannot_be_lower_than_1); - else if (site > 4) + if (site > 4) throw new ArgumentOutOfRangeException(nameof(site), site, Resources.Telescope_SelectSite_Site_cannot_be_higher_than_4); string command = String.Empty; @@ -607,7 +609,7 @@ namespace ASCOM.Meade.net if (site < 1) throw new ArgumentOutOfRangeException(nameof(site), site, Resources.Telescope_SelectSite_Site_cannot_be_lower_than_1); - else if (site > 4) + if (site > 4) throw new ArgumentOutOfRangeException(nameof(site), site, Resources.Telescope_SelectSite_Site_cannot_be_higher_than_4); switch (site) @@ -831,7 +833,7 @@ namespace ASCOM.Meade.net UtcDateTime = UTCDate, SiteLongitude = SiteLongitude, SiteLatitude = SiteLatitude, - EquatorialCoordinates = new EquatorialCoordinates() + EquatorialCoordinates = new EquatorialCoordinates { RightAscension = RightAscension, Declination = Declination @@ -866,7 +868,7 @@ namespace ASCOM.Meade.net { get { - LogMessage("AtHome", "Get - " + false.ToString()); + LogMessage("AtHome", "Get - " + false); return false; } } @@ -885,7 +887,7 @@ namespace ASCOM.Meade.net public IAxisRates AxisRates(TelescopeAxes axis) { - LogMessage("AxisRates", "Get - " + axis.ToString()); + LogMessage("AxisRates", "Get - " + axis); return new AxisRates(axis); } @@ -915,14 +917,14 @@ namespace ASCOM.Meade.net { get { - LogMessage("CanFindHome", "Get - " + false.ToString()); + LogMessage("CanFindHome", "Get - " + false); return false; } } public bool CanMoveAxis(TelescopeAxes axis) { - LogMessage("CanMoveAxis", "Get - " + axis.ToString()); + LogMessage("CanMoveAxis", "Get - " + axis); switch (axis) { case TelescopeAxes.axisPrimary: return true; //RA or AZ @@ -936,7 +938,7 @@ namespace ASCOM.Meade.net { get { - LogMessage("CanPark", "Get - " + true.ToString()); + LogMessage("CanPark", "Get - " + true); return true; } } @@ -945,7 +947,7 @@ namespace ASCOM.Meade.net { get { - LogMessage("CanPulseGuide", "Get - " + true.ToString()); + LogMessage("CanPulseGuide", "Get - " + true); return true; } } @@ -954,7 +956,7 @@ namespace ASCOM.Meade.net { get { - LogMessage("CanSetDeclinationRate", "Get - " + false.ToString()); + LogMessage("CanSetDeclinationRate", "Get - " + false); return false; } } @@ -967,7 +969,7 @@ namespace ASCOM.Meade.net var canSetGuideRate = IsGuideRateSettingSupported(); - LogMessage("CanSetGuideRates", "Get - " + canSetGuideRate.ToString()); + LogMessage("CanSetGuideRates", "Get - " + canSetGuideRate); return canSetGuideRate; } } @@ -976,7 +978,7 @@ namespace ASCOM.Meade.net { get { - LogMessage("CanSetPark", "Get - " + false.ToString()); + LogMessage("CanSetPark", "Get - " + false); return false; } } @@ -985,7 +987,7 @@ namespace ASCOM.Meade.net { get { - LogMessage("CanSetPierSide", "Get - " + false.ToString()); + LogMessage("CanSetPierSide", "Get - " + false); return false; } } @@ -994,7 +996,7 @@ namespace ASCOM.Meade.net { get { - LogMessage("CanSetRightAscensionRate", "Get - " + false.ToString()); + LogMessage("CanSetRightAscensionRate", "Get - " + false); return false; } } @@ -1003,7 +1005,7 @@ namespace ASCOM.Meade.net { get { - LogMessage("CanSetTracking", "Get - " + true.ToString()); + LogMessage("CanSetTracking", "Get - " + true); return true; } } @@ -1012,7 +1014,7 @@ namespace ASCOM.Meade.net { get { - LogMessage("CanSlew", "Get - " + true.ToString()); + LogMessage("CanSlew", "Get - " + true); return true; } } @@ -1021,7 +1023,7 @@ namespace ASCOM.Meade.net { get { - LogMessage("CanSlewAltAz", "Get - " + true.ToString()); + LogMessage("CanSlewAltAz", "Get - " + true); return true; } } @@ -1030,7 +1032,7 @@ namespace ASCOM.Meade.net { get { - LogMessage("CanSlewAltAzAsync", "Get - " + true.ToString()); + LogMessage("CanSlewAltAzAsync", "Get - " + true); return true; } } @@ -1039,7 +1041,7 @@ namespace ASCOM.Meade.net { get { - LogMessage("CanSlewAsync", "Get - " + true.ToString()); + LogMessage("CanSlewAsync", "Get - " + true); return true; } } @@ -1048,7 +1050,7 @@ namespace ASCOM.Meade.net { get { - LogMessage("CanSync", "Get - " + true.ToString()); + LogMessage("CanSync", "Get - " + true); return true; } } @@ -1057,7 +1059,7 @@ namespace ASCOM.Meade.net { get { - LogMessage("CanSyncAltAz", "Get - " + false.ToString()); + LogMessage("CanSyncAltAz", "Get - " + false); return false; } } @@ -1066,7 +1068,7 @@ namespace ASCOM.Meade.net { get { - LogMessage("CanUnpark", "Get - " + false.ToString()); + LogMessage("CanUnpark", "Get - " + false); return false; } } @@ -1131,7 +1133,7 @@ namespace ASCOM.Meade.net get { EquatorialCoordinateType equatorialSystem = EquatorialCoordinateType.equTopocentric; - LogMessage("DeclinationRate", "Get - " + equatorialSystem.ToString()); + LogMessage("DeclinationRate", "Get - " + equatorialSystem); return equatorialSystem; } } @@ -1473,13 +1475,13 @@ namespace ASCOM.Meade.net { // Now using NOVAS 3.1 double siderealTime = 0.0; - using (var novas = new Astrometry.NOVAS.NOVAS31()) + using (var novas = new NOVAS31()) { var jd = _utilities.DateUTCToJulian(DateTime.UtcNow); novas.SiderealTime(jd, 0, novas.DeltaT(jd), - Astrometry.GstType.GreenwichApparentSiderealTime, - Astrometry.Method.EquinoxBased, - Astrometry.Accuracy.Reduced, ref siderealTime); + GstType.GreenwichApparentSiderealTime, + Method.EquinoxBased, + Accuracy.Reduced, ref siderealTime); } // Allow for the longitude @@ -2096,7 +2098,7 @@ namespace ASCOM.Meade.net LogMessage("TrackingRates", "Get - "); foreach (DriveRates driveRate in trackingRates) { - LogMessage("TrackingRates", "Get - " + driveRate.ToString()); + LogMessage("TrackingRates", "Get - " + driveRate); } return trackingRates; } diff --git a/Meade.net.focuser/Focuser.cs b/Meade.net.focuser/Focuser.cs index 9aab8c5..e61be5d 100644 --- a/Meade.net.focuser/Focuser.cs +++ b/Meade.net.focuser/Focuser.cs @@ -1,13 +1,13 @@ #define Focuser using System; -using System.Diagnostics; -using System.Runtime.InteropServices; -using ASCOM.Utilities; -using ASCOM.DeviceInterface; using System.Collections; +using System.Diagnostics; using System.Reflection; +using System.Runtime.InteropServices; +using ASCOM.DeviceInterface; using ASCOM.Meade.net.Wrapper; +using ASCOM.Utilities; using ASCOM.Utilities.Interfaces; namespace ASCOM.Meade.net diff --git a/Meade.net.focuser/Properties/Resources.Designer.cs b/Meade.net.focuser/Properties/Resources.Designer.cs index 7df2b0c..80e9977 100644 --- a/Meade.net.focuser/Properties/Resources.Designer.cs +++ b/Meade.net.focuser/Properties/Resources.Designer.cs @@ -8,10 +8,16 @@ // //------------------------------------------------------------------------------ +using System.CodeDom.Compiler; +using System.ComponentModel; +using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; +using System.Drawing; +using System.Globalization; +using System.Resources; +using System.Runtime.CompilerServices; + namespace ASCOM.Meade.net.Properties { - using System; - - /// /// A strongly-typed resource class, for looking up localized strings, etc. /// @@ -19,27 +25,27 @@ namespace ASCOM.Meade.net.Properties { // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] + [DebuggerNonUserCode()] + [CompilerGenerated()] internal class Resources { - private static global::System.Resources.ResourceManager resourceMan; + private static ResourceManager resourceMan; - private static global::System.Globalization.CultureInfo resourceCulture; + private static CultureInfo resourceCulture; - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] internal Resources() { } /// /// Returns the cached ResourceManager instance used by this class. /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { + [EditorBrowsable(EditorBrowsableState.Advanced)] + internal static ResourceManager ResourceManager { get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ASCOM.Meade.net.Properties.Resources", typeof(Resources).Assembly); + if (ReferenceEquals(resourceMan, null)) { + ResourceManager temp = new ResourceManager("ASCOM.Meade.net.Properties.Resources", typeof(Resources).Assembly); resourceMan = temp; } return resourceMan; @@ -50,8 +56,8 @@ namespace ASCOM.Meade.net.Properties { /// Overrides the current thread's CurrentUICulture property for all /// resource lookups using this strongly typed resource class. /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { + [EditorBrowsable(EditorBrowsableState.Advanced)] + internal static CultureInfo Culture { get { return resourceCulture; } @@ -63,20 +69,20 @@ namespace ASCOM.Meade.net.Properties { /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// - internal static System.Drawing.Bitmap ASCOM { + internal static Bitmap ASCOM { get { object obj = ResourceManager.GetObject("ASCOM", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); + return ((Bitmap)(obj)); } } /// /// Looks up a localized resource of type System.Drawing.Icon similar to (Icon). /// - internal static System.Drawing.Icon DefaultIcon { + internal static Icon DefaultIcon { get { object obj = ResourceManager.GetObject("DefaultIcon", resourceCulture); - return ((System.Drawing.Icon)(obj)); + return ((Icon)(obj)); } } } diff --git a/Meade.net.focuser/Properties/Settings.Designer.cs b/Meade.net.focuser/Properties/Settings.Designer.cs index 67ea42d..81d4ba1 100644 --- a/Meade.net.focuser/Properties/Settings.Designer.cs +++ b/Meade.net.focuser/Properties/Settings.Designer.cs @@ -8,14 +8,18 @@ // //------------------------------------------------------------------------------ +using System.CodeDom.Compiler; +using System.Configuration; +using System.Runtime.CompilerServices; + namespace ASCOM.Meade.net.Properties { - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.0.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + [CompilerGenerated()] + [GeneratedCode("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.0.0.0")] + internal sealed partial class Settings : ApplicationSettingsBase { - private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + private static Settings defaultInstance = ((Settings)(Synchronized(new Settings()))); public static Settings Default { get { diff --git a/Meade.net/AssemblyInfo.cs b/Meade.net/AssemblyInfo.cs index cfb8bda..74aba9f 100644 --- a/Meade.net/AssemblyInfo.cs +++ b/Meade.net/AssemblyInfo.cs @@ -1,7 +1,7 @@ using System; using System.Reflection; -using System.Runtime.InteropServices; using System.Resources; +using System.Runtime.InteropServices; namespace ASCOM.Meade.net { diff --git a/Meade.net/ClassFactory.cs b/Meade.net/ClassFactory.cs index 4626a2f..2ceeda1 100644 --- a/Meade.net/ClassFactory.cs +++ b/Meade.net/ClassFactory.cs @@ -1,6 +1,6 @@ using System; -using System.Runtime.InteropServices; using System.Collections; +using System.Runtime.InteropServices; namespace ASCOM.Meade.net { @@ -204,7 +204,6 @@ namespace ASCOM.Meade.net if (riid == IidIDispatch) { ppvObject = Marshal.GetIDispatchForObject(Activator.CreateInstance(_mClassType)); - return; } else if (riid == IidIUnknown) { diff --git a/Meade.net/LocalServer.cs b/Meade.net/LocalServer.cs index eceb526..8563ba4 100644 --- a/Meade.net/LocalServer.cs +++ b/Meade.net/LocalServer.cs @@ -12,17 +12,19 @@ // Modified by Chris Rowland and Peter Simpson to allow use with multiple devices of the same type March 2011 // // + using System; -using System.IO; -using System.Windows.Forms; using System.Collections; -using System.Runtime.InteropServices; +using System.ComponentModel; +using System.Diagnostics; +using System.IO; using System.Reflection; +using System.Runtime.InteropServices; +using System.Security.Principal; +using System.Threading; +using System.Windows.Forms; using ASCOM.Utilities; using Microsoft.Win32; -using System.Threading; -using System.Security.Principal; -using System.Diagnostics; namespace ASCOM.Meade.net { @@ -109,7 +111,7 @@ namespace ASCOM.Meade.net #region Private Data private static int _objsInUse; // Keeps a count on the total number of objects alive. private static int _serverLocks; // Keeps a lock count on this application. - private static FrmMain _sMainForm = null; // Reference to our main form + private static FrmMain _sMainForm; // Reference to our main form private static ArrayList _sComObjectAssys; // Dynamically loaded assemblies containing served COM objects private static ArrayList _sComObjectTypes; // Served COM object types private static ArrayList _sClassFactories; // Served COM object class factories @@ -293,7 +295,7 @@ namespace ASCOM.Meade.net Verb = "runas" }; try { Process.Start(si); } - catch (System.ComponentModel.Win32Exception) + catch (Win32Exception) { MessageBox.Show($"The {DriverName} was not {(arg == "/register" ? "registered" : "unregistered")} because you did not allow it.", DriverName, MessageBoxButtons.OK, MessageBoxIcon.Warning); } diff --git a/Meade.net/Localization/LocalisationHelper.cs b/Meade.net/Localization/LocalisationHelper.cs index d193826..a7d4565 100644 --- a/Meade.net/Localization/LocalisationHelper.cs +++ b/Meade.net/Localization/LocalisationHelper.cs @@ -1,7 +1,7 @@ using System.Globalization; -using System.Threading; -using System.Resources; using System.Reflection; +using System.Resources; +using System.Threading; namespace ASCOM.Meade.net.Localization { diff --git a/Meade.net/Properties/AssemblyInfo.cs b/Meade.net/Properties/AssemblyInfo.cs index a2c5fb1..c906d0b 100644 --- a/Meade.net/Properties/AssemblyInfo.cs +++ b/Meade.net/Properties/AssemblyInfo.cs @@ -23,4 +23,4 @@ using System.Runtime.InteropServices; [assembly: AssemblyVersion("0.0.0.0")] [assembly: AssemblyFileVersion("0.0.0.0")] -[assembly: ComVisibleAttribute(false)] +[assembly: ComVisible(false)] diff --git a/Meade.net/Properties/Resources.Designer.cs b/Meade.net/Properties/Resources.Designer.cs index 67c41c7..71e56bc 100644 --- a/Meade.net/Properties/Resources.Designer.cs +++ b/Meade.net/Properties/Resources.Designer.cs @@ -8,10 +8,16 @@ // //------------------------------------------------------------------------------ +using System.CodeDom.Compiler; +using System.ComponentModel; +using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; +using System.Drawing; +using System.Globalization; +using System.Resources; +using System.Runtime.CompilerServices; + namespace ASCOM.Meade.net.Properties { - using System; - - /// /// A strongly-typed resource class, for looking up localized strings, etc. /// @@ -19,27 +25,27 @@ namespace ASCOM.Meade.net.Properties { // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] + [DebuggerNonUserCode()] + [CompilerGenerated()] internal class Resources { - private static global::System.Resources.ResourceManager resourceMan; + private static ResourceManager resourceMan; - private static global::System.Globalization.CultureInfo resourceCulture; + private static CultureInfo resourceCulture; - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] internal Resources() { } /// /// Returns the cached ResourceManager instance used by this class. /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { + [EditorBrowsable(EditorBrowsableState.Advanced)] + internal static ResourceManager ResourceManager { get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ASCOM.Meade.net.Properties.Resources", typeof(Resources).Assembly); + if (ReferenceEquals(resourceMan, null)) { + ResourceManager temp = new ResourceManager("ASCOM.Meade.net.Properties.Resources", typeof(Resources).Assembly); resourceMan = temp; } return resourceMan; @@ -50,8 +56,8 @@ namespace ASCOM.Meade.net.Properties { /// Overrides the current thread's CurrentUICulture property for all /// resource lookups using this strongly typed resource class. /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { + [EditorBrowsable(EditorBrowsableState.Advanced)] + internal static CultureInfo Culture { get { return resourceCulture; } @@ -63,10 +69,10 @@ namespace ASCOM.Meade.net.Properties { /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// - internal static System.Drawing.Bitmap ASCOM { + internal static Bitmap ASCOM { get { object obj = ResourceManager.GetObject("ASCOM", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); + return ((Bitmap)(obj)); } } } diff --git a/Meade.net/SetupDialogForm.cs b/Meade.net/SetupDialogForm.cs index ff5b104..e1bb086 100644 --- a/Meade.net/SetupDialogForm.cs +++ b/Meade.net/SetupDialogForm.cs @@ -1,6 +1,8 @@ using System; using System.ComponentModel; +using System.Diagnostics; using System.Globalization; +using System.IO.Ports; using System.Runtime.InteropServices; using System.Windows.Forms; @@ -33,7 +35,7 @@ namespace ASCOM.Meade.net { try { - System.Diagnostics.Process.Start("http://ascom-standards.org/"); + Process.Start("http://ascom-standards.org/"); } catch (Win32Exception noBrowser) { @@ -51,7 +53,7 @@ namespace ASCOM.Meade.net chkTrace.Checked = profileProperties.TraceLogger; // set the list of com ports to those that are currently available comboBoxComPort.Items.Clear(); - comboBoxComPort.Items.AddRange(System.IO.Ports.SerialPort + comboBoxComPort.Items.AddRange(SerialPort .GetPortNames()); // use System.IO because it's static // select the current port if possible if (comboBoxComPort.Items.Contains(profileProperties.ComPort)) diff --git a/Meade.net/SetupDialogForm.designer.cs b/Meade.net/SetupDialogForm.designer.cs index af1859b..10e1f06 100644 --- a/Meade.net/SetupDialogForm.designer.cs +++ b/Meade.net/SetupDialogForm.designer.cs @@ -1,3 +1,6 @@ +using System.ComponentModel; +using System.Windows.Forms; + namespace ASCOM.Meade.net { partial class SetupDialogForm @@ -5,7 +8,7 @@ namespace ASCOM.Meade.net /// /// Required designer variable. /// - private System.ComponentModel.IContainer components = null; + private IContainer components = null; /// /// Clean up any resources being used. @@ -162,18 +165,18 @@ namespace ASCOM.Meade.net #endregion - private System.Windows.Forms.Button cmdOK; - private System.Windows.Forms.Button cmdCancel; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.PictureBox picASCOM; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.CheckBox chkTrace; - private System.Windows.Forms.ComboBox comboBoxComPort; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.TextBox txtGuideRate; - private System.Windows.Forms.Label label4; - private System.Windows.Forms.Label lblPercentOfSiderealRate; - private System.Windows.Forms.Label label5; - private System.Windows.Forms.ComboBox cboPrecision; + private Button cmdOK; + private Button cmdCancel; + private Label label1; + private PictureBox picASCOM; + private Label label2; + private CheckBox chkTrace; + private ComboBox comboBoxComPort; + private Label label3; + private TextBox txtGuideRate; + private Label label4; + private Label lblPercentOfSiderealRate; + private Label label5; + private ComboBox cboPrecision; } } \ No newline at end of file diff --git a/Meade.net/SetupDialogForm.resx b/Meade.net/SetupDialogForm.resx index 69e65d4..84d89dc 100644 --- a/Meade.net/SetupDialogForm.resx +++ b/Meade.net/SetupDialogForm.resx @@ -1,4 +1,4 @@ - +