Sorted out some code inspection issues

This commit is contained in:
2021-04-25 20:16:07 +01:00
parent 795dc0c741
commit e32c2aa50a
4 changed files with 13 additions and 24 deletions
+7 -16
View File
@@ -446,7 +446,7 @@ namespace ASCOM.Meade.net
} }
else else
{ {
LogMessage("Connected Set", $"Autostar Attempting manual bypass of prompts"); LogMessage("Connected Set", "Autostar Attempting manual bypass of prompts");
ApplySkipAutoStarPrompts("Connect"); ApplySkipAutoStarPrompts("Connect");
SendCurrentDateTime("Connect"); SendCurrentDateTime("Connect");
} }
@@ -633,7 +633,7 @@ namespace ASCOM.Meade.net
if((Math.Abs(RightAscension - rightTargetAscension ) <= eps) && if((Math.Abs(RightAscension - rightTargetAscension ) <= eps) &&
(Math.Abs(Declination - targetDeclination) <= eps)) (Math.Abs(Declination - targetDeclination) <= eps))
{ {
LogMessage("IsTargetCoordinateInitRequired", $"0 diff -> false"); LogMessage("IsTargetCoordinateInitRequired", "0 diff -> false");
_isTargetCoordinateInitRequired = false; _isTargetCoordinateInitRequired = false;
return _isTargetCoordinateInitRequired; return _isTargetCoordinateInitRequired;
} }
@@ -657,7 +657,7 @@ namespace ASCOM.Meade.net
} }
catch (Exception ex) catch (Exception ex)
{ {
LogMessage("InitTargetCoordinates", $"Error sync telescope position", ex.Message); LogMessage("InitTargetCoordinates", "Error sync telescope position", ex.Message);
} }
} }
@@ -1804,13 +1804,13 @@ namespace ASCOM.Meade.net
LogMessage("SiteElevation", $"Set: {value}"); LogMessage("SiteElevation", $"Set: {value}");
if (Math.Abs(value - base.SiteElevation) < 0.1) if (Math.Abs(value - base.SiteElevation) < 0.1)
{ {
LogMessage("SiteElevation", $"Set: no change detected"); LogMessage("SiteElevation", "Set: no change detected");
return; return;
} }
LogMessage("SiteElevation", $"Set: {value} was {base.SiteElevation}"); LogMessage("SiteElevation", $"Set: {value} was {base.SiteElevation}");
base.SiteElevation = value; base.SiteElevation = value;
base.UpdateSiteElevation(); UpdateSiteElevation();
} }
} }
@@ -2184,16 +2184,7 @@ namespace ASCOM.Meade.net
try try
{ {
if (Connected) if (Connected)
{ result = MovingAxis() || IsSlewingToTarget();
if (!MovingAxis())
{
result = IsSlewingToTarget();
}
else
{
result = true;
}
}
} }
finally finally
{ {
@@ -2210,7 +2201,7 @@ namespace ASCOM.Meade.net
if (_isGuiding) if (_isGuiding)
return false; return false;
var result = string.Empty; string result;
try try
{ {
result = SharedResourcesWrapper.SendString(":D#"); result = SharedResourcesWrapper.SendString(":D#");
+4 -4
View File
@@ -8,13 +8,13 @@ namespace ASCOM.Meade.net
{ {
public static string GetDescription(this Enum GenericEnum) public static string GetDescription(this Enum GenericEnum)
{ {
Type genericEnumType = GenericEnum.GetType(); var genericEnumType = GenericEnum.GetType();
MemberInfo[] memberInfo = genericEnumType.GetMember(GenericEnum.ToString()); var memberInfo = genericEnumType.GetMember(GenericEnum.ToString());
if ((memberInfo != null && memberInfo.Length > 0)) if (memberInfo.Length > 0)
{ {
var _Attribs = memberInfo[0] var _Attribs = memberInfo[0]
.GetCustomAttributes(typeof(System.ComponentModel.DescriptionAttribute), false); .GetCustomAttributes(typeof(System.ComponentModel.DescriptionAttribute), false);
if ((_Attribs != null && _Attribs.Count() > 0)) if (_Attribs.Any())
{ {
return ((System.ComponentModel.DescriptionAttribute) _Attribs.ElementAt(0)).Description; return ((System.ComponentModel.DescriptionAttribute) _Attribs.ElementAt(0)).Description;
} }
+1 -4
View File
@@ -100,10 +100,7 @@ namespace ASCOM.Meade.net
{ {
SharedSerial.ClearBuffers(); SharedSerial.ClearBuffers();
if (includePrefix) SharedSerial.Transmit(includePrefix ? $"#{message}" : message);
SharedSerial.Transmit( $"#{message}");
else
SharedSerial.Transmit(message);
try try
{ {
+1
View File
@@ -14,6 +14,7 @@
// ReSharper disable once InconsistentNaming // ReSharper disable once InconsistentNaming
public const string Autostar497_43Eg = "43Eg"; public const string Autostar497_43Eg = "43Eg";
// ReSharper disable once InconsistentNaming
public const string AudioStar_A4S4 = "A4S4"; public const string AudioStar_A4S4 = "A4S4";
#endregion #endregion