Compare commits

..

2 Commits

Author SHA1 Message Date
ColinD 7759862f79 Upgated version numbers to 0.6.0.1 2019-06-09 15:48:14 +01:00
ColinD 58c75794bc Added check for Ascom platform 6.4 SP 1 or higher. 2019-06-09 15:43:32 +01:00
77 changed files with 1184 additions and 5819 deletions
@@ -39,7 +39,7 @@
<OutputPath>bin\x86\Debug\</OutputPath> <OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants> <DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType> <DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget> <PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup> </PropertyGroup>
@@ -54,10 +54,10 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="Castle.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL"> <Reference Include="Castle.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
<HintPath>..\packages\Castle.Core.4.4.0\lib\net45\Castle.Core.dll</HintPath> <HintPath>..\packages\Castle.Core.4.3.1\lib\net45\Castle.Core.dll</HintPath>
</Reference> </Reference>
<Reference Include="Moq, Version=4.12.0.0, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL"> <Reference Include="Moq, Version=4.10.0.0, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
<HintPath>..\packages\Moq.4.12.0\lib\net45\Moq.dll</HintPath> <HintPath>..\packages\Moq.4.10.1\lib\net45\Moq.dll</HintPath>
</Reference> </Reference>
<Reference Include="nunit.framework, Version=3.12.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL"> <Reference Include="nunit.framework, Version=3.12.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
<HintPath>..\packages\NUnit.3.12.0\lib\net45\nunit.framework.dll</HintPath> <HintPath>..\packages\NUnit.3.12.0\lib\net45\nunit.framework.dll</HintPath>
@@ -65,11 +65,11 @@
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Configuration" /> <Reference Include="System.Configuration" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> <Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.5.2\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll</HintPath> <HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.5.0\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference> </Reference>
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL"> <Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.3\lib\netstandard2.0\System.Threading.Tasks.Extensions.dll</HintPath> <HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.1\lib\netstandard2.0\System.Threading.Tasks.Extensions.dll</HintPath>
</Reference> </Reference>
<Reference Include="System.Xml.Linq" /> <Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" /> <Reference Include="System.Data.DataSetExtensions" />
@@ -89,7 +89,6 @@
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="app.config" />
<None Include="packages.config" /> <None Include="packages.config" />
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+7 -7
View File
@@ -1,5 +1,5 @@
using System; using System;
using ASCOM.Meade.net.AstroMaths; using ASCOM.Meade.net;
using NUnit.Framework; using NUnit.Framework;
namespace AstroMath.UnitTests namespace AstroMath.UnitTests
@@ -52,16 +52,16 @@ namespace AstroMath.UnitTests
public void UTtoGST_book() public void UTtoGST_book()
{ {
DateTime dateTime = new DateTime(1980, 04, 22, 14, 36, 51, 670, DateTimeKind.Utc); DateTime dateTime = new DateTime(1980, 04, 22, 14, 36, 51, 670, DateTimeKind.Utc);
double gst = _astroMath.UTtoGst(dateTime); double gst = _astroMath.UTtoGST(dateTime);
Assert.That(gst, Is.EqualTo(4.667932706211154)); Assert.That(gst, Is.EqualTo(4.667932706211154));
} }
[Test] [Test]
public void UTtoGst() public void UTtoGST()
{ {
DateTime dateTime = new DateTime(2019, 05, 18, 22, 26, 15, DateTimeKind.Utc); DateTime dateTime = new DateTime(2019, 05, 18, 22, 26, 15, DateTimeKind.Utc);
double gst = _astroMath.UTtoGst(dateTime); double gst = _astroMath.UTtoGST(dateTime);
Assert.That(gst, Is.EqualTo(14.191879687876451)); Assert.That(gst, Is.EqualTo(14.191879687876451));
} }
@@ -71,16 +71,16 @@ namespace AstroMath.UnitTests
{ {
double gst = 4.668119; double gst = 4.668119;
var longitude = -64; var longitude = -64;
var lst = _astroMath.GsTtoLst(gst, longitude); var lst = _astroMath.GSTtoLST(gst, longitude);
Assert.That(lst, Is.EqualTo(0.4014523333333333)); Assert.That(lst, Is.EqualTo(0.4014523333333333));
} }
[Test] [Test]
public void GsTtoLst() public void GSTtoLST()
{ {
double gst = 14.257589512545053; double gst = 14.257589512545053;
var longitude = -1.7833333333333332; var longitude = -1.7833333333333332;
var lst = _astroMath.GsTtoLst(gst, longitude); var lst = _astroMath.GSTtoLST(gst, longitude);
Assert.That(lst, Is.EqualTo(14.138700623656163)); Assert.That(lst, Is.EqualTo(14.138700623656163));
} }
@@ -1,4 +1,5 @@
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
@@ -31,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.0.0.0")] [assembly: AssemblyVersion("0.6.0.1")]
[assembly: AssemblyFileVersion("0.0.0.0")] [assembly: AssemblyFileVersion("0.6.0.1")]
-11
View File
@@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.0.1" newVersion="4.2.0.1" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
+4 -4
View File
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="Castle.Core" version="4.4.0" targetFramework="net472" /> <package id="Castle.Core" version="4.3.1" targetFramework="net472" />
<package id="Moq" version="4.12.0" targetFramework="net472" /> <package id="Moq" version="4.10.1" targetFramework="net472" />
<package id="NUnit" version="3.12.0" targetFramework="net472" /> <package id="NUnit" version="3.12.0" targetFramework="net472" />
<package id="System.Runtime.CompilerServices.Unsafe" version="4.5.2" targetFramework="net472" /> <package id="System.Runtime.CompilerServices.Unsafe" version="4.5.0" targetFramework="net472" />
<package id="System.Threading.Tasks.Extensions" version="4.5.3" targetFramework="net472" /> <package id="System.Threading.Tasks.Extensions" version="4.5.1" targetFramework="net472" />
</packages> </packages>
@@ -36,25 +36,6 @@
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit> <Prefer32Bit>false</Prefer32Bit>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="ASCOM.DeviceInterfaces, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL" /> <Reference Include="ASCOM.DeviceInterfaces, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL" />
<Reference Include="ASCOM.DriverAccess, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL" /> <Reference Include="ASCOM.DriverAccess, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL" />
+6 -3
View File
@@ -9,10 +9,13 @@
#define UseChooser #define UseChooser
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading; using System.Threading;
using ASCOM.DriverAccess; using ASCOM.DriverAccess;
namespace ASCOM.MeadeGeneric namespace ASCOM
{ {
class Program class Program
{ {
@@ -21,11 +24,11 @@ namespace ASCOM.MeadeGeneric
// Uncomment the code that's required // Uncomment the code that's required
#if UseChooser #if UseChooser
// choose the device // choose the device
string id = Focuser.Choose("ASCOM.MeadeGeneric.Focuser"); string id = ASCOM.DriverAccess.Focuser.Choose("ASCOM.MeadeGeneric.Focuser");
if (string.IsNullOrEmpty(id)) if (string.IsNullOrEmpty(id))
return; return;
// create this device // create this device
Focuser device = new Focuser(id); ASCOM.DriverAccess.Focuser device = new ASCOM.DriverAccess.Focuser(id);
#else #else
// this can be replaced by this code, it avoids the chooser and creates the driver class directly. // this can be replaced by this code, it avoids the chooser and creates the driver class directly.
ASCOM.DriverAccess.Telescope device = new ASCOM.DriverAccess.Telescope("ASCOM.MeadeGeneric.Telescope"); ASCOM.DriverAccess.Telescope device = new ASCOM.DriverAccess.Telescope("ASCOM.MeadeGeneric.Telescope");
@@ -1,4 +1,5 @@
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
@@ -31,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
[assembly: AssemblyVersion("0.0.0.0")] [assembly: AssemblyVersion("0.6.0.1")]
[assembly: AssemblyFileVersion("0.0.0.0")] [assembly: AssemblyFileVersion("0.6.0.1")]
-46
View File
@@ -1,46 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{7A63F045-FC76-47B9-9DC6-59FA4B758FBB}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Meade.net.Common</RootNamespace>
<AssemblyName>Meade.net.Common</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
@@ -1,36 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Meade.net.Common")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Meade.net.Common")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("7a63f045-fc76-47b9-9dc6-59fa4b758fbb")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
@@ -1,36 +0,0 @@
<#
This script initializes a bare minimum set of registry entries required for ASCOM.Utilities.Profile to work
without throwing any exceptions. When building on a build server, or on a computer without the ASCOM Platform installed,
it may be useful to execute this script as a build step prior to running any unit tests, or calling any code that relies on
ASCOM.Utilities.Profile. The alternative is to install the ASCOM Platform on the build agent.
NOTE: This script equires elevated permissions because it creates registry keys in the LocalMachine hive.
#>
$wow = Test-Path HKLM:\SOFTWARE\Wow6432Node
if ($wow)
{
$root = "HKLM:\SOFTWARE\Wow6432Node"
}
else
{
$root = "HKLM:\SOFTWARE"
}
$ascomRoot = $root + "\ASCOM"
if (Test-Path $ascomRoot)
{
<# Don't upset an already-existing ASCOM registry #>
exit
}
<# Create the ASCOM root key and set it's ACL to allow all users read/write access #>
New-Item -Path $root -Name ASCOM Force
$ascomAcl = Get-Acl $ascomRoot
$aclRule = New-Object System.Security.AccessControl.RegistryAccessRule ("Users","FullControl","Allow")
$ascomAcl.SetAccessRule($aclRule)
$ascomAcl | Set-Acl -Path $ascomRoot
<# Now create the bare minimum keys required so that ASCOM.Utilities.Profile doesn't crash and burn #>
New-ItemProperty -Path $ascomRoot -Name PlatformVersion -Value "6.1" -PropertyType String Force
New-ItemProperty -Path $ascomRoot -Name SerTraceFile -Value "C:\SerialTraceAuto.txt" -PropertyType String Force
@@ -1,455 +0,0 @@
using System;
using ASCOM;
using ASCOM.DeviceInterface;
using ASCOM.Meade.net;
using ASCOM.Meade.net.Wrapper;
using ASCOM.Utilities.Interfaces;
using Moq;
using NUnit.Framework;
using NotImplementedException = System.NotImplementedException;
namespace Meade.net.Focuser.UnitTests
{
[TestFixture]
public class FocuserUnitTests
{
private Mock<IUtil> _utilMock;
private Mock<ISharedResourcesWrapper> _sharedResourcesWrapperMock;
private ProfileProperties _profileProperties;
private ASCOM.Meade.net.Focuser _focuser;
[SetUp]
public void Setup()
{
_profileProperties = new ProfileProperties();
_profileProperties.TraceLogger = false;
_profileProperties.ComPort = "TestCom1";
_profileProperties.GuideRateArcSecondsPerSecond = 1.23;
_profileProperties.Precision = "Unchanged";
_utilMock = new Mock<IUtil>();
_sharedResourcesWrapperMock = new Mock<ISharedResourcesWrapper>();
_sharedResourcesWrapperMock.Setup(x => x.Lock(It.IsAny<Action>())).Callback<Action>(action => { action(); });
_sharedResourcesWrapperMock.Setup(x => x.ReadProfile()).Returns(() => _profileProperties);
_focuser = new ASCOM.Meade.net.Focuser(_utilMock.Object, _sharedResourcesWrapperMock.Object);
}
private void ConnectFocuser()
{
_sharedResourcesWrapperMock.Setup(x => x.ProductName).Returns(() => TelescopeList.Autostar497);
_sharedResourcesWrapperMock.Setup(x => x.FirmwareVersion).Returns(() => TelescopeList.Autostar497_31Ee);
_focuser.Connected = true;
}
[Test]
public void CheckThatClassCreatedProperly()
{
Assert.That(_focuser, Is.Not.Null);
}
[Test]
public void NotConnectedByDefault()
{
Assert.That(_focuser.Connected, Is.False);
}
[Test]
public void SetupDialog()
{
_sharedResourcesWrapperMock.Verify(x => x.ReadProfile(), Times.Once);
_focuser.SetupDialog();
_sharedResourcesWrapperMock.Verify(x => x.SetupDialog(), Times.Once);
_sharedResourcesWrapperMock.Verify(x => x.ReadProfile(), Times.Exactly(2));
}
[Test]
public void SupportedActions()
{
var supportedActions = _focuser.SupportedActions;
Assert.That(supportedActions, Is.Not.Null);
Assert.That(supportedActions.Count, Is.EqualTo(0));
}
[Test]
public void Action_WhenNotConnected_ThrowsNotConnectedException()
{
var actionName = "Action";
var exception = Assert.Throws<ActionNotImplementedException>(() => { var actualResult = _focuser.Action(actionName, string.Empty); });
}
[Test]
public void CommandBlind_WhenNotConnected_ThenThrowsNotConnectedException()
{
string expectedMessage = "test blind Message";
var exception = Assert.Throws<NotConnectedException>(() => { _focuser.CommandBlind(expectedMessage, true); });
Assert.That(exception.Message, Is.EqualTo("Not connected to focuser when trying to execute: CommandBlind"));
}
[Test]
public void CommandBlind_WhenConnected_ThenSendsExpectedMessage()
{
string expectedMessage = "test blind Message";
ConnectFocuser();
_focuser.CommandBlind(expectedMessage, true);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(expectedMessage), Times.Once);
}
[Test]
public void CommandBool_WhenNotConnected_ThenThrowsNotConnectedException()
{
string expectedMessage = "test blind Message";
var exception = Assert.Throws<NotConnectedException>(() => { _focuser.CommandBool(expectedMessage, true); });
Assert.That(exception.Message, Is.EqualTo("Not connected to focuser when trying to execute: CommandBool"));
}
[Test]
public void CommandBool_WhenConnected_ThenSendsExpectedMessage()
{
string expectedMessage = "test blind Message";
ConnectFocuser();
var exception = Assert.Throws<MethodNotImplementedException>(() => { _focuser.CommandBool(expectedMessage, true); });
Assert.That(exception.Message, Is.EqualTo("Method CommandBool is not implemented in this driver."));
}
[Test]
public void CommandString_WhenNotConnected_ThenThrowsNotConnectedException()
{
string expectedMessage = "test blind Message";
var exception = Assert.Throws<NotConnectedException>(() => { _focuser.CommandString(expectedMessage, true); });
Assert.That(exception.Message, Is.EqualTo("Not connected to focuser when trying to execute: CommandString"));
}
[Test]
public void CommandString_WhenConnected_ThenSendsExpectedMessage()
{
string expectedMessage = "expected result message";
string sendMessage = "test blind Message";
ConnectFocuser();
_sharedResourcesWrapperMock.Setup(x => x.SendString(sendMessage)).Returns(() => expectedMessage);
var actualMessage = _focuser.CommandString(sendMessage, true);
_sharedResourcesWrapperMock.Verify(x => x.SendString(sendMessage), Times.Once);
Assert.That(actualMessage, Is.EqualTo(expectedMessage));
}
[TestCase(true)]
[TestCase(false)]
public void Connected_Get_ReturnsExpectedValue(bool expectedConnected)
{
_sharedResourcesWrapperMock.Setup(x => x.ProductName).Returns(() => TelescopeList.Autostar497);
_sharedResourcesWrapperMock.Setup(x => x.FirmwareVersion).Returns(() => TelescopeList.Autostar497_31Ee);
_focuser.Connected = expectedConnected;
Assert.That(_focuser.Connected, Is.EqualTo(expectedConnected));
}
[Test]
public void Connected_Set_WhenConnecting_Then_ConnectsToSerialDevice()
{
var productName = "LX2001";
var firmware = string.Empty;
_sharedResourcesWrapperMock.Setup(x => x.ProductName).Returns(productName);
_sharedResourcesWrapperMock.Setup(x => x.FirmwareVersion).Returns(firmware);
_focuser.Connected = true;
_sharedResourcesWrapperMock.Verify(x => x.Connect("Serial", It.IsAny<string>()), Times.Once);
}
[Test]
public void Connected_Set_SettingTrueWhenTrue_ThenDoesNothing()
{
ConnectFocuser();
_sharedResourcesWrapperMock.Verify(x => x.Connect(It.IsAny<string>(), It.IsAny<string>()), Times.Once);
//act
_focuser.Connected = true;
//assert
_sharedResourcesWrapperMock.Verify(x => x.Connect(It.IsAny<string>(), It.IsAny<string>()), Times.Once);
}
[Test]
public void Connected_Set_SettingFalseWhenTrue_ThenDisconnects()
{
ConnectFocuser();
_sharedResourcesWrapperMock.Verify(x => x.Connect(It.IsAny<string>(), It.IsAny<string>()), Times.Once);
//act
_focuser.Connected = false;
//assert
_sharedResourcesWrapperMock.Verify(x => x.Disconnect(It.IsAny<string>(), It.IsAny<string>()), Times.Once());
}
//Commented out for now as the catch after connect is currently unreachable code.
//[Test]
//public void Connected_Set_WhenFailsToConnect_ThenDisconnects()
//{
// _sharedResourcesWrapperMock.Setup(x => x.ProductName).Returns(() => TelescopeList.Autostar497);
// _sharedResourcesWrapperMock.Setup(x => x.FirmwareVersion).Returns(() => TelescopeList.Autostar497_31Ee);
// _sharedResourcesWrapperMock.Setup(x => x.SendString(It.IsAny<string>())).Throws(new Exception("TestFailed"));
// //act
// _focuser.Connected = true;
// //assert
// _sharedResourcesWrapperMock.Verify(x => x.Disconnect(It.IsAny<string>(), It.IsAny<string>()), Times.Once());
//}
[Test]
public void Description_Get()
{
var expectedDescription = "Meade Generic";
var description = _focuser.Description;
Assert.That(description, Is.EqualTo(expectedDescription));
}
[Test]
public void DriverVersion_Get()
{
Version version = System.Reflection.Assembly.GetAssembly(typeof(ASCOM.Meade.net.Focuser)).GetName().Version;
string exptectedDriverInfo = $"{version.Major}.{version.Minor}.{version.Build}.{version.Revision}";
var driverVersion = _focuser.DriverVersion;
Assert.That(driverVersion, Is.EqualTo(exptectedDriverInfo));
}
[Test]
public void DriverInfo_Get()
{
Version version = System.Reflection.Assembly.GetAssembly(typeof(ASCOM.Meade.net.Focuser)).GetName().Version;
string exptectedDriverInfo = $"{_focuser.Description} .net driver. Version: {_focuser.DriverVersion}";
var driverInfo = _focuser.DriverInfo;
Assert.That(driverInfo, Is.EqualTo(exptectedDriverInfo));
}
[Test]
public void InterfaceVersion_Get()
{
var interfaceVersion = _focuser.InterfaceVersion;
Assert.That(interfaceVersion, Is.EqualTo(3));
Assert.That(_focuser, Is.AssignableTo<IFocuserV3>());
}
[Test]
public void Name_Get()
{
string expectedName = "Meade Generic";
var name = _focuser.Name;
Assert.That(name, Is.EqualTo(expectedName));
}
[Test]
public void Absolute_Get_WhenNotConnected_ThenThrowsException()
{
var exception = Assert.Throws<NotConnectedException>(() => { var result = _focuser.Absolute; });
Assert.That(exception.Message, Is.EqualTo("Not connected to focuser when trying to execute: Absolute Get"));
}
[Test]
public void Absolute_Get_WhenConnected_ThenReturnsFalse()
{
ConnectFocuser();
var result = _focuser.Absolute;
Assert.That(result, Is.False);
}
[Test]
public void Halt_WhenNotConnected_ThenThrowsException()
{
var exception = Assert.Throws<NotConnectedException>(() => { _focuser.Halt(); });
Assert.That(exception.Message, Is.EqualTo("Not connected to focuser when trying to execute: Halt"));
}
[Test]
public void Halt_WhenConnected_ThenSendsHaltCommand()
{
ConnectFocuser();
_focuser.Halt();
_sharedResourcesWrapperMock.Verify( x => x.SendBlind(":FQ#"), Times.AtLeastOnce);
_utilMock.Verify( x => x.WaitForMilliseconds(250), Times.AtLeastOnce);
}
[Test]
public void IsMoving_WhenCalled_ThenReturnsFalse()
{
ConnectFocuser();
var result = _focuser.IsMoving;
Assert.That(result, Is.False);
}
[TestCase(false)]
[TestCase(true)]
public void Link_Get_ReturnsSameValueAsConnected( bool connected)
{
_sharedResourcesWrapperMock.Setup(x => x.ProductName).Returns(() => TelescopeList.Autostar497);
_sharedResourcesWrapperMock.Setup(x => x.FirmwareVersion).Returns(() => TelescopeList.Autostar497_31Ee);
_focuser.Connected = connected;
Assert.That( _focuser.Link, Is.EqualTo(connected));
}
[TestCase(false)]
[TestCase(true)]
public void Link_Set_WhenSet_ThenSetsConnectedState(bool connected)
{
_sharedResourcesWrapperMock.Setup(x => x.ProductName).Returns(() => TelescopeList.Autostar497);
_sharedResourcesWrapperMock.Setup(x => x.FirmwareVersion).Returns(() => TelescopeList.Autostar497_31Ee);
_focuser.Link = connected;
Assert.That(_focuser.Link, Is.EqualTo(connected));
}
[Test]
public void MaxIncrement_WhenCalled_ThenReturnsExpectedValue()
{
var result = _focuser.MaxIncrement;
Assert.That(result, Is.EqualTo(7000));
}
[Test]
public void MaxStep_WhenCalled_ThenReturnsExpectedValue()
{
var result = _focuser.MaxStep;
Assert.That(result, Is.EqualTo(7000));
}
[Test]
public void Move_WhenNotConnected_ThenThrowsException()
{
var exception = Assert.Throws<NotConnectedException>(() => { _focuser.Move(0); });
Assert.That(exception.Message, Is.EqualTo("Not connected to focuser when trying to execute: Move"));
}
[TestCase(-7001)]
[TestCase(7001)]
public void Move_WhenLargerThanMaxIncrement_ThenThrowsException(int position)
{
ConnectFocuser();
var exception = Assert.Throws<InvalidValueException>(() => { _focuser.Move(position); });
Assert.That(exception.Message, Is.EqualTo($"position out of range -{_focuser.MaxIncrement} < {position} < {_focuser.MaxIncrement}"));
}
[Test]
public void Move_WhenIncrementIs0_ThenDoesNothing()
{
ConnectFocuser();
_focuser.Move(0);
_utilMock.Verify( x => x.WaitForMilliseconds(It.IsAny<int>()), Times.Never);
}
[TestCase(200)]
[TestCase(-200)]
public void Move_WhenIncrementIsNot0_ThenMovesFocuserAndStopsFocuser( int position)
{
ConnectFocuser();
_focuser.Move(position);
if (position < 0)
{
_sharedResourcesWrapperMock.Verify( x => x.SendBlind(":F-#"), Times.AtLeastOnce);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":F+#"), Times.Never);
}
else
{
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":F-#"), Times.Never);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":F+#"), Times.AtLeastOnce);
}
_sharedResourcesWrapperMock.Verify( x => x.Lock(It.IsAny<Action>()), Times.Once);
_utilMock.Verify(x => x.WaitForMilliseconds(250), Times.AtLeastOnce);
_utilMock.Verify(x => x.WaitForMilliseconds(100), Times.Once());
_utilMock.Verify(x => x.WaitForMilliseconds(1000), Times.Once());
}
[Test]
public void Position_WhenCalled_ThenThrowsException()
{
var exception = Assert.Throws<PropertyNotImplementedException>(() => { var result = _focuser.Position; });
Assert.That(exception.Message, Is.EqualTo("Property read Position is not implemented in this driver."));
}
[Test]
public void StepSize_WhenCalled_ThenThrowsException()
{
var exception = Assert.Throws<PropertyNotImplementedException>(() => { var result = _focuser.StepSize; });
Assert.That(exception.Message, Is.EqualTo("Property read StepSize is not implemented in this driver."));
}
[Test]
public void TempComp_WhenRead_ThenReturnsFalse()
{
var result = _focuser.TempComp;
Assert.That(result, Is.False);
}
[Test]
public void TempComp_WhenWrite_ThenThrowsException()
{
var exception = Assert.Throws<PropertyNotImplementedException>(() => { _focuser.TempComp = false; });
Assert.That(exception.Message, Is.EqualTo("Property read TempComp is not implemented in this driver."));
}
[Test]
public void TempCompAvailable_WhenRead_ThenReturnsFalse()
{
var result = _focuser.TempCompAvailable;
Assert.That(result, Is.False);
}
[Test]
public void Temperature_WhenCalled_ThenThrowsException()
{
var exception = Assert.Throws<PropertyNotImplementedException>(() => { var result = _focuser.Temperature; });
Assert.That(exception.Message, Is.EqualTo("Property read Temperature is not implemented in this driver."));
}
}
}
@@ -1,122 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\NUnit.3.12.0\build\NUnit.props" Condition="Exists('..\packages\NUnit.3.12.0\build\NUnit.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{A3991FA7-23C3-405A-96F9-5AB03AC58F30}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Meade.net.Focuser.UnitTests</RootNamespace>
<AssemblyName>Meade.net.Focuser.UnitTests</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="ASCOM.Astrometry, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Astrometry.dll</HintPath>
</Reference>
<Reference Include="ASCOM.Attributes, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Attributes.dll</HintPath>
</Reference>
<Reference Include="ASCOM.Cache, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Cache.dll</HintPath>
</Reference>
<Reference Include="ASCOM.Controls, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Controls.dll</HintPath>
</Reference>
<Reference Include="ASCOM.DeviceInterfaces, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.DeviceInterfaces.dll</HintPath>
</Reference>
<Reference Include="ASCOM.DriverAccess, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.DriverAccess.dll</HintPath>
</Reference>
<Reference Include="ASCOM.Exceptions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Exceptions.dll</HintPath>
</Reference>
<Reference Include="ASCOM.Internal.Extensions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Internal.Extensions.dll</HintPath>
</Reference>
<Reference Include="ASCOM.SettingsProvider, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.SettingsProvider.dll</HintPath>
</Reference>
<Reference Include="ASCOM.Utilities, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Utilities.dll</HintPath>
</Reference>
<Reference Include="ASCOM.Utilities.Video, Version=6.1.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Utilities.Video.dll</HintPath>
</Reference>
<Reference Include="Castle.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
<HintPath>..\packages\Castle.Core.4.4.0\lib\net45\Castle.Core.dll</HintPath>
</Reference>
<Reference Include="Moq, Version=4.12.0.0, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
<HintPath>..\packages\Moq.4.12.0\lib\net45\Moq.dll</HintPath>
</Reference>
<Reference Include="nunit.framework, Version=3.12.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
<HintPath>..\packages\NUnit.3.12.0\lib\net45\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.5.2\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.3\lib\netstandard2.0\System.Threading.Tasks.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="FocuserUnitTests.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="BootstrapAscomProfileStore.ps1" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Meade.net.focuser\Meade.net.focuser.csproj">
<Project>{a97e3aec-f11d-49da-b259-de99da813a86}</Project>
<Name>Meade.net.focuser</Name>
</ProjectReference>
<ProjectReference Include="..\Meade.net\Meade.net.csproj">
<Project>{3689a2cb-94c5-4012-a5cf-7e7d1dd27143}</Project>
<Name>Meade.net</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\NUnit.3.12.0\build\NUnit.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\NUnit.3.12.0\build\NUnit.props'))" />
</Target>
</Project>
@@ -1,36 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Meade.net.Focuser.UnitTests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Meade.net.Focuser.UnitTests")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("a3991fa7-23c3-405a-96f9-5ab03ac58f30")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
-11
View File
@@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.0.1" newVersion="4.2.0.1" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
@@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="ASCOM.Platform" version="6.4.2" targetFramework="net472" />
<package id="Castle.Core" version="4.4.0" targetFramework="net472" />
<package id="Moq" version="4.12.0" targetFramework="net472" />
<package id="NUnit" version="3.12.0" targetFramework="net472" />
<package id="System.Runtime.CompilerServices.Unsafe" version="4.5.2" targetFramework="net472" />
<package id="System.Threading.Tasks.Extensions" version="4.5.3" targetFramework="net472" />
</packages>
+35
View File
@@ -18,6 +18,41 @@
Vital="yes" Vital="yes"
Assembly=".net" Assembly=".net"
AssemblyApplication="filFocuserDriverAssembly" /> AssemblyApplication="filFocuserDriverAssembly" />
<!-- Registry entries suitable for a LocalServer served class -->
<!-- HKCR\CLSID\{driver-guid} -->
<RegistryKey Root="HKCR" Key="CLSID">
<RegistryKey Key="$(var.FocuserDriverClassId)">
<RegistryValue Value="$(var.FocuserDriverProgId)" Type="string"/>
<RegistryValue Name="AppId" Value="$(var.LocalServerAppId)" Type="string"/>
<RegistryKey Key="Implemented Categories">
<RegistryKey Key="{62C8FE65-4EBB-45e7-B440-6E39B2CDBF29}"
ForceCreateOnInstall="yes"
ForceDeleteOnUninstall="yes"/>
</RegistryKey>
<RegistryKey Key="ProgId">
<RegistryValue Value="$(var.FocuserDriverProgId)" Type="string"/>
</RegistryKey>
<RegistryKey Key="Programmable"
ForceCreateOnInstall="yes"
ForceDeleteOnUninstall="yes" />
<RegistryKey Key="LocalServer32">
<RegistryValue Value="[#filLocalServerAssembly]" Type="string"/>
</RegistryKey>
</RegistryKey>
</RegistryKey>
<!-- HKCR\{driver-prog-id} -->
<RegistryKey Root="HKCR" Key="$(var.FocuserDriverProgId)">
<RegistryValue Value="$(var.FocuserDriverDescription)" Type="string"/>
<RegistryKey Key="CLSID">
<RegistryValue Value="$(var.FocuserDriverClassId)" Type="string" />
</RegistryKey>
</RegistryKey>
<!--Register the driver with the ASCOM Profile-->
<RegistryKey Root="HKLM" Key="SOFTWARE\ASCOM\Focuser Drivers\$(var.FocuserDriverProgId)">
<RegistryValue Value="$(var.FocuserDriverDescription)" Type="string"/>
</RegistryKey>
</Component> </Component>
</ComponentGroup> </ComponentGroup>
</Fragment> </Fragment>
+15 -25
View File
@@ -12,31 +12,21 @@
Assembly=".net" Assembly=".net"
AssemblyApplication="filLocalServerAssembly" /> AssemblyApplication="filLocalServerAssembly" />
</Component> </Component>
<Component Id="cmpLocalServerRegistry" Win64="no">
<!-- LocalServer32 COM Registration -->
<RegistryKey Root="HKCR" Key="AppID" >
<!-- HKCR\AppID\{my-app-id} -->
<RegistryKey Key="$(var.LocalServerAppId)">
<RegistryValue Value="$(var.InstallName)" Type="string"/>
<RegistryValue Name="AppID" Value="$(var.LocalServerAppId)" Type="string"/>
<RegistryValue Name="AuthenticationLevel" Value="1" Type="integer"/>
</RegistryKey>
<!-- HKCR\AppID\{exe-name} -->
<RegistryKey Key="$(var.Meade.net.TargetFileName)">
<RegistryValue Name="AppID" Value="$(var.LocalServerAppId)" Type="string"/>
</RegistryKey>
</RegistryKey>
</Component>
</ComponentGroup> </ComponentGroup>
<CustomAction Id="RegisterEXE"
Directory="INSTALLFOLDER"
ExeCommand="&quot;[#filLocalServerAssembly]&quot; /register"
Execute="deferred"
Return="ignore"
Impersonate="no"
/>
<CustomAction Id="UnRegisterEXE"
Directory="INSTALLFOLDER"
ExeCommand="&quot;[#filLocalServerAssembly]&quot; /unregister"
Execute="deferred"
Return="ignore"
Impersonate="no"
/>
<InstallExecuteSequence>
<Custom Action='RegisterEXE' Before="InstallFinalize">
<![CDATA[(NOT Installed)]]>
</Custom>
<Custom Action="UnRegisterEXE" After="InstallInitialize">
<![CDATA[(REMOVE ~= "ALL" AND NOT UPGRADINGPRODUCTCODE)]]>
</Custom>
</InstallExecuteSequence>
</Fragment> </Fragment>
</Wix> </Wix>
+35
View File
@@ -18,6 +18,41 @@
Vital="yes" Vital="yes"
Assembly=".net" Assembly=".net"
AssemblyApplication="filTelescopeDriverAssembly" /> AssemblyApplication="filTelescopeDriverAssembly" />
<!-- Registry entries suitable for a LocalServer served class -->
<!-- HKCR\CLSID\{driver-guid} -->
<RegistryKey Root="HKCR" Key="CLSID">
<RegistryKey Key="$(var.TelescopeDriverClassId)">
<RegistryValue Value="$(var.TelescopeDriverProgId)" Type="string"/>
<RegistryValue Name="AppId" Value="$(var.LocalServerAppId)" Type="string"/>
<RegistryKey Key="Implemented Categories">
<RegistryKey Key="{62C8FE65-4EBB-45e7-B440-6E39B2CDBF29}"
ForceCreateOnInstall="yes"
ForceDeleteOnUninstall="yes"/>
</RegistryKey>
<RegistryKey Key="ProgId">
<RegistryValue Value="$(var.TelescopeDriverProgId)" Type="string"/>
</RegistryKey>
<RegistryKey Key="Programmable"
ForceCreateOnInstall="yes"
ForceDeleteOnUninstall="yes" />
<RegistryKey Key="LocalServer32">
<RegistryValue Value="[#filLocalServerAssembly]" Type="string"/>
</RegistryKey>
</RegistryKey>
</RegistryKey>
<!-- HKCR\{driver-prog-id} -->
<RegistryKey Root="HKCR" Key="$(var.TelescopeDriverProgId)">
<RegistryValue Value="$(var.TelescopeDriverDescription)" Type="string"/>
<RegistryKey Key="CLSID">
<RegistryValue Value="$(var.TelescopeDriverClassId)" Type="string" />
</RegistryKey>
</RegistryKey>
<!--Register the driver with the ASCOM Profile-->
<RegistryKey Root="HKLM" Key="SOFTWARE\ASCOM\Telescope Drivers\$(var.TelescopeDriverProgId)">
<RegistryValue Value="$(var.TelescopeDriverDescription)" Type="string"/>
</RegistryKey>
</Component> </Component>
</ComponentGroup> </ComponentGroup>
</Fragment> </Fragment>
+3 -3
View File
@@ -11,7 +11,7 @@
UpgradeCode must be unique to this product and should not be changed for the product lifetime. UpgradeCode must be unique to this product and should not be changed for the product lifetime.
--> -->
<?define InstallName = "ASCOM Meade Generic" ?> <?define InstallName = "ASCOM Meade.net" ?>
<?define Manufacturer = "cjdawson.com" ?> <?define Manufacturer = "cjdawson.com" ?>
<?define UpgradeCode = "{57597bb6-f207-4998-97f4-8a041950d062}" ?> <?define UpgradeCode = "{57597bb6-f207-4998-97f4-8a041950d062}" ?>
<?define INSTALLFOLDER = "$(var.InstallName)" ?> <?define INSTALLFOLDER = "$(var.InstallName)" ?>
@@ -43,6 +43,6 @@
<!-- <?endif ?> --> <!-- <?endif ?> -->
<!-- Set installer version based on the file version of the main assembly. --> <!-- Set installer version based on the file version of the main assembly. -->
<?define ProductVersion="!(bind.FileVersion.filLocalServerAssembly)"?> <!--<?define ProductVersion="!(bind.FileVersion.filLocalServerAssembly)"?>-->
<!--<?define ProductVersion="0.7.0.0"?>--> <?define ProductVersion="0.6.0.1"?>
</Include> </Include>
Binary file not shown.
-1
View File
@@ -48,7 +48,6 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Content Include="Config.wxi" /> <Content Include="Config.wxi" />
<Content Include="License.rtf" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Meade.net.focuser\Meade.net.focuser.csproj"> <ProjectReference Include="..\Meade.net.focuser\Meade.net.focuser.csproj">
+6 -2
View File
@@ -30,7 +30,12 @@
<![CDATA[Installed OR NETFRAMEWORK40FULL]]> <![CDATA[Installed OR NETFRAMEWORK40FULL]]>
</Condition> </Condition>
<!-- <Condition Message="Please use the correct installer for your operating system - x86 for 32-bit, x64 for 64-bit."> <!--todo create a method to check if ASCOM is installed.-->
<!--<Condition Message="This application requires ASCOM Platform 6.4 or later. Please install this and try again.">
<![CDATA[Installed or WIX_IS_NETFRAMEWORK_471_OR_LATER_INSTALLED]]>
</Condition>-->
<!-- <Condition Message="Please use the correct installer for your operating system - x86 for 32-bit, x64 for 64-bit.">
<?if $(var.Win64) = "yes" ?> <?if $(var.Win64) = "yes" ?>
VersionNT64 VersionNT64
<?else?> <?else?>
@@ -41,7 +46,6 @@
<UIRef Id="InstallationUI"/> <UIRef Id="InstallationUI"/>
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER" /> <Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER" />
<WixVariable Id="WixUILicenseRtf" Value="License.rtf" />
<FeatureGroupRef Id="fgRoot"/> <FeatureGroupRef Id="fgRoot"/>
</Product> </Product>
@@ -1,36 +0,0 @@
<#
This script initializes a bare minimum set of registry entries required for ASCOM.Utilities.Profile to work
without throwing any exceptions. When building on a build server, or on a computer without the ASCOM Platform installed,
it may be useful to execute this script as a build step prior to running any unit tests, or calling any code that relies on
ASCOM.Utilities.Profile. The alternative is to install the ASCOM Platform on the build agent.
NOTE: This script equires elevated permissions because it creates registry keys in the LocalMachine hive.
#>
$wow = Test-Path HKLM:\SOFTWARE\Wow6432Node
if ($wow)
{
$root = "HKLM:\SOFTWARE\Wow6432Node"
}
else
{
$root = "HKLM:\SOFTWARE"
}
$ascomRoot = $root + "\ASCOM"
if (Test-Path $ascomRoot)
{
<# Don't upset an already-existing ASCOM registry #>
exit
}
<# Create the ASCOM root key and set it's ACL to allow all users read/write access #>
New-Item -Path $root -Name ASCOM Force
$ascomAcl = Get-Acl $ascomRoot
$aclRule = New-Object System.Security.AccessControl.RegistryAccessRule ("Users","FullControl","Allow")
$ascomAcl.SetAccessRule($aclRule)
$ascomAcl | Set-Acl -Path $ascomRoot
<# Now create the bare minimum keys required so that ASCOM.Utilities.Profile doesn't crash and burn #>
New-ItemProperty -Path $ascomRoot -Name PlatformVersion -Value "6.1" -PropertyType String Force
New-ItemProperty -Path $ascomRoot -Name SerTraceFile -Value "C:\SerialTraceAuto.txt" -PropertyType String Force
@@ -1,142 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\NUnit.3.12.0\build\NUnit.props" Condition="Exists('..\packages\NUnit.3.12.0\build\NUnit.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{B7EEEEFD-5BFF-443D-981C-7B8AB5DFDE33}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Meade.net.Telescope.UnitTests</RootNamespace>
<AssemblyName>Meade.net.Telescope.UnitTests</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="ASCOM.Astrometry, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Astrometry.dll</HintPath>
</Reference>
<Reference Include="ASCOM.Attributes, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Attributes.dll</HintPath>
</Reference>
<Reference Include="ASCOM.Cache, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Cache.dll</HintPath>
</Reference>
<Reference Include="ASCOM.Controls, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Controls.dll</HintPath>
</Reference>
<Reference Include="ASCOM.DeviceInterfaces, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.DeviceInterfaces.dll</HintPath>
</Reference>
<Reference Include="ASCOM.DriverAccess, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.DriverAccess.dll</HintPath>
</Reference>
<Reference Include="ASCOM.Exceptions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Exceptions.dll</HintPath>
</Reference>
<Reference Include="ASCOM.Internal.Extensions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Internal.Extensions.dll</HintPath>
</Reference>
<Reference Include="ASCOM.SettingsProvider, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.SettingsProvider.dll</HintPath>
</Reference>
<Reference Include="ASCOM.Utilities, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Utilities.dll</HintPath>
</Reference>
<Reference Include="ASCOM.Utilities.Video, Version=6.1.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Utilities.Video.dll</HintPath>
</Reference>
<Reference Include="Castle.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
<HintPath>..\packages\Castle.Core.4.4.0\lib\net45\Castle.Core.dll</HintPath>
</Reference>
<Reference Include="Moq, Version=4.12.0.0, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
<HintPath>..\packages\Moq.4.12.0\lib\net45\Moq.dll</HintPath>
</Reference>
<Reference Include="nunit.framework, Version=3.12.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
<HintPath>..\packages\NUnit.3.12.0\lib\net40\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.5.2\lib\netstandard1.0\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.3\lib\netstandard2.0\System.Threading.Tasks.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="TelescopeUnitTests.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Meade.net.Telescope\Meade.net.Telescope.csproj">
<Project>{64308775-bd4a-469c-bcab-3ed830b811af}</Project>
<Name>Meade.net.Telescope</Name>
</ProjectReference>
<ProjectReference Include="..\Meade.net\Meade.net.csproj">
<Project>{3689a2cb-94c5-4012-a5cf-7e7d1dd27143}</Project>
<Name>Meade.net</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="BootstrapAscomProfileStore.ps1" />
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\NUnit.3.12.0\build\NUnit.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\NUnit.3.12.0\build\NUnit.props'))" />
</Target>
</Project>
@@ -1,35 +0,0 @@
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Meade.net.Telescope.UnitTests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Meade.net.Telescope.UnitTests")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("b7eeeefd-5bff-443d-981c-7b8ab5dfde33")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.0.0.0")]
[assembly: AssemblyFileVersion("0.0.0.0")]
File diff suppressed because it is too large Load Diff
-15
View File
@@ -1,15 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.4.1" newVersion="4.0.4.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.0.1" newVersion="4.2.0.1" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" /></startup></configuration>
@@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="ASCOM.Platform" version="6.4.2" targetFramework="net472" />
<package id="Castle.Core" version="4.4.0" targetFramework="net45" />
<package id="Moq" version="4.12.0" targetFramework="net45" />
<package id="NUnit" version="3.12.0" targetFramework="net40" requireReinstallation="true" />
<package id="System.Runtime.CompilerServices.Unsafe" version="4.5.2" targetFramework="net45" requireReinstallation="true" />
<package id="System.Threading.Tasks.Extensions" version="4.5.3" targetFramework="net472" />
</packages>
@@ -1,17 +1,38 @@
using System; using System;
using ASCOM.Utilities; using ASCOM.Utilities;
namespace ASCOM.Meade.net.AstroMaths namespace ASCOM.Meade.net
{ {
public class AstroMaths : IAstroMaths public class EquatorialCoordinates
{
public double RightAscension { get; set; }
public double Declination { get; set; }
}
public class HorizonCoordinates
{
public double Altitude { get; set; }
public double Azimuth { get; set; }
}
public class AltitudeData
{
public DateTime UtcDateTime { get; set; }
public double SiteLatitude { get; set; }
public double SiteLongitude { get; set; }
public EquatorialCoordinates equatorialCoordinates { get; set; }
}
public class AstroMaths
{ {
//returns the decimal hour angle for given right ascension on a given datetime for a given logitude. //returns the decimal hour angle for given right ascension on a given datetime for a given logitude.
public double RightAscensionToHourAngle(DateTime utcDateTime, double longitude, double rightAscension) public double RightAscensionToHourAngle(DateTime utcDateTime, double longitude, double rightAscension)
{ {
var ut = DateTimeToDecimalHours( utcDateTime); var ut = DateTimeToDecimalHours( utcDateTime);
var gst = UTtoGst( utcDateTime); var gst = UTtoGST( utcDateTime);
var lst = GsTtoLst( gst, longitude); var lst = GSTtoLST( gst, longitude);
var raHours = rightAscension; var raHours = rightAscension;
var h1 = lst - raHours; var h1 = lst - raHours;
var h = h1; var h = h1;
@@ -24,8 +45,8 @@ namespace ASCOM.Meade.net.AstroMaths
public double HourAngleToRightAscension(DateTime utcDateTime, double longitude, double hourAngle ) public double HourAngleToRightAscension(DateTime utcDateTime, double longitude, double hourAngle )
{ {
var gst = UTtoGst(utcDateTime); var gst = UTtoGST(utcDateTime);
var lst = GsTtoLst( gst, longitude); var lst = GSTtoLST( gst, longitude);
var raHours = hourAngle; var raHours = hourAngle;
var h1 = lst - raHours; var h1 = lst - raHours;
var h = h1; var h = h1;
@@ -129,7 +150,7 @@ namespace ASCOM.Meade.net.AstroMaths
} }
//todo convert to extension method //todo convert to extension method
public double UTtoGst(DateTime utcDateTime) public double UTtoGST(DateTime utcDateTime)
{ {
Util util = new Util(); Util util = new Util();
@@ -171,7 +192,7 @@ namespace ASCOM.Meade.net.AstroMaths
return t1; return t1;
} }
public double GsTtoLst(double gst, double longitude) public double GSTtoLST(double gst, double longitude)
{ {
var l = longitude/ 15; var l = longitude/ 15;
@@ -1,12 +0,0 @@
using System;
namespace ASCOM.Meade.net.AstroMaths
{
public class AltitudeData
{
public DateTime UtcDateTime { get; set; }
public double SiteLatitude { get; set; }
public double SiteLongitude { get; set; }
public EquatorialCoordinates EquatorialCoordinates { get; set; }
}
}
@@ -1,8 +0,0 @@
namespace ASCOM.Meade.net.AstroMaths
{
public class EquatorialCoordinates
{
public double RightAscension { get; set; }
public double Declination { get; set; }
}
}
@@ -1,8 +0,0 @@
namespace ASCOM.Meade.net.AstroMaths
{
public class HorizonCoordinates
{
public double Altitude { get; set; }
public double Azimuth { get; set; }
}
}
@@ -1,17 +0,0 @@
using System;
namespace ASCOM.Meade.net.AstroMaths
{
public interface IAstroMaths
{
double RightAscensionToHourAngle(DateTime utcDateTime, double longitude, double rightAscension);
double HourAngleToRightAscension(DateTime utcDateTime, double longitude, double hourAngle );
EquatorialCoordinates ConvertHozToEq( DateTime utcDateTime, double latitude, double longitude, HorizonCoordinates altAz);
HorizonCoordinates ConvertEqToHoz(double hourAngle, double latitude, EquatorialCoordinates raDec);
double DegreesToRadians(double degrees);
double RadiansToDegrees(double radians);
double DateTimeToDecimalHours( DateTime utcDateTime);
double UTtoGst(DateTime utcDateTime);
double GsTtoLst(double gst, double longitude);
}
}
@@ -1,36 +0,0 @@
<#
This script initializes a bare minimum set of registry entries required for ASCOM.Utilities.Profile to work
without throwing any exceptions. When building on a build server, or on a computer without the ASCOM Platform installed,
it may be useful to execute this script as a build step prior to running any unit tests, or calling any code that relies on
ASCOM.Utilities.Profile. The alternative is to install the ASCOM Platform on the build agent.
NOTE: This script equires elevated permissions because it creates registry keys in the LocalMachine hive.
#>
$wow = Test-Path HKLM:\SOFTWARE\Wow6432Node
if ($wow)
{
$root = "HKLM:\SOFTWARE\Wow6432Node"
}
else
{
$root = "HKLM:\SOFTWARE"
}
$ascomRoot = $root + "\ASCOM"
if (Test-Path $ascomRoot)
{
<# Don't upset an already-existing ASCOM registry #>
exit
}
<# Create the ASCOM root key and set it's ACL to allow all users read/write access #>
New-Item -Path $root -Name ASCOM Force
$ascomAcl = Get-Acl $ascomRoot
$aclRule = New-Object System.Security.AccessControl.RegistryAccessRule ("Users","FullControl","Allow")
$ascomAcl.SetAccessRule($aclRule)
$ascomAcl | Set-Acl -Path $ascomRoot
<# Now create the bare minimum keys required so that ASCOM.Utilities.Profile doesn't crash and burn #>
New-ItemProperty -Path $ascomRoot -Name PlatformVersion -Value "6.1" -PropertyType String Force
New-ItemProperty -Path $ascomRoot -Name SerTraceFile -Value "C:\SerialTraceAuto.txt" -PropertyType String Force
-14
View File
@@ -1,14 +0,0 @@
namespace ASCOM.Meade.net
{
public static class DoubleExtensions
{
public static bool InRange(this double value, double low, double high)
{
if (value < low)
return false;
if (value > high)
return false;
return true;
}
}
}
+11 -43
View File
@@ -46,7 +46,7 @@
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<RegisterForComInterop>true</RegisterForComInterop> <RegisterForComInterop>true</RegisterForComInterop>
<PlatformTarget>AnyCPU</PlatformTarget> <PlatformTarget>x86</PlatformTarget>
<Prefer32Bit>false</Prefer32Bit> <Prefer32Bit>false</Prefer32Bit>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
@@ -65,42 +65,17 @@
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<OutputPath>..\bin\Debug\</OutputPath> <OutputPath>..\bin\Debug\</OutputPath>
<PlatformTarget>AnyCPU</PlatformTarget> <PlatformTarget>x86</PlatformTarget>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="ASCOM.Astrometry, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL"> <Reference Include="ASCOM.Astrometry, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL" />
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Astrometry.dll</HintPath> <Reference Include="ASCOM.Attributes, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL" />
</Reference> <Reference Include="ASCOM.Controls, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL" />
<Reference Include="ASCOM.Attributes, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL"> <Reference Include="ASCOM.DeviceInterfaces, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL" />
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Attributes.dll</HintPath> <Reference Include="ASCOM.Exceptions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL" />
</Reference> <Reference Include="ASCOM.SettingsProvider, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL" />
<Reference Include="ASCOM.Cache, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL"> <Reference Include="ASCOM.Utilities, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL" />
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Cache.dll</HintPath> <Reference Include="ASCOM.Utilities.Video, Version=6.1.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL" />
</Reference>
<Reference Include="ASCOM.Controls, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Controls.dll</HintPath>
</Reference>
<Reference Include="ASCOM.DeviceInterfaces, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.DeviceInterfaces.dll</HintPath>
</Reference>
<Reference Include="ASCOM.DriverAccess, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.DriverAccess.dll</HintPath>
</Reference>
<Reference Include="ASCOM.Exceptions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Exceptions.dll</HintPath>
</Reference>
<Reference Include="ASCOM.Internal.Extensions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Internal.Extensions.dll</HintPath>
</Reference>
<Reference Include="ASCOM.SettingsProvider, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.SettingsProvider.dll</HintPath>
</Reference>
<Reference Include="ASCOM.Utilities, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Utilities.dll</HintPath>
</Reference>
<Reference Include="ASCOM.Utilities.Video, Version=6.1.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Utilities.Video.dll</HintPath>
</Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.configuration" /> <Reference Include="System.configuration" />
<Reference Include="System.Configuration.Install" /> <Reference Include="System.Configuration.Install" />
@@ -113,12 +88,7 @@
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="AstroMaths\AltitudeData.cs" /> <Compile Include="AstroMaths.cs" />
<Compile Include="AstroMaths\AstroMaths.cs" />
<Compile Include="AstroMaths\EquatorialCoordinates.cs" />
<Compile Include="AstroMaths\HorizonCoordinates.cs" />
<Compile Include="AstroMaths\IAstroMaths.cs" />
<Compile Include="DoubleExtensions.cs" />
<Compile Include="StringExtensions.cs" /> <Compile Include="StringExtensions.cs" />
<Compile Include="Telescope.cs" /> <Compile Include="Telescope.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
@@ -145,8 +115,6 @@
<None Include="app.config" /> <None Include="app.config" />
<None Include="ASCOM.png" /> <None Include="ASCOM.png" />
<None Include="ASCOMDriverTemplate.snk" /> <None Include="ASCOMDriverTemplate.snk" />
<None Include="BootstrapAscomProfileStore.ps1" />
<None Include="packages.config" />
<None Include="Properties\Settings.settings"> <None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator> <Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput> <LastGenOutput>Settings.Designer.cs</LastGenOutput>
@@ -1,5 +0,0 @@
<ProjectConfiguration>
<Settings>
<UseCPUArchitecture>x86</UseCPUArchitecture>
</Settings>
</ProjectConfiguration>
@@ -1,4 +1,5 @@
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
@@ -34,5 +35,5 @@ using System.Runtime.InteropServices;
// by using the '*' as shown below: // by using the '*' as shown below:
// //
// TODO - Set your driver's version here // TODO - Set your driver's version here
[assembly: AssemblyVersion("0.0.0.0")] [assembly: AssemblyVersion("0.6.0.1")]
[assembly: AssemblyFileVersion("0.0.0.0")] [assembly: AssemblyFileVersion("0.6.0.1")]
+48 -32
View File
@@ -1,4 +1,8 @@
using System.Runtime.InteropServices; using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
using ASCOM.DeviceInterface; using ASCOM.DeviceInterface;
using System.Collections; using System.Collections;
using System.Threading; using System.Threading;
@@ -17,10 +21,10 @@ namespace ASCOM.Meade.net
[Guid("288838d1-bbf9-4ce0-9ee1-86ecf38b45c9")] [Guid("288838d1-bbf9-4ce0-9ee1-86ecf38b45c9")]
[ClassInterface(ClassInterfaceType.None)] [ClassInterface(ClassInterfaceType.None)]
[ComVisible(true)] [ComVisible(true)]
public class Rate : IRate public class Rate : ASCOM.DeviceInterface.IRate
{ {
private double _maximum = 0; private double maximum = 0;
private double _minimum = 0; private double minimum = 0;
// //
// Default constructor - Internal prevents public creation // Default constructor - Internal prevents public creation
@@ -28,8 +32,8 @@ namespace ASCOM.Meade.net
// //
internal Rate(double minimum, double maximum) internal Rate(double minimum, double maximum)
{ {
_maximum = maximum; this.maximum = maximum;
_minimum = minimum; this.minimum = minimum;
} }
#region Implementation of IRate #region Implementation of IRate
@@ -41,14 +45,14 @@ namespace ASCOM.Meade.net
public double Maximum public double Maximum
{ {
get => _maximum; get { return this.maximum; }
set => _maximum = value; set { this.maximum = value; }
} }
public double Minimum public double Minimum
{ {
get => _minimum; get { return this.minimum; }
set => _minimum = value; set { this.minimum = value; }
} }
#endregion #endregion
@@ -70,8 +74,8 @@ namespace ASCOM.Meade.net
[ComVisible(true)] [ComVisible(true)]
public class AxisRates : IAxisRates, IEnumerable public class AxisRates : IAxisRates, IEnumerable
{ {
private TelescopeAxes _axis; private TelescopeAxes axis;
private readonly Rate[] _rates; private readonly Rate[] rates;
// //
// Constructor - Internal prevents public creation // Constructor - Internal prevents public creation
@@ -79,7 +83,7 @@ namespace ASCOM.Meade.net
// //
internal AxisRates(TelescopeAxes axis) internal AxisRates(TelescopeAxes axis)
{ {
_axis = axis; this.axis = axis;
// //
// This collection must hold zero or more Rate objects describing the // This collection must hold zero or more Rate objects describing the
// rates of motion ranges for the Telescope.MoveAxis() method // rates of motion ranges for the Telescope.MoveAxis() method
@@ -96,23 +100,26 @@ 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) }; this.rates = new Rate[] { 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) }; this.rates = new Rate[] { 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
_rates = new Rate[0]; this.rates = new Rate[0];
break; break;
} }
} }
#region IAxisRates Members #region IAxisRates Members
public int Count => _rates.Length; public int Count
{
get { return this.rates.Length; }
}
public void Dispose() public void Dispose()
{ {
@@ -121,10 +128,13 @@ namespace ASCOM.Meade.net
public IEnumerator GetEnumerator() public IEnumerator GetEnumerator()
{ {
return _rates.GetEnumerator(); return rates.GetEnumerator();
} }
public IRate this[int index] => _rates[index - 1]; public IRate this[int index]
{
get { return this.rates[index - 1]; } // 1-based
}
#endregion #endregion
} }
@@ -149,11 +159,11 @@ namespace ASCOM.Meade.net
[ComVisible(true)] [ComVisible(true)]
public class TrackingRates : ITrackingRates, IEnumerable, IEnumerator public class TrackingRates : ITrackingRates, IEnumerable, IEnumerator
{ {
private readonly DriveRates[] _trackingRates; private readonly DriveRates[] trackingRates;
// this is used to make the index thread safe // this is used to make the index thread safe
private readonly ThreadLocal<int> _pos = new ThreadLocal<int>(() => { return -1; }); private readonly ThreadLocal<int> pos = new ThreadLocal<int>(() => { return -1; });
private static readonly object LockObj = new object(); private static readonly object lockObj = new object();
// //
// Default constructor - Internal prevents public creation // Default constructor - Internal prevents public creation
@@ -166,17 +176,20 @@ namespace ASCOM.Meade.net
// the tracking rates supported by your telescope. The one value // the tracking rates supported by your telescope. The one value
// (tracking rate) that MUST be supported is driveSidereal! // (tracking rate) that MUST be supported is driveSidereal!
// //
_trackingRates = new[] { DriveRates.driveSidereal, DriveRates.driveLunar }; this.trackingRates = new[] { DriveRates.driveSidereal, DriveRates.driveLunar };
// TODO Initialize this array with any additional tracking rates that your driver may provide // TODO Initialize this array with any additional tracking rates that your driver may provide
} }
#region ITrackingRates Members #region ITrackingRates Members
public int Count => _trackingRates.Length; public int Count
{
get { return this.trackingRates.Length; }
}
public IEnumerator GetEnumerator() public IEnumerator GetEnumerator()
{ {
_pos.Value = -1; pos.Value = -1;
return this as IEnumerator; return this as IEnumerator;
} }
@@ -185,7 +198,10 @@ namespace ASCOM.Meade.net
// TODO Add any required object cleanup here // TODO Add any required object cleanup here
} }
public DriveRates this[int index] => _trackingRates[index - 1]; public DriveRates this[int index]
{
get { return this.trackingRates[index - 1]; } // 1-based
}
#endregion #endregion
@@ -195,22 +211,22 @@ namespace ASCOM.Meade.net
{ {
get get
{ {
lock (LockObj) lock (lockObj)
{ {
if (_pos.Value < 0 || _pos.Value >= _trackingRates.Length) if (pos.Value < 0 || pos.Value >= trackingRates.Length)
{ {
throw new System.InvalidOperationException(); throw new System.InvalidOperationException();
} }
return _trackingRates[_pos.Value]; return trackingRates[pos.Value];
} }
} }
} }
public bool MoveNext() public bool MoveNext()
{ {
lock (LockObj) lock (lockObj)
{ {
if (++_pos.Value >= _trackingRates.Length) if (++pos.Value >= trackingRates.Length)
{ {
return false; return false;
} }
@@ -220,7 +236,7 @@ namespace ASCOM.Meade.net
public void Reset() public void Reset()
{ {
_pos.Value = -1; pos.Value = -1;
} }
#endregion #endregion
} }
-23
View File
@@ -6,28 +6,5 @@ namespace ASCOM.Meade.net
{ {
return int.Parse(str); return int.Parse(str);
} }
public static double ToDouble(this string str)
{
return double.Parse(str);
}
public static int Position(this string str, char find, int instance)
{
var currentInstance = 0;
for (var i = 0; i < str.Length; i++)
{
if (str[i] == find)
{
currentInstance++;
if (currentInstance == instance)
{
return i;
}
}
}
return -1;
}
} }
} }
File diff suppressed because it is too large Load Diff
-4
View File
@@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="ASCOM.Platform" version="6.4.2" targetFramework="net40" />
</packages>
@@ -1,36 +0,0 @@
<#
This script initializes a bare minimum set of registry entries required for ASCOM.Utilities.Profile to work
without throwing any exceptions. When building on a build server, or on a computer without the ASCOM Platform installed,
it may be useful to execute this script as a build step prior to running any unit tests, or calling any code that relies on
ASCOM.Utilities.Profile. The alternative is to install the ASCOM Platform on the build agent.
NOTE: This script equires elevated permissions because it creates registry keys in the LocalMachine hive.
#>
$wow = Test-Path HKLM:\SOFTWARE\Wow6432Node
if ($wow)
{
$root = "HKLM:\SOFTWARE\Wow6432Node"
}
else
{
$root = "HKLM:\SOFTWARE"
}
$ascomRoot = $root + "\ASCOM"
if (Test-Path $ascomRoot)
{
<# Don't upset an already-existing ASCOM registry #>
exit
}
<# Create the ASCOM root key and set it's ACL to allow all users read/write access #>
New-Item -Path $root -Name ASCOM Force
$ascomAcl = Get-Acl $ascomRoot
$aclRule = New-Object System.Security.AccessControl.RegistryAccessRule ("Users","FullControl","Allow")
$ascomAcl.SetAccessRule($aclRule)
$ascomAcl | Set-Acl -Path $ascomRoot
<# Now create the bare minimum keys required so that ASCOM.Utilities.Profile doesn't crash and burn #>
New-ItemProperty -Path $ascomRoot -Name PlatformVersion -Value "6.1" -PropertyType String Force
New-ItemProperty -Path $ascomRoot -Name SerTraceFile -Value "C:\SerialTraceAuto.txt" -PropertyType String Force
+202 -120
View File
@@ -1,13 +1,45 @@
//tabs=4
// --------------------------------------------------------------------------------
// TODO fill in this information for your driver, then remove this line!
//
// ASCOM Focuser driver for Meade.net
//
// Description: Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam
// nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam
// erat, sed diam voluptua. At vero eos et accusam et justo duo
// dolores et ea rebum. Stet clita kasd gubergren, no sea takimata
// sanctus est Lorem ipsum dolor sit amet.
//
// Implements: ASCOM Focuser interface version: <To be completed by driver developer>
// Author: (XXX) Your N. Here <your@email.here>
//
// Edit Log:
//
// Date Who Vers Description
// ----------- --- ----- -------------------------------------------------------
// dd-mmm-yyyy XXX 6.0.0 Initial edit, created from ASCOM driver template
// --------------------------------------------------------------------------------
//
// This is used to define code in the template that is specific to one class implementation
// unused code canbe deleted and this definition removed.
#define Focuser #define Focuser
using System; using System;
using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.Text;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using ASCOM;
using ASCOM.Astrometry;
using ASCOM.Astrometry.AstroUtils;
using ASCOM.Utilities; using ASCOM.Utilities;
using ASCOM.DeviceInterface; using ASCOM.DeviceInterface;
using System.Globalization;
using System.Collections; using System.Collections;
using System.Reflection; using System.Reflection;
using ASCOM.Meade.net.Wrapper;
using ASCOM.Utilities.Interfaces; using ASCOM.Utilities.Interfaces;
namespace ASCOM.Meade.net namespace ASCOM.Meade.net
@@ -28,7 +60,7 @@ namespace ASCOM.Meade.net
/// </summary> /// </summary>
[Guid("a32ac647-bf0f-42f9-8ab0-d166fa5884ad")] [Guid("a32ac647-bf0f-42f9-8ab0-d166fa5884ad")]
[ProgId("ASCOM.MeadeGeneric.focuser")] [ProgId("ASCOM.MeadeGeneric.focuser")]
[ServedClassName("Meade Generic")] [ServedClassName("Meade.net Focuser")]
[ClassInterface(ClassInterfaceType.None)] [ClassInterface(ClassInterfaceType.None)]
public class Focuser : ReferenceCountedObjectBase, IFocuserV3 public class Focuser : ReferenceCountedObjectBase, IFocuserV3
{ {
@@ -37,26 +69,39 @@ namespace ASCOM.Meade.net
/// The DeviceID is used by ASCOM applications to load the driver at runtime. /// The DeviceID is used by ASCOM applications to load the driver at runtime.
/// </summary> /// </summary>
//internal static string driverID = "ASCOM.Meade.net.Focuser"; //internal static string driverID = "ASCOM.Meade.net.Focuser";
private static readonly string DriverId = Marshal.GenerateProgIdForType(MethodBase.GetCurrentMethod().DeclaringType ?? throw new System.InvalidOperationException()); internal static string driverID = Marshal.GenerateProgIdForType(MethodBase.GetCurrentMethod().DeclaringType);
// TODO Change the descriptive string for your driver then remove this line // TODO Change the descriptive string for your driver then remove this line
/// <summary> /// <summary>
/// Driver description that displays in the ASCOM Chooser. /// Driver description that displays in the ASCOM Chooser.
/// </summary> /// </summary>
private static readonly string DriverDescription = "Meade Generic"; private static string driverDescription = "Meade Generic";
private static string _comPort; // Variables to hold the currrent device configuration internal static string comPortProfileName = "COM Port"; // Constants used for Profile persistence
internal static string comPortDefault = "COM1";
internal static string traceStateProfileName = "Trace Level";
internal static string traceStateDefault = "false";
internal static string comPort; // Variables to hold the currrent device configuration
/// <summary>
/// Private variable to hold the connected state
/// </summary>
private bool connectedState;
/// <summary> /// <summary>
/// Private variable to hold an ASCOM Utilities object /// Private variable to hold an ASCOM Utilities object
/// </summary> /// </summary>
private readonly IUtil _utilities; private Util utilities;
/// <summary>
/// Private variable to hold an ASCOM AstroUtilities object to provide the Range method
/// </summary>
private AstroUtils astroUtilities;
/// <summary> /// <summary>
/// Variable to hold the trace logger object (creates a diagnostic log file with information that you specify) /// Variable to hold the trace logger object (creates a diagnostic log file with information that you specify)
/// </summary> /// </summary>
private static TraceLogger Tl; internal static TraceLogger tl;
private readonly ISharedResourcesWrapper _sharedResourcesWrapper;
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="Meade.net"/> class. /// Initializes a new instance of the <see cref="Meade.net"/> class.
@@ -64,33 +109,16 @@ namespace ASCOM.Meade.net
/// </summary> /// </summary>
public Focuser() public Focuser()
{ {
//todo move this out to IOC tl = new TraceLogger("", "Meade.net.focusser");
var util = new Util(); //Initialise util object
_utilities = util;
_sharedResourcesWrapper = new SharedResourcesWrapper();
Initialise();
}
public Focuser(IUtil util, ISharedResourcesWrapper sharedResourcesWrapper)
{
_utilities = util;
_sharedResourcesWrapper = sharedResourcesWrapper;
Initialise();
}
private void Initialise()
{
//todo move the TraceLogger out to a factory class.
Tl = new TraceLogger("", "Meade.Generic.focusser");
ReadProfile(); // Read device configuration from the ASCOM Profile store ReadProfile(); // Read device configuration from the ASCOM Profile store
IsConnected = false; // Initialise connected to false tl.LogMessage("Focuser", "Starting initialisation");
LogMessage("Focuser", "Completed initialisation"); connectedState = false; // Initialise connected to false
LogMessage("Focuser", $"Driver version: {DriverVersion}"); utilities = new Util(); //Initialise util object
astroUtilities = new AstroUtils(); // Initialise astro utilities object
tl.LogMessage("Focuser", "Completed initialisation");
} }
@@ -108,17 +136,17 @@ namespace ASCOM.Meade.net
/// </summary> /// </summary>
public void SetupDialog() public void SetupDialog()
{ {
Tl.LogMessage("SetupDialog", "Opening setup dialog"); tl.LogMessage("SetupDialog", "Opening setup dialog");
_sharedResourcesWrapper.SetupDialog(); SharedResources.SetupDialog();
ReadProfile(); ReadProfile();
Tl.LogMessage("SetupDialog", "complete"); tl.LogMessage("SetupDialog", "complete");
} }
public ArrayList SupportedActions public ArrayList SupportedActions
{ {
get get
{ {
Tl.LogMessage("SupportedActions Get", "Returning empty arraylist"); tl.LogMessage("SupportedActions Get", "Returning empty arraylist");
return new ArrayList(); return new ArrayList();
} }
} }
@@ -126,7 +154,7 @@ namespace ASCOM.Meade.net
public string Action(string actionName, string actionParameters) public string Action(string actionName, string actionParameters)
{ {
LogMessage("", "Action {0}, parameters {1} not implemented", actionName, actionParameters); LogMessage("", "Action {0}, parameters {1} not implemented", actionName, actionParameters);
throw new ActionNotImplementedException(); throw new ASCOM.ActionNotImplementedException("Action " + actionName + " is not implemented by this driver");
} }
public void CommandBlind(string command, bool raw) public void CommandBlind(string command, bool raw)
@@ -134,7 +162,7 @@ namespace ASCOM.Meade.net
CheckConnected("CommandBlind"); CheckConnected("CommandBlind");
// Call CommandString and return as soon as it finishes // Call CommandString and return as soon as it finishes
//this.CommandString(command, raw); //this.CommandString(command, raw);
_sharedResourcesWrapper.SendBlind(command); SharedResources.SendBlind(command);
// or // or
//throw new ASCOM.MethodNotImplementedException("CommandBlind"); //throw new ASCOM.MethodNotImplementedException("CommandBlind");
// DO NOT have both these sections! One or the other // DO NOT have both these sections! One or the other
@@ -146,7 +174,7 @@ namespace ASCOM.Meade.net
//string ret = CommandString(command, raw); //string ret = CommandString(command, raw);
// TODO decode the return string and return true or false // TODO decode the return string and return true or false
// or // or
throw new MethodNotImplementedException("CommandBool"); throw new ASCOM.MethodNotImplementedException("CommandBool");
// DO NOT have both these sections! One or the other // DO NOT have both these sections! One or the other
} }
@@ -156,16 +184,21 @@ namespace ASCOM.Meade.net
// it's a good idea to put all the low level communication with the device here, // it's a good idea to put all the low level communication with the device here,
// then all communication calls this function // then all communication calls this function
// you need something to ensure that only one command is in progress at a time // you need something to ensure that only one command is in progress at a time
return _sharedResourcesWrapper.SendString(command); return SharedResources.SendString(command);
//throw new ASCOM.MethodNotImplementedException("CommandString");
throw new ASCOM.MethodNotImplementedException("CommandString");
} }
public void Dispose() public void Dispose()
{ {
// Clean up the tracelogger and util objects // Clean up the tracelogger and util objects
Tl.Enabled = false; tl.Enabled = false;
Tl.Dispose(); tl.Dispose();
Tl = null; tl = null;
utilities.Dispose();
utilities = null;
astroUtilities.Dispose();
astroUtilities = null;
} }
public bool Connected public bool Connected
@@ -177,7 +210,7 @@ namespace ASCOM.Meade.net
} }
set set
{ {
Tl.LogMessage("Connected", "Set {0}", value); tl.LogMessage("Connected", "Set {0}", value);
if (value == IsConnected) if (value == IsConnected)
return; return;
@@ -185,39 +218,72 @@ namespace ASCOM.Meade.net
{ {
try try
{ {
ReadProfile(); SharedResources.Connect("Serial");
_sharedResourcesWrapper.Connect("Serial", DriverId);
try try
{ {
IsConnected = true; SelectSite(1);
SetLongFormat(true);
connectedState = true;
} }
catch (Exception) catch (Exception)
{ {
_sharedResourcesWrapper.Disconnect("Serial", DriverId); SharedResources.Disconnect("Serial");
throw; throw;
} }
} }
catch (Exception ex) catch (Exception ex)
{ {
LogMessage("Connected Set", "Error connecting to port {0} - {1}", _comPort, ex.Message); LogMessage("Connected Set", "Error connecting to port {0} - {1}", comPort, ex.Message);
} }
} }
else else
{ {
LogMessage("Connected Set", "Disconnecting from port {0}", _comPort); LogMessage("Connected Set", "Disconnecting from port {0}", comPort);
_sharedResourcesWrapper.Disconnect("Serial", DriverId); SharedResources.Disconnect("Serial");
IsConnected = false; connectedState = false;
} }
} }
} }
private void SetLongFormat(bool setLongFormat)
{
SharedResources.Lock(() =>
{
var result = SharedResources.SendString(":GZ#");
//:GZ# Get telescope azimuth
//Returns: DDD*MM#T or DDD*MMSS#
//The current telescope Azimuth depending on the selected precision.
bool isLongFormat = result.Length > 6;
if (isLongFormat != setLongFormat)
{
utilities.WaitForMilliseconds(500);
SharedResources.SendBlind(":U#");
//:U# Toggle between low/hi precision positions
//Low - RA displays and messages HH:MM.T sDD*MM
//High - Dec / Az / El displays and messages HH:MM: SS sDD*MM:SS
// Returns Nothing
}
});
}
private void SelectSite(int site)
{
SharedResources.SendBlind($":W{site}#");
//:W<n>#
//Set current site to<n>, an ASCII digit in the range 1..4
//Returns: Nothing
}
public string Description public string Description
{ {
// TODO customise this device description // TODO customise this device description
get get
{ {
Tl.LogMessage("Description Get", DriverDescription); tl.LogMessage("Description Get", driverDescription);
return DriverDescription; return driverDescription;
} }
} }
@@ -225,9 +291,10 @@ namespace ASCOM.Meade.net
{ {
get get
{ {
Version version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
// TODO customise this driver description // TODO customise this driver description
string driverInfo = $"{Description} .net driver. Version: {DriverVersion}"; string driverInfo = "Information about the driver itself. Version: " + String.Format(CultureInfo.InvariantCulture, "{0}.{1}", version.Major, version.Minor);
LogMessage("DriverInfo Get", driverInfo); tl.LogMessage("DriverInfo Get", driverInfo);
return driverInfo; return driverInfo;
} }
} }
@@ -236,9 +303,9 @@ namespace ASCOM.Meade.net
{ {
get get
{ {
Version version = Assembly.GetExecutingAssembly().GetName().Version; Version version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
string driverVersion = $"{version.Major}.{version.Minor}.{version.Build}.{version.Revision}"; string driverVersion = String.Format(CultureInfo.InvariantCulture, "{0}.{1}", version.Major, version.Minor);
LogMessage("DriverVersion Get", driverVersion); tl.LogMessage("DriverVersion Get", driverVersion);
return driverVersion; return driverVersion;
} }
} }
@@ -258,8 +325,8 @@ namespace ASCOM.Meade.net
get get
{ {
//string name = "Short driver name - please customise"; //string name = "Short driver name - please customise";
string name = DriverDescription; string name = driverDescription;
Tl.LogMessage("Name Get", name); tl.LogMessage("Name Get", name);
return name; return name;
} }
} }
@@ -272,29 +339,26 @@ namespace ASCOM.Meade.net
{ {
get get
{ {
CheckConnected("Absolute Get"); tl.LogMessage("Absolute Get", false.ToString());
Tl.LogMessage("Absolute Get", false.ToString());
return false; // This is a relative focuser return false; // This is a relative focuser
} }
} }
public void Halt() public void Halt()
{ {
Tl.LogMessage("Halt", "Halting"); tl.LogMessage("Halt", "Halting");
CheckConnected("Halt"); CheckConnected("Halt");
//A single halt command is sometimes missed by the #909 apm, so let's do it a few times to be safe. //A single halt command is sometimes missed by the #909 apm, so let's do it a few times to be safe.
//todo make this mockable
Stopwatch stopwatch = Stopwatch.StartNew(); Stopwatch stopwatch = Stopwatch.StartNew();
while (stopwatch.ElapsedMilliseconds < 1000) while (stopwatch.ElapsedMilliseconds < 1000)
{ {
_sharedResourcesWrapper.SendBlind(":FQ#"); SharedResources.SendBlind(":FQ#");
//:FQ# Halt Focuser Motion //:FQ# Halt Focuser Motion
//Returns: Nothing //Returns: Nothing
_utilities.WaitForMilliseconds(250); utilities.WaitForMilliseconds(250);
} }
} }
@@ -302,7 +366,7 @@ namespace ASCOM.Meade.net
{ {
get get
{ {
Tl.LogMessage("IsMoving Get", false.ToString()); tl.LogMessage("IsMoving Get", false.ToString());
return false; // This focuser always moves instantaneously so no need for IsMoving ever to be True return false; // This focuser always moves instantaneously so no need for IsMoving ever to be True
} }
} }
@@ -311,13 +375,13 @@ namespace ASCOM.Meade.net
{ {
get get
{ {
Tl.LogMessage("Link Get", Connected.ToString()); tl.LogMessage("Link Get", this.Connected.ToString());
return Connected; // Direct function to the connected method, the Link method is just here for backwards compatibility return this.Connected; // Direct function to the connected method, the Link method is just here for backwards compatibility
} }
set set
{ {
Tl.LogMessage("Link Set", value.ToString()); tl.LogMessage("Link Set", value.ToString());
Connected = value; // Direct function to the connected method, the Link method is just here for backwards compatibility this.Connected = value; // Direct function to the connected method, the Link method is just here for backwards compatibility
} }
} }
@@ -326,7 +390,7 @@ namespace ASCOM.Meade.net
{ {
get get
{ {
Tl.LogMessage("MaxIncrement Get", _maxIncrement.ToString()); tl.LogMessage("MaxIncrement Get", _maxIncrement.ToString());
return _maxIncrement; // Maximum change in one move return _maxIncrement; // Maximum change in one move
} }
} }
@@ -336,36 +400,45 @@ namespace ASCOM.Meade.net
{ {
get get
{ {
Tl.LogMessage("MaxStep Get", _maxStep.ToString()); tl.LogMessage("MaxStep Get", _maxStep.ToString());
return _maxStep; return _maxStep;
} }
} }
public void Move(int position) public void Move(int Position)
{ {
Tl.LogMessage("Move", position.ToString()); tl.LogMessage("Move", Position.ToString());
CheckConnected("Move"); CheckConnected("Move");
//todo implement backlash compensation //todo implement backlash compensation
//todo implement direction reverse //todo implement direction reverse
//todo implement dynamic braking //todo implement dynamic braking
if (position < -MaxIncrement || position > MaxIncrement) if (Position < -MaxIncrement || Position > MaxIncrement)
{ {
throw new InvalidValueException($"position out of range {-MaxIncrement} < {position} < {MaxIncrement}"); throw new ASCOM.InvalidValueException($"position out of range {-MaxIncrement} < {Position} < {MaxIncrement}");
} }
if (position == 0) if (Position == 0)
return; return;
MoveFocuser(position > 0, Math.Abs(position)); if (Position > 0)
{
//desired move direction is out
MoveFocuser(true, Math.Abs(Position));
}
else
{
//desired move direction is in
MoveFocuser(false, Math.Abs(Position));
}
} }
private void MoveFocuser(bool directionOut, int steps) private void MoveFocuser(bool directionOut, int steps)
{ {
_sharedResourcesWrapper.Lock(() => SharedResources.Lock(() =>
{ {
//_sharedResourcesWrapper.SendBlind(":FF#"); //SharedResources.SendBlind(":FF#");
//:FF# Set Focus speed to fastest setting //:FF# Set Focus speed to fastest setting
//Returns: Nothing //Returns: Nothing
@@ -375,38 +448,44 @@ namespace ASCOM.Meade.net
//:F<n># Autostar, Autostar II set focuser speed to <n> where <n> is an ASCII digit 1..4 //:F<n># Autostar, Autostar II set focuser speed to <n> where <n> is an ASCII digit 1..4
//Returns: Nothing //Returns: Nothing
//All others Not Supported //All others Not Supported
_utilities.WaitForMilliseconds(100); utilities.WaitForMilliseconds(100);
//A Single focus command sometimes gets lost on the #909, so sending lots of them solves the issue. //A Single focus command sometimes gets lost on the #909, so sending lots of them solves the issue.
//todo make this mockable
Stopwatch stopwatch = Stopwatch.StartNew(); Stopwatch stopwatch = Stopwatch.StartNew();
while (stopwatch.ElapsedMilliseconds < steps) while (stopwatch.ElapsedMilliseconds < steps)
{ {
_sharedResourcesWrapper.SendBlind(directionOut ? ":F+#" : ":F-#"); SharedResources.SendBlind(directionOut ? ":F+#" : ":F-#");
//:F+# Start Focuser moving inward (toward objective) //:F+# Start Focuser moving inward (toward objective)
//Returns: None //Returns: None
//:F-# Start Focuser moving outward (away from objective) //:F-# Start Focuser moving outward (away from objective)
//Returns: None //Returns: None
_utilities.WaitForMilliseconds(250); utilities.WaitForMilliseconds(250);
} }
Halt(); Halt();
//This gives the focuser time to physically stop. //This gives the focuser time to physically stop.
_utilities.WaitForMilliseconds(1000); utilities.WaitForMilliseconds(1000);
}); });
} }
public int Position => throw new PropertyNotImplementedException("Position", false); public int Position
{
get
{
throw new ASCOM.PropertyNotImplementedException("Position", false);
//return focuserPosition; // Return the focuser position
}
}
public double StepSize public double StepSize
{ {
get get
{ {
Tl.LogMessage("StepSize Get", "Not implemented"); tl.LogMessage("StepSize Get", "Not implemented");
throw new PropertyNotImplementedException("StepSize", false); throw new ASCOM.PropertyNotImplementedException("StepSize", false);
} }
} }
@@ -414,14 +493,13 @@ namespace ASCOM.Meade.net
{ {
get get
{ {
Tl.LogMessage("TempComp Get", false.ToString()); tl.LogMessage("TempComp Get", false.ToString());
return false; return false;
} }
// ReSharper disable once ValueParameterNotUsed
set set
{ {
Tl.LogMessage("TempComp Set", "Not implemented"); tl.LogMessage("TempComp Set", "Not implemented");
throw new PropertyNotImplementedException("TempComp", false); throw new ASCOM.PropertyNotImplementedException("TempComp", false);
} }
} }
@@ -429,7 +507,7 @@ namespace ASCOM.Meade.net
{ {
get get
{ {
Tl.LogMessage("TempCompAvailable Get", false.ToString()); tl.LogMessage("TempCompAvailable Get", false.ToString());
return false; // Temperature compensation is not available in this driver return false; // Temperature compensation is not available in this driver
} }
} }
@@ -438,8 +516,8 @@ namespace ASCOM.Meade.net
{ {
get get
{ {
Tl.LogMessage("Temperature Get", "Not implemented"); tl.LogMessage("Temperature Get", "Not implemented");
throw new PropertyNotImplementedException("Temperature", false); throw new ASCOM.PropertyNotImplementedException("Temperature", false);
} }
} }
@@ -459,18 +537,18 @@ namespace ASCOM.Meade.net
/// This is harmless if the driver is already registered/unregistered. /// This is harmless if the driver is already registered/unregistered.
/// </summary> /// </summary>
/// <param name="bRegister">If <c>true</c>, registers the driver, otherwise unregisters it.</param> /// <param name="bRegister">If <c>true</c>, registers the driver, otherwise unregisters it.</param>
private static void RegUnregAscom(bool bRegister) private static void RegUnregASCOM(bool bRegister)
{ {
using (var p = new Profile()) using (var P = new ASCOM.Utilities.Profile())
{ {
p.DeviceType = "Focuser"; P.DeviceType = "Focuser";
if (bRegister) if (bRegister)
{ {
p.Register(DriverId, DriverDescription); P.Register(driverID, driverDescription);
} }
else else
{ {
p.Unregister(DriverId); P.Unregister(driverID);
} }
} }
} }
@@ -493,9 +571,9 @@ namespace ASCOM.Meade.net
/// This technique should mean that it is never necessary to manually register a driver with ASCOM. /// This technique should mean that it is never necessary to manually register a driver with ASCOM.
/// </remarks> /// </remarks>
[ComRegisterFunction] [ComRegisterFunction]
public static void RegisterAscom(Type t) public static void RegisterASCOM(Type t)
{ {
RegUnregAscom(true); RegUnregASCOM(true);
} }
/// <summary> /// <summary>
@@ -516,9 +594,9 @@ namespace ASCOM.Meade.net
/// This technique should mean that it is never necessary to manually unregister a driver from ASCOM. /// This technique should mean that it is never necessary to manually unregister a driver from ASCOM.
/// </remarks> /// </remarks>
[ComUnregisterFunction] [ComUnregisterFunction]
public static void UnregisterAscom(Type t) public static void UnregisterASCOM(Type t)
{ {
RegUnregAscom(false); RegUnregASCOM(false);
} }
#endregion #endregion
@@ -526,7 +604,14 @@ namespace ASCOM.Meade.net
/// <summary> /// <summary>
/// Returns true if there is a valid connection to the driver hardware /// Returns true if there is a valid connection to the driver hardware
/// </summary> /// </summary>
private bool IsConnected { get; set; } private bool IsConnected
{
get
{
// TODO check that the driver hardware connection exists and is connected to the hardware
return connectedState;
}
}
/// <summary> /// <summary>
/// Use this function to throw an exception if we aren't connected to the hardware /// Use this function to throw an exception if we aren't connected to the hardware
@@ -536,21 +621,18 @@ namespace ASCOM.Meade.net
{ {
if (!IsConnected) if (!IsConnected)
{ {
throw new NotConnectedException($"Not connected to focuser when trying to execute: {message}"); throw new ASCOM.NotConnectedException(message);
} }
} }
/// <summary> /// <summary>
/// Read the device configuration from the ASCOM Profile store /// Read the device configuration from the ASCOM Profile store
/// </summary> /// </summary>
private void ReadProfile() internal void ReadProfile()
{ {
var profileProperties = _sharedResourcesWrapper.ReadProfile(); var profileProperties = SharedResources.ReadProfile();
Tl.Enabled = profileProperties.TraceLogger; tl.Enabled = profileProperties.TraceLogger;
_comPort = profileProperties.ComPort; comPort = profileProperties.ComPort;
LogMessage("ReadProfile", $"Trace logger enabled: {Tl.Enabled}");
LogMessage("ReadProfile", $"Com Port: {_comPort}");
} }
/// <summary> /// <summary>
@@ -559,10 +641,10 @@ namespace ASCOM.Meade.net
/// <param name="identifier"></param> /// <param name="identifier"></param>
/// <param name="message"></param> /// <param name="message"></param>
/// <param name="args"></param> /// <param name="args"></param>
private static void LogMessage(string identifier, string message, params object[] args) internal static void LogMessage(string identifier, string message, params object[] args)
{ {
var msg = string.Format(message, args); var msg = string.Format(message, args);
Tl.LogMessage(identifier, msg); tl.LogMessage(identifier, msg);
} }
#endregion #endregion
} }
+9 -36
View File
@@ -66,7 +66,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants> <DefineConstants>DEBUG;TRACE</DefineConstants>
<RegisterForComInterop>true</RegisterForComInterop> <RegisterForComInterop>true</RegisterForComInterop>
<DebugType>full</DebugType> <DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget> <PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup> </PropertyGroup>
@@ -80,39 +80,14 @@
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="ASCOM.Astrometry, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL"> <Reference Include="ASCOM.Astrometry, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL" />
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Astrometry.dll</HintPath> <Reference Include="ASCOM.Attributes, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL" />
</Reference> <Reference Include="ASCOM.Controls, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL" />
<Reference Include="ASCOM.Attributes, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL"> <Reference Include="ASCOM.DeviceInterfaces, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL" />
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Attributes.dll</HintPath> <Reference Include="ASCOM.Exceptions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL" />
</Reference> <Reference Include="ASCOM.SettingsProvider, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL" />
<Reference Include="ASCOM.Cache, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL"> <Reference Include="ASCOM.Utilities, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL" />
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Cache.dll</HintPath> <Reference Include="ASCOM.Utilities.Video, Version=6.1.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL" />
</Reference>
<Reference Include="ASCOM.Controls, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Controls.dll</HintPath>
</Reference>
<Reference Include="ASCOM.DeviceInterfaces, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.DeviceInterfaces.dll</HintPath>
</Reference>
<Reference Include="ASCOM.DriverAccess, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.DriverAccess.dll</HintPath>
</Reference>
<Reference Include="ASCOM.Exceptions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Exceptions.dll</HintPath>
</Reference>
<Reference Include="ASCOM.Internal.Extensions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Internal.Extensions.dll</HintPath>
</Reference>
<Reference Include="ASCOM.SettingsProvider, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.SettingsProvider.dll</HintPath>
</Reference>
<Reference Include="ASCOM.Utilities, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Utilities.dll</HintPath>
</Reference>
<Reference Include="ASCOM.Utilities.Video, Version=6.1.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Utilities.Video.dll</HintPath>
</Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.configuration" /> <Reference Include="System.configuration" />
<Reference Include="System.Configuration.Install" /> <Reference Include="System.Configuration.Install" />
@@ -149,8 +124,6 @@
<None Include="app.config" /> <None Include="app.config" />
<None Include="ASCOM.png" /> <None Include="ASCOM.png" />
<None Include="ASCOMDriverTemplate.snk" /> <None Include="ASCOMDriverTemplate.snk" />
<None Include="BootstrapAscomProfileStore.ps1" />
<None Include="packages.config" />
<None Include="Properties\Settings.settings"> <None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator> <Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput> <LastGenOutput>Settings.Designer.cs</LastGenOutput>
@@ -1,5 +0,0 @@
<ProjectConfiguration>
<Settings>
<UseCPUArchitecture>x86</UseCPUArchitecture>
</Settings>
</ProjectConfiguration>
+3 -2
View File
@@ -1,4 +1,5 @@
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
@@ -34,5 +35,5 @@ using System.Runtime.InteropServices;
// by using the '*' as shown below: // by using the '*' as shown below:
// //
// TODO - Set your driver's version here // TODO - Set your driver's version here
[assembly: AssemblyVersion("0.0.0.0")] [assembly: AssemblyVersion("0.6.0.1")]
[assembly: AssemblyFileVersion("0.0.0.0")] [assembly: AssemblyFileVersion("0.6.0.1")]
-4
View File
@@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="ASCOM.Platform" version="6.4.2" targetFramework="net40" />
</packages>
+6 -39
View File
@@ -21,10 +21,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AstroMath.UnitTests", "Astr
EndProject EndProject
Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "Meade.net.Setup", "Meade.net.Setup\Meade.net.Setup.wixproj", "{8EEB5C25-8394-4257-8E57-CDED47CB6F1B}" Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "Meade.net.Setup", "Meade.net.Setup\Meade.net.Setup.wixproj", "{8EEB5C25-8394-4257-8E57-CDED47CB6F1B}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Meade.net.Telescope.UnitTests", "Meade.net.Telescope.UnitTests\Meade.net.Telescope.UnitTests.csproj", "{B7EEEEFD-5BFF-443D-981C-7B8AB5DFDE33}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Meade.net.Focuser.UnitTests", "Meade.net.Focuser.UnitTests\Meade.net.Focuser.UnitTests.csproj", "{A3991FA7-23C3-405A-96F9-5AB03AC58F30}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@@ -71,23 +67,21 @@ Global
{A97E3AEC-F11D-49DA-B259-DE99DA813A86}.Release|x64.Build.0 = Release|Any CPU {A97E3AEC-F11D-49DA-B259-DE99DA813A86}.Release|x64.Build.0 = Release|Any CPU
{A97E3AEC-F11D-49DA-B259-DE99DA813A86}.Release|x86.ActiveCfg = Release|x86 {A97E3AEC-F11D-49DA-B259-DE99DA813A86}.Release|x86.ActiveCfg = Release|x86
{A97E3AEC-F11D-49DA-B259-DE99DA813A86}.Release|x86.Build.0 = Release|x86 {A97E3AEC-F11D-49DA-B259-DE99DA813A86}.Release|x86.Build.0 = Release|x86
{D5207217-61C7-4E94-8097-91DBACE57D2A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {D5207217-61C7-4E94-8097-91DBACE57D2A}.Debug|Any CPU.ActiveCfg = Debug|x86
{D5207217-61C7-4E94-8097-91DBACE57D2A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D5207217-61C7-4E94-8097-91DBACE57D2A}.Debug|x64.ActiveCfg = Debug|x86 {D5207217-61C7-4E94-8097-91DBACE57D2A}.Debug|x64.ActiveCfg = Debug|x86
{D5207217-61C7-4E94-8097-91DBACE57D2A}.Debug|x64.Build.0 = Debug|x86 {D5207217-61C7-4E94-8097-91DBACE57D2A}.Debug|x64.Build.0 = Debug|x86
{D5207217-61C7-4E94-8097-91DBACE57D2A}.Debug|x86.ActiveCfg = Debug|x86 {D5207217-61C7-4E94-8097-91DBACE57D2A}.Debug|x86.ActiveCfg = Debug|x86
{D5207217-61C7-4E94-8097-91DBACE57D2A}.Debug|x86.Build.0 = Debug|x86 {D5207217-61C7-4E94-8097-91DBACE57D2A}.Debug|x86.Build.0 = Debug|x86
{D5207217-61C7-4E94-8097-91DBACE57D2A}.Release|Any CPU.ActiveCfg = Release|Any CPU {D5207217-61C7-4E94-8097-91DBACE57D2A}.Release|Any CPU.ActiveCfg = Release|x86
{D5207217-61C7-4E94-8097-91DBACE57D2A}.Release|x64.ActiveCfg = Release|x86 {D5207217-61C7-4E94-8097-91DBACE57D2A}.Release|x64.ActiveCfg = Release|x86
{D5207217-61C7-4E94-8097-91DBACE57D2A}.Release|x86.ActiveCfg = Release|x86 {D5207217-61C7-4E94-8097-91DBACE57D2A}.Release|x86.ActiveCfg = Release|x86
{D5207217-61C7-4E94-8097-91DBACE57D2A}.Release|x86.Build.0 = Release|x86 {D5207217-61C7-4E94-8097-91DBACE57D2A}.Release|x86.Build.0 = Release|x86
{AABC96B8-C462-4B3A-9B5F-2929E3CB7A49}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {AABC96B8-C462-4B3A-9B5F-2929E3CB7A49}.Debug|Any CPU.ActiveCfg = Debug|x86
{AABC96B8-C462-4B3A-9B5F-2929E3CB7A49}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AABC96B8-C462-4B3A-9B5F-2929E3CB7A49}.Debug|x64.ActiveCfg = Debug|x86 {AABC96B8-C462-4B3A-9B5F-2929E3CB7A49}.Debug|x64.ActiveCfg = Debug|x86
{AABC96B8-C462-4B3A-9B5F-2929E3CB7A49}.Debug|x64.Build.0 = Debug|x86 {AABC96B8-C462-4B3A-9B5F-2929E3CB7A49}.Debug|x64.Build.0 = Debug|x86
{AABC96B8-C462-4B3A-9B5F-2929E3CB7A49}.Debug|x86.ActiveCfg = Debug|x86 {AABC96B8-C462-4B3A-9B5F-2929E3CB7A49}.Debug|x86.ActiveCfg = Debug|x86
{AABC96B8-C462-4B3A-9B5F-2929E3CB7A49}.Debug|x86.Build.0 = Debug|x86 {AABC96B8-C462-4B3A-9B5F-2929E3CB7A49}.Debug|x86.Build.0 = Debug|x86
{AABC96B8-C462-4B3A-9B5F-2929E3CB7A49}.Release|Any CPU.ActiveCfg = Release|Any CPU {AABC96B8-C462-4B3A-9B5F-2929E3CB7A49}.Release|Any CPU.ActiveCfg = Release|x86
{AABC96B8-C462-4B3A-9B5F-2929E3CB7A49}.Release|x64.ActiveCfg = Release|x86 {AABC96B8-C462-4B3A-9B5F-2929E3CB7A49}.Release|x64.ActiveCfg = Release|x86
{AABC96B8-C462-4B3A-9B5F-2929E3CB7A49}.Release|x86.ActiveCfg = Release|x86 {AABC96B8-C462-4B3A-9B5F-2929E3CB7A49}.Release|x86.ActiveCfg = Release|x86
{AABC96B8-C462-4B3A-9B5F-2929E3CB7A49}.Release|x86.Build.0 = Release|x86 {AABC96B8-C462-4B3A-9B5F-2929E3CB7A49}.Release|x86.Build.0 = Release|x86
@@ -103,40 +97,15 @@ Global
{AD4959DD-33D7-4C3F-8DB0-7361D8E74A95}.Release|x64.Build.0 = Release|Any CPU {AD4959DD-33D7-4C3F-8DB0-7361D8E74A95}.Release|x64.Build.0 = Release|Any CPU
{AD4959DD-33D7-4C3F-8DB0-7361D8E74A95}.Release|x86.ActiveCfg = Release|x86 {AD4959DD-33D7-4C3F-8DB0-7361D8E74A95}.Release|x86.ActiveCfg = Release|x86
{AD4959DD-33D7-4C3F-8DB0-7361D8E74A95}.Release|x86.Build.0 = Release|x86 {AD4959DD-33D7-4C3F-8DB0-7361D8E74A95}.Release|x86.Build.0 = Release|x86
{8EEB5C25-8394-4257-8E57-CDED47CB6F1B}.Debug|Any CPU.ActiveCfg = Debug|x86 {8EEB5C25-8394-4257-8E57-CDED47CB6F1B}.Debug|Any CPU.ActiveCfg = Debug|x64
{8EEB5C25-8394-4257-8E57-CDED47CB6F1B}.Debug|Any CPU.Build.0 = Debug|x86 {8EEB5C25-8394-4257-8E57-CDED47CB6F1B}.Debug|Any CPU.Build.0 = Debug|x64
{8EEB5C25-8394-4257-8E57-CDED47CB6F1B}.Debug|x64.ActiveCfg = Debug|x64 {8EEB5C25-8394-4257-8E57-CDED47CB6F1B}.Debug|x64.ActiveCfg = Debug|x64
{8EEB5C25-8394-4257-8E57-CDED47CB6F1B}.Debug|x86.ActiveCfg = Debug|x86 {8EEB5C25-8394-4257-8E57-CDED47CB6F1B}.Debug|x86.ActiveCfg = Debug|x86
{8EEB5C25-8394-4257-8E57-CDED47CB6F1B}.Debug|x86.Build.0 = Debug|x86 {8EEB5C25-8394-4257-8E57-CDED47CB6F1B}.Debug|x86.Build.0 = Debug|x86
{8EEB5C25-8394-4257-8E57-CDED47CB6F1B}.Release|Any CPU.ActiveCfg = Release|x86 {8EEB5C25-8394-4257-8E57-CDED47CB6F1B}.Release|Any CPU.ActiveCfg = Release|x86
{8EEB5C25-8394-4257-8E57-CDED47CB6F1B}.Release|Any CPU.Build.0 = Release|x86
{8EEB5C25-8394-4257-8E57-CDED47CB6F1B}.Release|x64.ActiveCfg = Release|x86 {8EEB5C25-8394-4257-8E57-CDED47CB6F1B}.Release|x64.ActiveCfg = Release|x86
{8EEB5C25-8394-4257-8E57-CDED47CB6F1B}.Release|x86.ActiveCfg = Release|x86 {8EEB5C25-8394-4257-8E57-CDED47CB6F1B}.Release|x86.ActiveCfg = Release|x86
{8EEB5C25-8394-4257-8E57-CDED47CB6F1B}.Release|x86.Build.0 = Release|x86 {8EEB5C25-8394-4257-8E57-CDED47CB6F1B}.Release|x86.Build.0 = Release|x86
{B7EEEEFD-5BFF-443D-981C-7B8AB5DFDE33}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B7EEEEFD-5BFF-443D-981C-7B8AB5DFDE33}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B7EEEEFD-5BFF-443D-981C-7B8AB5DFDE33}.Debug|x64.ActiveCfg = Debug|Any CPU
{B7EEEEFD-5BFF-443D-981C-7B8AB5DFDE33}.Debug|x64.Build.0 = Debug|Any CPU
{B7EEEEFD-5BFF-443D-981C-7B8AB5DFDE33}.Debug|x86.ActiveCfg = Debug|Any CPU
{B7EEEEFD-5BFF-443D-981C-7B8AB5DFDE33}.Debug|x86.Build.0 = Debug|Any CPU
{B7EEEEFD-5BFF-443D-981C-7B8AB5DFDE33}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B7EEEEFD-5BFF-443D-981C-7B8AB5DFDE33}.Release|Any CPU.Build.0 = Release|Any CPU
{B7EEEEFD-5BFF-443D-981C-7B8AB5DFDE33}.Release|x64.ActiveCfg = Release|Any CPU
{B7EEEEFD-5BFF-443D-981C-7B8AB5DFDE33}.Release|x64.Build.0 = Release|Any CPU
{B7EEEEFD-5BFF-443D-981C-7B8AB5DFDE33}.Release|x86.ActiveCfg = Release|x86
{B7EEEEFD-5BFF-443D-981C-7B8AB5DFDE33}.Release|x86.Build.0 = Release|x86
{A3991FA7-23C3-405A-96F9-5AB03AC58F30}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A3991FA7-23C3-405A-96F9-5AB03AC58F30}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A3991FA7-23C3-405A-96F9-5AB03AC58F30}.Debug|x64.ActiveCfg = Debug|Any CPU
{A3991FA7-23C3-405A-96F9-5AB03AC58F30}.Debug|x64.Build.0 = Debug|Any CPU
{A3991FA7-23C3-405A-96F9-5AB03AC58F30}.Debug|x86.ActiveCfg = Debug|Any CPU
{A3991FA7-23C3-405A-96F9-5AB03AC58F30}.Debug|x86.Build.0 = Debug|Any CPU
{A3991FA7-23C3-405A-96F9-5AB03AC58F30}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A3991FA7-23C3-405A-96F9-5AB03AC58F30}.Release|Any CPU.Build.0 = Release|Any CPU
{A3991FA7-23C3-405A-96F9-5AB03AC58F30}.Release|x64.ActiveCfg = Release|Any CPU
{A3991FA7-23C3-405A-96F9-5AB03AC58F30}.Release|x64.Build.0 = Release|Any CPU
{A3991FA7-23C3-405A-96F9-5AB03AC58F30}.Release|x86.ActiveCfg = Release|Any CPU
{A3991FA7-23C3-405A-96F9-5AB03AC58F30}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
@@ -145,8 +114,6 @@ Global
{D5207217-61C7-4E94-8097-91DBACE57D2A} = {BF650D97-AF98-4638-9C55-21311C6D88DA} {D5207217-61C7-4E94-8097-91DBACE57D2A} = {BF650D97-AF98-4638-9C55-21311C6D88DA}
{AABC96B8-C462-4B3A-9B5F-2929E3CB7A49} = {BF650D97-AF98-4638-9C55-21311C6D88DA} {AABC96B8-C462-4B3A-9B5F-2929E3CB7A49} = {BF650D97-AF98-4638-9C55-21311C6D88DA}
{AD4959DD-33D7-4C3F-8DB0-7361D8E74A95} = {0958D817-269C-44BE-BEFB-F3E6A409DE91} {AD4959DD-33D7-4C3F-8DB0-7361D8E74A95} = {0958D817-269C-44BE-BEFB-F3E6A409DE91}
{B7EEEEFD-5BFF-443D-981C-7B8AB5DFDE33} = {0958D817-269C-44BE-BEFB-F3E6A409DE91}
{A3991FA7-23C3-405A-96F9-5AB03AC58F30} = {0958D817-269C-44BE-BEFB-F3E6A409DE91}
EndGlobalSection EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {3C0509DC-C7F5-48DC-920D-DCFD9C879BD2} SolutionGuid = {3C0509DC-C7F5-48DC-920D-DCFD9C879BD2}
-7
View File
@@ -1,7 +0,0 @@
<SolutionConfiguration>
<Settings>
<AllowParallelTestExecution>True</AllowParallelTestExecution>
<CopyReferencedAssembliesToWorkspace>True</CopyReferencedAssembliesToWorkspace>
<SolutionConfigured>True</SolutionConfigured>
</Settings>
</SolutionConfiguration>
-16
View File
@@ -1,16 +0,0 @@
<SolutionConfiguration>
<Settings>
<AutoEnable>True</AutoEnable>
<CurrentEngineMode>Run all tests automatically [Global]</CurrentEngineMode>
<MetricsTreeShowTestProjects>False</MetricsTreeShowTestProjects>
<StatusIndicatorSplitterDistance>25</StatusIndicatorSplitterDistance>
<TestsWindowMenuOptions>
<VerticalSplitMenuOption>false</VerticalSplitMenuOption>
<ShowPassingTestsMenuOption>false</ShowPassingTestsMenuOption>
<ShowFailingTestsMenuOption>true</ShowFailingTestsMenuOption>
<ShowUnexecutedTestsMenuOption>true</ShowUnexecutedTestsMenuOption>
<ShowIgnoredTestsMenuOption>false</ShowIgnoredTestsMenuOption>
</TestsWindowMenuOptions>
<TestsWindowSplitterDistance>451</TestsWindowSplitterDistance>
</Settings>
</SolutionConfiguration>
-90
View File
@@ -1,90 +0,0 @@
using System;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Resources;
namespace ASCOM.Meade.net
{
public class AssemblyInfo
{
// The assembly information values.
public string Title = "", Description = "", Company = "",
Product = "", Copyright = "", Trademark = "",
AssemblyVersion = "", FileVersion = "", Guid = "",
NeutralLanguage = "";
public bool IsComVisible = false;
// Return a particular assembly attribute value.
public static T GetAssemblyAttribute<T>(Assembly assembly)
where T : Attribute
{
// Get attributes of this type.
object[] attributes =
assembly.GetCustomAttributes(typeof(T), true);
// If we didn't get anything, return null.
if ((attributes == null) || (attributes.Length == 0))
return null;
// Convert the first attribute value into
// the desired type and return it.
return (T)attributes[0];
}
// Constructors.
public AssemblyInfo()
: this(Assembly.GetExecutingAssembly())
{
}
public AssemblyInfo(Assembly assembly)
{
// Get values from the assembly.
AssemblyTitleAttribute titleAttr =
GetAssemblyAttribute<AssemblyTitleAttribute>(assembly);
if (titleAttr != null) Title = titleAttr.Title;
AssemblyDescriptionAttribute assemblyAttr =
GetAssemblyAttribute<AssemblyDescriptionAttribute>(assembly);
if (assemblyAttr != null) Description =
assemblyAttr.Description;
AssemblyCompanyAttribute companyAttr =
GetAssemblyAttribute<AssemblyCompanyAttribute>(assembly);
if (companyAttr != null) Company = companyAttr.Company;
AssemblyProductAttribute productAttr =
GetAssemblyAttribute<AssemblyProductAttribute>(assembly);
if (productAttr != null) Product = productAttr.Product;
AssemblyCopyrightAttribute copyrightAttr =
GetAssemblyAttribute<AssemblyCopyrightAttribute>(assembly);
if (copyrightAttr != null) Copyright = copyrightAttr.Copyright;
AssemblyTrademarkAttribute trademarkAttr =
GetAssemblyAttribute<AssemblyTrademarkAttribute>(assembly);
if (trademarkAttr != null) Trademark = trademarkAttr.Trademark;
var version = assembly.GetName().Version;
AssemblyVersion = $"{version.Major}.{version.Minor}.{version.Build}.{version.Revision}";
AssemblyFileVersionAttribute fileVersionAttr =
GetAssemblyAttribute<AssemblyFileVersionAttribute>(assembly);
if (fileVersionAttr != null) FileVersion =
fileVersionAttr.Version;
GuidAttribute guidAttr = GetAssemblyAttribute<GuidAttribute>(assembly);
if (guidAttr != null) Guid = guidAttr.Value;
NeutralResourcesLanguageAttribute languageAttr =
GetAssemblyAttribute<NeutralResourcesLanguageAttribute>(assembly);
if (languageAttr != null) NeutralLanguage =
languageAttr.CultureName;
ComVisibleAttribute comAttr =
GetAssemblyAttribute<ComVisibleAttribute>(assembly);
if (comAttr != null) IsComVisible = comAttr.Value;
}
}
}
-36
View File
@@ -1,36 +0,0 @@
<#
This script initializes a bare minimum set of registry entries required for ASCOM.Utilities.Profile to work
without throwing any exceptions. When building on a build server, or on a computer without the ASCOM Platform installed,
it may be useful to execute this script as a build step prior to running any unit tests, or calling any code that relies on
ASCOM.Utilities.Profile. The alternative is to install the ASCOM Platform on the build agent.
NOTE: This script equires elevated permissions because it creates registry keys in the LocalMachine hive.
#>
$wow = Test-Path HKLM:\SOFTWARE\Wow6432Node
if ($wow)
{
$root = "HKLM:\SOFTWARE\Wow6432Node"
}
else
{
$root = "HKLM:\SOFTWARE"
}
$ascomRoot = $root + "\ASCOM"
if (Test-Path $ascomRoot)
{
<# Don't upset an already-existing ASCOM registry #>
exit
}
<# Create the ASCOM root key and set it's ACL to allow all users read/write access #>
New-Item -Path $root -Name ASCOM Force
$ascomAcl = Get-Acl $ascomRoot
$aclRule = New-Object System.Security.AccessControl.RegistryAccessRule ("Users","FullControl","Allow")
$ascomAcl.SetAccessRule($aclRule)
$ascomAcl | Set-Acl -Path $ascomRoot
<# Now create the bare minimum keys required so that ASCOM.Utilities.Profile doesn't crash and burn #>
New-ItemProperty -Path $ascomRoot -Name PlatformVersion -Value "6.1" -PropertyType String Force
New-ItemProperty -Path $ascomRoot -Name SerTraceFile -Value "C:\SerialTraceAuto.txt" -PropertyType String Force
+69 -58
View File
@@ -33,43 +33,43 @@ namespace ASCOM.Meade.net
#region Access to ole32.dll functions for class factories #region Access to ole32.dll functions for class factories
// Define two common GUID objects for public usage. // Define two common GUID objects for public usage.
private static readonly Guid _iidIUnknown = new Guid("{00000000-0000-0000-C000-000000000046}"); public static Guid IID_IUnknown = new Guid("{00000000-0000-0000-C000-000000000046}");
private static readonly Guid _iidIDispatch = new Guid("{00020400-0000-0000-C000-000000000046}"); public static Guid IID_IDispatch = new Guid("{00020400-0000-0000-C000-000000000046}");
[Flags] [Flags]
enum Clsctx : uint enum CLSCTX : uint
{ {
ClsctxInprocServer = 0x1, CLSCTX_INPROC_SERVER = 0x1,
ClsctxInprocHandler = 0x2, CLSCTX_INPROC_HANDLER = 0x2,
ClsctxLocalServer = 0x4, CLSCTX_LOCAL_SERVER = 0x4,
ClsctxInprocServer16 = 0x8, CLSCTX_INPROC_SERVER16 = 0x8,
ClsctxRemoteServer = 0x10, CLSCTX_REMOTE_SERVER = 0x10,
ClsctxInprocHandler16 = 0x20, CLSCTX_INPROC_HANDLER16 = 0x20,
ClsctxReserved1 = 0x40, CLSCTX_RESERVED1 = 0x40,
ClsctxReserved2 = 0x80, CLSCTX_RESERVED2 = 0x80,
ClsctxReserved3 = 0x100, CLSCTX_RESERVED3 = 0x100,
ClsctxReserved4 = 0x200, CLSCTX_RESERVED4 = 0x200,
ClsctxNoCodeDownload = 0x400, CLSCTX_NO_CODE_DOWNLOAD = 0x400,
ClsctxReserved5 = 0x800, CLSCTX_RESERVED5 = 0x800,
ClsctxNoCustomMarshal = 0x1000, CLSCTX_NO_CUSTOM_MARSHAL = 0x1000,
ClsctxEnableCodeDownload = 0x2000, CLSCTX_ENABLE_CODE_DOWNLOAD = 0x2000,
ClsctxNoFailureLog = 0x4000, CLSCTX_NO_FAILURE_LOG = 0x4000,
ClsctxDisableAaa = 0x8000, CLSCTX_DISABLE_AAA = 0x8000,
ClsctxEnableAaa = 0x10000, CLSCTX_ENABLE_AAA = 0x10000,
ClsctxFromDefaultContext = 0x20000, CLSCTX_FROM_DEFAULT_CONTEXT = 0x20000,
ClsctxInproc = ClsctxInprocServer | ClsctxInprocHandler, CLSCTX_INPROC = CLSCTX_INPROC_SERVER | CLSCTX_INPROC_HANDLER,
ClsctxServer = ClsctxInprocServer | ClsctxLocalServer | ClsctxRemoteServer, CLSCTX_SERVER = CLSCTX_INPROC_SERVER | CLSCTX_LOCAL_SERVER | CLSCTX_REMOTE_SERVER,
ClsctxAll = ClsctxServer | ClsctxInprocHandler CLSCTX_ALL = CLSCTX_SERVER | CLSCTX_INPROC_HANDLER
} }
[Flags] [Flags]
enum Regcls : uint enum REGCLS : uint
{ {
RegclsSingleuse = 0, REGCLS_SINGLEUSE = 0,
RegclsMultipleuse = 1, REGCLS_MULTIPLEUSE = 1,
RegclsMultiSeparate = 2, REGCLS_MULTI_SEPARATE = 2,
RegclsSuspended = 4, REGCLS_SUSPENDED = 4,
RegclsSurrogate = 8 REGCLS_SURROGATE = 8
} }
// //
// CoRegisterClassObject() is used to register a Class Factory // CoRegisterClassObject() is used to register a Class Factory
@@ -109,59 +109,70 @@ namespace ASCOM.Meade.net
#region Constructor and Private ClassFactory Data #region Constructor and Private ClassFactory Data
private readonly Type _mClassType; protected Type m_ClassType;
private Guid _mClassId; protected Guid m_ClassId;
private readonly ArrayList _mInterfaceTypes; protected ArrayList m_InterfaceTypes;
private uint _mCookie; protected uint m_ClassContext;
private readonly string _mProgid; protected uint m_Flags;
protected UInt32 m_locked = 0;
protected uint m_Cookie;
protected string m_progid;
public ClassFactory(Type type) public ClassFactory(Type type)
{ {
if (type == null) if (type == null)
throw new ArgumentNullException("type"); throw new ArgumentNullException("type");
_mClassType = type; m_ClassType = type;
//PWGS Get the ProgID from the MetaData //PWGS Get the ProgID from the MetaData
_mProgid = Marshal.GenerateProgIdForType(type); m_progid = Marshal.GenerateProgIdForType(type);
_mClassId = Marshal.GenerateGuidForType(type); // Should be nailed down by [Guid(...)] m_ClassId = Marshal.GenerateGuidForType(type); // Should be nailed down by [Guid(...)]
ClassContext = (uint)Clsctx.ClsctxLocalServer; // Default m_ClassContext = (uint)CLSCTX.CLSCTX_LOCAL_SERVER; // Default
Flags = (uint)Regcls.RegclsMultipleuse | // Default m_Flags = (uint)REGCLS.REGCLS_MULTIPLEUSE | // Default
(uint)Regcls.RegclsSuspended; (uint)REGCLS.REGCLS_SUSPENDED;
_mInterfaceTypes = new ArrayList(); m_InterfaceTypes = new ArrayList();
foreach (Type T in type.GetInterfaces()) // Save all of the implemented interfaces foreach (Type T in type.GetInterfaces()) // Save all of the implemented interfaces
_mInterfaceTypes.Add(T); m_InterfaceTypes.Add(T);
} }
#endregion #endregion
#region Common ClassFactory Methods #region Common ClassFactory Methods
public uint ClassContext { get; } public uint ClassContext
{
get { return m_ClassContext; }
set { m_ClassContext = value; }
}
public Guid ClassId public Guid ClassId
{ {
get => _mClassId; get { return m_ClassId; }
set => _mClassId = value; set { m_ClassId = value; }
} }
public uint Flags { get; } public uint Flags
{
get { return m_Flags; }
set { m_Flags = value; }
}
public bool RegisterClassObject() public bool RegisterClassObject()
{ {
// Register the class factory // Register the class factory
int i = CoRegisterClassObject int i = CoRegisterClassObject
( (
ref _mClassId, ref m_ClassId,
this, this,
ClassContext, m_ClassContext,
Flags, m_Flags,
out _mCookie out m_Cookie
); );
return (i == 0); return (i == 0);
} }
public bool RevokeClassObject() public bool RevokeClassObject()
{ {
int i = CoRevokeClassObject(_mCookie); int i = CoRevokeClassObject(m_Cookie);
return (i == 0); return (i == 0);
} }
@@ -190,25 +201,25 @@ namespace ASCOM.Meade.net
// //
// Handle specific requests for implemented interfaces // Handle specific requests for implemented interfaces
// //
foreach (Type iType in _mInterfaceTypes) foreach (Type iType in m_InterfaceTypes)
{ {
if (riid == Marshal.GenerateGuidForType(iType)) if (riid == Marshal.GenerateGuidForType(iType))
{ {
ppvObject = Marshal.GetComInterfaceForObject(Activator.CreateInstance(_mClassType), iType); ppvObject = Marshal.GetComInterfaceForObject(Activator.CreateInstance(m_ClassType), iType);
return; return;
} }
} }
// //
// Handle requests for IDispatch or IUnknown on the class // Handle requests for IDispatch or IUnknown on the class
// //
if (riid == _iidIDispatch) if (riid == IID_IDispatch)
{ {
ppvObject = Marshal.GetIDispatchForObject(Activator.CreateInstance(_mClassType)); ppvObject = Marshal.GetIDispatchForObject(Activator.CreateInstance(m_ClassType));
return; return;
} }
else if (riid == _iidIUnknown) else if (riid == IID_IUnknown)
{ {
ppvObject = Marshal.GetIUnknownForObject(Activator.CreateInstance(_mClassType)); ppvObject = Marshal.GetIUnknownForObject(Activator.CreateInstance(m_ClassType));
} }
else else
{ {
-8
View File
@@ -1,8 +0,0 @@
namespace ASCOM.Meade.net
{
public class ConnectionInfo
{
public int Connections { get; set; }
public int SameDevice { get; set; }
}
}
+15 -13
View File
@@ -8,33 +8,35 @@ namespace ASCOM.Meade.net
/// </summary> /// </summary>
class GarbageCollection class GarbageCollection
{ {
private bool _mbContinueThread; protected bool m_bContinueThread;
private readonly int _miInterval; protected bool m_GCWatchStopped;
private readonly ManualResetEvent _mEventThreadEnded; protected int m_iInterval;
protected ManualResetEvent m_EventThreadEnded;
public GarbageCollection(int iInterval) public GarbageCollection(int iInterval)
{ {
_mbContinueThread = true; m_bContinueThread = true;
_miInterval = iInterval; m_GCWatchStopped = false;
_mEventThreadEnded = new ManualResetEvent(false); m_iInterval = iInterval;
m_EventThreadEnded = new ManualResetEvent(false);
} }
public void GcWatch() public void GCWatch()
{ {
// Pause for a moment to provide a delay to make threads more apparent. // Pause for a moment to provide a delay to make threads more apparent.
while (ContinueThread()) while (ContinueThread())
{ {
GC.Collect(); GC.Collect();
Thread.Sleep(_miInterval); Thread.Sleep(m_iInterval);
} }
_mEventThreadEnded.Set(); m_EventThreadEnded.Set();
} }
protected bool ContinueThread() protected bool ContinueThread()
{ {
lock (this) lock (this)
{ {
return _mbContinueThread; return m_bContinueThread;
} }
} }
@@ -42,14 +44,14 @@ namespace ASCOM.Meade.net
{ {
lock (this) lock (this)
{ {
_mbContinueThread = false; m_bContinueThread = false;
} }
} }
public void WaitForThreadToStop() public void WaitForThreadToStop()
{ {
_mEventThreadEnded.WaitOne(); m_EventThreadEnded.WaitOne();
_mEventThreadEnded.Reset(); m_EventThreadEnded.Reset();
} }
} }
} }
+100 -98
View File
@@ -15,70 +15,71 @@
using System; using System;
using System.IO; using System.IO;
using System.Windows.Forms; using System.Windows.Forms;
using System.Drawing;
using System.Collections; using System.Collections;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Reflection; using System.Reflection;
using ASCOM.Utilities; using ASCOM.Utilities;
using Microsoft.Win32; using Microsoft.Win32;
using System.Text;
using System.Threading; using System.Threading;
using System.Security.Principal; using System.Security.Principal;
using System.Diagnostics; using System.Diagnostics;
using ASCOM;
namespace ASCOM.Meade.net namespace ASCOM.Meade.net
{ {
public static class Server public static class Server
{ {
private const string DRIVER_NAME = "Meade Generic";
#region Access to kernel32.dll, user32.dll, and ole32.dll functions #region Access to kernel32.dll, user32.dll, and ole32.dll functions
[Flags] [Flags]
enum Clsctx : uint enum CLSCTX : uint
{ {
ClsctxInprocServer = 0x1, CLSCTX_INPROC_SERVER = 0x1,
ClsctxInprocHandler = 0x2, CLSCTX_INPROC_HANDLER = 0x2,
ClsctxLocalServer = 0x4, CLSCTX_LOCAL_SERVER = 0x4,
ClsctxInprocServer16 = 0x8, CLSCTX_INPROC_SERVER16 = 0x8,
ClsctxRemoteServer = 0x10, CLSCTX_REMOTE_SERVER = 0x10,
ClsctxInprocHandler16 = 0x20, CLSCTX_INPROC_HANDLER16 = 0x20,
ClsctxReserved1 = 0x40, CLSCTX_RESERVED1 = 0x40,
ClsctxReserved2 = 0x80, CLSCTX_RESERVED2 = 0x80,
ClsctxReserved3 = 0x100, CLSCTX_RESERVED3 = 0x100,
ClsctxReserved4 = 0x200, CLSCTX_RESERVED4 = 0x200,
ClsctxNoCodeDownload = 0x400, CLSCTX_NO_CODE_DOWNLOAD = 0x400,
ClsctxReserved5 = 0x800, CLSCTX_RESERVED5 = 0x800,
ClsctxNoCustomMarshal = 0x1000, CLSCTX_NO_CUSTOM_MARSHAL = 0x1000,
ClsctxEnableCodeDownload = 0x2000, CLSCTX_ENABLE_CODE_DOWNLOAD = 0x2000,
ClsctxNoFailureLog = 0x4000, CLSCTX_NO_FAILURE_LOG = 0x4000,
ClsctxDisableAaa = 0x8000, CLSCTX_DISABLE_AAA = 0x8000,
ClsctxEnableAaa = 0x10000, CLSCTX_ENABLE_AAA = 0x10000,
ClsctxFromDefaultContext = 0x20000, CLSCTX_FROM_DEFAULT_CONTEXT = 0x20000,
ClsctxInproc = ClsctxInprocServer | ClsctxInprocHandler, CLSCTX_INPROC = CLSCTX_INPROC_SERVER | CLSCTX_INPROC_HANDLER,
ClsctxServer = ClsctxInprocServer | ClsctxLocalServer | ClsctxRemoteServer, CLSCTX_SERVER = CLSCTX_INPROC_SERVER | CLSCTX_LOCAL_SERVER | CLSCTX_REMOTE_SERVER,
ClsctxAll = ClsctxServer | ClsctxInprocHandler CLSCTX_ALL = CLSCTX_SERVER | CLSCTX_INPROC_HANDLER
} }
[Flags] [Flags]
enum Coinit : uint enum COINIT : uint
{ {
/// Initializes the thread for multi-threaded object concurrency. /// Initializes the thread for multi-threaded object concurrency.
CoinitMultithreaded = 0x0, COINIT_MULTITHREADED = 0x0,
/// Initializes the thread for apartment-threaded object concurrency. /// Initializes the thread for apartment-threaded object concurrency.
CoinitApartmentthreaded = 0x2, COINIT_APARTMENTTHREADED = 0x2,
/// Disables DDE for Ole1 support. /// Disables DDE for Ole1 support.
CoinitDisableOle1Dde = 0x4, COINIT_DISABLE_OLE1DDE = 0x4,
/// Trades memory for speed. /// Trades memory for speed.
CoinitSpeedOverMemory = 0x8 COINIT_SPEED_OVER_MEMORY = 0x8
} }
[Flags] [Flags]
enum Regcls : uint enum REGCLS : uint
{ {
RegclsSingleuse = 0, REGCLS_SINGLEUSE = 0,
RegclsMultipleuse = 1, REGCLS_MULTIPLEUSE = 1,
RegclsMultiSeparate = 2, REGCLS_MULTI_SEPARATE = 2,
RegclsSuspended = 4, REGCLS_SUSPENDED = 4,
RegclsSurrogate = 8 REGCLS_SURROGATE = 8
} }
@@ -96,7 +97,7 @@ namespace ASCOM.Meade.net
// We will need this API to post a WM_QUIT message to the main // We will need this API to post a WM_QUIT message to the main
// thread in order to terminate this application. // thread in order to terminate this application.
[DllImport("user32.dll")] [DllImport("user32.dll")]
static extern bool PostThreadMessage(uint idThread, uint msg, UIntPtr wParam, static extern bool PostThreadMessage(uint idThread, uint Msg, UIntPtr wParam,
IntPtr lParam); IntPtr lParam);
// GetCurrentThreadId() allows us to obtain the thread id of the // GetCurrentThreadId() allows us to obtain the thread id of the
@@ -107,21 +108,21 @@ namespace ASCOM.Meade.net
#endregion #endregion
#region Private Data #region Private Data
private static int _objsInUse; // Keeps a count on the total number of objects alive. private static int objsInUse; // Keeps a count on the total number of objects alive.
private static int _serverLocks; // Keeps a lock count on this application. private static int serverLocks; // Keeps a lock count on this application.
private static FrmMain _sMainForm = null; // Reference to our main form private static frmMain s_MainForm = null; // Reference to our main form
private static ArrayList _sComObjectAssys; // Dynamically loaded assemblies containing served COM objects private static ArrayList s_ComObjectAssys; // Dynamically loaded assemblies containing served COM objects
private static ArrayList _sComObjectTypes; // Served COM object types private static ArrayList s_ComObjectTypes; // Served COM object types
private static ArrayList _sClassFactories; // Served COM object class factories private static ArrayList s_ClassFactories; // Served COM object class factories
private static string _sAppId = "{4e68ec46-5ffc-49e7-b298-38a548df0bfd}"; // Our AppId private static string s_appId = "{4e68ec46-5ffc-49e7-b298-38a548df0bfd}"; // Our AppId
private static readonly Object LockObject = new object(); private static readonly Object lockObject = new object();
#endregion #endregion
// This property returns the main thread's id. // This property returns the main thread's id.
public static uint MainThreadId { get; private set; } // Stores the main thread's thread id. public static uint MainThreadId { get; private set; } // Stores the main thread's thread id.
// Used to tell if started by COM or manually // Used to tell if started by COM or manually
public static bool StartedByCom { get; private set; } // True if server started by COM (-embedding) public static bool StartedByCOM { get; private set; } // True if server started by COM (-embedding)
#region Server Lock, Object Counting, and AutoQuit on COM startup #region Server Lock, Object Counting, and AutoQuit on COM startup
@@ -130,9 +131,9 @@ namespace ASCOM.Meade.net
{ {
get get
{ {
lock (LockObject) lock (lockObject)
{ {
return _objsInUse; return objsInUse;
} }
} }
} }
@@ -141,14 +142,14 @@ namespace ASCOM.Meade.net
public static int CountObject() public static int CountObject()
{ {
// Increment the global count of objects. // Increment the global count of objects.
return Interlocked.Increment(ref _objsInUse); return Interlocked.Increment(ref objsInUse);
} }
// This method performs a thread-safe decrementation the objects count. // This method performs a thread-safe decrementation the objects count.
public static int UncountObject() public static int UncountObject()
{ {
// Decrement the global count of objects. // Decrement the global count of objects.
return Interlocked.Decrement(ref _objsInUse); return Interlocked.Decrement(ref objsInUse);
} }
// Returns the current server lock count. // Returns the current server lock count.
@@ -156,9 +157,9 @@ namespace ASCOM.Meade.net
{ {
get get
{ {
lock (LockObject) lock (lockObject)
{ {
return _serverLocks; return serverLocks;
} }
} }
} }
@@ -168,7 +169,7 @@ namespace ASCOM.Meade.net
public static int CountLock() public static int CountLock()
{ {
// Increment the global lock count of this server. // Increment the global lock count of this server.
return Interlocked.Increment(ref _serverLocks); return Interlocked.Increment(ref serverLocks);
} }
// This method performs a thread-safe decrementation the // This method performs a thread-safe decrementation the
@@ -176,7 +177,7 @@ namespace ASCOM.Meade.net
public static int UncountLock() public static int UncountLock()
{ {
// Decrement the global lock count of this server. // Decrement the global lock count of this server.
return Interlocked.Decrement(ref _serverLocks); return Interlocked.Decrement(ref serverLocks);
} }
// AttemptToTerminateServer() will check to see if the objects count and the server // AttemptToTerminateServer() will check to see if the objects count and the server
@@ -188,11 +189,11 @@ namespace ASCOM.Meade.net
// //
public static void ExitIf() public static void ExitIf()
{ {
lock (LockObject) lock (lockObject)
{ {
if ((ObjectsCount <= 0) && (ServerLockCount <= 0)) if ((ObjectsCount <= 0) && (ServerLockCount <= 0))
{ {
if (StartedByCom) if (StartedByCOM)
{ {
UIntPtr wParam = new UIntPtr(0); UIntPtr wParam = new UIntPtr(0);
IntPtr lParam = new IntPtr(0); IntPtr lParam = new IntPtr(0);
@@ -215,8 +216,8 @@ namespace ASCOM.Meade.net
// //
private static bool LoadComObjectAssemblies() private static bool LoadComObjectAssemblies()
{ {
_sComObjectAssys = new ArrayList(); s_ComObjectAssys = new ArrayList();
_sComObjectTypes = new ArrayList(); s_ComObjectTypes = new ArrayList();
// put everything into one folder, the same as the server. // put everything into one folder, the same as the server.
string assyPath = Assembly.GetEntryAssembly().Location; string assyPath = Assembly.GetEntryAssembly().Location;
@@ -245,8 +246,8 @@ namespace ASCOM.Meade.net
if (attrbutes.Length > 0) if (attrbutes.Length > 0)
{ {
//MessageBox.Show("Adding Type: " + type.Name + " " + type.FullName); //MessageBox.Show("Adding Type: " + type.Name + " " + type.FullName);
_sComObjectTypes.Add(type); //PWGS - much simpler s_ComObjectTypes.Add(type); //PWGS - much simpler
_sComObjectAssys.Add(so); s_ComObjectAssys.Add(so);
} }
} }
} }
@@ -258,8 +259,8 @@ namespace ASCOM.Meade.net
} }
catch (Exception e) catch (Exception e)
{ {
MessageBox.Show($"Failed to load served COM class assembly {fi.Name} - {e.Message}", MessageBox.Show("Failed to load served COM class assembly " + fi.Name + " - " + e.Message,
DRIVER_NAME, MessageBoxButtons.OK, MessageBoxIcon.Stop); "Meade.net", MessageBoxButtons.OK, MessageBoxIcon.Stop);
return false; return false;
} }
@@ -295,11 +296,12 @@ namespace ASCOM.Meade.net
try { Process.Start(si); } try { Process.Start(si); }
catch (System.ComponentModel.Win32Exception) catch (System.ComponentModel.Win32Exception)
{ {
MessageBox.Show($"The {DRIVER_NAME} was not {(arg == "/register" ? "registered" : "unregistered")} because you did not allow it.", DRIVER_NAME, MessageBoxButtons.OK, MessageBoxIcon.Warning); MessageBox.Show("The Meade.net was not " + (arg == "/register" ? "registered" : "unregistered") +
" because you did not allow it.", "Meade.net", MessageBoxButtons.OK, MessageBoxIcon.Warning);
} }
catch (Exception ex) catch (Exception ex)
{ {
MessageBox.Show(ex.ToString(), DRIVER_NAME, MessageBoxButtons.OK, MessageBoxIcon.Stop); MessageBox.Show(ex.ToString(), "Meade.net", MessageBoxButtons.OK, MessageBoxIcon.Stop);
} }
return; return;
} }
@@ -340,10 +342,10 @@ namespace ASCOM.Meade.net
// //
// HKCR\APPID\appid // HKCR\APPID\appid
// //
using (RegistryKey key = Registry.ClassesRoot.CreateSubKey("APPID\\" + _sAppId)) using (RegistryKey key = Registry.ClassesRoot.CreateSubKey("APPID\\" + s_appId))
{ {
key.SetValue(null, assyDescription); key.SetValue(null, assyDescription);
key.SetValue("AppID", _sAppId); key.SetValue("AppID", s_appId);
key.SetValue("AuthenticationLevel", 1, RegistryValueKind.DWord); key.SetValue("AuthenticationLevel", 1, RegistryValueKind.DWord);
} }
// //
@@ -352,13 +354,13 @@ namespace ASCOM.Meade.net
using (RegistryKey key = Registry.ClassesRoot.CreateSubKey(string.Format("APPID\\{0}", using (RegistryKey key = Registry.ClassesRoot.CreateSubKey(string.Format("APPID\\{0}",
Application.ExecutablePath.Substring(Application.ExecutablePath.LastIndexOf('\\') + 1)))) Application.ExecutablePath.Substring(Application.ExecutablePath.LastIndexOf('\\') + 1))))
{ {
key.SetValue("AppID", _sAppId); key.SetValue("AppID", s_appId);
} }
} }
catch (Exception ex) catch (Exception ex)
{ {
MessageBox.Show($"Error while registering the server:\n{ex}", MessageBox.Show("Error while registering the server:\n" + ex.ToString(),
DRIVER_NAME, MessageBoxButtons.OK, MessageBoxIcon.Stop); "Meade.net", MessageBoxButtons.OK, MessageBoxIcon.Stop);
return; return;
} }
finally finally
@@ -368,7 +370,7 @@ namespace ASCOM.Meade.net
// //
// For each of the driver assemblies // For each of the driver assemblies
// //
foreach (Type type in _sComObjectTypes) foreach (Type type in s_ComObjectTypes)
{ {
bool bFail = false; bool bFail = false;
try try
@@ -384,7 +386,7 @@ namespace ASCOM.Meade.net
using (RegistryKey key = Registry.ClassesRoot.CreateSubKey(string.Format("CLSID\\{0}", clsid))) using (RegistryKey key = Registry.ClassesRoot.CreateSubKey(string.Format("CLSID\\{0}", clsid)))
{ {
key.SetValue(null, progid); // Could be assyTitle/Desc??, but .NET components show ProgId here key.SetValue(null, progid); // Could be assyTitle/Desc??, but .NET components show ProgId here
key.SetValue("AppId", _sAppId); key.SetValue("AppId", s_appId);
using (RegistryKey key2 = key.CreateSubKey("Implemented Categories")) using (RegistryKey key2 = key.CreateSubKey("Implemented Categories"))
{ {
key2.CreateSubKey("{62C8FE65-4EBB-45e7-B440-6E39B2CDBF29}"); key2.CreateSubKey("{62C8FE65-4EBB-45e7-B440-6E39B2CDBF29}");
@@ -418,16 +420,16 @@ namespace ASCOM.Meade.net
// 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
string chooserName = ((ServedClassNameAttribute)attr).DisplayName ?? "MultiServer"; string chooserName = ((ServedClassNameAttribute)attr).DisplayName ?? "MultiServer";
using (var p = new Profile()) using (var P = new ASCOM.Utilities.Profile())
{ {
p.DeviceType = deviceType; P.DeviceType = deviceType;
p.Register(progid, chooserName); P.Register(progid, chooserName);
} }
} }
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.ToString(),
DRIVER_NAME, MessageBoxButtons.OK, MessageBoxIcon.Stop); "Meade.net", MessageBoxButtons.OK, MessageBoxIcon.Stop);
bFail = true; bFail = true;
} }
finally finally
@@ -454,14 +456,14 @@ namespace ASCOM.Meade.net
// //
// Local server's DCOM/AppID information // Local server's DCOM/AppID information
// //
Registry.ClassesRoot.DeleteSubKey(string.Format("APPID\\{0}", _sAppId), false); Registry.ClassesRoot.DeleteSubKey(string.Format("APPID\\{0}", s_appId), false);
Registry.ClassesRoot.DeleteSubKey(string.Format("APPID\\{0}", Registry.ClassesRoot.DeleteSubKey(string.Format("APPID\\{0}",
Application.ExecutablePath.Substring(Application.ExecutablePath.LastIndexOf('\\') + 1)), false); Application.ExecutablePath.Substring(Application.ExecutablePath.LastIndexOf('\\') + 1)), false);
// //
// For each of the driver assemblies // For each of the driver assemblies
// //
foreach (Type type in _sComObjectTypes) foreach (Type type in s_ComObjectTypes)
{ {
string clsid = Marshal.GenerateGuidForType(type).ToString("B"); string clsid = Marshal.GenerateGuidForType(type).ToString("B");
string progid = Marshal.GenerateProgIdForType(type); string progid = Marshal.GenerateProgIdForType(type);
@@ -488,10 +490,10 @@ namespace ASCOM.Meade.net
// //
// ASCOM // ASCOM
// //
using (var p = new Profile()) using (var P = new ASCOM.Utilities.Profile())
{ {
p.DeviceType = deviceType; P.DeviceType = deviceType;
p.Unregister(progid); P.Unregister(progid);
} }
} }
catch (Exception) { } catch (Exception) { }
@@ -507,15 +509,15 @@ namespace ASCOM.Meade.net
// //
private static bool RegisterClassFactories() private static bool RegisterClassFactories()
{ {
_sClassFactories = new ArrayList(); s_ClassFactories = new ArrayList();
foreach (Type type in _sComObjectTypes) foreach (Type type in s_ComObjectTypes)
{ {
ClassFactory factory = new ClassFactory(type); // Use default context & flags ClassFactory factory = new ClassFactory(type); // Use default context & flags
_sClassFactories.Add(factory); s_ClassFactories.Add(factory);
if (!factory.RegisterClassObject()) if (!factory.RegisterClassObject())
{ {
MessageBox.Show("Failed to register class factory for " + type.Name, MessageBox.Show("Failed to register class factory for " + type.Name,
DRIVER_NAME, MessageBoxButtons.OK, MessageBoxIcon.Stop); "Meade.net", MessageBoxButtons.OK, MessageBoxIcon.Stop);
return false; return false;
} }
} }
@@ -526,7 +528,7 @@ namespace ASCOM.Meade.net
private static void RevokeClassFactories() private static void RevokeClassFactories()
{ {
ClassFactory.SuspendClassObjects(); // Prevent race conditions ClassFactory.SuspendClassObjects(); // Prevent race conditions
foreach (ClassFactory factory in _sClassFactories) foreach (ClassFactory factory in s_ClassFactories)
factory.RevokeClassObject(); factory.RevokeClassObject();
} }
#endregion #endregion
@@ -550,7 +552,7 @@ namespace ASCOM.Meade.net
switch (args[0].ToLower()) switch (args[0].ToLower())
{ {
case "-embedding": case "-embedding":
StartedByCom = true; // Indicate COM started us StartedByCOM = true; // Indicate COM started us
break; break;
case "-register": case "-register":
@@ -571,12 +573,12 @@ namespace ASCOM.Meade.net
default: default:
MessageBox.Show("Unknown argument: " + args[0] + "\nValid are : -register, -unregister and -embedding", MessageBox.Show("Unknown argument: " + args[0] + "\nValid are : -register, -unregister and -embedding",
DRIVER_NAME, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); "Meade.net", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
break; break;
} }
} }
else else
StartedByCom = false; StartedByCOM = false;
return bRet; return bRet;
} }
@@ -596,24 +598,24 @@ namespace ASCOM.Meade.net
if (!ProcessArguments(args)) return; // Register/Unregister if (!ProcessArguments(args)) return; // Register/Unregister
// Initialize critical member variables. // Initialize critical member variables.
_objsInUse = 0; objsInUse = 0;
_serverLocks = 0; serverLocks = 0;
MainThreadId = GetCurrentThreadId(); MainThreadId = GetCurrentThreadId();
Thread.CurrentThread.Name = "Main Thread"; Thread.CurrentThread.Name = "Main Thread";
Application.EnableVisualStyles(); Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false); Application.SetCompatibleTextRenderingDefault(false);
_sMainForm = new FrmMain(); s_MainForm = new frmMain();
if (StartedByCom) _sMainForm.WindowState = FormWindowState.Minimized; if (StartedByCOM) s_MainForm.WindowState = FormWindowState.Minimized;
// Register the class factories of the served objects // Register the class factories of the served objects
RegisterClassFactories(); RegisterClassFactories();
// Start up the garbage collection thread. // Start up the garbage collection thread.
GarbageCollection garbageCollector = new GarbageCollection(1000); GarbageCollection GarbageCollector = new GarbageCollection(1000);
Thread gcThread = new Thread(new ThreadStart(garbageCollector.GcWatch)); Thread GCThread = new Thread(new ThreadStart(GarbageCollector.GCWatch));
gcThread.Name = "Garbage Collection Thread"; GCThread.Name = "Garbage Collection Thread";
gcThread.Start(); GCThread.Start();
// //
// Start the message loop. This serializes incoming calls to our // Start the message loop. This serializes incoming calls to our
@@ -621,7 +623,7 @@ namespace ASCOM.Meade.net
// //
try try
{ {
Application.Run(_sMainForm); Application.Run(s_MainForm);
} }
finally finally
{ {
@@ -631,8 +633,8 @@ namespace ASCOM.Meade.net
RevokeClassFactories(); RevokeClassFactories();
// Now stop the Garbage Collector thread. // Now stop the Garbage Collector thread.
garbageCollector.StopThread(); GarbageCollector.StopThread();
garbageCollector.WaitForThreadToStop(); GarbageCollector.WaitForThreadToStop();
} }
} }
#endregion #endregion
+1 -1
View File
@@ -8,7 +8,7 @@ namespace ASCOM.Meade.net.Localization
internal class LocalisationHelper internal class LocalisationHelper
{ {
private const string LocalizationNamespace = "LocalisationTest.Localization.Resources.Localization"; private const string LocalizationNamespace = "LocalisationTest.Localization.Resources.Localization";
private readonly ResourceManager _resourceManager; ResourceManager _resourceManager;
public LocalisationHelper() public LocalisationHelper()
{ {
+6 -43
View File
@@ -43,7 +43,6 @@
<PlatformTarget>AnyCPU</PlatformTarget> <PlatformTarget>AnyCPU</PlatformTarget>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit> <Prefer32Bit>true</Prefer32Bit>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType> <DebugType>pdbonly</DebugType>
@@ -69,7 +68,7 @@
<OutputPath>..\bin\Debug\</OutputPath> <OutputPath>..\bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants> <DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType> <DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget> <PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit> <Prefer32Bit>true</Prefer32Bit>
@@ -84,47 +83,16 @@
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="ASCOM.Astrometry, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL"> <Reference Include="ASCOM.Attributes, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL" />
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Astrometry.dll</HintPath> <Reference Include="ASCOM.DeviceInterfaces, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL" />
</Reference> <Reference Include="ASCOM.Exceptions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL" />
<Reference Include="ASCOM.Attributes, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL"> <Reference Include="ASCOM.Utilities, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL" />
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Attributes.dll</HintPath>
</Reference>
<Reference Include="ASCOM.Cache, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Cache.dll</HintPath>
</Reference>
<Reference Include="ASCOM.Controls, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Controls.dll</HintPath>
</Reference>
<Reference Include="ASCOM.DeviceInterfaces, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.DeviceInterfaces.dll</HintPath>
</Reference>
<Reference Include="ASCOM.DriverAccess, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.DriverAccess.dll</HintPath>
</Reference>
<Reference Include="ASCOM.Exceptions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Exceptions.dll</HintPath>
</Reference>
<Reference Include="ASCOM.Internal.Extensions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Internal.Extensions.dll</HintPath>
</Reference>
<Reference Include="ASCOM.SettingsProvider, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.SettingsProvider.dll</HintPath>
</Reference>
<Reference Include="ASCOM.Utilities, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Utilities.dll</HintPath>
</Reference>
<Reference Include="ASCOM.Utilities.Video, Version=6.1.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Utilities.Video.dll</HintPath>
</Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Drawing" /> <Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" /> <Reference Include="System.Windows.Forms" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="AssemblyInfo.cs" />
<Compile Include="ClassFactory.cs" /> <Compile Include="ClassFactory.cs" />
<Compile Include="ConnectionInfo.cs" />
<Compile Include="frmMain.cs"> <Compile Include="frmMain.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
@@ -134,11 +102,7 @@
<Compile Include="GarbageCollection.cs" /> <Compile Include="GarbageCollection.cs" />
<Compile Include="Localization\LocalisationHelper.cs" /> <Compile Include="Localization\LocalisationHelper.cs" />
<Compile Include="LocalServer.cs" /> <Compile Include="LocalServer.cs" />
<Compile Include="ProfileProperties.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="TelescopeList.cs" />
<Compile Include="Win32Utilities.cs" />
<Compile Include="Wrapper\SharedResourcesWrapper.cs" />
<EmbeddedResource Include="frmMain.resx"> <EmbeddedResource Include="frmMain.resx">
<SubType>Designer</SubType> <SubType>Designer</SubType>
<DependentUpon>frmMain.cs</DependentUpon> <DependentUpon>frmMain.cs</DependentUpon>
@@ -169,8 +133,6 @@
<Content Include="ASCOM.ico" /> <Content Include="ASCOM.ico" />
<Content Include="ASCOM.png" /> <Content Include="ASCOM.png" />
<Content Include="ReadMe.htm" /> <Content Include="ReadMe.htm" />
<None Include="BootstrapAscomProfileStore.ps1" />
<None Include="packages.config" />
<None Include="Resources\ASCOM.bmp" /> <None Include="Resources\ASCOM.bmp" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
@@ -194,6 +156,7 @@
<Install>true</Install> <Install>true</Install>
</BootstrapperPackage> </BootstrapperPackage>
</ItemGroup> </ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets. Other similar extension points exist, see Microsoft.Common.targets.
-11
View File
@@ -1,11 +0,0 @@
namespace ASCOM.Meade.net
{
public class ProfileProperties
{
// properies that are part of the profile
public string ComPort { get; set; }
public bool TraceLogger { get; set; }
public double GuideRateArcSecondsPerSecond { get; set; }
public string Precision { get; set; }
}
}
+4 -3
View File
@@ -1,4 +1,5 @@
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
@@ -8,7 +9,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyDescription("ASCOM multi-interface server for Meade.net")] [assembly: AssemblyDescription("ASCOM multi-interface server for Meade.net")]
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("cjdawson.com")] [assembly: AssemblyCompany("cjdawson.com")]
[assembly: AssemblyProduct("ASCOM Meade Generic")] [assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("Copyright © 2019 cjdawson.com")] [assembly: AssemblyCopyright("Copyright © 2019 cjdawson.com")]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture("")]
@@ -20,7 +21,7 @@ using System.Runtime.InteropServices;
// Build Number // Build Number
// Revision // Revision
// //
[assembly: AssemblyVersion("0.0.0.0")] [assembly: AssemblyVersion("0.6.0.1")]
[assembly: AssemblyFileVersion("0.0.0.0")] [assembly: AssemblyFileVersion("0.6.0.1")]
[assembly: ComVisibleAttribute(false)] [assembly: ComVisibleAttribute(false)]
+1
View File
@@ -1,3 +1,4 @@
using System;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
namespace ASCOM.Meade.net namespace ASCOM.Meade.net
+12 -74
View File
@@ -1,20 +1,21 @@
using System; using System;
using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Drawing;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
using ASCOM.Utilities;
using ASCOM.Meade.net;
namespace ASCOM.Meade.net namespace ASCOM.Meade.net
{ {
[ComVisible(false)] // Form not registered for COM! [ComVisible(false)] // Form not registered for COM!
public partial class SetupDialogForm : Form public partial class SetupDialogForm : Form
{ {
public SetupDialogForm() public SetupDialogForm()
{ {
InitializeComponent(); InitializeComponent();
var assemblyInfo = new AssemblyInfo();
Text = $"{assemblyInfo.Product} Settings ({assemblyInfo.AssemblyVersion})";
} }
private void cmdCancel_Click(object sender, EventArgs e) // Cancel button event handler private void cmdCancel_Click(object sender, EventArgs e) // Cancel button event handler
@@ -28,49 +29,36 @@ namespace ASCOM.Meade.net
{ {
System.Diagnostics.Process.Start("http://ascom-standards.org/"); System.Diagnostics.Process.Start("http://ascom-standards.org/");
} }
catch (Win32Exception noBrowser) catch (System.ComponentModel.Win32Exception noBrowser)
{ {
if (noBrowser.ErrorCode == -2147467259) if (noBrowser.ErrorCode == -2147467259)
MessageBox.Show(noBrowser.Message); MessageBox.Show(noBrowser.Message);
} }
catch (Exception other) catch (System.Exception other)
{ {
MessageBox.Show(other.Message); MessageBox.Show(other.Message);
} }
} }
public void SetProfile(ProfileProperties profileProperties) public void SetProfile(ProfileProperties profileProperties)
{ {
chkTrace.Checked = profileProperties.TraceLogger; chkTrace.Checked = profileProperties.TraceLogger;
// set the list of com ports to those that are currently available // set the list of com ports to those that are currently available
comboBoxComPort.Items.Clear(); comboBoxComPort.Items.Clear();
comboBoxComPort.Items.AddRange(System.IO.Ports.SerialPort comboBoxComPort.Items.AddRange(System.IO.Ports.SerialPort.GetPortNames()); // use System.IO because it's static
.GetPortNames()); // use System.IO because it's static
// select the current port if possible // select the current port if possible
if (comboBoxComPort.Items.Contains(profileProperties.ComPort)) if (comboBoxComPort.Items.Contains(profileProperties.ComPort))
{ {
comboBoxComPort.SelectedItem = profileProperties.ComPort; comboBoxComPort.SelectedItem = profileProperties.ComPort;
} }
txtGuideRate.Text = profileProperties.GuideRateArcSecondsPerSecond.ToString();
try
{
cboPrecision.SelectedItem = profileProperties.Precision;
}
catch (Exception)
{
cboPrecision.SelectedItem = "Unchanged";
}
} }
public ProfileProperties GetProfile() public ProfileProperties GetProfile()
{ {
var profileProperties = new ProfileProperties var profileProperties = new ProfileProperties
{ {
TraceLogger = chkTrace.Checked, TraceLogger = chkTrace.Checked,
ComPort = comboBoxComPort.SelectedItem.ToString(), ComPort = comboBoxComPort.SelectedItem.ToString()
GuideRateArcSecondsPerSecond = double.Parse(txtGuideRate.Text.Trim()),
Precision = cboPrecision.SelectedItem.ToString()
}; };
return profileProperties; return profileProperties;
@@ -78,57 +66,7 @@ namespace ASCOM.Meade.net
private void SetupDialogForm_Shown(object sender, EventArgs e) private void SetupDialogForm_Shown(object sender, EventArgs e)
{ {
Win32Utilities.BringWindowToFront(Handle);
Activate(); Activate();
} }
private bool _guideRateValid = true;
private void TextBox1_TextChanged(object sender, EventArgs e)
{
//const double SIDRATE = 0.9972695677; //synodic/solar seconds per sidereal second
try
{
double newGuideRate = double.Parse(txtGuideRate.Text.Trim());
const double siderealArcSecondsPerSecond = 15.041;
var percentOfSideReal = (newGuideRate / siderealArcSecondsPerSecond * 100);
lblPercentOfSiderealRate.Text = $"({percentOfSideReal:00.0}% of sidereal rate)";
_guideRateValid = true;
}
catch (Exception)
{
//Surpressing this exception as if the value is not valid then it's not useful.
_guideRateValid = false;
}
UpdateOKButton();
}
private void UpdateOKButton()
{
cmdOK.Enabled = _guideRateValid && (comboBoxComPort.SelectedItem != null);
}
private void ComboBoxComPort_SelectedValueChanged(object sender, EventArgs e)
{
UpdateOKButton();
}
public void SetReadOnlyMode()
{
foreach (Control control in Controls)
{
control.Enabled = false;
}
cmdCancel.Enabled = true;
//cmdOK.Enabled = false;
//comboBoxComPort.Enabled = false;
//chkTrace.Enabled = false;
//txtGuideRate.Enabled = false;
//cboPrecision.Enabled = false;
}
} }
} }
-57
View File
@@ -36,12 +36,6 @@ namespace ASCOM.Meade.net
this.label2 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label();
this.chkTrace = new System.Windows.Forms.CheckBox(); this.chkTrace = new System.Windows.Forms.CheckBox();
this.comboBoxComPort = new System.Windows.Forms.ComboBox(); this.comboBoxComPort = new System.Windows.Forms.ComboBox();
this.label3 = new System.Windows.Forms.Label();
this.txtGuideRate = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.lblPercentOfSiderealRate = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.cboPrecision = new System.Windows.Forms.ComboBox();
((System.ComponentModel.ISupportInitialize)(this.picASCOM)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.picASCOM)).BeginInit();
this.SuspendLayout(); this.SuspendLayout();
// //
@@ -91,55 +85,11 @@ namespace ASCOM.Meade.net
this.comboBoxComPort.FormattingEnabled = true; this.comboBoxComPort.FormattingEnabled = true;
resources.ApplyResources(this.comboBoxComPort, "comboBoxComPort"); resources.ApplyResources(this.comboBoxComPort, "comboBoxComPort");
this.comboBoxComPort.Name = "comboBoxComPort"; this.comboBoxComPort.Name = "comboBoxComPort";
this.comboBoxComPort.SelectedValueChanged += new System.EventHandler(this.ComboBoxComPort_SelectedValueChanged);
//
// label3
//
resources.ApplyResources(this.label3, "label3");
this.label3.Name = "label3";
//
// txtGuideRate
//
resources.ApplyResources(this.txtGuideRate, "txtGuideRate");
this.txtGuideRate.Name = "txtGuideRate";
this.txtGuideRate.TextChanged += new System.EventHandler(this.TextBox1_TextChanged);
//
// label4
//
resources.ApplyResources(this.label4, "label4");
this.label4.Name = "label4";
//
// lblPercentOfSiderealRate
//
resources.ApplyResources(this.lblPercentOfSiderealRate, "lblPercentOfSiderealRate");
this.lblPercentOfSiderealRate.Name = "lblPercentOfSiderealRate";
//
// label5
//
resources.ApplyResources(this.label5, "label5");
this.label5.Name = "label5";
//
// cboPrecision
//
this.cboPrecision.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cboPrecision.FormattingEnabled = true;
this.cboPrecision.Items.AddRange(new object[] {
resources.GetString("cboPrecision.Items"),
resources.GetString("cboPrecision.Items1"),
resources.GetString("cboPrecision.Items2")});
resources.ApplyResources(this.cboPrecision, "cboPrecision");
this.cboPrecision.Name = "cboPrecision";
// //
// SetupDialogForm // SetupDialogForm
// //
resources.ApplyResources(this, "$this"); resources.ApplyResources(this, "$this");
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.cboPrecision);
this.Controls.Add(this.label5);
this.Controls.Add(this.lblPercentOfSiderealRate);
this.Controls.Add(this.label4);
this.Controls.Add(this.txtGuideRate);
this.Controls.Add(this.label3);
this.Controls.Add(this.comboBoxComPort); this.Controls.Add(this.comboBoxComPort);
this.Controls.Add(this.chkTrace); this.Controls.Add(this.chkTrace);
this.Controls.Add(this.label2); this.Controls.Add(this.label2);
@@ -152,7 +102,6 @@ namespace ASCOM.Meade.net
this.MinimizeBox = false; this.MinimizeBox = false;
this.Name = "SetupDialogForm"; this.Name = "SetupDialogForm";
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
this.TopMost = true;
this.Shown += new System.EventHandler(this.SetupDialogForm_Shown); this.Shown += new System.EventHandler(this.SetupDialogForm_Shown);
((System.ComponentModel.ISupportInitialize)(this.picASCOM)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.picASCOM)).EndInit();
this.ResumeLayout(false); this.ResumeLayout(false);
@@ -169,11 +118,5 @@ namespace ASCOM.Meade.net
private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label2;
private System.Windows.Forms.CheckBox chkTrace; private System.Windows.Forms.CheckBox chkTrace;
private System.Windows.Forms.ComboBox comboBoxComPort; private System.Windows.Forms.ComboBox comboBoxComPort;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.TextBox txtGuideRate;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label lblPercentOfSiderealRate;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.ComboBox cboPrecision;
} }
} }
+11 -173
View File
@@ -123,7 +123,7 @@
</data> </data>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="cmdOK.Location" type="System.Drawing.Point, System.Drawing"> <data name="cmdOK.Location" type="System.Drawing.Point, System.Drawing">
<value>281, 225</value> <value>281, 112</value>
</data> </data>
<data name="cmdOK.Size" type="System.Drawing.Size, System.Drawing"> <data name="cmdOK.Size" type="System.Drawing.Size, System.Drawing">
<value>59, 24</value> <value>59, 24</value>
@@ -145,13 +145,13 @@
<value>$this</value> <value>$this</value>
</data> </data>
<data name="&gt;&gt;cmdOK.ZOrder" xml:space="preserve"> <data name="&gt;&gt;cmdOK.ZOrder" xml:space="preserve">
<value>12</value> <value>6</value>
</data> </data>
<data name="cmdCancel.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms"> <data name="cmdCancel.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Bottom, Right</value> <value>Bottom, Right</value>
</data> </data>
<data name="cmdCancel.Location" type="System.Drawing.Point, System.Drawing"> <data name="cmdCancel.Location" type="System.Drawing.Point, System.Drawing">
<value>281, 255</value> <value>281, 142</value>
</data> </data>
<data name="cmdCancel.Size" type="System.Drawing.Size, System.Drawing"> <data name="cmdCancel.Size" type="System.Drawing.Size, System.Drawing">
<value>59, 25</value> <value>59, 25</value>
@@ -172,13 +172,13 @@
<value>$this</value> <value>$this</value>
</data> </data>
<data name="&gt;&gt;cmdCancel.ZOrder" xml:space="preserve"> <data name="&gt;&gt;cmdCancel.ZOrder" xml:space="preserve">
<value>11</value> <value>5</value>
</data> </data>
<data name="label1.Location" type="System.Drawing.Point, System.Drawing"> <data name="label1.Location" type="System.Drawing.Point, System.Drawing">
<value>12, 9</value> <value>12, 9</value>
</data> </data>
<data name="label1.Size" type="System.Drawing.Size, System.Drawing"> <data name="label1.Size" type="System.Drawing.Size, System.Drawing">
<value>274, 31</value> <value>123, 31</value>
</data> </data>
<data name="label1.TabIndex" type="System.Int32, mscorlib"> <data name="label1.TabIndex" type="System.Int32, mscorlib">
<value>2</value> <value>2</value>
@@ -196,7 +196,7 @@
<value>$this</value> <value>$this</value>
</data> </data>
<data name="&gt;&gt;label1.ZOrder" xml:space="preserve"> <data name="&gt;&gt;label1.ZOrder" xml:space="preserve">
<value>10</value> <value>4</value>
</data> </data>
<data name="picASCOM.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms"> <data name="picASCOM.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Top, Right</value> <value>Top, Right</value>
@@ -223,7 +223,7 @@
<value>$this</value> <value>$this</value>
</data> </data>
<data name="&gt;&gt;picASCOM.ZOrder" xml:space="preserve"> <data name="&gt;&gt;picASCOM.ZOrder" xml:space="preserve">
<value>9</value> <value>3</value>
</data> </data>
<data name="label2.AutoSize" type="System.Boolean, mscorlib"> <data name="label2.AutoSize" type="System.Boolean, mscorlib">
<value>True</value> <value>True</value>
@@ -250,13 +250,13 @@
<value>$this</value> <value>$this</value>
</data> </data>
<data name="&gt;&gt;label2.ZOrder" xml:space="preserve"> <data name="&gt;&gt;label2.ZOrder" xml:space="preserve">
<value>8</value> <value>2</value>
</data> </data>
<data name="chkTrace.AutoSize" type="System.Boolean, mscorlib"> <data name="chkTrace.AutoSize" type="System.Boolean, mscorlib">
<value>True</value> <value>True</value>
</data> </data>
<data name="chkTrace.Location" type="System.Drawing.Point, System.Drawing"> <data name="chkTrace.Location" type="System.Drawing.Point, System.Drawing">
<value>77, 136</value> <value>77, 118</value>
</data> </data>
<data name="chkTrace.Size" type="System.Drawing.Size, System.Drawing"> <data name="chkTrace.Size" type="System.Drawing.Size, System.Drawing">
<value>69, 17</value> <value>69, 17</value>
@@ -277,7 +277,7 @@
<value>$this</value> <value>$this</value>
</data> </data>
<data name="&gt;&gt;chkTrace.ZOrder" xml:space="preserve"> <data name="&gt;&gt;chkTrace.ZOrder" xml:space="preserve">
<value>7</value> <value>1</value>
</data> </data>
<data name="comboBoxComPort.Location" type="System.Drawing.Point, System.Drawing"> <data name="comboBoxComPort.Location" type="System.Drawing.Point, System.Drawing">
<value>77, 87</value> <value>77, 87</value>
@@ -298,168 +298,6 @@
<value>$this</value> <value>$this</value>
</data> </data>
<data name="&gt;&gt;comboBoxComPort.ZOrder" xml:space="preserve"> <data name="&gt;&gt;comboBoxComPort.ZOrder" xml:space="preserve">
<value>6</value>
</data>
<data name="label3.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="label3.Location" type="System.Drawing.Point, System.Drawing">
<value>10, 162</value>
</data>
<data name="label3.Size" type="System.Drawing.Size, System.Drawing">
<value>61, 13</value>
</data>
<data name="label3.TabIndex" type="System.Int32, mscorlib">
<value>8</value>
</data>
<data name="label3.Text" xml:space="preserve">
<value>Guide Rate</value>
</data>
<data name="&gt;&gt;label3.Name" xml:space="preserve">
<value>label3</value>
</data>
<data name="&gt;&gt;label3.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;label3.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;label3.ZOrder" xml:space="preserve">
<value>5</value>
</data>
<data name="txtGuideRate.Location" type="System.Drawing.Point, System.Drawing">
<value>77, 159</value>
</data>
<data name="txtGuideRate.Size" type="System.Drawing.Size, System.Drawing">
<value>46, 20</value>
</data>
<data name="txtGuideRate.TabIndex" type="System.Int32, mscorlib">
<value>9</value>
</data>
<data name="txtGuideRate.Text" xml:space="preserve">
<value>10.0</value>
</data>
<data name="&gt;&gt;txtGuideRate.Name" xml:space="preserve">
<value>txtGuideRate</value>
</data>
<data name="&gt;&gt;txtGuideRate.Type" xml:space="preserve">
<value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;txtGuideRate.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;txtGuideRate.ZOrder" xml:space="preserve">
<value>4</value>
</data>
<data name="label4.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="label4.Location" type="System.Drawing.Point, System.Drawing">
<value>129, 162</value>
</data>
<data name="label4.Size" type="System.Drawing.Size, System.Drawing">
<value>122, 13</value>
</data>
<data name="label4.TabIndex" type="System.Int32, mscorlib">
<value>10</value>
</data>
<data name="label4.Text" xml:space="preserve">
<value>Arc seconds per second</value>
</data>
<data name="&gt;&gt;label4.Name" xml:space="preserve">
<value>label4</value>
</data>
<data name="&gt;&gt;label4.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;label4.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;label4.ZOrder" xml:space="preserve">
<value>3</value>
</data>
<data name="lblPercentOfSiderealRate.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="lblPercentOfSiderealRate.Location" type="System.Drawing.Point, System.Drawing">
<value>129, 175</value>
</data>
<data name="lblPercentOfSiderealRate.Size" type="System.Drawing.Size, System.Drawing">
<value>105, 13</value>
</data>
<data name="lblPercentOfSiderealRate.TabIndex" type="System.Int32, mscorlib">
<value>11</value>
</data>
<data name="lblPercentOfSiderealRate.Text" xml:space="preserve">
<value>(67% of sidereal rate)</value>
</data>
<data name="&gt;&gt;lblPercentOfSiderealRate.Name" xml:space="preserve">
<value>lblPercentOfSiderealRate</value>
</data>
<data name="&gt;&gt;lblPercentOfSiderealRate.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;lblPercentOfSiderealRate.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;lblPercentOfSiderealRate.ZOrder" xml:space="preserve">
<value>2</value>
</data>
<data name="label5.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="label5.Location" type="System.Drawing.Point, System.Drawing">
<value>13, 194</value>
</data>
<data name="label5.Size" type="System.Drawing.Size, System.Drawing">
<value>50, 13</value>
</data>
<data name="label5.TabIndex" type="System.Int32, mscorlib">
<value>12</value>
</data>
<data name="label5.Text" xml:space="preserve">
<value>Precision</value>
</data>
<data name="&gt;&gt;label5.Name" xml:space="preserve">
<value>label5</value>
</data>
<data name="&gt;&gt;label5.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;label5.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;label5.ZOrder" xml:space="preserve">
<value>1</value>
</data>
<data name="cboPrecision.Items" xml:space="preserve">
<value>Unchanged</value>
</data>
<data name="cboPrecision.Items1" xml:space="preserve">
<value>Low</value>
</data>
<data name="cboPrecision.Items2" xml:space="preserve">
<value>High</value>
</data>
<data name="cboPrecision.Location" type="System.Drawing.Point, System.Drawing">
<value>77, 191</value>
</data>
<data name="cboPrecision.Size" type="System.Drawing.Size, System.Drawing">
<value>90, 21</value>
</data>
<data name="cboPrecision.TabIndex" type="System.Int32, mscorlib">
<value>13</value>
</data>
<data name="&gt;&gt;cboPrecision.Name" xml:space="preserve">
<value>cboPrecision</value>
</data>
<data name="&gt;&gt;cboPrecision.Type" xml:space="preserve">
<value>System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;cboPrecision.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;cboPrecision.ZOrder" xml:space="preserve">
<value>0</value> <value>0</value>
</data> </data>
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
@@ -469,7 +307,7 @@
<value>6, 13</value> <value>6, 13</value>
</data> </data>
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing"> <data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
<value>350, 288</value> <value>350, 175</value>
</data> </data>
<data name="$this.StartPosition" type="System.Windows.Forms.FormStartPosition, System.Windows.Forms"> <data name="$this.StartPosition" type="System.Windows.Forms.FormStartPosition, System.Windows.Forms">
<value>CenterScreen</value> <value>CenterScreen</value>
+74 -106
View File
@@ -15,11 +15,19 @@
// //
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Text;
using ASCOM;
using ASCOM.Utilities; using ASCOM.Utilities;
namespace ASCOM.Meade.net namespace ASCOM.Meade.net
{ {
public class ProfileProperties
{
// properies that are part of the profile
public string ComPort { get; set; }
public bool TraceLogger { get; set; }
}
/// <summary> /// <summary>
/// The resources shared by all drivers and devices, in this example it's a serial port with a shared SendMessage method /// The resources shared by all drivers and devices, in this example it's a serial port with a shared SendMessage method
/// an idea for locking the message and handling connecting is given. /// an idea for locking the message and handling connecting is given.
@@ -31,10 +39,10 @@ namespace ASCOM.Meade.net
public static class SharedResources public static class SharedResources
{ {
// object used for locking to prevent multiple drivers accessing common code at the same time // object used for locking to prevent multiple drivers accessing common code at the same time
private static readonly object LockObject = new object(); private static readonly object lockObject = new object();
// Shared serial port. This will allow multiple drivers to use one single serial port. // Shared serial port. This will allow multiple drivers to use one single serial port.
private static Serial _sSharedSerial; // Shared serial port private static ASCOM.Utilities.Serial s_sharedSerial; // Shared serial port
// //
// Public access to shared resources // Public access to shared resources
@@ -59,7 +67,7 @@ namespace ASCOM.Meade.net
/// <summary> /// <summary>
/// Shared serial port /// Shared serial port
/// </summary> /// </summary>
public static Serial SharedSerial => _sSharedSerial ?? (_sSharedSerial = new Serial()); public static ASCOM.Utilities.Serial SharedSerial => s_sharedSerial ?? (s_sharedSerial = new ASCOM.Utilities.Serial());
/// <summary> /// <summary>
/// number of connections to the shared serial port /// number of connections to the shared serial port
@@ -68,7 +76,7 @@ namespace ASCOM.Meade.net
public static void SendBlind(string message) public static void SendBlind(string message)
{ {
lock (LockObject) lock (lockObject)
{ {
SharedSerial.ClearBuffers(); SharedSerial.ClearBuffers();
SharedSerial.Transmit(message); SharedSerial.Transmit(message);
@@ -91,7 +99,7 @@ namespace ASCOM.Meade.net
/// <returns></returns> /// <returns></returns>
public static string SendString(string message) public static string SendString(string message)
{ {
lock (LockObject) lock (lockObject)
{ {
SharedSerial.ClearBuffers(); SharedSerial.ClearBuffers();
SharedSerial.Transmit(message); SharedSerial.Transmit(message);
@@ -101,7 +109,7 @@ namespace ASCOM.Meade.net
public static string SendChar(string message) public static string SendChar(string message)
{ {
lock (LockObject) lock (lockObject)
{ {
SharedSerial.ClearBuffers(); SharedSerial.ClearBuffers();
SharedSerial.Transmit(message); SharedSerial.Transmit(message);
@@ -111,20 +119,12 @@ namespace ASCOM.Meade.net
public static string ReadTerminated() public static string ReadTerminated()
{ {
lock (LockObject) lock (lockObject)
{ {
return SharedSerial.ReceiveTerminated("#"); return SharedSerial.ReceiveTerminated("#");
} }
} }
public static string ReadCharacters(int throwAwayCharacters)
{
lock (LockObject)
{
return SharedSerial.ReceiveCounted(throwAwayCharacters);
}
}
/// <summary> /// <summary>
/// Example of handling connecting to and disconnection from the /// Example of handling connecting to and disconnection from the
/// shared serial port. /// shared serial port.
@@ -137,7 +137,7 @@ namespace ASCOM.Meade.net
{ {
set set
{ {
lock (LockObject) lock (lockObject)
{ {
if (value) if (value)
{ {
@@ -155,53 +155,47 @@ namespace ASCOM.Meade.net
} }
} }
} }
get => SharedSerial.Connected; get { return SharedSerial.Connected; }
} }
#endregion #endregion
#region Profile #region Profile
private const string DriverId = "ASCOM.MeadeGeneric.Telescope"; internal static string driverID = "ASCOM.MeadeGeneric.Telescope";
// Constants used for Profile persistence // Constants used for Profile persistence
private const string ComPortProfileName = "COM Port"; internal static string comPortProfileName = "COM Port";
private const string TraceStateProfileName = "Trace Level"; internal static string traceStateProfileName = "Trace Level";
private const string GuideRateProfileName = "Guide Rate Arc Seconds Per Second";
private const string PrecisionProfileName = "Precision";
public static void WriteProfile(ProfileProperties profileProperties) public static void WriteProfile(ProfileProperties profileProperties)
{ {
lock (LockObject) lock (lockObject)
{ {
using (Profile driverProfile = new Profile()) using (Profile driverProfile = new Profile())
{ {
driverProfile.DeviceType = "Telescope"; driverProfile.DeviceType = "Telescope";
driverProfile.WriteValue(DriverId, TraceStateProfileName, profileProperties.TraceLogger.ToString()); driverProfile.WriteValue(driverID, traceStateProfileName, profileProperties.TraceLogger.ToString());
driverProfile.WriteValue(DriverId, ComPortProfileName, profileProperties.ComPort); driverProfile.WriteValue(driverID, comPortProfileName, profileProperties.ComPort);
driverProfile.WriteValue(DriverId, GuideRateProfileName, profileProperties.GuideRateArcSecondsPerSecond.ToString());
driverProfile.WriteValue(DriverId, PrecisionProfileName, profileProperties.Precision);
} }
} }
} }
private const string ComPortDefault = "COM1"; private static readonly string comPortDefault = "COM1";
private const string TraceStateDefault = "false"; internal static string traceStateDefault = "false";
private const string GuideRateProfileNameDefault = "10.077939"; //67% of sidereal rate
private const string PrecisionDefault = "Unchanged";
public static ProfileProperties ReadProfile() public static ProfileProperties ReadProfile()
{ {
lock (LockObject) lock (lockObject)
{ {
ProfileProperties profileProperties = new ProfileProperties(); ProfileProperties profileProperties = new ProfileProperties();
using (Profile driverProfile = new Profile()) using (Profile driverProfile = new Profile())
{ {
driverProfile.DeviceType = "Telescope"; driverProfile.DeviceType = "Telescope";
profileProperties.ComPort = driverProfile.GetValue(DriverId, ComPortProfileName, string.Empty, ComPortDefault); profileProperties.ComPort =
profileProperties.TraceLogger = Convert.ToBoolean(driverProfile.GetValue(DriverId, TraceStateProfileName, string.Empty, TraceStateDefault)); driverProfile.GetValue(driverID, comPortProfileName, string.Empty, comPortDefault);
profileProperties.GuideRateArcSecondsPerSecond = double.Parse(driverProfile.GetValue(DriverId, GuideRateProfileName, string.Empty, GuideRateProfileNameDefault)); profileProperties.TraceLogger = Convert.ToBoolean(driverProfile.GetValue(driverID,
profileProperties.Precision = driverProfile.GetValue(DriverId, PrecisionProfileName, string.Empty, PrecisionDefault); traceStateProfileName, string.Empty, traceStateDefault));
} }
return profileProperties; return profileProperties;
@@ -224,19 +218,14 @@ namespace ASCOM.Meade.net
var profileProperties = ReadProfile(); var profileProperties = ReadProfile();
using (SetupDialogForm f = new SetupDialogForm()) using (SetupDialogForm F = new SetupDialogForm())
{ {
f.SetProfile(profileProperties); F.SetProfile(profileProperties);
if (IsConnected()) var result = F.ShowDialog();
{
f.SetReadOnlyMode();
}
var result = f.ShowDialog();
if (result == System.Windows.Forms.DialogResult.OK) if (result == System.Windows.Forms.DialogResult.OK)
{ {
profileProperties = f.GetProfile(); profileProperties = F.GetProfile();
WriteProfile(profileProperties); // Persist device configuration values to the ASCOM Profile store WriteProfile(profileProperties); // Persist device configuration values to the ASCOM Profile store
} }
@@ -244,7 +233,15 @@ namespace ASCOM.Meade.net
} }
#endregion #endregion
#region AutostarProducts
public const string AUTOSTAR497 = "Autostar";
public const string AUTOSTAR497_31EE = "31Ee";
#endregion
#region Multi Driver handling #region Multi Driver handling
public static string ProductName { get; private set; } = string.Empty; public static string ProductName { get; private set; } = string.Empty;
@@ -264,95 +261,66 @@ namespace ASCOM.Meade.net
/// The Key is the connection number that identifies the device, it could be the COM port name, /// The Key is the connection number that identifies the device, it could be the COM port name,
/// USB ID or IP Address, the Value is the DeviceHardware class /// USB ID or IP Address, the Value is the DeviceHardware class
/// </summary> /// </summary>
private static readonly Dictionary<string, DeviceHardware> _connectedDevices = new Dictionary<string, DeviceHardware>(); private static Dictionary<string, DeviceHardware> connectedDevices = new Dictionary<string, DeviceHardware>();
private static readonly Dictionary<string, DeviceHardware> _connectedDeviceIds = new Dictionary<string, DeviceHardware>();
/// <summary> /// <summary>
/// This is called in the driver Connect(true) property, /// This is called in the driver Connect(true) property,
/// it add the device id to the list of devices if it's not there and increments the device count. /// it add the device id to the list of devices if it's not there and increments the device count.
/// </summary> /// </summary>
/// <param name="deviceId"></param> /// <param name="deviceId"></param>
public static ConnectionInfo Connect(string deviceId, string driverId) public static void Connect(string deviceId)
{ {
lock (LockObject) lock (lockObject)
{ {
if (!_connectedDevices.ContainsKey(deviceId)) if (!connectedDevices.ContainsKey(deviceId))
_connectedDevices.Add(deviceId, new DeviceHardware()); connectedDevices.Add(deviceId, new DeviceHardware());
_connectedDevices[deviceId].Count++; // increment the value connectedDevices[deviceId].count++; // increment the value
if (!_connectedDeviceIds.ContainsKey(driverId))
_connectedDeviceIds.Add(driverId, new DeviceHardware());
_connectedDeviceIds[driverId].Count++; // increment the value
if (deviceId == "Serial") if (deviceId == "Serial")
{ {
if (_connectedDevices[deviceId].Count == 1) if (connectedDevices[deviceId].count == 1)
{ {
var profileProperties = ReadProfile(); var profileProperties = ReadProfile();
SharedSerial.PortName = profileProperties.ComPort; SharedResources.SharedSerial.PortName = profileProperties.ComPort;
SharedSerial.DTREnable = false; SharedResources.SharedSerial.DTREnable = false;
SharedSerial.RTSEnable = false; SharedResources.SharedSerial.RTSEnable = false;
SharedSerial.DataBits = 8; SharedResources.SharedSerial.DataBits = 8;
SharedSerial.StopBits = SerialStopBits.One; SharedResources.SharedSerial.StopBits = SerialStopBits.One;
SharedSerial.Parity = SerialParity.None; SharedResources.SharedSerial.Parity = SerialParity.None;
SharedSerial.Speed = SerialSpeed.ps9600; SharedResources.SharedSerial.Speed = SerialSpeed.ps9600;
SharedSerial.Handshake = SerialHandshake.None; SharedResources.SharedSerial.Handshake = SerialHandshake.None;
SharedSerial.Connected = true; SharedResources.SharedSerial.Connected = true;
ProductName = SendString(":GVP#"); ProductName = SendString(":GVP#");
FirmwareVersion = SendString(":GVN#"); FirmwareVersion = SendString(":GVN#");
} }
} }
return new ConnectionInfo
{
Connections = _connectedDevices[deviceId].Count,
SameDevice = _connectedDeviceIds[driverId].Count
};
} }
} }
public static void Disconnect(string deviceId, string driverId) public static void Disconnect(string deviceId)
{ {
lock (LockObject) lock (lockObject)
{ {
if (_connectedDevices.ContainsKey(deviceId)) if (connectedDevices.ContainsKey(deviceId))
{ {
_connectedDevices[deviceId].Count--; connectedDevices[deviceId].count--;
if (_connectedDevices[deviceId].Count <= 0) if (connectedDevices[deviceId].count <= 0)
{ {
_connectedDevices.Remove(deviceId); connectedDevices.Remove(deviceId);
if (deviceId == "Serial") if (deviceId == "Serial")
{ {
SharedSerial.Connected = false; SharedResources.SharedSerial.Connected = false;
} }
} }
} }
if (_connectedDeviceIds.ContainsKey(driverId))
{
_connectedDeviceIds[driverId].Count--;
}
} }
} }
public static bool IsConnected()
{
foreach (var device in _connectedDevices)
{
if (device.Value.Count > 0)
return true;
}
return false;
}
public static bool IsConnected(string deviceId) public static bool IsConnected(string deviceId)
{ {
if (_connectedDevices.ContainsKey(deviceId)) if (connectedDevices.ContainsKey(deviceId))
return (_connectedDevices[deviceId].Count > 0); return (connectedDevices[deviceId].count > 0);
else else
return false; return false;
} }
@@ -361,7 +329,7 @@ namespace ASCOM.Meade.net
public static void Lock(Action action) public static void Lock(Action action)
{ {
lock (LockObject) lock (lockObject)
{ {
action(); action();
} }
@@ -369,7 +337,7 @@ namespace ASCOM.Meade.net
public static T Lock<T>(Func<T> func) public static T Lock<T>(Func<T> func)
{ {
lock (LockObject) lock (lockObject)
{ {
return func(); return func();
} }
@@ -383,7 +351,7 @@ namespace ASCOM.Meade.net
{ {
private int _count; private int _count;
internal int Count internal int count
{ {
set => _count = value; set => _count = value;
get => _count; get => _count;
@@ -391,7 +359,7 @@ namespace ASCOM.Meade.net
internal DeviceHardware() internal DeviceHardware()
{ {
Count = 0; count = 0;
} }
} }
-30
View File
@@ -1,30 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.NetworkInformation;
using System.Text;
namespace ASCOM.Meade.net
{
public static class TelescopeList
{
#region Autostar 497/Audiostar
public readonly static string Autostar497 = "Autostar";
//Autostar/Audiostar firmware revisions
public readonly static string Autostar497_30Ee = "30Ee";
public readonly static string Autostar497_31Ee = "31Ee";
public readonly static string Autostar497_43Eg = "43Eg";
#endregion
#region LX200GPS
public readonly static string LX200GPS = "LX2001";
public readonly static string LX200GPS_42G = "4.2G";
#endregion
}
}
-106
View File
@@ -1,106 +0,0 @@
using System;
using System.Runtime.InteropServices;
using System.Text;
namespace ASCOM.Meade.net
{
internal static class Win32Utilities
{
//Win32 API calls necesary to raise an unowned processs main window
[DllImport("user32.dll")]
private static extern bool SetForegroundWindow(IntPtr hWnd);
[DllImport("user32.dll")]
private static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);
[DllImport("user32.dll")]
private static extern bool IsIconic(IntPtr hWnd);
[DllImport("user32.dll", SetLastError = true)]
private static extern bool SystemParametersInfo(uint uiAction, uint uiParam, IntPtr pvParam, uint fWinIni);
[DllImport("user32.dll", SetLastError = true)]
private static extern uint GetWindowThreadProcessId(IntPtr hWnd, IntPtr lpdwProcessId);
[DllImport("user32.dll")]
private static extern IntPtr GetForegroundWindow();
[DllImport("user32.dll")]
private static extern bool AttachThreadInput(uint idAttach, uint idAttachTo, bool fAttach);
[DllImport("user32.dll")]
static extern bool BringWindowToTop(IntPtr hWnd);
[DllImport("user32.dll")]
private static extern int GetWindowText(IntPtr hWnd, StringBuilder lpString, Int32 nMaxCount);
[DllImport("user32.dll")]
private static extern int GetWindowThreadProcessId(IntPtr hWnd, ref Int32 lpdwProcessId);
[DllImport("User32.dll")]
public static extern IntPtr GetParent(IntPtr hWnd);
private const int SW_HIDE = 0;
private const int SW_SHOWNORMAL = 1;
private const int SW_NORMAL = 1;
private const int SW_SHOWMINIMIZED = 2;
private const int SW_SHOWMAXIMIZED = 3;
private const int SW_MAXIMIZE = 3;
private const int SW_SHOWNOACTIVATE = 4;
private const int SW_SHOW = 5;
private const int SW_MINIMIZE = 6;
private const int SW_SHOWMINNOACTIVE = 7;
private const int SW_SHOWNA = 8;
private const int SW_RESTORE = 9;
private const int SW_SHOWDEFAULT = 10;
private const int SW_MAX = 10;
private const uint SPI_GETFOREGROUNDLOCKTIMEOUT = 0x2000;
private const uint SPI_SETFOREGROUNDLOCKTIMEOUT = 0x2001;
private const int SPIF_SENDCHANGE = 0x2;
public static void BringWindowToFront(IntPtr hWnd)
{
if (IsIconic(hWnd))
ShowWindowAsync(hWnd, SW_RESTORE);
ShowWindowAsync(hWnd, SW_SHOW);
SetForegroundWindow(hWnd);
// Code from Karl E. Peterson, www.mvps.org/vb/sample.htm
// Converted to Delphi by Ray Lischner
// Published in The Delphi Magazine 55, page 16
// Converted to C# by Kevin Gale
IntPtr foregroundWindow = GetForegroundWindow();
IntPtr Dummy = IntPtr.Zero;
uint foregroundThreadId = GetWindowThreadProcessId(foregroundWindow, Dummy);
uint thisThreadId = GetWindowThreadProcessId(hWnd, Dummy);
if (AttachThreadInput(thisThreadId, foregroundThreadId, true))
{
BringWindowToTop(hWnd); // IE 5.5 related hack
SetForegroundWindow(hWnd);
AttachThreadInput(thisThreadId, foregroundThreadId, false);
}
if (GetForegroundWindow() != hWnd)
{
// Code by Daniel P. Stasinski
// Converted to C# by Kevin Gale
IntPtr Timeout = IntPtr.Zero;
SystemParametersInfo(SPI_GETFOREGROUNDLOCKTIMEOUT, 0, Timeout, 0);
SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT, 0, Dummy, SPIF_SENDCHANGE);
BringWindowToTop(hWnd); // IE 5.5 related hack
SetForegroundWindow(hWnd);
SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT, 0, Timeout, SPIF_SENDCHANGE);
}
}
}
}
@@ -1,96 +0,0 @@
using System;
namespace ASCOM.Meade.net.Wrapper
{
public interface ISharedResourcesWrapper
{
ConnectionInfo Connect(string deviceId, string driverId);
void Disconnect(string deviceId, string driverId);
string ProductName { get; }
string FirmwareVersion { get; }
void Lock(Action action);
T Lock<T>(Func<T> func);
string SendString(string message);
void SendBlind(string message);
string SendChar(string message);
string ReadTerminated();
ProfileProperties ReadProfile();
void SetupDialog();
void WriteProfile(ProfileProperties profileProperties);
string ReadCharacters(int throwAwayCharacters);
}
public class SharedResourcesWrapper : ISharedResourcesWrapper
{
public ConnectionInfo Connect(string deviceId, string driverId)
{
return SharedResources.Connect(deviceId, driverId);
}
public void Disconnect(string deviceId, string driverId)
{
SharedResources.Disconnect(deviceId, driverId);
}
public string ProductName => SharedResources.ProductName;
public string FirmwareVersion => SharedResources.FirmwareVersion;
public void Lock(Action action)
{
SharedResources.Lock(action);
}
public T Lock<T>(Func<T> func)
{
return SharedResources.Lock(func);
}
public string SendString(string message)
{
return SharedResources.SendString(message);
}
public void SendBlind(string message)
{
SharedResources.SendBlind(message);
}
public string SendChar(string message)
{
return SharedResources.SendChar(message);
}
public string ReadTerminated()
{
return SharedResources.ReadTerminated();
}
public string ReadCharacters(int throwAwayCharacters)
{
return SharedResources.ReadCharacters(throwAwayCharacters);
}
public ProfileProperties ReadProfile()
{
return SharedResources.ReadProfile();
}
public void SetupDialog()
{
SharedResources.SetupDialog();
}
public void WriteProfile(ProfileProperties profileProperties)
{
SharedResources.WriteProfile(profileProperties);
}
}
}
+2 -2
View File
@@ -2,7 +2,7 @@ using System;
namespace ASCOM.Meade.net namespace ASCOM.Meade.net
{ {
partial class FrmMain partial class frmMain
{ {
/// <summary> /// <summary>
/// Required designer variable. /// Required designer variable.
@@ -48,7 +48,7 @@ namespace ASCOM.Meade.net
this.ClientSize = new System.Drawing.Size(233, 52); this.ClientSize = new System.Drawing.Size(233, 52);
this.Controls.Add(this.label1); this.Controls.Add(this.label1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.Name = "FrmMain"; this.Name = "frmMain";
this.Text = "Meade.net Driver Server"; this.Text = "Meade.net Driver Server";
this.ResumeLayout(false); this.ResumeLayout(false);
+7 -2
View File
@@ -1,12 +1,17 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
namespace ASCOM.Meade.net namespace ASCOM.Meade.net
{ {
public partial class FrmMain : Form public partial class frmMain : Form
{ {
delegate void SetTextCallback(string text); delegate void SetTextCallback(string text);
public FrmMain() public frmMain()
{ {
InitializeComponent(); InitializeComponent();
} }
-4
View File
@@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="ASCOM.Platform" version="6.4.2" targetFramework="net40" />
</packages>
+6 -3
View File
@@ -9,8 +9,11 @@
#define UseChooser #define UseChooser
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ASCOM.Meade.net namespace ASCOM
{ {
class Program class Program
{ {
@@ -19,11 +22,11 @@ namespace ASCOM.Meade.net
// Uncomment the code that's required // Uncomment the code that's required
#if UseChooser #if UseChooser
// choose the device // choose the device
string id = DriverAccess.Telescope.Choose("ASCOM.MeadeGeneric.Telescope"); string id = ASCOM.DriverAccess.Telescope.Choose("ASCOM.MeadeGeneric.Telescope");
if (string.IsNullOrEmpty(id)) if (string.IsNullOrEmpty(id))
return; return;
// create this device // create this device
DriverAccess.Telescope device = new DriverAccess.Telescope(id); ASCOM.DriverAccess.Telescope device = new ASCOM.DriverAccess.Telescope(id);
#else #else
// this can be replaced by this code, it avoids the chooser and creates the driver class directly. // this can be replaced by this code, it avoids the chooser and creates the driver class directly.
ASCOM.DriverAccess.Telescope device = new ASCOM.DriverAccess.Telescope("ASCOM.Meade.net.Telescope"); ASCOM.DriverAccess.Telescope device = new ASCOM.DriverAccess.Telescope("ASCOM.Meade.net.Telescope");
@@ -1,4 +1,5 @@
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
@@ -31,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
[assembly: AssemblyVersion("0.0.0.0")] [assembly: AssemblyVersion("0.6.0.1")]
[assembly: AssemblyFileVersion("0.0.0.0")] [assembly: AssemblyFileVersion("0.6.0.1")]
@@ -36,25 +36,6 @@
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit> <Prefer32Bit>false</Prefer32Bit>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="ASCOM.DeviceInterfaces, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL" /> <Reference Include="ASCOM.DeviceInterfaces, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL" />
<Reference Include="ASCOM.DriverAccess, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL" /> <Reference Include="ASCOM.DriverAccess, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL" />
-42
View File
@@ -1,42 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--EXTERNAL_PROPERTIES: outputDir-->
<project name="Meade.net" default="publish">
<property name="solution.directory" value="${directory::get-current-directory()}"/>
<property name="build.output.directory" value="${solution.directory}\${outputDir}"/>
<target name="setup">
<delete dir="${build.output.directory}"/>
<mkdir dir="${build.output.directory}"/>
</target>
<target name="compile.application" depends="setup">
<!-- compilation handled by TeamCity-->
</target>
<target name="cleanup" depends="setup">
<!-- no cleanup necessary-->
</target>
<target name="publish" depends="cleanup">
<!-- publish -->
<copy todir="${build.output.directory}">
<fileset basedir="${solution.directory}\Meade.net.Setup\bin\${configuration}">
<include name="**/*" />
</fileset>
</copy>
<copy todir="${build.output.directory}">
<fileset basedir="${solution.directory}\bin\${configuration}">
<include name="**/*" />
</fileset>
</copy>
<foreach item="File" in="${build.output.directory}" property="fileName">
<if test="${string::to-lower(path::get-extension(fileName)) == '.msi'}">
<move file="${fileName}" tofile="${path::combine(path::get-directory-name(fileName), path::get-file-name-without-extension(fileName) + '.' + environment::get-variable('BUILD_NUMBER') + '.msi')}" />
</if>
</foreach>
</target>
</project>