Code inspections

This commit is contained in:
2019-09-28 22:40:09 +01:00
parent e782ac36fb
commit ca982edbf8
2 changed files with 40 additions and 37 deletions
+6
View File
@@ -1096,6 +1096,7 @@ namespace ASCOM.Meade.net
LogMessage("DeclinationRate", "Get - " + declination.ToString(CultureInfo.InvariantCulture)); LogMessage("DeclinationRate", "Get - " + declination.ToString(CultureInfo.InvariantCulture));
return declination; return declination;
} }
// ReSharper disable once ValueParameterNotUsed
set set
{ {
LogMessage("DeclinationRate Set", "Not implemented"); LogMessage("DeclinationRate Set", "Not implemented");
@@ -1116,6 +1117,7 @@ namespace ASCOM.Meade.net
LogMessage("DoesRefraction Get", "Not implemented"); LogMessage("DoesRefraction Get", "Not implemented");
throw new PropertyNotImplementedException("DoesRefraction", false); throw new PropertyNotImplementedException("DoesRefraction", false);
} }
// ReSharper disable once ValueParameterNotUsed
set set
{ {
LogMessage("DoesRefraction Set", "Not implemented"); LogMessage("DoesRefraction Set", "Not implemented");
@@ -1435,6 +1437,7 @@ namespace ASCOM.Meade.net
LogMessage("RightAscensionRate", "Get - " + rightAscensionRate.ToString(CultureInfo.InvariantCulture)); LogMessage("RightAscensionRate", "Get - " + rightAscensionRate.ToString(CultureInfo.InvariantCulture));
return rightAscensionRate; return rightAscensionRate;
} }
// ReSharper disable once ValueParameterNotUsed
set set
{ {
LogMessage("RightAscensionRate Set", "Not implemented"); LogMessage("RightAscensionRate Set", "Not implemented");
@@ -1455,6 +1458,7 @@ namespace ASCOM.Meade.net
LogMessage("SideOfPier Get", "Not implemented"); LogMessage("SideOfPier Get", "Not implemented");
throw new PropertyNotImplementedException("SideOfPier", false); throw new PropertyNotImplementedException("SideOfPier", false);
} }
// ReSharper disable once ValueParameterNotUsed
set set
{ {
LogMessage("SideOfPier Set", "Not implemented"); LogMessage("SideOfPier Set", "Not implemented");
@@ -1495,6 +1499,7 @@ namespace ASCOM.Meade.net
LogMessage("SiteElevation Get", "Not implemented"); LogMessage("SiteElevation Get", "Not implemented");
throw new PropertyNotImplementedException("SiteElevation", false); throw new PropertyNotImplementedException("SiteElevation", false);
} }
// ReSharper disable once ValueParameterNotUsed
set set
{ {
LogMessage("SiteElevation Set", "Not implemented"); LogMessage("SiteElevation Set", "Not implemented");
@@ -1609,6 +1614,7 @@ namespace ASCOM.Meade.net
LogMessage("SlewSettleTime Get", "Not implemented"); LogMessage("SlewSettleTime Get", "Not implemented");
throw new PropertyNotImplementedException("SlewSettleTime", false); throw new PropertyNotImplementedException("SlewSettleTime", false);
} }
// ReSharper disable once ValueParameterNotUsed
set set
{ {
LogMessage("SlewSettleTime Set", "Not implemented"); LogMessage("SlewSettleTime Set", "Not implemented");
+34 -37
View File
@@ -8,10 +8,10 @@ namespace ASCOM.Meade.net
public class AssemblyInfo public class AssemblyInfo
{ {
// The assembly information values. // The assembly information values.
public string Title = "", Description = "", Company = "", public string Title = string.Empty, Description = string.Empty, Company = string.Empty,
Product = "", Copyright = "", Trademark = "", Product = string.Empty, Copyright = string.Empty, Trademark = string.Empty,
AssemblyVersion = "", FileVersion = "", Guid = "", AssemblyVersion, FileVersion = string.Empty, Guid = string.Empty,
NeutralLanguage = ""; NeutralLanguage = string.Empty;
public bool IsComVisible; public bool IsComVisible;
// Return a particular assembly attribute value. // Return a particular assembly attribute value.
@@ -19,11 +19,10 @@ namespace ASCOM.Meade.net
where T : Attribute where T : Attribute
{ {
// Get attributes of this type. // Get attributes of this type.
object[] attributes = object[] attributes = assembly.GetCustomAttributes(typeof(T), true);
assembly.GetCustomAttributes(typeof(T), true);
// If we didn't get anything, return null. // If we didn't get anything, return null.
if ((attributes == null) || (attributes.Length == 0)) if (attributes.Length == 0)
return null; return null;
// Convert the first attribute value into // Convert the first attribute value into
@@ -40,51 +39,49 @@ namespace ASCOM.Meade.net
public AssemblyInfo(Assembly assembly) public AssemblyInfo(Assembly assembly)
{ {
// Get values from the assembly. // Get values from the assembly.
AssemblyTitleAttribute titleAttr = var titleAttr = GetAssemblyAttribute<AssemblyTitleAttribute>(assembly);
GetAssemblyAttribute<AssemblyTitleAttribute>(assembly); if (titleAttr != null)
if (titleAttr != null) Title = titleAttr.Title; Title = titleAttr.Title;
AssemblyDescriptionAttribute assemblyAttr = var assemblyAttr = GetAssemblyAttribute<AssemblyDescriptionAttribute>(assembly);
GetAssemblyAttribute<AssemblyDescriptionAttribute>(assembly); if (assemblyAttr != null)
if (assemblyAttr != null) Description = Description = assemblyAttr.Description;
assemblyAttr.Description;
AssemblyCompanyAttribute companyAttr = var companyAttr =GetAssemblyAttribute<AssemblyCompanyAttribute>(assembly);
GetAssemblyAttribute<AssemblyCompanyAttribute>(assembly); if (companyAttr != null)
if (companyAttr != null) Company = companyAttr.Company; Company = companyAttr.Company;
AssemblyProductAttribute productAttr = var productAttr = GetAssemblyAttribute<AssemblyProductAttribute>(assembly);
GetAssemblyAttribute<AssemblyProductAttribute>(assembly); if (productAttr != null)
if (productAttr != null) Product = productAttr.Product; Product = productAttr.Product;
AssemblyCopyrightAttribute copyrightAttr = var copyrightAttr = GetAssemblyAttribute<AssemblyCopyrightAttribute>(assembly);
GetAssemblyAttribute<AssemblyCopyrightAttribute>(assembly); if (copyrightAttr != null)
if (copyrightAttr != null) Copyright = copyrightAttr.Copyright; Copyright = copyrightAttr.Copyright;
AssemblyTrademarkAttribute trademarkAttr = var trademarkAttr = GetAssemblyAttribute<AssemblyTrademarkAttribute>(assembly);
GetAssemblyAttribute<AssemblyTrademarkAttribute>(assembly); if (trademarkAttr != null)
if (trademarkAttr != null) Trademark = trademarkAttr.Trademark; Trademark = trademarkAttr.Trademark;
var version = assembly.GetName().Version; var version = assembly.GetName().Version;
AssemblyVersion = $"{version.Major}.{version.Minor}.{version.Build}.{version.Revision}"; AssemblyVersion = $"{version.Major}.{version.Minor}.{version.Build}.{version.Revision}";
AssemblyFileVersionAttribute fileVersionAttr = var fileVersionAttr = GetAssemblyAttribute<AssemblyFileVersionAttribute>(assembly);
GetAssemblyAttribute<AssemblyFileVersionAttribute>(assembly);
if (fileVersionAttr != null) FileVersion = if (fileVersionAttr != null) FileVersion =
fileVersionAttr.Version; fileVersionAttr.Version;
GuidAttribute guidAttr = GetAssemblyAttribute<GuidAttribute>(assembly); var guidAttr = GetAssemblyAttribute<GuidAttribute>(assembly);
if (guidAttr != null) Guid = guidAttr.Value; if (guidAttr != null)
Guid = guidAttr.Value;
NeutralResourcesLanguageAttribute languageAttr = var languageAttr = GetAssemblyAttribute<NeutralResourcesLanguageAttribute>(assembly);
GetAssemblyAttribute<NeutralResourcesLanguageAttribute>(assembly); if (languageAttr != null)
if (languageAttr != null) NeutralLanguage = NeutralLanguage = languageAttr.CultureName;
languageAttr.CultureName;
ComVisibleAttribute comAttr = var comAttr = GetAssemblyAttribute<ComVisibleAttribute>(assembly);
GetAssemblyAttribute<ComVisibleAttribute>(assembly); if (comAttr != null)
if (comAttr != null) IsComVisible = comAttr.Value; IsComVisible = comAttr.Value;
} }
} }
} }