Code inspections

This commit is contained in:
2019-09-29 19:38:56 +01:00
parent 013c2fd672
commit 4489a91eb7
5 changed files with 52 additions and 9 deletions
+27
View File
@@ -79,5 +79,32 @@ namespace ASCOM.Meade.net.Properties {
return ((System.Drawing.Icon)(obj)); return ((System.Drawing.Icon)(obj));
} }
} }
/// <summary>
/// Looks up a localized string similar to Site out of range.
/// </summary>
internal static string Telescope_GetSiteName_Site_out_of_range {
get {
return ResourceManager.GetString("Telescope_GetSiteName_Site_out_of_range", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Site cannot be higher than 4.
/// </summary>
internal static string Telescope_SelectSite_Site_cannot_be_higher_than_4 {
get {
return ResourceManager.GetString("Telescope_SelectSite_Site_cannot_be_higher_than_4", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Site cannot be lower than 1.
/// </summary>
internal static string Telescope_SelectSite_Site_cannot_be_lower_than_1 {
get {
return ResourceManager.GetString("Telescope_SelectSite_Site_cannot_be_lower_than_1", resourceCulture);
}
}
} }
} }
@@ -124,4 +124,13 @@
<data name="DefaultIcon" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="DefaultIcon" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\ASCOM.ico;System.Drawing.Icon, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\ASCOM.ico;System.Drawing.Icon, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="Telescope_SelectSite_Site_cannot_be_lower_than_1" xml:space="preserve">
<value>Site cannot be lower than 1</value>
</data>
<data name="Telescope_SelectSite_Site_cannot_be_higher_than_4" xml:space="preserve">
<value>Site cannot be higher than 4</value>
</data>
<data name="Telescope_GetSiteName_Site_out_of_range" xml:space="preserve">
<value>Site out of range</value>
</data>
</root> </root>
+8 -7
View File
@@ -9,6 +9,7 @@ using System.Collections;
using System.Globalization; using System.Globalization;
using System.Reflection; using System.Reflection;
using ASCOM.Meade.net.AstroMaths; using ASCOM.Meade.net.AstroMaths;
using ASCOM.Meade.net.Properties;
using ASCOM.Meade.net.Wrapper; using ASCOM.Meade.net.Wrapper;
using ASCOM.Utilities.Interfaces; using ASCOM.Utilities.Interfaces;
@@ -536,9 +537,9 @@ namespace ASCOM.Meade.net
CheckConnected("SelectSite"); CheckConnected("SelectSite");
if (site < 1) if (site < 1)
throw new ArgumentOutOfRangeException(nameof(site),site,"Site cannot be lower than 1"); throw new ArgumentOutOfRangeException(nameof(site),site,Resources.Telescope_SelectSite_Site_cannot_be_lower_than_1);
else if (site > 4) else if (site > 4)
throw new ArgumentOutOfRangeException(nameof(site), site, "Site cannot be higher than 4"); throw new ArgumentOutOfRangeException(nameof(site), site, Resources.Telescope_SelectSite_Site_cannot_be_higher_than_4);
_sharedResourcesWrapper.SendBlind($":W{site}#"); _sharedResourcesWrapper.SendBlind($":W{site}#");
//:W<n># //:W<n>#
@@ -551,9 +552,9 @@ namespace ASCOM.Meade.net
CheckConnected("SetSiteName"); CheckConnected("SetSiteName");
if (site < 1) if (site < 1)
throw new ArgumentOutOfRangeException(nameof(site), site, "Site cannot be lower than 1"); throw new ArgumentOutOfRangeException(nameof(site), site, Resources.Telescope_SelectSite_Site_cannot_be_lower_than_1);
else if (site > 4) else if (site > 4)
throw new ArgumentOutOfRangeException(nameof(site), site, "Site cannot be higher than 4"); throw new ArgumentOutOfRangeException(nameof(site), site, Resources.Telescope_SelectSite_Site_cannot_be_higher_than_4);
string command = String.Empty; string command = String.Empty;
switch (site) switch (site)
@@ -605,9 +606,9 @@ namespace ASCOM.Meade.net
CheckConnected("GetSiteName"); CheckConnected("GetSiteName");
if (site < 1) if (site < 1)
throw new ArgumentOutOfRangeException(nameof(site), site, "Site cannot be lower than 1"); throw new ArgumentOutOfRangeException(nameof(site), site, Resources.Telescope_SelectSite_Site_cannot_be_lower_than_1);
else if (site > 4) else if (site > 4)
throw new ArgumentOutOfRangeException(nameof(site), site, "Site cannot be higher than 4"); throw new ArgumentOutOfRangeException(nameof(site), site, Resources.Telescope_SelectSite_Site_cannot_be_higher_than_4);
switch (site) switch (site)
{ {
@@ -633,7 +634,7 @@ namespace ASCOM.Meade.net
//A # terminated string with the name of the requested site. //A # terminated string with the name of the requested site.
} }
throw new ArgumentOutOfRangeException(nameof(site), site, "Site out of range"); throw new ArgumentOutOfRangeException(nameof(site), site, Resources.Telescope_GetSiteName_Site_out_of_range);
} }
public string Description public string Description
+2 -2
View File
@@ -113,7 +113,7 @@ namespace ASCOM.Meade.net
private Guid _mClassId; private Guid _mClassId;
private readonly ArrayList _mInterfaceTypes; private readonly ArrayList _mInterfaceTypes;
private uint _mCookie; private uint _mCookie;
private readonly string _mProgid; //private readonly string _mProgid;
public ClassFactory(Type type) public ClassFactory(Type type)
{ {
@@ -122,7 +122,7 @@ namespace ASCOM.Meade.net
_mClassType = type; _mClassType = type;
//PWGS Get the ProgID from the MetaData //PWGS Get the ProgID from the MetaData
_mProgid = Marshal.GenerateProgIdForType(type); //_mProgid = Marshal.GenerateProgIdForType(type);
_mClassId = Marshal.GenerateGuidForType(type); // Should be nailed down by [Guid(...)] _mClassId = Marshal.GenerateGuidForType(type); // Should be nailed down by [Guid(...)]
ClassContext = (uint)Clsctx.ClsctxLocalServer; // Default ClassContext = (uint)Clsctx.ClsctxLocalServer; // Default
Flags = (uint)Regcls.RegclsMultipleuse | // Default Flags = (uint)Regcls.RegclsMultipleuse | // Default
+6
View File
@@ -18,6 +18,12 @@ namespace ASCOM.Meade.net
Text = $"{assemblyInfo.Product} Settings ({assemblyInfo.AssemblyVersion})"; Text = $"{assemblyInfo.Product} Settings ({assemblyInfo.AssemblyVersion})";
} }
public sealed override string Text
{
get { return base.Text; }
set { base.Text = value; }
}
private void cmdCancel_Click(object sender, EventArgs e) // Cancel button event handler private void cmdCancel_Click(object sender, EventArgs e) // Cancel button event handler
{ {
Close(); Close();