Code inspections
This commit is contained in:
@@ -58,7 +58,7 @@ namespace AstroMath.UnitTests
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void UTtoGST()
|
public void UTtoGst()
|
||||||
{
|
{
|
||||||
DateTime dateTime = new DateTime(2019, 05, 18, 22, 26, 15, DateTimeKind.Utc);
|
DateTime dateTime = new DateTime(2019, 05, 18, 22, 26, 15, DateTimeKind.Utc);
|
||||||
double gst = _astroMath.UTtoGST(dateTime);
|
double gst = _astroMath.UTtoGST(dateTime);
|
||||||
@@ -76,7 +76,7 @@ namespace AstroMath.UnitTests
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void GSTtoLST()
|
public void GsTtoLst()
|
||||||
{
|
{
|
||||||
double gst = 14.257589512545053;
|
double gst = 14.257589512545053;
|
||||||
var longitude = -1.7833333333333332;
|
var longitude = -1.7833333333333332;
|
||||||
|
|||||||
@@ -7,6 +7,6 @@ namespace ASCOM.Meade.net.AstroMaths
|
|||||||
public DateTime UtcDateTime { get; set; }
|
public DateTime UtcDateTime { get; set; }
|
||||||
public double SiteLatitude { get; set; }
|
public double SiteLatitude { get; set; }
|
||||||
public double SiteLongitude { get; set; }
|
public double SiteLongitude { get; set; }
|
||||||
public EquatorialCoordinates equatorialCoordinates { get; set; }
|
public EquatorialCoordinates EquatorialCoordinates { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -19,8 +19,8 @@ namespace ASCOM.Meade.net
|
|||||||
[ComVisible(true)]
|
[ComVisible(true)]
|
||||||
public class Rate : IRate
|
public class Rate : IRate
|
||||||
{
|
{
|
||||||
private double maximum = 0;
|
private double _maximum = 0;
|
||||||
private double minimum = 0;
|
private double _minimum = 0;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Default constructor - Internal prevents public creation
|
// Default constructor - Internal prevents public creation
|
||||||
@@ -28,8 +28,8 @@ namespace ASCOM.Meade.net
|
|||||||
//
|
//
|
||||||
internal Rate(double minimum, double maximum)
|
internal Rate(double minimum, double maximum)
|
||||||
{
|
{
|
||||||
this.maximum = maximum;
|
_maximum = maximum;
|
||||||
this.minimum = minimum;
|
_minimum = minimum;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Implementation of IRate
|
#region Implementation of IRate
|
||||||
@@ -41,14 +41,14 @@ namespace ASCOM.Meade.net
|
|||||||
|
|
||||||
public double Maximum
|
public double Maximum
|
||||||
{
|
{
|
||||||
get { return maximum; }
|
get => _maximum;
|
||||||
set { maximum = value; }
|
set => _maximum = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public double Minimum
|
public double Minimum
|
||||||
{
|
{
|
||||||
get { return minimum; }
|
get => _minimum;
|
||||||
set { minimum = value; }
|
set => _minimum = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@@ -112,10 +112,7 @@ namespace ASCOM.Meade.net
|
|||||||
|
|
||||||
#region IAxisRates Members
|
#region IAxisRates Members
|
||||||
|
|
||||||
public int Count
|
public int Count => rates.Length;
|
||||||
{
|
|
||||||
get { return rates.Length; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
@@ -127,10 +124,7 @@ namespace ASCOM.Meade.net
|
|||||||
return rates.GetEnumerator();
|
return rates.GetEnumerator();
|
||||||
}
|
}
|
||||||
|
|
||||||
public IRate this[int index]
|
public IRate this[int index] => rates[index - 1];
|
||||||
{
|
|
||||||
get { return rates[index - 1]; } // 1-based
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
@@ -178,10 +172,7 @@ namespace ASCOM.Meade.net
|
|||||||
|
|
||||||
#region ITrackingRates Members
|
#region ITrackingRates Members
|
||||||
|
|
||||||
public int Count
|
public int Count => trackingRates.Length;
|
||||||
{
|
|
||||||
get { return trackingRates.Length; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public IEnumerator GetEnumerator()
|
public IEnumerator GetEnumerator()
|
||||||
{
|
{
|
||||||
@@ -194,10 +185,7 @@ namespace ASCOM.Meade.net
|
|||||||
// TODO Add any required object cleanup here
|
// TODO Add any required object cleanup here
|
||||||
}
|
}
|
||||||
|
|
||||||
public DriveRates this[int index]
|
public DriveRates this[int index] => trackingRates[index - 1];
|
||||||
{
|
|
||||||
get { return trackingRates[index - 1]; } // 1-based
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ using ASCOM.Astrometry.AstroUtils;
|
|||||||
using ASCOM.Utilities;
|
using ASCOM.Utilities;
|
||||||
using ASCOM.DeviceInterface;
|
using ASCOM.DeviceInterface;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
|
using System.Globalization;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using ASCOM.Meade.net.AstroMaths;
|
using ASCOM.Meade.net.AstroMaths;
|
||||||
using ASCOM.Meade.net.Wrapper;
|
using ASCOM.Meade.net.Wrapper;
|
||||||
@@ -38,15 +39,15 @@ namespace ASCOM.Meade.net
|
|||||||
/// The DeviceID is used by ASCOM applications to load the driver at runtime.
|
/// The DeviceID is used by ASCOM applications to load the driver at runtime.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
//internal static string driverID = "ASCOM.Meade.net.Telescope";
|
//internal static string driverID = "ASCOM.Meade.net.Telescope";
|
||||||
internal static string driverID = Marshal.GenerateProgIdForType(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly string driverID = Marshal.GenerateProgIdForType(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
// TODO Change the descriptive string for your driver then remove this line
|
// TODO Change the descriptive string for your driver then remove this line
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Driver description that displays in the ASCOM Chooser.
|
/// Driver description that displays in the ASCOM Chooser.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private static string driverDescription = "Meade Generic";
|
private static readonly string driverDescription = "Meade Generic";
|
||||||
|
|
||||||
internal static string comPort; // Variables to hold the currrent device configuration
|
private static string comPort; // Variables to hold the currrent device configuration
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Private variable to hold an ASCOM Utilities object
|
/// Private variable to hold an ASCOM Utilities object
|
||||||
@@ -583,7 +584,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
|
||||||
@@ -591,8 +592,8 @@ namespace ASCOM.Meade.net
|
|||||||
});
|
});
|
||||||
|
|
||||||
double hourAngle = _astroMaths.RightAscensionToHourAngle(altitudeData.UtcDateTime, altitudeData.SiteLongitude,
|
double hourAngle = _astroMaths.RightAscensionToHourAngle(altitudeData.UtcDateTime, altitudeData.SiteLongitude,
|
||||||
altitudeData.equatorialCoordinates.RightAscension);
|
altitudeData.EquatorialCoordinates.RightAscension);
|
||||||
var altAz = _astroMaths.ConvertEqToHoz(hourAngle, altitudeData.SiteLatitude, altitudeData.equatorialCoordinates);
|
var altAz = _astroMaths.ConvertEqToHoz(hourAngle, altitudeData.SiteLatitude, altitudeData.EquatorialCoordinates);
|
||||||
return altAz;
|
return altAz;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -632,7 +633,7 @@ namespace ASCOM.Meade.net
|
|||||||
LogMessage("AtPark", "Get - " + _atPark);
|
LogMessage("AtPark", "Get - " + _atPark);
|
||||||
return _atPark;
|
return _atPark;
|
||||||
}
|
}
|
||||||
private set { _atPark = value; }
|
private set => _atPark = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IAxisRates AxisRates(TelescopeAxes Axis)
|
public IAxisRates AxisRates(TelescopeAxes Axis)
|
||||||
@@ -842,7 +843,7 @@ namespace ASCOM.Meade.net
|
|||||||
get
|
get
|
||||||
{
|
{
|
||||||
double declination = 0.0;
|
double declination = 0.0;
|
||||||
LogMessage("DeclinationRate", "Get - " + declination.ToString());
|
LogMessage("DeclinationRate", "Get - " + declination.ToString(CultureInfo.InvariantCulture));
|
||||||
return declination;
|
return declination;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
@@ -1141,7 +1142,7 @@ namespace ASCOM.Meade.net
|
|||||||
get
|
get
|
||||||
{
|
{
|
||||||
double rightAscensionRate = 0.0;
|
double rightAscensionRate = 0.0;
|
||||||
LogMessage("RightAscensionRate", "Get - " + rightAscensionRate.ToString());
|
LogMessage("RightAscensionRate", "Get - " + rightAscensionRate.ToString(CultureInfo.InvariantCulture));
|
||||||
return rightAscensionRate;
|
return rightAscensionRate;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
@@ -1192,7 +1193,7 @@ namespace ASCOM.Meade.net
|
|||||||
// Reduce to the range 0 to 24 hours
|
// Reduce to the range 0 to 24 hours
|
||||||
siderealTime = _astroUtilities.ConditionRA(siderealTime);
|
siderealTime = _astroUtilities.ConditionRA(siderealTime);
|
||||||
|
|
||||||
LogMessage("SiderealTime", "Get - " + siderealTime.ToString());
|
LogMessage("SiderealTime", "Get - " + siderealTime.ToString(CultureInfo.InvariantCulture));
|
||||||
return siderealTime;
|
return siderealTime;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -430,14 +430,7 @@ namespace ASCOM.Meade.net
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public int Position
|
public int Position => throw new PropertyNotImplementedException("Position", false);
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
throw new PropertyNotImplementedException("Position", false);
|
|
||||||
//return focuserPosition; // Return the focuser position
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public double StepSize
|
public double StepSize
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -109,9 +109,9 @@ namespace ASCOM.Meade.net
|
|||||||
|
|
||||||
#region Constructor and Private ClassFactory Data
|
#region Constructor and Private ClassFactory Data
|
||||||
|
|
||||||
protected Type m_ClassType;
|
protected readonly Type m_ClassType;
|
||||||
protected Guid m_ClassId;
|
protected Guid m_ClassId;
|
||||||
protected ArrayList m_InterfaceTypes;
|
protected readonly ArrayList m_InterfaceTypes;
|
||||||
protected uint m_ClassContext;
|
protected uint m_ClassContext;
|
||||||
protected uint m_Flags;
|
protected uint m_Flags;
|
||||||
protected UInt32 m_locked = 0;
|
protected UInt32 m_locked = 0;
|
||||||
@@ -140,20 +140,20 @@ namespace ASCOM.Meade.net
|
|||||||
#region Common ClassFactory Methods
|
#region Common ClassFactory Methods
|
||||||
public uint ClassContext
|
public uint ClassContext
|
||||||
{
|
{
|
||||||
get { return m_ClassContext; }
|
get => m_ClassContext;
|
||||||
set { m_ClassContext = value; }
|
set => m_ClassContext = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Guid ClassId
|
public Guid ClassId
|
||||||
{
|
{
|
||||||
get { return m_ClassId; }
|
get => m_ClassId;
|
||||||
set { m_ClassId = value; }
|
set => m_ClassId = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public uint Flags
|
public uint Flags
|
||||||
{
|
{
|
||||||
get { return m_Flags; }
|
get => m_Flags;
|
||||||
set { m_Flags = value; }
|
set => m_Flags = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool RegisterClassObject()
|
public bool RegisterClassObject()
|
||||||
|
|||||||
@@ -146,7 +146,7 @@ namespace ASCOM.Meade.net
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
get { return SharedSerial.Connected; }
|
get => SharedSerial.Connected;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
Reference in New Issue
Block a user