Code inspections

This commit is contained in:
2019-09-29 19:51:19 +01:00
parent 272fdb58d1
commit 0e0ea2d2b0
22 changed files with 195 additions and 160 deletions
@@ -1,4 +1,5 @@
using System; using System;
using System.Reflection;
using ASCOM; using ASCOM;
using ASCOM.DeviceInterface; using ASCOM.DeviceInterface;
using ASCOM.Meade.net; using ASCOM.Meade.net;
@@ -239,7 +240,7 @@ namespace Meade.net.Focuser.UnitTests
[Test] [Test]
public void DriverVersion_Get() 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}"; string exptectedDriverInfo = $"{version.Major}.{version.Minor}.{version.Build}.{version.Revision}";
@@ -1,4 +1,5 @@
using System; using System;
using System.Reflection;
using ASCOM; using ASCOM;
using ASCOM.Astrometry.AstroUtils; using ASCOM.Astrometry.AstroUtils;
using ASCOM.DeviceInterface; using ASCOM.DeviceInterface;
@@ -45,8 +46,8 @@ namespace Meade.net.Telescope.UnitTests
_sharedResourcesWrapperMock.Setup(x => x.ReadProfile()).Returns(() =>_profileProperties); _sharedResourcesWrapperMock.Setup(x => x.ReadProfile()).Returns(() =>_profileProperties);
_sharedResourcesWrapperMock.Setup(x => x.Lock(It.IsAny<Action>())).Callback<Action>(action => { action(); }); _sharedResourcesWrapperMock.Setup(x => x.Lock(It.IsAny<Action>())).Callback<Action>(action => { action(); });
_sharedResourcesWrapperMock.Setup(x => x.Lock(It.IsAny<Func<ASCOM.Meade.net.Telescope.TelescopeDateDetails>>())).Returns<Func<ASCOM.Meade.net.Telescope.TelescopeDateDetails>>( (func) => func()); _sharedResourcesWrapperMock.Setup(x => x.Lock(It.IsAny<Func<ASCOM.Meade.net.Telescope.TelescopeDateDetails>>())).Returns<Func<ASCOM.Meade.net.Telescope.TelescopeDateDetails>>( func => func());
_sharedResourcesWrapperMock.Setup(x => x.Lock(It.IsAny<Func<AltitudeData>>())).Returns<Func<AltitudeData>>((func) => func()); _sharedResourcesWrapperMock.Setup(x => x.Lock(It.IsAny<Func<AltitudeData>>())).Returns<Func<AltitudeData>>(func => func());
_connectionInfo = new ConnectionInfo {Connections = 1, SameDevice = 1}; _connectionInfo = new ConnectionInfo {Connections = 1, SameDevice = 1};
@@ -243,7 +244,7 @@ namespace Meade.net.Telescope.UnitTests
{ {
ConnectTelescope(); ConnectTelescope();
string parameters = $"unknown"; string parameters = "unknown";
var exception = Assert.Throws<InvalidValueException>(() => { _telescope.Action("site", parameters); }); var exception = Assert.Throws<InvalidValueException>(() => { _telescope.Action("site", parameters); });
Assert.That(exception.Message, Is.EqualTo($"Site parameters {parameters} not known")); Assert.That(exception.Message, Is.EqualTo($"Site parameters {parameters} not known"));
@@ -514,7 +515,7 @@ namespace Meade.net.Telescope.UnitTests
[Test] [Test]
public void DriverVersion_Get() 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}"; string exptectedDriverInfo = $"{version.Major}.{version.Minor}.{version.Build}.{version.Revision}";
@@ -1183,7 +1184,7 @@ namespace Meade.net.Telescope.UnitTests
var exception = Assert.Throws<InvalidValueException>(() => { _telescope.MoveAxis(TelescopeAxes.axisTertiary, testRate); }); var exception = Assert.Throws<InvalidValueException>(() => { _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] [Test]
@@ -2190,8 +2191,7 @@ namespace Meade.net.Telescope.UnitTests
slewCounter++; slewCounter++;
if (slewCounter <= iterations) if (slewCounter <= iterations)
return "|"; return "|";
else return "";
return "";
}); });
_telescope.SlewToTarget(); _telescope.SlewToTarget();
@@ -2259,8 +2259,7 @@ namespace Meade.net.Telescope.UnitTests
slewCounter++; slewCounter++;
if (slewCounter <= iterations) if (slewCounter <= iterations)
return "|"; return "|";
else return "";
return "";
}); });
_telescope.SlewToCoordinates(rightAscension, declination); _telescope.SlewToCoordinates(rightAscension, declination);
@@ -2330,7 +2329,7 @@ namespace Meade.net.Telescope.UnitTests
_astroMathsMock _astroMathsMock
.Setup(x => x.ConvertHozToEq(It.IsAny<DateTime>(), It.IsAny<double>(), It.IsAny<double>(), .Setup(x => x.ConvertHozToEq(It.IsAny<DateTime>(), It.IsAny<double>(), It.IsAny<double>(),
It.IsAny<HorizonCoordinates>())).Returns(new EquatorialCoordinates(){ Declination = declination, RightAscension = rightAscension }); It.IsAny<HorizonCoordinates>())).Returns(new EquatorialCoordinates { Declination = declination, RightAscension = rightAscension });
_sharedResourcesWrapperMock.Setup(x => x.SendChar(":MS#")).Returns("0"); _sharedResourcesWrapperMock.Setup(x => x.SendChar(":MS#")).Returns("0");
@@ -2364,7 +2363,7 @@ namespace Meade.net.Telescope.UnitTests
_astroMathsMock _astroMathsMock
.Setup(x => x.ConvertHozToEq(It.IsAny<DateTime>(), It.IsAny<double>(), It.IsAny<double>(), .Setup(x => x.ConvertHozToEq(It.IsAny<DateTime>(), It.IsAny<double>(), It.IsAny<double>(),
It.IsAny<HorizonCoordinates>())).Returns(new EquatorialCoordinates() { Declination = declination, RightAscension = rightAscension }); It.IsAny<HorizonCoordinates>())).Returns(new EquatorialCoordinates { Declination = declination, RightAscension = rightAscension });
_sharedResourcesWrapperMock.Setup(x => x.SendChar(":MS#")).Returns("0"); _sharedResourcesWrapperMock.Setup(x => x.SendChar(":MS#")).Returns("0");
@@ -2375,8 +2374,7 @@ namespace Meade.net.Telescope.UnitTests
slewCounter++; slewCounter++;
if (slewCounter <= iterations) if (slewCounter <= iterations)
return "|"; return "|";
else return "";
return "";
}); });
_telescope.SlewToAltAz( azimuth, altitude); _telescope.SlewToAltAz( azimuth, altitude);
@@ -2499,5 +2497,4 @@ namespace Meade.net.Telescope.UnitTests
_sharedResourcesWrapperMock.Verify( x => x.SendString(":D#"), Times.Once); _sharedResourcesWrapperMock.Verify( x => x.SendString(":D#"), Times.Once);
} }
} }
} }
;
+25 -19
View File
@@ -8,10 +8,16 @@
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
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 { namespace ASCOM.Meade.net.Properties {
using System;
/// <summary> /// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc. /// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary> /// </summary>
@@ -19,27 +25,27 @@ namespace ASCOM.Meade.net.Properties {
// class via a tool like ResGen or Visual Studio. // class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen // To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project. // with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] [GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [DebuggerNonUserCode()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [CompilerGenerated()]
internal class Resources { 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() { internal Resources() {
} }
/// <summary> /// <summary>
/// Returns the cached ResourceManager instance used by this class. /// Returns the cached ResourceManager instance used by this class.
/// </summary> /// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] [EditorBrowsable(EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager { internal static ResourceManager ResourceManager {
get { get {
if (object.ReferenceEquals(resourceMan, null)) { if (ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ASCOM.Meade.net.Properties.Resources", typeof(Resources).Assembly); ResourceManager temp = new ResourceManager("ASCOM.Meade.net.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp; resourceMan = temp;
} }
return resourceMan; return resourceMan;
@@ -50,8 +56,8 @@ namespace ASCOM.Meade.net.Properties {
/// Overrides the current thread's CurrentUICulture property for all /// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class. /// resource lookups using this strongly typed resource class.
/// </summary> /// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] [EditorBrowsable(EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture { internal static CultureInfo Culture {
get { get {
return resourceCulture; return resourceCulture;
} }
@@ -63,20 +69,20 @@ namespace ASCOM.Meade.net.Properties {
/// <summary> /// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap. /// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary> /// </summary>
internal static System.Drawing.Bitmap ASCOM { internal static Bitmap ASCOM {
get { get {
object obj = ResourceManager.GetObject("ASCOM", resourceCulture); object obj = ResourceManager.GetObject("ASCOM", resourceCulture);
return ((System.Drawing.Bitmap)(obj)); return ((Bitmap)(obj));
} }
} }
/// <summary> /// <summary>
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon). /// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
/// </summary> /// </summary>
internal static System.Drawing.Icon DefaultIcon { internal static Icon DefaultIcon {
get { get {
object obj = ResourceManager.GetObject("DefaultIcon", resourceCulture); object obj = ResourceManager.GetObject("DefaultIcon", resourceCulture);
return ((System.Drawing.Icon)(obj)); return ((Icon)(obj));
} }
} }
+8 -4
View File
@@ -8,14 +8,18 @@
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
using System.CodeDom.Compiler;
using System.Configuration;
using System.Runtime.CompilerServices;
namespace ASCOM.Meade.net.Properties { namespace ASCOM.Meade.net.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [CompilerGenerated()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.0.0.0")] [GeneratedCode("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 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 { public static Settings Default {
get { get {
+3 -3
View File
@@ -1,7 +1,7 @@
using System.Runtime.InteropServices; using System.Collections;
using ASCOM.DeviceInterface; using System.Runtime.InteropServices;
using System.Collections;
using System.Threading; using System.Threading;
using ASCOM.DeviceInterface;
namespace ASCOM.Meade.net namespace ASCOM.Meade.net
{ {
+35 -33
View File
@@ -1,16 +1,18 @@
#define Telescope #define Telescope
using System; using System;
using System.Runtime.InteropServices;
using ASCOM.Astrometry.AstroUtils;
using ASCOM.Utilities;
using ASCOM.DeviceInterface;
using System.Collections; using System.Collections;
using System.Globalization; using System.Globalization;
using System.Reflection; 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.AstroMaths;
using ASCOM.Meade.net.Properties; using ASCOM.Meade.net.Properties;
using ASCOM.Meade.net.Wrapper; using ASCOM.Meade.net.Wrapper;
using ASCOM.Utilities;
using ASCOM.Utilities.Interfaces; using ASCOM.Utilities.Interfaces;
namespace ASCOM.Meade.net namespace ASCOM.Meade.net
@@ -538,7 +540,7 @@ namespace ASCOM.Meade.net
if (site < 1) if (site < 1)
throw new ArgumentOutOfRangeException(nameof(site),site,Resources.Telescope_SelectSite_Site_cannot_be_lower_than_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); throw new ArgumentOutOfRangeException(nameof(site), site, Resources.Telescope_SelectSite_Site_cannot_be_higher_than_4);
_sharedResourcesWrapper.SendBlind($":W{site}#"); _sharedResourcesWrapper.SendBlind($":W{site}#");
@@ -553,7 +555,7 @@ namespace ASCOM.Meade.net
if (site < 1) if (site < 1)
throw new ArgumentOutOfRangeException(nameof(site), site, Resources.Telescope_SelectSite_Site_cannot_be_lower_than_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); throw new ArgumentOutOfRangeException(nameof(site), site, Resources.Telescope_SelectSite_Site_cannot_be_higher_than_4);
string command = String.Empty; string command = String.Empty;
@@ -607,7 +609,7 @@ namespace ASCOM.Meade.net
if (site < 1) if (site < 1)
throw new ArgumentOutOfRangeException(nameof(site), site, Resources.Telescope_SelectSite_Site_cannot_be_lower_than_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); throw new ArgumentOutOfRangeException(nameof(site), site, Resources.Telescope_SelectSite_Site_cannot_be_higher_than_4);
switch (site) switch (site)
@@ -831,7 +833,7 @@ namespace ASCOM.Meade.net
UtcDateTime = UTCDate, UtcDateTime = UTCDate,
SiteLongitude = SiteLongitude, SiteLongitude = SiteLongitude,
SiteLatitude = SiteLatitude, SiteLatitude = SiteLatitude,
EquatorialCoordinates = new EquatorialCoordinates() EquatorialCoordinates = new EquatorialCoordinates
{ {
RightAscension = RightAscension, RightAscension = RightAscension,
Declination = Declination Declination = Declination
@@ -866,7 +868,7 @@ namespace ASCOM.Meade.net
{ {
get get
{ {
LogMessage("AtHome", "Get - " + false.ToString()); LogMessage("AtHome", "Get - " + false);
return false; return false;
} }
} }
@@ -885,7 +887,7 @@ namespace ASCOM.Meade.net
public IAxisRates AxisRates(TelescopeAxes axis) public IAxisRates AxisRates(TelescopeAxes axis)
{ {
LogMessage("AxisRates", "Get - " + axis.ToString()); LogMessage("AxisRates", "Get - " + axis);
return new AxisRates(axis); return new AxisRates(axis);
} }
@@ -915,14 +917,14 @@ namespace ASCOM.Meade.net
{ {
get get
{ {
LogMessage("CanFindHome", "Get - " + false.ToString()); LogMessage("CanFindHome", "Get - " + false);
return false; return false;
} }
} }
public bool CanMoveAxis(TelescopeAxes axis) public bool CanMoveAxis(TelescopeAxes axis)
{ {
LogMessage("CanMoveAxis", "Get - " + axis.ToString()); LogMessage("CanMoveAxis", "Get - " + axis);
switch (axis) switch (axis)
{ {
case TelescopeAxes.axisPrimary: return true; //RA or AZ case TelescopeAxes.axisPrimary: return true; //RA or AZ
@@ -936,7 +938,7 @@ namespace ASCOM.Meade.net
{ {
get get
{ {
LogMessage("CanPark", "Get - " + true.ToString()); LogMessage("CanPark", "Get - " + true);
return true; return true;
} }
} }
@@ -945,7 +947,7 @@ namespace ASCOM.Meade.net
{ {
get get
{ {
LogMessage("CanPulseGuide", "Get - " + true.ToString()); LogMessage("CanPulseGuide", "Get - " + true);
return true; return true;
} }
} }
@@ -954,7 +956,7 @@ namespace ASCOM.Meade.net
{ {
get get
{ {
LogMessage("CanSetDeclinationRate", "Get - " + false.ToString()); LogMessage("CanSetDeclinationRate", "Get - " + false);
return false; return false;
} }
} }
@@ -967,7 +969,7 @@ namespace ASCOM.Meade.net
var canSetGuideRate = IsGuideRateSettingSupported(); var canSetGuideRate = IsGuideRateSettingSupported();
LogMessage("CanSetGuideRates", "Get - " + canSetGuideRate.ToString()); LogMessage("CanSetGuideRates", "Get - " + canSetGuideRate);
return canSetGuideRate; return canSetGuideRate;
} }
} }
@@ -976,7 +978,7 @@ namespace ASCOM.Meade.net
{ {
get get
{ {
LogMessage("CanSetPark", "Get - " + false.ToString()); LogMessage("CanSetPark", "Get - " + false);
return false; return false;
} }
} }
@@ -985,7 +987,7 @@ namespace ASCOM.Meade.net
{ {
get get
{ {
LogMessage("CanSetPierSide", "Get - " + false.ToString()); LogMessage("CanSetPierSide", "Get - " + false);
return false; return false;
} }
} }
@@ -994,7 +996,7 @@ namespace ASCOM.Meade.net
{ {
get get
{ {
LogMessage("CanSetRightAscensionRate", "Get - " + false.ToString()); LogMessage("CanSetRightAscensionRate", "Get - " + false);
return false; return false;
} }
} }
@@ -1003,7 +1005,7 @@ namespace ASCOM.Meade.net
{ {
get get
{ {
LogMessage("CanSetTracking", "Get - " + true.ToString()); LogMessage("CanSetTracking", "Get - " + true);
return true; return true;
} }
} }
@@ -1012,7 +1014,7 @@ namespace ASCOM.Meade.net
{ {
get get
{ {
LogMessage("CanSlew", "Get - " + true.ToString()); LogMessage("CanSlew", "Get - " + true);
return true; return true;
} }
} }
@@ -1021,7 +1023,7 @@ namespace ASCOM.Meade.net
{ {
get get
{ {
LogMessage("CanSlewAltAz", "Get - " + true.ToString()); LogMessage("CanSlewAltAz", "Get - " + true);
return true; return true;
} }
} }
@@ -1030,7 +1032,7 @@ namespace ASCOM.Meade.net
{ {
get get
{ {
LogMessage("CanSlewAltAzAsync", "Get - " + true.ToString()); LogMessage("CanSlewAltAzAsync", "Get - " + true);
return true; return true;
} }
} }
@@ -1039,7 +1041,7 @@ namespace ASCOM.Meade.net
{ {
get get
{ {
LogMessage("CanSlewAsync", "Get - " + true.ToString()); LogMessage("CanSlewAsync", "Get - " + true);
return true; return true;
} }
} }
@@ -1048,7 +1050,7 @@ namespace ASCOM.Meade.net
{ {
get get
{ {
LogMessage("CanSync", "Get - " + true.ToString()); LogMessage("CanSync", "Get - " + true);
return true; return true;
} }
} }
@@ -1057,7 +1059,7 @@ namespace ASCOM.Meade.net
{ {
get get
{ {
LogMessage("CanSyncAltAz", "Get - " + false.ToString()); LogMessage("CanSyncAltAz", "Get - " + false);
return false; return false;
} }
} }
@@ -1066,7 +1068,7 @@ namespace ASCOM.Meade.net
{ {
get get
{ {
LogMessage("CanUnpark", "Get - " + false.ToString()); LogMessage("CanUnpark", "Get - " + false);
return false; return false;
} }
} }
@@ -1131,7 +1133,7 @@ namespace ASCOM.Meade.net
get get
{ {
EquatorialCoordinateType equatorialSystem = EquatorialCoordinateType.equTopocentric; EquatorialCoordinateType equatorialSystem = EquatorialCoordinateType.equTopocentric;
LogMessage("DeclinationRate", "Get - " + equatorialSystem.ToString()); LogMessage("DeclinationRate", "Get - " + equatorialSystem);
return equatorialSystem; return equatorialSystem;
} }
} }
@@ -1473,13 +1475,13 @@ namespace ASCOM.Meade.net
{ {
// Now using NOVAS 3.1 // Now using NOVAS 3.1
double siderealTime = 0.0; double siderealTime = 0.0;
using (var novas = new Astrometry.NOVAS.NOVAS31()) using (var novas = new NOVAS31())
{ {
var jd = _utilities.DateUTCToJulian(DateTime.UtcNow); var jd = _utilities.DateUTCToJulian(DateTime.UtcNow);
novas.SiderealTime(jd, 0, novas.DeltaT(jd), novas.SiderealTime(jd, 0, novas.DeltaT(jd),
Astrometry.GstType.GreenwichApparentSiderealTime, GstType.GreenwichApparentSiderealTime,
Astrometry.Method.EquinoxBased, Method.EquinoxBased,
Astrometry.Accuracy.Reduced, ref siderealTime); Accuracy.Reduced, ref siderealTime);
} }
// Allow for the longitude // Allow for the longitude
@@ -2096,7 +2098,7 @@ namespace ASCOM.Meade.net
LogMessage("TrackingRates", "Get - "); LogMessage("TrackingRates", "Get - ");
foreach (DriveRates driveRate in trackingRates) foreach (DriveRates driveRate in trackingRates)
{ {
LogMessage("TrackingRates", "Get - " + driveRate.ToString()); LogMessage("TrackingRates", "Get - " + driveRate);
} }
return trackingRates; return trackingRates;
} }
+4 -4
View File
@@ -1,13 +1,13 @@
#define Focuser #define Focuser
using System; using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
using ASCOM.Utilities;
using ASCOM.DeviceInterface;
using System.Collections; using System.Collections;
using System.Diagnostics;
using System.Reflection; using System.Reflection;
using System.Runtime.InteropServices;
using ASCOM.DeviceInterface;
using ASCOM.Meade.net.Wrapper; using ASCOM.Meade.net.Wrapper;
using ASCOM.Utilities;
using ASCOM.Utilities.Interfaces; using ASCOM.Utilities.Interfaces;
namespace ASCOM.Meade.net namespace ASCOM.Meade.net
+25 -19
View File
@@ -8,10 +8,16 @@
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
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 { namespace ASCOM.Meade.net.Properties {
using System;
/// <summary> /// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc. /// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary> /// </summary>
@@ -19,27 +25,27 @@ namespace ASCOM.Meade.net.Properties {
// class via a tool like ResGen or Visual Studio. // class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen // To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project. // with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] [GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [DebuggerNonUserCode()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [CompilerGenerated()]
internal class Resources { 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() { internal Resources() {
} }
/// <summary> /// <summary>
/// Returns the cached ResourceManager instance used by this class. /// Returns the cached ResourceManager instance used by this class.
/// </summary> /// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] [EditorBrowsable(EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager { internal static ResourceManager ResourceManager {
get { get {
if (object.ReferenceEquals(resourceMan, null)) { if (ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ASCOM.Meade.net.Properties.Resources", typeof(Resources).Assembly); ResourceManager temp = new ResourceManager("ASCOM.Meade.net.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp; resourceMan = temp;
} }
return resourceMan; return resourceMan;
@@ -50,8 +56,8 @@ namespace ASCOM.Meade.net.Properties {
/// Overrides the current thread's CurrentUICulture property for all /// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class. /// resource lookups using this strongly typed resource class.
/// </summary> /// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] [EditorBrowsable(EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture { internal static CultureInfo Culture {
get { get {
return resourceCulture; return resourceCulture;
} }
@@ -63,20 +69,20 @@ namespace ASCOM.Meade.net.Properties {
/// <summary> /// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap. /// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary> /// </summary>
internal static System.Drawing.Bitmap ASCOM { internal static Bitmap ASCOM {
get { get {
object obj = ResourceManager.GetObject("ASCOM", resourceCulture); object obj = ResourceManager.GetObject("ASCOM", resourceCulture);
return ((System.Drawing.Bitmap)(obj)); return ((Bitmap)(obj));
} }
} }
/// <summary> /// <summary>
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon). /// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
/// </summary> /// </summary>
internal static System.Drawing.Icon DefaultIcon { internal static Icon DefaultIcon {
get { get {
object obj = ResourceManager.GetObject("DefaultIcon", resourceCulture); object obj = ResourceManager.GetObject("DefaultIcon", resourceCulture);
return ((System.Drawing.Icon)(obj)); return ((Icon)(obj));
} }
} }
} }
+8 -4
View File
@@ -8,14 +8,18 @@
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
using System.CodeDom.Compiler;
using System.Configuration;
using System.Runtime.CompilerServices;
namespace ASCOM.Meade.net.Properties { namespace ASCOM.Meade.net.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [CompilerGenerated()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.0.0.0")] [GeneratedCode("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 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 { public static Settings Default {
get { get {
+1 -1
View File
@@ -1,7 +1,7 @@
using System; using System;
using System.Reflection; using System.Reflection;
using System.Runtime.InteropServices;
using System.Resources; using System.Resources;
using System.Runtime.InteropServices;
namespace ASCOM.Meade.net namespace ASCOM.Meade.net
{ {
+1 -2
View File
@@ -1,6 +1,6 @@
using System; using System;
using System.Runtime.InteropServices;
using System.Collections; using System.Collections;
using System.Runtime.InteropServices;
namespace ASCOM.Meade.net namespace ASCOM.Meade.net
{ {
@@ -204,7 +204,6 @@ namespace ASCOM.Meade.net
if (riid == IidIDispatch) if (riid == IidIDispatch)
{ {
ppvObject = Marshal.GetIDispatchForObject(Activator.CreateInstance(_mClassType)); ppvObject = Marshal.GetIDispatchForObject(Activator.CreateInstance(_mClassType));
return;
} }
else if (riid == IidIUnknown) else if (riid == IidIUnknown)
{ {
+10 -8
View File
@@ -12,17 +12,19 @@
// Modified by Chris Rowland and Peter Simpson to allow use with multiple devices of the same type March 2011 // Modified by Chris Rowland and Peter Simpson to allow use with multiple devices of the same type March 2011
// //
// //
using System; using System;
using System.IO;
using System.Windows.Forms;
using System.Collections; using System.Collections;
using System.Runtime.InteropServices; using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Reflection; using System.Reflection;
using System.Runtime.InteropServices;
using System.Security.Principal;
using System.Threading;
using System.Windows.Forms;
using ASCOM.Utilities; using ASCOM.Utilities;
using Microsoft.Win32; using Microsoft.Win32;
using System.Threading;
using System.Security.Principal;
using System.Diagnostics;
namespace ASCOM.Meade.net namespace ASCOM.Meade.net
{ {
@@ -109,7 +111,7 @@ namespace ASCOM.Meade.net
#region Private Data #region Private Data
private static int _objsInUse; // Keeps a count on the total number of objects alive. 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 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 _sComObjectAssys; // Dynamically loaded assemblies containing served COM objects
private static ArrayList _sComObjectTypes; // Served COM object types private static ArrayList _sComObjectTypes; // Served COM object types
private static ArrayList _sClassFactories; // Served COM object class factories private static ArrayList _sClassFactories; // Served COM object class factories
@@ -293,7 +295,7 @@ namespace ASCOM.Meade.net
Verb = "runas" Verb = "runas"
}; };
try { Process.Start(si); } 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); MessageBox.Show($"The {DriverName} was not {(arg == "/register" ? "registered" : "unregistered")} because you did not allow it.", DriverName, MessageBoxButtons.OK, MessageBoxIcon.Warning);
} }
+2 -2
View File
@@ -1,7 +1,7 @@
using System.Globalization; using System.Globalization;
using System.Threading;
using System.Resources;
using System.Reflection; using System.Reflection;
using System.Resources;
using System.Threading;
namespace ASCOM.Meade.net.Localization namespace ASCOM.Meade.net.Localization
{ {
+1 -1
View File
@@ -23,4 +23,4 @@ using System.Runtime.InteropServices;
[assembly: AssemblyVersion("0.0.0.0")] [assembly: AssemblyVersion("0.0.0.0")]
[assembly: AssemblyFileVersion("0.0.0.0")] [assembly: AssemblyFileVersion("0.0.0.0")]
[assembly: ComVisibleAttribute(false)] [assembly: ComVisible(false)]
+23 -17
View File
@@ -8,10 +8,16 @@
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
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 { namespace ASCOM.Meade.net.Properties {
using System;
/// <summary> /// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc. /// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary> /// </summary>
@@ -19,27 +25,27 @@ namespace ASCOM.Meade.net.Properties {
// class via a tool like ResGen or Visual Studio. // class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen // To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project. // with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] [GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [DebuggerNonUserCode()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [CompilerGenerated()]
internal class Resources { 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() { internal Resources() {
} }
/// <summary> /// <summary>
/// Returns the cached ResourceManager instance used by this class. /// Returns the cached ResourceManager instance used by this class.
/// </summary> /// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] [EditorBrowsable(EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager { internal static ResourceManager ResourceManager {
get { get {
if (object.ReferenceEquals(resourceMan, null)) { if (ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ASCOM.Meade.net.Properties.Resources", typeof(Resources).Assembly); ResourceManager temp = new ResourceManager("ASCOM.Meade.net.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp; resourceMan = temp;
} }
return resourceMan; return resourceMan;
@@ -50,8 +56,8 @@ namespace ASCOM.Meade.net.Properties {
/// Overrides the current thread's CurrentUICulture property for all /// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class. /// resource lookups using this strongly typed resource class.
/// </summary> /// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] [EditorBrowsable(EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture { internal static CultureInfo Culture {
get { get {
return resourceCulture; return resourceCulture;
} }
@@ -63,10 +69,10 @@ namespace ASCOM.Meade.net.Properties {
/// <summary> /// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap. /// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary> /// </summary>
internal static System.Drawing.Bitmap ASCOM { internal static Bitmap ASCOM {
get { get {
object obj = ResourceManager.GetObject("ASCOM", resourceCulture); object obj = ResourceManager.GetObject("ASCOM", resourceCulture);
return ((System.Drawing.Bitmap)(obj)); return ((Bitmap)(obj));
} }
} }
} }
+4 -2
View File
@@ -1,6 +1,8 @@
using System; using System;
using System.ComponentModel; using System.ComponentModel;
using System.Diagnostics;
using System.Globalization; using System.Globalization;
using System.IO.Ports;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Windows.Forms; using System.Windows.Forms;
@@ -33,7 +35,7 @@ namespace ASCOM.Meade.net
{ {
try try
{ {
System.Diagnostics.Process.Start("http://ascom-standards.org/"); Process.Start("http://ascom-standards.org/");
} }
catch (Win32Exception noBrowser) catch (Win32Exception noBrowser)
{ {
@@ -51,7 +53,7 @@ namespace ASCOM.Meade.net
chkTrace.Checked = profileProperties.TraceLogger; chkTrace.Checked = profileProperties.TraceLogger;
// set the list of com ports to those that are currently available // set the list of com ports to those that are currently available
comboBoxComPort.Items.Clear(); comboBoxComPort.Items.Clear();
comboBoxComPort.Items.AddRange(System.IO.Ports.SerialPort comboBoxComPort.Items.AddRange(SerialPort
.GetPortNames()); // use System.IO because it's static .GetPortNames()); // use System.IO because it's static
// select the current port if possible // select the current port if possible
if (comboBoxComPort.Items.Contains(profileProperties.ComPort)) if (comboBoxComPort.Items.Contains(profileProperties.ComPort))
+17 -14
View File
@@ -1,3 +1,6 @@
using System.ComponentModel;
using System.Windows.Forms;
namespace ASCOM.Meade.net namespace ASCOM.Meade.net
{ {
partial class SetupDialogForm partial class SetupDialogForm
@@ -5,7 +8,7 @@ namespace ASCOM.Meade.net
/// <summary> /// <summary>
/// Required designer variable. /// Required designer variable.
/// </summary> /// </summary>
private System.ComponentModel.IContainer components = null; private IContainer components = null;
/// <summary> /// <summary>
/// Clean up any resources being used. /// Clean up any resources being used.
@@ -162,18 +165,18 @@ namespace ASCOM.Meade.net
#endregion #endregion
private System.Windows.Forms.Button cmdOK; private Button cmdOK;
private System.Windows.Forms.Button cmdCancel; private Button cmdCancel;
private System.Windows.Forms.Label label1; private Label label1;
private System.Windows.Forms.PictureBox picASCOM; private PictureBox picASCOM;
private System.Windows.Forms.Label label2; private Label label2;
private System.Windows.Forms.CheckBox chkTrace; private CheckBox chkTrace;
private System.Windows.Forms.ComboBox comboBoxComPort; private ComboBox comboBoxComPort;
private System.Windows.Forms.Label label3; private Label label3;
private System.Windows.Forms.TextBox txtGuideRate; private TextBox txtGuideRate;
private System.Windows.Forms.Label label4; private Label label4;
private System.Windows.Forms.Label lblPercentOfSiderealRate; private Label lblPercentOfSiderealRate;
private System.Windows.Forms.Label label5; private Label label5;
private System.Windows.Forms.ComboBox cboPrecision; private ComboBox cboPrecision;
} }
} }
+1 -1
View File
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<root> <root>
<!-- <!--
Microsoft ResX Schema Microsoft ResX Schema
+5 -4
View File
@@ -13,9 +13,11 @@
// Written by: Bob Denny 29-May-2007 // Written by: Bob Denny 29-May-2007
// Modified by Chris Rowland and Peter Simpson to hamdle multiple hardware devices March 2011 // Modified by Chris Rowland and Peter Simpson to hamdle multiple hardware devices March 2011
// //
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization; using System.Globalization;
using System.Windows.Forms;
using ASCOM.Utilities; using ASCOM.Utilities;
namespace ASCOM.Meade.net namespace ASCOM.Meade.net
@@ -218,7 +220,7 @@ namespace ASCOM.Meade.net
// or call a different dialog if connected // or call a different dialog if connected
if (Connections > 0) if (Connections > 0)
{ {
System.Windows.Forms.MessageBox.Show("Already connected, please disconnect before altering settings"); MessageBox.Show("Already connected, please disconnect before altering settings");
return; return;
} }
@@ -234,7 +236,7 @@ namespace ASCOM.Meade.net
} }
var result = f.ShowDialog(); var result = f.ShowDialog();
if (result == System.Windows.Forms.DialogResult.OK) if (result == DialogResult.OK)
{ {
profileProperties = f.GetProfile(); profileProperties = f.GetProfile();
@@ -354,8 +356,7 @@ namespace ASCOM.Meade.net
{ {
if (ConnectedDevices.ContainsKey(deviceId)) if (ConnectedDevices.ContainsKey(deviceId))
return ConnectedDevices[deviceId].Count > 0; return ConnectedDevices[deviceId].Count > 0;
else return false;
return false;
} }
#endregion #endregion
+4 -3
View File
@@ -1,4 +1,5 @@
using System; using System.ComponentModel;
using System.Windows.Forms;
namespace ASCOM.Meade.net namespace ASCOM.Meade.net
{ {
@@ -7,7 +8,7 @@ namespace ASCOM.Meade.net
/// <summary> /// <summary>
/// Required designer variable. /// Required designer variable.
/// </summary> /// </summary>
private System.ComponentModel.IContainer components = null; private IContainer components = null;
/// <summary> /// <summary>
/// Clean up any resources being used. /// Clean up any resources being used.
@@ -56,7 +57,7 @@ namespace ASCOM.Meade.net
#endregion #endregion
private System.Windows.Forms.Label label1; private Label label1;
} }
} }
+1 -1
View File
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<root> <root>
<!-- <!--
Microsoft ResX Schema Microsoft ResX Schema
+3 -2
View File
@@ -9,6 +9,7 @@
#define UseChooser #define UseChooser
using System; using System;
using ASCOM.DriverAccess;
namespace ASCOM.Meade.net namespace ASCOM.Meade.net
{ {
@@ -19,11 +20,11 @@ namespace ASCOM.Meade.net
// Uncomment the code that's required // Uncomment the code that's required
#if UseChooser #if UseChooser
// choose the device // choose the device
string id = DriverAccess.Telescope.Choose("ASCOM.MeadeGeneric.Telescope"); string id = Telescope.Choose("ASCOM.MeadeGeneric.Telescope");
if (string.IsNullOrEmpty(id)) if (string.IsNullOrEmpty(id))
return; return;
// create this device // create this device
DriverAccess.Telescope device = new DriverAccess.Telescope(id); Telescope device = new Telescope(id);
#else #else
// this can be replaced by this code, it avoids the chooser and creates the driver class directly. // 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"); ASCOM.DriverAccess.Telescope device = new ASCOM.DriverAccess.Telescope("ASCOM.Meade.net.Telescope");