Code inspections

This commit is contained in:
2019-09-29 17:37:07 +01:00
parent b8faab13b3
commit 15bf977458
7 changed files with 13 additions and 25 deletions
@@ -6,7 +6,6 @@ using ASCOM.Meade.net.Wrapper;
using ASCOM.Utilities.Interfaces; using ASCOM.Utilities.Interfaces;
using Moq; using Moq;
using NUnit.Framework; using NUnit.Framework;
using NotImplementedException = System.NotImplementedException;
namespace Meade.net.Focuser.UnitTests namespace Meade.net.Focuser.UnitTests
{ {
@@ -1,5 +1,4 @@
using System.Reflection; using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following // General Information about an assembly is controlled through the following
+2 -2
View File
@@ -85,12 +85,12 @@ namespace ASCOM.Meade.net
// TODO Initialize this array with any Primary axis rates that your driver may provide // 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) } // 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[0];
_rates = new Rate[] { new Rate(1, 1), new Rate(2, 2), new Rate(3, 3), new Rate(4, 4) }; _rates = new[] { new Rate(1, 1), new Rate(2, 2), new Rate(3, 3), new Rate(4, 4) };
break; break;
case TelescopeAxes.axisSecondary: case TelescopeAxes.axisSecondary:
// TODO Initialize this array with any Secondary axis rates that your driver may provide // TODO Initialize this array with any Secondary axis rates that your driver may provide
//this.rates = new Rate[0]; //this.rates = new Rate[0];
_rates = new Rate[] { new Rate(1, 1), new Rate(2, 2), new Rate(3, 3), new Rate(4, 4) }; _rates = new[] { new Rate(1, 1), new Rate(2, 2), new Rate(3, 3), new Rate(4, 4) };
break; break;
case TelescopeAxes.axisTertiary: case TelescopeAxes.axisTertiary:
// TODO Initialize this array with any Tertiary axis rates that your driver may provide // TODO Initialize this array with any Tertiary axis rates that your driver may provide
+8 -8
View File
@@ -384,7 +384,7 @@ namespace ASCOM.Meade.net
if (connectionInfo.SameDevice == 1) if (connectionInfo.SameDevice == 1)
{ {
LogMessage("Connected Set", $"Making first connection telescope adjustments"); LogMessage("Connected Set", "Making first connection telescope adjustments");
//These settings are applied only when the first device connects to the telescope. //These settings are applied only when the first device connects to the telescope.
SetLongFormat(true); SetLongFormat(true);
@@ -426,14 +426,14 @@ namespace ASCOM.Meade.net
{ {
case "high": case "high":
TelescopePointingPrecision(true); TelescopePointingPrecision(true);
LogMessage(propertyName, $"High precision slewing selected"); LogMessage(propertyName, "High precision slewing selected");
break; break;
case "low": case "low":
TelescopePointingPrecision(false); TelescopePointingPrecision(false);
LogMessage(propertyName, $"Low precision slewing selected"); LogMessage(propertyName, "Low precision slewing selected");
break; break;
default: default:
LogMessage(propertyName, $"Precision slewing unchanged"); LogMessage(propertyName, "Precision slewing unchanged");
break; break;
} }
} }
@@ -494,7 +494,7 @@ namespace ASCOM.Meade.net
private bool TogglePrecision() private bool TogglePrecision()
{ {
LogMessage("TogglePrecision", $"Toggling slewing precision"); LogMessage("TogglePrecision", "Toggling slewing precision");
var result = _sharedResourcesWrapper.SendChar(":P#"); var result = _sharedResourcesWrapper.SendChar(":P#");
//:P# Toggles High Precsion Pointing. When High precision pointing is enabled scope will first allow the operator to center a nearby bright star before moving to the actual target. //:P# Toggles High Precsion Pointing. When High precision pointing is enabled scope will first allow the operator to center a nearby bright star before moving to the actual target.
//Returns: <string> //Returns: <string>
@@ -1369,7 +1369,7 @@ namespace ASCOM.Meade.net
if (_userNewerPulseGuiding && duration < 10000) if (_userNewerPulseGuiding && duration < 10000)
{ {
LogMessage("PulseGuide", $"Using new pulse guiding technique"); LogMessage("PulseGuide", "Using new pulse guiding technique");
_sharedResourcesWrapper.SendBlind($":Mg{d}{duration:0000}#"); _sharedResourcesWrapper.SendBlind($":Mg{d}{duration:0000}#");
//:MgnDDDD# //:MgnDDDD#
//:MgsDDDD# //:MgsDDDD#
@@ -1383,7 +1383,7 @@ namespace ASCOM.Meade.net
} }
else else
{ {
LogMessage("PulseGuide", $"Using old pulse guiding technique"); LogMessage("PulseGuide", "Using old pulse guiding technique");
_sharedResourcesWrapper.Lock(() => _sharedResourcesWrapper.Lock(() =>
{ {
_sharedResourcesWrapper.SendBlind(":RG#"); //Make sure we are at guide rate _sharedResourcesWrapper.SendBlind(":RG#"); //Make sure we are at guide rate
@@ -2026,7 +2026,7 @@ namespace ASCOM.Meade.net
} }
set set
{ {
LogMessage($"Tracking Set", $"{value}"); LogMessage("Tracking Set", $"{value}");
_tracking = value; _tracking = value;
} }
} }
+2 -5
View File
@@ -254,7 +254,6 @@ namespace ASCOM.Meade.net
{ {
// Probably an attempt to load a Win32 DLL (i.e. not a .net assembly) // Probably an attempt to load a Win32 DLL (i.e. not a .net assembly)
// Just swallow the exception and continue to the next item. // Just swallow the exception and continue to the next item.
continue;
} }
catch (Exception e) catch (Exception e)
{ {
@@ -262,7 +261,6 @@ namespace ASCOM.Meade.net
DriverName, MessageBoxButtons.OK, MessageBoxIcon.Stop); DriverName, MessageBoxButtons.OK, MessageBoxIcon.Stop);
return false; return false;
} }
} }
return true; return true;
} }
@@ -303,7 +301,6 @@ namespace ASCOM.Meade.net
{ {
MessageBox.Show(ex.ToString(), DriverName, MessageBoxButtons.OK, MessageBoxIcon.Stop); MessageBox.Show(ex.ToString(), DriverName, MessageBoxButtons.OK, MessageBoxIcon.Stop);
} }
return;
} }
// //
@@ -412,7 +409,7 @@ namespace ASCOM.Meade.net
// //
// ASCOM // ASCOM
// //
assy = type.Assembly; //assy = type.Assembly;
// Pull the display name from the ServedClassName attribute. // Pull the display name from the ServedClassName attribute.
attr = Attribute.GetCustomAttribute(type, typeof(ServedClassNameAttribute)); //PWGS Changed to search type for attribute rather than assembly attr = Attribute.GetCustomAttribute(type, typeof(ServedClassNameAttribute)); //PWGS Changed to search type for attribute rather than assembly
@@ -425,7 +422,7 @@ namespace ASCOM.Meade.net
} }
catch (Exception ex) catch (Exception ex)
{ {
MessageBox.Show("Error while registering the server:\n" + ex.ToString(), MessageBox.Show($"Error while registering the server:\n{ex}",
DriverName, MessageBoxButtons.OK, MessageBoxIcon.Stop); DriverName, MessageBoxButtons.OK, MessageBoxIcon.Stop);
bFail = true; bFail = true;
} }
-1
View File
@@ -16,7 +16,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization; using System.Globalization;
using System.Linq;
using ASCOM.Utilities; using ASCOM.Utilities;
namespace ASCOM.Meade.net namespace ASCOM.Meade.net
+1 -7
View File
@@ -1,10 +1,4 @@
using System; namespace ASCOM.Meade.net
using System.Collections.Generic;
using System.Linq;
using System.Net.NetworkInformation;
using System.Text;
namespace ASCOM.Meade.net
{ {
public static class TelescopeList public static class TelescopeList
{ {