From 2ce8c4e12341715053434e88407cf0229d0824fd Mon Sep 17 00:00:00 2001 From: Colin Date: Fri, 19 Jul 2019 13:12:22 +0100 Subject: [PATCH] Removed redundant qualifiers --- FocuserTestConsole/Program.cs | 4 +- .../TelescopeUnitTests.cs | 2 +- Meade.net.Telescope/Rates.cs | 26 ++-- Meade.net.Telescope/Telescope.cs | 120 +++++++++--------- Meade.net.focuser/Focuser.cs | 30 ++--- Meade.net/LocalServer.cs | 4 +- Meade.net/SetupDialogForm.cs | 4 +- Meade.net/SharedResources.cs | 24 ++-- TelescopeTestConsole/Program.cs | 4 +- 9 files changed, 109 insertions(+), 109 deletions(-) diff --git a/FocuserTestConsole/Program.cs b/FocuserTestConsole/Program.cs index af644c8..aff0a29 100644 --- a/FocuserTestConsole/Program.cs +++ b/FocuserTestConsole/Program.cs @@ -24,11 +24,11 @@ namespace ASCOM // Uncomment the code that's required #if UseChooser // choose the device - string id = ASCOM.DriverAccess.Focuser.Choose("ASCOM.MeadeGeneric.Focuser"); + string id = Focuser.Choose("ASCOM.MeadeGeneric.Focuser"); if (string.IsNullOrEmpty(id)) return; // create this device - ASCOM.DriverAccess.Focuser device = new ASCOM.DriverAccess.Focuser(id); + Focuser device = new Focuser(id); #else // this can be replaced by this code, it avoids the chooser and creates the driver class directly. ASCOM.DriverAccess.Telescope device = new ASCOM.DriverAccess.Telescope("ASCOM.MeadeGeneric.Telescope"); diff --git a/Meade.net.Telescope.UnitTests/TelescopeUnitTests.cs b/Meade.net.Telescope.UnitTests/TelescopeUnitTests.cs index 9f0a845..ab6cf16 100644 --- a/Meade.net.Telescope.UnitTests/TelescopeUnitTests.cs +++ b/Meade.net.Telescope.UnitTests/TelescopeUnitTests.cs @@ -1200,7 +1200,7 @@ namespace Meade.net.Telescope.UnitTests _sharedResourcesWrapperMock.Setup(x => x.SendChar(It.IsAny())).Returns("0"); - var exception = Assert.Throws(() => { _telescope.SiteLatitude = siteLatitude; }); + var exception = Assert.Throws(() => { _telescope.SiteLatitude = siteLatitude; }); Assert.That(exception.Message, Is.EqualTo("Failed to set site latitude.")); } diff --git a/Meade.net.Telescope/Rates.cs b/Meade.net.Telescope/Rates.cs index 2230bf7..0579dc7 100644 --- a/Meade.net.Telescope/Rates.cs +++ b/Meade.net.Telescope/Rates.cs @@ -21,7 +21,7 @@ namespace ASCOM.Meade.net [Guid("288838d1-bbf9-4ce0-9ee1-86ecf38b45c9")] [ClassInterface(ClassInterfaceType.None)] [ComVisible(true)] - public class Rate : ASCOM.DeviceInterface.IRate + public class Rate : IRate { private double maximum = 0; private double minimum = 0; @@ -45,14 +45,14 @@ namespace ASCOM.Meade.net public double Maximum { - get { return this.maximum; } - set { this.maximum = value; } + get { return maximum; } + set { maximum = value; } } public double Minimum { - get { return this.minimum; } - set { this.minimum = value; } + get { return minimum; } + set { minimum = value; } } #endregion @@ -100,16 +100,16 @@ namespace ASCOM.Meade.net // TODO Initialize this array with any Primary axis rates that your driver may provide // Example: m_Rates = new Rate[] { new Rate(10.5, 30.2), new Rate(54.0, 43.6) } //this.rates = new Rate[0]; - this.rates = new Rate[] { new Rate(1, 1), new Rate(2, 2), new Rate(3, 3), new Rate(4, 4) }; + rates = new Rate[] { new Rate(1, 1), new Rate(2, 2), new Rate(3, 3), new Rate(4, 4) }; break; case TelescopeAxes.axisSecondary: // TODO Initialize this array with any Secondary axis rates that your driver may provide //this.rates = new Rate[0]; - this.rates = new Rate[] { new Rate(1, 1), new Rate(2, 2), new Rate(3, 3), new Rate(4, 4) }; + rates = new Rate[] { new Rate(1, 1), new Rate(2, 2), new Rate(3, 3), new Rate(4, 4) }; break; case TelescopeAxes.axisTertiary: // TODO Initialize this array with any Tertiary axis rates that your driver may provide - this.rates = new Rate[0]; + rates = new Rate[0]; break; } } @@ -118,7 +118,7 @@ namespace ASCOM.Meade.net public int Count { - get { return this.rates.Length; } + get { return rates.Length; } } public void Dispose() @@ -133,7 +133,7 @@ namespace ASCOM.Meade.net public IRate this[int index] { - get { return this.rates[index - 1]; } // 1-based + get { return rates[index - 1]; } // 1-based } #endregion @@ -176,7 +176,7 @@ namespace ASCOM.Meade.net // the tracking rates supported by your telescope. The one value // (tracking rate) that MUST be supported is driveSidereal! // - this.trackingRates = new[] { DriveRates.driveSidereal, DriveRates.driveLunar }; + trackingRates = new[] { DriveRates.driveSidereal, DriveRates.driveLunar }; // TODO Initialize this array with any additional tracking rates that your driver may provide } @@ -184,7 +184,7 @@ namespace ASCOM.Meade.net public int Count { - get { return this.trackingRates.Length; } + get { return trackingRates.Length; } } public IEnumerator GetEnumerator() @@ -200,7 +200,7 @@ namespace ASCOM.Meade.net public DriveRates this[int index] { - get { return this.trackingRates[index - 1]; } // 1-based + get { return trackingRates[index - 1]; } // 1-based } #endregion diff --git a/Meade.net.Telescope/Telescope.cs b/Meade.net.Telescope/Telescope.cs index d9d187c..d57d84a 100644 --- a/Meade.net.Telescope/Telescope.cs +++ b/Meade.net.Telescope/Telescope.cs @@ -230,12 +230,12 @@ namespace ASCOM.Meade.net break; default: LogMessage("", "Action {0}, parameters {1} not implemented", actionName, actionParameters); - throw new ASCOM.ActionNotImplementedException($"{actionName}({actionParameters})"); + throw new ActionNotImplementedException($"{actionName}({actionParameters})"); } break; default: LogMessage("", "Action {0}, parameters {1} not implemented", actionName, actionParameters); - throw new ASCOM.ActionNotImplementedException($"{actionName}"); + throw new ActionNotImplementedException($"{actionName}"); } return string.Empty; @@ -258,7 +258,7 @@ namespace ASCOM.Meade.net //string ret = CommandString(command, raw); // TODO decode the return string and return true or false // or - throw new ASCOM.MethodNotImplementedException("CommandBool"); + throw new MethodNotImplementedException("CommandBool"); // DO NOT have both these sections! One or the other } @@ -414,7 +414,7 @@ namespace ASCOM.Meade.net { get { - Version version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version; + Version version = Assembly.GetExecutingAssembly().GetName().Version; string driverVersion = $"{version.Major}.{version.Minor}.{version.Revision}.{version.Build}"; LogMessage("DriverVersion Get", driverVersion); return driverVersion; @@ -580,13 +580,13 @@ namespace ASCOM.Meade.net { var altitudeData = _sharedResourcesWrapper.Lock(() => new AltitudeData { - UtcDateTime = this.UTCDate, - SiteLongitude = this.SiteLongitude, - SiteLatitude = this.SiteLatitude, + UtcDateTime = UTCDate, + SiteLongitude = SiteLongitude, + SiteLatitude = SiteLatitude, equatorialCoordinates = new EquatorialCoordinates() { - RightAscension = this.RightAscension, - Declination = this.Declination + RightAscension = RightAscension, + Declination = Declination } }); @@ -601,7 +601,7 @@ namespace ASCOM.Meade.net get { LogMessage("ApertureArea Get", "Not implemented"); - throw new ASCOM.PropertyNotImplementedException("ApertureArea", false); + throw new PropertyNotImplementedException("ApertureArea", false); } } @@ -610,7 +610,7 @@ namespace ASCOM.Meade.net get { LogMessage("ApertureDiameter Get", "Not implemented"); - throw new ASCOM.PropertyNotImplementedException("ApertureDiameter", false); + throw new PropertyNotImplementedException("ApertureDiameter", false); } } @@ -848,14 +848,14 @@ namespace ASCOM.Meade.net set { LogMessage("DeclinationRate Set", "Not implemented"); - throw new ASCOM.PropertyNotImplementedException("DeclinationRate", true); + throw new PropertyNotImplementedException("DeclinationRate", true); } } public PierSide DestinationSideOfPier(double rightAscension, double declination) { LogMessage("DestinationSideOfPier Get", "Not implemented"); - throw new ASCOM.MethodNotImplementedException("DestinationSideOfPier"); + throw new MethodNotImplementedException("DestinationSideOfPier"); } public bool DoesRefraction @@ -863,12 +863,12 @@ namespace ASCOM.Meade.net get { LogMessage("DoesRefraction Get", "Not implemented"); - throw new ASCOM.PropertyNotImplementedException("DoesRefraction", false); + throw new PropertyNotImplementedException("DoesRefraction", false); } set { LogMessage("DoesRefraction Set", "Not implemented"); - throw new ASCOM.PropertyNotImplementedException("DoesRefraction", true); + throw new PropertyNotImplementedException("DoesRefraction", true); } } @@ -885,7 +885,7 @@ namespace ASCOM.Meade.net public void FindHome() { LogMessage("FindHome", "Not implemented"); - throw new ASCOM.MethodNotImplementedException("FindHome"); + throw new MethodNotImplementedException("FindHome"); } public double FocalLength @@ -893,7 +893,7 @@ namespace ASCOM.Meade.net get { LogMessage("FocalLength Get", "Not implemented"); - throw new ASCOM.PropertyNotImplementedException("FocalLength", false); + throw new PropertyNotImplementedException("FocalLength", false); } } @@ -902,12 +902,12 @@ namespace ASCOM.Meade.net get { LogMessage("GuideRateDeclination Get", "Not implemented"); - throw new ASCOM.PropertyNotImplementedException("GuideRateDeclination", false); + throw new PropertyNotImplementedException("GuideRateDeclination", false); } set { LogMessage("GuideRateDeclination Set", "Not implemented"); - throw new ASCOM.PropertyNotImplementedException("GuideRateDeclination", true); + throw new PropertyNotImplementedException("GuideRateDeclination", true); } } @@ -916,12 +916,12 @@ namespace ASCOM.Meade.net get { LogMessage("GuideRateRightAscension Get", "Not implemented"); - throw new ASCOM.PropertyNotImplementedException("GuideRateRightAscension", false); + throw new PropertyNotImplementedException("GuideRateRightAscension", false); } set { LogMessage("GuideRateRightAscension Set", "Not implemented"); - throw new ASCOM.PropertyNotImplementedException("GuideRateRightAscension", true); + throw new PropertyNotImplementedException("GuideRateRightAscension", true); } } @@ -972,7 +972,7 @@ namespace ASCOM.Meade.net //Returns: Nothing break; default: - throw new ASCOM.InvalidValueException($"Rate {rate} not supported"); + throw new InvalidValueException($"Rate {rate} not supported"); } switch (axis) @@ -1032,7 +1032,7 @@ namespace ASCOM.Meade.net break; default: - throw new ASCOM.InvalidValueException("Can not move this axis."); + throw new InvalidValueException("Can not move this axis."); } } @@ -1147,14 +1147,14 @@ namespace ASCOM.Meade.net set { LogMessage("RightAscensionRate Set", "Not implemented"); - throw new ASCOM.PropertyNotImplementedException("RightAscensionRate", true); + throw new PropertyNotImplementedException("RightAscensionRate", true); } } public void SetPark() { LogMessage("SetPark", "Not implemented"); - throw new ASCOM.MethodNotImplementedException("SetPark"); + throw new MethodNotImplementedException("SetPark"); } public PierSide SideOfPier @@ -1162,12 +1162,12 @@ namespace ASCOM.Meade.net get { LogMessage("SideOfPier Get", "Not implemented"); - throw new ASCOM.PropertyNotImplementedException("SideOfPier", false); + throw new PropertyNotImplementedException("SideOfPier", false); } set { LogMessage("SideOfPier Set", "Not implemented"); - throw new ASCOM.PropertyNotImplementedException("SideOfPier", true); + throw new PropertyNotImplementedException("SideOfPier", true); } } @@ -1177,13 +1177,13 @@ namespace ASCOM.Meade.net { // Now using NOVAS 3.1 double siderealTime = 0.0; - using (var novas = new ASCOM.Astrometry.NOVAS.NOVAS31()) + using (var novas = new Astrometry.NOVAS.NOVAS31()) { var jd = _utilities.DateUTCToJulian(DateTime.UtcNow); novas.SiderealTime(jd, 0, novas.DeltaT(jd), - ASCOM.Astrometry.GstType.GreenwichApparentSiderealTime, - ASCOM.Astrometry.Method.EquinoxBased, - ASCOM.Astrometry.Accuracy.Reduced, ref siderealTime); + Astrometry.GstType.GreenwichApparentSiderealTime, + Astrometry.Method.EquinoxBased, + Astrometry.Accuracy.Reduced, ref siderealTime); } // Allow for the longitude @@ -1202,12 +1202,12 @@ namespace ASCOM.Meade.net get { LogMessage("SiteElevation Get", "Not implemented"); - throw new ASCOM.PropertyNotImplementedException("SiteElevation", false); + throw new PropertyNotImplementedException("SiteElevation", false); } set { LogMessage("SiteElevation Set", "Not implemented"); - throw new ASCOM.PropertyNotImplementedException("SiteElevation", true); + throw new PropertyNotImplementedException("SiteElevation", true); } } @@ -1316,12 +1316,12 @@ namespace ASCOM.Meade.net get { LogMessage("SlewSettleTime Get", "Not implemented"); - throw new ASCOM.PropertyNotImplementedException("SlewSettleTime", false); + throw new PropertyNotImplementedException("SlewSettleTime", false); } set { LogMessage("SlewSettleTime Set", "Not implemented"); - throw new ASCOM.PropertyNotImplementedException("SlewSettleTime", true); + throw new PropertyNotImplementedException("SlewSettleTime", true); } } @@ -1343,10 +1343,10 @@ namespace ASCOM.Meade.net set { if (value > 90) - throw new ASCOM.InvalidValueException("Altitude cannot be greater than 90."); + throw new InvalidValueException("Altitude cannot be greater than 90."); if (value < 0) - throw new ASCOM.InvalidValueException("Altitide cannot be less than 0."); + throw new InvalidValueException("Altitide cannot be less than 0."); CheckConnected("TargetAltitude Set"); @@ -1363,7 +1363,7 @@ namespace ASCOM.Meade.net //0 Object out of slew range if (result == "0") - throw new ASCOM.InvalidOperationException("Target altitude out of slew range"); + throw new InvalidOperationException("Target altitude out of slew range"); } } @@ -1372,10 +1372,10 @@ namespace ASCOM.Meade.net set { if (value >= 360) - throw new ASCOM.InvalidValueException("Azimuth cannot be 360 or higher."); + throw new InvalidValueException("Azimuth cannot be 360 or higher."); if (value < 0) - throw new ASCOM.InvalidValueException("Azimuth cannot be less than 0."); + throw new InvalidValueException("Azimuth cannot be less than 0."); CheckConnected("TargetAzimuth Set"); @@ -1391,7 +1391,7 @@ namespace ASCOM.Meade.net //1 - Valid if (result == "0") - throw new ASCOM.InvalidOperationException("Target Azimuth out of slew range"); + throw new InvalidOperationException("Target Azimuth out of slew range"); } } @@ -1401,16 +1401,16 @@ namespace ASCOM.Meade.net CheckConnected("SlewToAltAzAsync"); if (altitude > 90) - throw new ASCOM.InvalidValueException("Altitude cannot be greater than 90."); + throw new InvalidValueException("Altitude cannot be greater than 90."); if (altitude < 0) - throw new ASCOM.InvalidValueException("Altitide cannot be less than 0."); + throw new InvalidValueException("Altitide cannot be less than 0."); if (azimuth >= 360) - throw new ASCOM.InvalidValueException("Azimuth cannot be 360 or higher."); + throw new InvalidValueException("Azimuth cannot be 360 or higher."); if (azimuth < 0) - throw new ASCOM.InvalidValueException("Azimuth cannot be less than 0."); + throw new InvalidValueException("Azimuth cannot be less than 0."); LogMessage("SlewToAltAzAsync", $"Az={azimuth} Alt={altitude}"); @@ -1464,15 +1464,15 @@ namespace ASCOM.Meade.net //Below Horizon string belowHorizonMessage = _sharedResourcesWrapper.ReadTerminated(); LogMessage("DoSlewAsync", $"Slew failed \"{belowHorizonMessage}\""); - throw new ASCOM.InvalidOperationException(belowHorizonMessage); + throw new InvalidOperationException(belowHorizonMessage); case "2": //Below Horizon string belowMinimumElevationMessage = _sharedResourcesWrapper.ReadTerminated(); LogMessage("DoSlewAsync", $"Slew failed \"{belowMinimumElevationMessage}\""); - throw new ASCOM.InvalidOperationException(belowMinimumElevationMessage); + throw new InvalidOperationException(belowMinimumElevationMessage); default: LogMessage("DoSlewAsync", $"Slew failed - unknown response \"{response}\""); - throw new ASCOM.DriverException("This error should not happen"); + throw new DriverException("This error should not happen"); } @@ -1487,7 +1487,7 @@ namespace ASCOM.Meade.net if (maResponse == "1") { - throw new ASCOM.InvalidOperationException("fault"); + throw new InvalidOperationException("fault"); } break; @@ -1544,7 +1544,7 @@ namespace ASCOM.Meade.net CheckConnected("SlewToTargetAsync"); if (TargetDeclination == INVALID_PARAMETER || TargetRightAscension == INVALID_PARAMETER) - throw new ASCOM.InvalidOperationException("No target selected to slew to."); + throw new InvalidOperationException("No target selected to slew to."); DoSlewAsync(true); } @@ -1587,7 +1587,7 @@ namespace ASCOM.Meade.net public void SyncToAltAz(double azimuth, double altitude) { LogMessage("SyncToAltAz", "Not implemented"); - throw new ASCOM.MethodNotImplementedException("SyncToAltAz"); + throw new MethodNotImplementedException("SyncToAltAz"); } public void SyncToCoordinates(double rightAscension, double declination) @@ -1616,7 +1616,7 @@ namespace ASCOM.Meade.net // Autostars & Autostar II - A static string: " M31 EX GAL MAG 3.5 SZ178.0'#" if (result == string.Empty) - throw new ASCOM.InvalidOperationException("Unable to perform sync"); + throw new InvalidOperationException("Unable to perform sync"); } private double _targetDeclination = INVALID_PARAMETER; @@ -1625,7 +1625,7 @@ namespace ASCOM.Meade.net get { if (_targetDeclination == INVALID_PARAMETER) - throw new ASCOM.InvalidOperationException("Target not set"); + throw new InvalidOperationException("Target not set"); //var result = SerialPort.CommandTerminated(":Gd#", "#"); ////:Gd# Get Currently Selected Object/Target Declination @@ -1647,10 +1647,10 @@ namespace ASCOM.Meade.net //todo implement low precision version of this. if (value > 90) - throw new ASCOM.InvalidValueException("Declination cannot be greater than 90."); + throw new InvalidValueException("Declination cannot be greater than 90."); if (value < -90) - throw new ASCOM.InvalidValueException("Declination cannot be less than -90."); + throw new InvalidValueException("Declination cannot be less than -90."); var dms = _utilities.DegreesToDMS(value, "*", ":", ":", 2); var s = value < 0 ? string.Empty : "+"; @@ -1667,7 +1667,7 @@ namespace ASCOM.Meade.net if (result == "0") { - throw new ASCOM.InvalidOperationException("Target declination invalid"); + throw new InvalidOperationException("Target declination invalid"); } _targetDeclination = value; @@ -1680,7 +1680,7 @@ namespace ASCOM.Meade.net get { if (_targetRightAscension == INVALID_PARAMETER) - throw new ASCOM.InvalidOperationException("Target not set"); + throw new InvalidOperationException("Target not set"); //var result = SerialPort.CommandTerminated(":Gr#", "#"); ////:Gr# Get current/target object RA @@ -1914,7 +1914,7 @@ namespace ASCOM.Meade.net public void Unpark() { LogMessage("Unpark", "Not implemented"); - throw new ASCOM.MethodNotImplementedException("Unpark"); + throw new MethodNotImplementedException("Unpark"); } #endregion @@ -1935,7 +1935,7 @@ namespace ASCOM.Meade.net /// If true, registers the driver, otherwise unregisters it. private static void RegUnregASCOM(bool bRegister) { - using (var P = new ASCOM.Utilities.Profile()) + using (var P = new Profile()) { P.DeviceType = "Telescope"; if (bRegister) @@ -2010,7 +2010,7 @@ namespace ASCOM.Meade.net { if (!IsConnected) { - throw new ASCOM.NotConnectedException($"Not connected to telescope when trying to execute: {message}"); + throw new NotConnectedException($"Not connected to telescope when trying to execute: {message}"); } } diff --git a/Meade.net.focuser/Focuser.cs b/Meade.net.focuser/Focuser.cs index 62d4ba3..d39d12c 100644 --- a/Meade.net.focuser/Focuser.cs +++ b/Meade.net.focuser/Focuser.cs @@ -117,7 +117,7 @@ namespace ASCOM.Meade.net public string Action(string actionName, string actionParameters) { LogMessage("", "Action {0}, parameters {1} not implemented", actionName, actionParameters); - throw new ASCOM.ActionNotImplementedException("Action " + actionName + " is not implemented by this driver"); + throw new ActionNotImplementedException("Action " + actionName + " is not implemented by this driver"); } public void CommandBlind(string command, bool raw) @@ -137,7 +137,7 @@ namespace ASCOM.Meade.net //string ret = CommandString(command, raw); // TODO decode the return string and return true or false // or - throw new ASCOM.MethodNotImplementedException("CommandBool"); + throw new MethodNotImplementedException("CommandBool"); // DO NOT have both these sections! One or the other } @@ -149,7 +149,7 @@ namespace ASCOM.Meade.net // you need something to ensure that only one command is in progress at a time return _sharedResourcesWrapper.SendString(command); - throw new ASCOM.MethodNotImplementedException("CommandString"); + throw new MethodNotImplementedException("CommandString"); } public void Dispose() @@ -250,7 +250,7 @@ namespace ASCOM.Meade.net { get { - Version version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version; + Version version = Assembly.GetExecutingAssembly().GetName().Version; // TODO customise this driver description string driverInfo = "Information about the driver itself. Version: " + String.Format(CultureInfo.InvariantCulture, "{0}.{1}", version.Major, version.Minor); tl.LogMessage("DriverInfo Get", driverInfo); @@ -262,7 +262,7 @@ namespace ASCOM.Meade.net { get { - Version version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version; + Version version = Assembly.GetExecutingAssembly().GetName().Version; string driverVersion = String.Format(CultureInfo.InvariantCulture, "{0}.{1}", version.Major, version.Minor); tl.LogMessage("DriverVersion Get", driverVersion); return driverVersion; @@ -334,13 +334,13 @@ namespace ASCOM.Meade.net { get { - tl.LogMessage("Link Get", this.Connected.ToString()); - return this.Connected; // Direct function to the connected method, the Link method is just here for backwards compatibility + tl.LogMessage("Link Get", Connected.ToString()); + return Connected; // Direct function to the connected method, the Link method is just here for backwards compatibility } set { tl.LogMessage("Link Set", value.ToString()); - this.Connected = value; // Direct function to the connected method, the Link method is just here for backwards compatibility + Connected = value; // Direct function to the connected method, the Link method is just here for backwards compatibility } } @@ -375,7 +375,7 @@ namespace ASCOM.Meade.net if (Position < -MaxIncrement || Position > MaxIncrement) { - throw new ASCOM.InvalidValueException($"position out of range {-MaxIncrement} < {Position} < {MaxIncrement}"); + throw new InvalidValueException($"position out of range {-MaxIncrement} < {Position} < {MaxIncrement}"); } if (Position == 0) @@ -434,7 +434,7 @@ namespace ASCOM.Meade.net { get { - throw new ASCOM.PropertyNotImplementedException("Position", false); + throw new PropertyNotImplementedException("Position", false); //return focuserPosition; // Return the focuser position } } @@ -444,7 +444,7 @@ namespace ASCOM.Meade.net get { tl.LogMessage("StepSize Get", "Not implemented"); - throw new ASCOM.PropertyNotImplementedException("StepSize", false); + throw new PropertyNotImplementedException("StepSize", false); } } @@ -458,7 +458,7 @@ namespace ASCOM.Meade.net set { tl.LogMessage("TempComp Set", "Not implemented"); - throw new ASCOM.PropertyNotImplementedException("TempComp", false); + throw new PropertyNotImplementedException("TempComp", false); } } @@ -476,7 +476,7 @@ namespace ASCOM.Meade.net get { tl.LogMessage("Temperature Get", "Not implemented"); - throw new ASCOM.PropertyNotImplementedException("Temperature", false); + throw new PropertyNotImplementedException("Temperature", false); } } @@ -498,7 +498,7 @@ namespace ASCOM.Meade.net /// If true, registers the driver, otherwise unregisters it. private static void RegUnregASCOM(bool bRegister) { - using (var P = new ASCOM.Utilities.Profile()) + using (var P = new Profile()) { P.DeviceType = "Focuser"; if (bRegister) @@ -573,7 +573,7 @@ namespace ASCOM.Meade.net { if (!IsConnected) { - throw new ASCOM.NotConnectedException(message); + throw new NotConnectedException(message); } } diff --git a/Meade.net/LocalServer.cs b/Meade.net/LocalServer.cs index a4fc2c2..922dbec 100644 --- a/Meade.net/LocalServer.cs +++ b/Meade.net/LocalServer.cs @@ -420,7 +420,7 @@ namespace ASCOM.Meade.net // Pull the display name from the ServedClassName attribute. attr = Attribute.GetCustomAttribute(type, typeof(ServedClassNameAttribute)); //PWGS Changed to search type for attribute rather than assembly string chooserName = ((ServedClassNameAttribute)attr).DisplayName ?? "MultiServer"; - using (var P = new ASCOM.Utilities.Profile()) + using (var P = new Profile()) { P.DeviceType = deviceType; P.Register(progid, chooserName); @@ -490,7 +490,7 @@ namespace ASCOM.Meade.net // // ASCOM // - using (var P = new ASCOM.Utilities.Profile()) + using (var P = new Profile()) { P.DeviceType = deviceType; P.Unregister(progid); diff --git a/Meade.net/SetupDialogForm.cs b/Meade.net/SetupDialogForm.cs index 2a1dac3..aedb020 100644 --- a/Meade.net/SetupDialogForm.cs +++ b/Meade.net/SetupDialogForm.cs @@ -29,12 +29,12 @@ namespace ASCOM.Meade.net { System.Diagnostics.Process.Start("http://ascom-standards.org/"); } - catch (System.ComponentModel.Win32Exception noBrowser) + catch (Win32Exception noBrowser) { if (noBrowser.ErrorCode == -2147467259) MessageBox.Show(noBrowser.Message); } - catch (System.Exception other) + catch (Exception other) { MessageBox.Show(other.Message); } diff --git a/Meade.net/SharedResources.cs b/Meade.net/SharedResources.cs index 7b7525b..1dd7630 100644 --- a/Meade.net/SharedResources.cs +++ b/Meade.net/SharedResources.cs @@ -35,7 +35,7 @@ namespace ASCOM.Meade.net private static readonly object lockObject = new object(); // Shared serial port. This will allow multiple drivers to use one single serial port. - private static ASCOM.Utilities.Serial s_sharedSerial; // Shared serial port + private static Serial s_sharedSerial; // Shared serial port // // Public access to shared resources @@ -60,7 +60,7 @@ namespace ASCOM.Meade.net /// /// Shared serial port /// - public static ASCOM.Utilities.Serial SharedSerial => s_sharedSerial ?? (s_sharedSerial = new ASCOM.Utilities.Serial()); + public static Serial SharedSerial => s_sharedSerial ?? (s_sharedSerial = new Serial()); /// /// number of connections to the shared serial port @@ -266,15 +266,15 @@ namespace ASCOM.Meade.net if (connectedDevices[deviceId].count == 1) { var profileProperties = ReadProfile(); - SharedResources.SharedSerial.PortName = profileProperties.ComPort; - SharedResources.SharedSerial.DTREnable = false; - SharedResources.SharedSerial.RTSEnable = false; - SharedResources.SharedSerial.DataBits = 8; - SharedResources.SharedSerial.StopBits = SerialStopBits.One; - SharedResources.SharedSerial.Parity = SerialParity.None; - SharedResources.SharedSerial.Speed = SerialSpeed.ps9600; - SharedResources.SharedSerial.Handshake = SerialHandshake.None; - SharedResources.SharedSerial.Connected = true; + SharedSerial.PortName = profileProperties.ComPort; + SharedSerial.DTREnable = false; + SharedSerial.RTSEnable = false; + SharedSerial.DataBits = 8; + SharedSerial.StopBits = SerialStopBits.One; + SharedSerial.Parity = SerialParity.None; + SharedSerial.Speed = SerialSpeed.ps9600; + SharedSerial.Handshake = SerialHandshake.None; + SharedSerial.Connected = true; ProductName = SendString(":GVP#"); FirmwareVersion = SendString(":GVN#"); @@ -295,7 +295,7 @@ namespace ASCOM.Meade.net connectedDevices.Remove(deviceId); if (deviceId == "Serial") { - SharedResources.SharedSerial.Connected = false; + SharedSerial.Connected = false; } } } diff --git a/TelescopeTestConsole/Program.cs b/TelescopeTestConsole/Program.cs index 98c8e2b..6636701 100644 --- a/TelescopeTestConsole/Program.cs +++ b/TelescopeTestConsole/Program.cs @@ -22,11 +22,11 @@ namespace ASCOM // Uncomment the code that's required #if UseChooser // choose the device - string id = ASCOM.DriverAccess.Telescope.Choose("ASCOM.MeadeGeneric.Telescope"); + string id = DriverAccess.Telescope.Choose("ASCOM.MeadeGeneric.Telescope"); if (string.IsNullOrEmpty(id)) return; // create this device - ASCOM.DriverAccess.Telescope device = new ASCOM.DriverAccess.Telescope(id); + DriverAccess.Telescope device = new DriverAccess.Telescope(id); #else // this can be replaced by this code, it avoids the chooser and creates the driver class directly. ASCOM.DriverAccess.Telescope device = new ASCOM.DriverAccess.Telescope("ASCOM.Meade.net.Telescope");