Trying to reduce code duplication
This commit is contained in:
@@ -9,6 +9,13 @@ namespace ASCOM.Meade.net
|
||||
[ComVisible(false)]
|
||||
public class MeadeTelescopeBase : ReferenceCountedObjectBase
|
||||
{
|
||||
static MeadeTelescopeBase()
|
||||
{
|
||||
ClassName = nameof(MeadeTelescopeBase);
|
||||
}
|
||||
|
||||
public static string ClassName { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
/// Variable to hold the trace logger object (creates a diagnostic log file with information that you specify)
|
||||
/// </summary>
|
||||
@@ -41,16 +48,14 @@ namespace ASCOM.Meade.net
|
||||
|
||||
protected void Initialise()
|
||||
{
|
||||
var typeName = GetType().Name;
|
||||
|
||||
Tl = new TraceLogger("", $"Meade.Generic.{typeName}");
|
||||
Tl = new TraceLogger("", $"Meade.Generic.{ClassName}");
|
||||
|
||||
ReadProfile(); // Read device configuration from the ASCOM Profile store
|
||||
|
||||
IsConnected = false; // Initialise connected to false
|
||||
|
||||
LogMessage(typeName, "Completed initialisation");
|
||||
LogMessage(typeName, $"Driver version: {DriverVersion}");
|
||||
LogMessage(ClassName, "Completed initialisation");
|
||||
LogMessage(ClassName, $"Driver version: {DriverVersion}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -123,5 +128,17 @@ namespace ASCOM.Meade.net
|
||||
return driverVersion;
|
||||
}
|
||||
}
|
||||
|
||||
#region ASCOM Registration
|
||||
|
||||
private static IProfileFactory _profileFactory;
|
||||
|
||||
public static IProfileFactory ProfileFactory
|
||||
{
|
||||
get => _profileFactory ?? (_profileFactory = new ProfileFactory());
|
||||
set => _profileFactory = value;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -309,8 +309,7 @@ namespace ASCOM.Meade.net
|
||||
//Returns: sHH# or sHH.H#
|
||||
//The number of decimal hours to add to local time to convert it to UTC. If the number is a whole number the
|
||||
//sHH# form is returned, otherwise the longer form is returned.
|
||||
double utcOffsetHours;
|
||||
if (!double.TryParse(utcOffSet, out utcOffsetHours))
|
||||
if (!double.TryParse(utcOffSet, out var utcOffsetHours))
|
||||
{
|
||||
var message = "Unable to decode response from the telescope, This is likely a hardware serial communications error.";
|
||||
traceLogger.LogIssue("Connect", message);
|
||||
|
||||
Reference in New Issue
Block a user