Code inspections
This commit is contained in:
@@ -1,36 +0,0 @@
|
|||||||
using System.Globalization;
|
|
||||||
using System.Reflection;
|
|
||||||
using System.Resources;
|
|
||||||
using System.Threading;
|
|
||||||
|
|
||||||
namespace ASCOM.Meade.net.Localization
|
|
||||||
{
|
|
||||||
internal class LocalisationHelper
|
|
||||||
{
|
|
||||||
private const string LocalizationNamespace = "LocalisationTest.Localization.Resources.Localization";
|
|
||||||
private readonly ResourceManager _resourceManager;
|
|
||||||
|
|
||||||
public LocalisationHelper()
|
|
||||||
{
|
|
||||||
_resourceManager = new ResourceManager(LocalizationNamespace, Assembly.GetExecutingAssembly());
|
|
||||||
|
|
||||||
SetLocalisation(CultureInfo.CurrentCulture.Name);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void SetLocalisation(string name)
|
|
||||||
{
|
|
||||||
var cultureInfo = new CultureInfo(name);
|
|
||||||
|
|
||||||
//CultureInfo.DefaultThreadCurrentCulture = cultureInfo;
|
|
||||||
//CultureInfo.DefaultThreadCurrentUICulture = cultureInfo;
|
|
||||||
|
|
||||||
Thread.CurrentThread.CurrentCulture = cultureInfo;
|
|
||||||
Thread.CurrentThread.CurrentUICulture = cultureInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal string GetString(string key)
|
|
||||||
{
|
|
||||||
return _resourceManager.GetString(key);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -132,7 +132,6 @@
|
|||||||
<DependentUpon>frmMain.cs</DependentUpon>
|
<DependentUpon>frmMain.cs</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="GarbageCollection.cs" />
|
<Compile Include="GarbageCollection.cs" />
|
||||||
<Compile Include="Localization\LocalisationHelper.cs" />
|
|
||||||
<Compile Include="LocalServer.cs" />
|
<Compile Include="LocalServer.cs" />
|
||||||
<Compile Include="ProfileProperties.cs" />
|
<Compile Include="ProfileProperties.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
|||||||
@@ -78,12 +78,6 @@ namespace ASCOM.Meade.net
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool SendBool(string message)
|
|
||||||
{
|
|
||||||
SharedSerial.ClearBuffers();
|
|
||||||
return SendChar(message) == "1";
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Example of a shared SendMessage method, the lock
|
/// Example of a shared SendMessage method, the lock
|
||||||
/// prevents different drivers tripping over one another.
|
/// prevents different drivers tripping over one another.
|
||||||
@@ -128,39 +122,6 @@ namespace ASCOM.Meade.net
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Example of handling connecting to and disconnection from the
|
|
||||||
/// shared serial port.
|
|
||||||
/// Needs error handling
|
|
||||||
/// the port name etc. needs to be set up first, this could be done by the driver
|
|
||||||
/// checking Connected and if it's false setting up the port before setting connected to true.
|
|
||||||
/// It could also be put here.
|
|
||||||
/// </summary>
|
|
||||||
public static bool Connected
|
|
||||||
{
|
|
||||||
set
|
|
||||||
{
|
|
||||||
lock (LockObject)
|
|
||||||
{
|
|
||||||
if (value)
|
|
||||||
{
|
|
||||||
if (Connections == 0)
|
|
||||||
SharedSerial.Connected = true;
|
|
||||||
Connections++;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Connections--;
|
|
||||||
if (Connections <= 0)
|
|
||||||
{
|
|
||||||
SharedSerial.Connected = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
get => SharedSerial.Connected;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Profile
|
#region Profile
|
||||||
@@ -353,13 +314,6 @@ namespace ASCOM.Meade.net
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool IsConnected(string deviceId)
|
|
||||||
{
|
|
||||||
if (ConnectedDevices.ContainsKey(deviceId))
|
|
||||||
return ConnectedDevices[deviceId].Count > 0;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public static void Lock(Action action)
|
public static void Lock(Action action)
|
||||||
@@ -391,31 +345,5 @@ namespace ASCOM.Meade.net
|
|||||||
Count = 0;
|
Count = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//#region ServedClassName attribute
|
|
||||||
///// <summary>
|
|
||||||
///// This is only needed if the driver is targeted at platform 5.5, it is included with Platform 6
|
|
||||||
///// </summary>
|
|
||||||
//[global::System.AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
|
|
||||||
//public sealed class ServedClassNameAttribute : Attribute
|
|
||||||
//{
|
|
||||||
// // See the attribute guidelines at
|
|
||||||
// // http://go.microsoft.com/fwlink/?LinkId=85236
|
|
||||||
|
|
||||||
// /// <summary>
|
|
||||||
// /// Gets or sets the 'friendly name' of the served class, as registered with the ASCOM Chooser.
|
|
||||||
// /// </summary>
|
|
||||||
// /// <value>The 'friendly name' of the served class.</value>
|
|
||||||
// public string DisplayName { get; private set; }
|
|
||||||
// /// <summary>
|
|
||||||
// /// Initializes a new instance of the <see cref="ServedClassNameAttribute"/> class.
|
|
||||||
// /// </summary>
|
|
||||||
// /// <param name="servedClassName">The 'friendly name' of the served class.</param>
|
|
||||||
// public ServedClassNameAttribute(string servedClassName)
|
|
||||||
// {
|
|
||||||
// DisplayName = servedClassName;
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
//#endregion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
// ReSharper disable UnusedMember.Global
|
||||||
|
|
||||||
namespace ASCOM.Meade.net
|
namespace ASCOM.Meade.net
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user