Code inspections

This commit is contained in:
2019-07-19 13:22:15 +01:00
parent c1cae2b0c4
commit d6f72c8222
7 changed files with 36 additions and 54 deletions
+2 -2
View File
@@ -58,7 +58,7 @@ namespace AstroMath.UnitTests
}
[Test]
public void UTtoGST()
public void UTtoGst()
{
DateTime dateTime = new DateTime(2019, 05, 18, 22, 26, 15, DateTimeKind.Utc);
double gst = _astroMath.UTtoGST(dateTime);
@@ -76,7 +76,7 @@ namespace AstroMath.UnitTests
}
[Test]
public void GSTtoLST()
public void GsTtoLst()
{
double gst = 14.257589512545053;
var longitude = -1.7833333333333332;
@@ -7,6 +7,6 @@ namespace ASCOM.Meade.net.AstroMaths
public DateTime UtcDateTime { get; set; }
public double SiteLatitude { get; set; }
public double SiteLongitude { get; set; }
public EquatorialCoordinates equatorialCoordinates { get; set; }
public EquatorialCoordinates EquatorialCoordinates { get; set; }
}
}
+12 -24
View File
@@ -19,8 +19,8 @@ namespace ASCOM.Meade.net
[ComVisible(true)]
public class Rate : IRate
{
private double maximum = 0;
private double minimum = 0;
private double _maximum = 0;
private double _minimum = 0;
//
// Default constructor - Internal prevents public creation
@@ -28,8 +28,8 @@ namespace ASCOM.Meade.net
//
internal Rate(double minimum, double maximum)
{
this.maximum = maximum;
this.minimum = minimum;
_maximum = maximum;
_minimum = minimum;
}
#region Implementation of IRate
@@ -41,14 +41,14 @@ namespace ASCOM.Meade.net
public double Maximum
{
get { return maximum; }
set { maximum = value; }
get => _maximum;
set => _maximum = value;
}
public double Minimum
{
get { return minimum; }
set { minimum = value; }
get => _minimum;
set => _minimum = value;
}
#endregion
@@ -112,10 +112,7 @@ namespace ASCOM.Meade.net
#region IAxisRates Members
public int Count
{
get { return rates.Length; }
}
public int Count => rates.Length;
public void Dispose()
{
@@ -127,10 +124,7 @@ namespace ASCOM.Meade.net
return rates.GetEnumerator();
}
public IRate this[int index]
{
get { return rates[index - 1]; } // 1-based
}
public IRate this[int index] => rates[index - 1];
#endregion
}
@@ -178,10 +172,7 @@ namespace ASCOM.Meade.net
#region ITrackingRates Members
public int Count
{
get { return trackingRates.Length; }
}
public int Count => trackingRates.Length;
public IEnumerator GetEnumerator()
{
@@ -194,10 +185,7 @@ namespace ASCOM.Meade.net
// TODO Add any required object cleanup here
}
public DriveRates this[int index]
{
get { return trackingRates[index - 1]; } // 1-based
}
public DriveRates this[int index] => trackingRates[index - 1];
#endregion
+11 -10
View File
@@ -6,6 +6,7 @@ using ASCOM.Astrometry.AstroUtils;
using ASCOM.Utilities;
using ASCOM.DeviceInterface;
using System.Collections;
using System.Globalization;
using System.Reflection;
using ASCOM.Meade.net.AstroMaths;
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.
/// </summary>
//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
/// <summary>
/// Driver description that displays in the ASCOM Chooser.
/// </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>
/// Private variable to hold an ASCOM Utilities object
@@ -583,7 +584,7 @@ namespace ASCOM.Meade.net
UtcDateTime = UTCDate,
SiteLongitude = SiteLongitude,
SiteLatitude = SiteLatitude,
equatorialCoordinates = new EquatorialCoordinates()
EquatorialCoordinates = new EquatorialCoordinates()
{
RightAscension = RightAscension,
Declination = Declination
@@ -591,8 +592,8 @@ namespace ASCOM.Meade.net
});
double hourAngle = _astroMaths.RightAscensionToHourAngle(altitudeData.UtcDateTime, altitudeData.SiteLongitude,
altitudeData.equatorialCoordinates.RightAscension);
var altAz = _astroMaths.ConvertEqToHoz(hourAngle, altitudeData.SiteLatitude, altitudeData.equatorialCoordinates);
altitudeData.EquatorialCoordinates.RightAscension);
var altAz = _astroMaths.ConvertEqToHoz(hourAngle, altitudeData.SiteLatitude, altitudeData.EquatorialCoordinates);
return altAz;
}
@@ -632,7 +633,7 @@ namespace ASCOM.Meade.net
LogMessage("AtPark", "Get - " + _atPark);
return _atPark;
}
private set { _atPark = value; }
private set => _atPark = value;
}
public IAxisRates AxisRates(TelescopeAxes Axis)
@@ -842,7 +843,7 @@ namespace ASCOM.Meade.net
get
{
double declination = 0.0;
LogMessage("DeclinationRate", "Get - " + declination.ToString());
LogMessage("DeclinationRate", "Get - " + declination.ToString(CultureInfo.InvariantCulture));
return declination;
}
set
@@ -1141,7 +1142,7 @@ namespace ASCOM.Meade.net
get
{
double rightAscensionRate = 0.0;
LogMessage("RightAscensionRate", "Get - " + rightAscensionRate.ToString());
LogMessage("RightAscensionRate", "Get - " + rightAscensionRate.ToString(CultureInfo.InvariantCulture));
return rightAscensionRate;
}
set
@@ -1192,7 +1193,7 @@ namespace ASCOM.Meade.net
// Reduce to the range 0 to 24 hours
siderealTime = _astroUtilities.ConditionRA(siderealTime);
LogMessage("SiderealTime", "Get - " + siderealTime.ToString());
LogMessage("SiderealTime", "Get - " + siderealTime.ToString(CultureInfo.InvariantCulture));
return siderealTime;
}
}
+1 -8
View File
@@ -430,14 +430,7 @@ namespace ASCOM.Meade.net
});
}
public int Position
{
get
{
throw new PropertyNotImplementedException("Position", false);
//return focuserPosition; // Return the focuser position
}
}
public int Position => throw new PropertyNotImplementedException("Position", false);
public double StepSize
{
+8 -8
View File
@@ -109,9 +109,9 @@ namespace ASCOM.Meade.net
#region Constructor and Private ClassFactory Data
protected Type m_ClassType;
protected readonly Type m_ClassType;
protected Guid m_ClassId;
protected ArrayList m_InterfaceTypes;
protected readonly ArrayList m_InterfaceTypes;
protected uint m_ClassContext;
protected uint m_Flags;
protected UInt32 m_locked = 0;
@@ -140,20 +140,20 @@ namespace ASCOM.Meade.net
#region Common ClassFactory Methods
public uint ClassContext
{
get { return m_ClassContext; }
set { m_ClassContext = value; }
get => m_ClassContext;
set => m_ClassContext = value;
}
public Guid ClassId
{
get { return m_ClassId; }
set { m_ClassId = value; }
get => m_ClassId;
set => m_ClassId = value;
}
public uint Flags
{
get { return m_Flags; }
set { m_Flags = value; }
get => m_Flags;
set => m_Flags = value;
}
public bool RegisterClassObject()
+1 -1
View File
@@ -146,7 +146,7 @@ namespace ASCOM.Meade.net
}
}
}
get { return SharedSerial.Connected; }
get => SharedSerial.Connected;
}
#endregion