Compare commits
120 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| df3887c385 | |||
| 53150f9400 | |||
| ac887ccdff | |||
| 0e98f0e370 | |||
| 9cf63c4912 | |||
| d6f72c8222 | |||
| c1cae2b0c4 | |||
| 2ce8c4e123 | |||
| dfef48ff0c | |||
| 4b65c946d2 | |||
| 3579189465 | |||
| 8b31c8d7a9 | |||
| 04845cea7a | |||
| aeaaf9df95 | |||
| 1d5dcb529e | |||
| fdeee5b822 | |||
| a53f99810d | |||
| 325e9908a7 | |||
| 83865a3911 | |||
| b3b1d95cda | |||
| bfb8f257a1 | |||
| 3109d1dcef | |||
| 0ac7b8b7bd | |||
| ee60613a95 | |||
| a6308f1a64 | |||
| 0475217d62 | |||
| e89f01ed51 | |||
| 2846e9f719 | |||
| a7904d7485 | |||
| 12c11b4987 | |||
| 07569b146e | |||
| 112fdf0bb9 | |||
| 73e8e8ffe8 | |||
| 34a145765b | |||
| e3f82ff232 | |||
| 5f5d819f3b | |||
| 69434454ca | |||
| 8980c3c6b5 | |||
| bfde58c6af | |||
| 64b949551e | |||
| bd49a86866 | |||
| 8089e8d536 | |||
| 3162827396 | |||
| 02f69b54a4 | |||
| 4ea22d9455 | |||
| 916c04a791 | |||
| d03b0f2cd1 | |||
| feb69c970f | |||
| 9049412acc | |||
| 44e02dda1d | |||
| c72d2c00fc | |||
| 465d4cb5d9 | |||
| f8cbc3fa8d | |||
| ca3dd0e4fd | |||
| bc90049798 | |||
| a0a908d67d | |||
| 69c690aa54 | |||
| 617faee9dd | |||
| 335c7da935 | |||
| 71bc7fd49a | |||
| 621b7dc2da | |||
| 8e1188ac49 | |||
| d8b4886b85 | |||
| 4c92bf13c2 | |||
| 22de5679b7 | |||
| 5501e97b7e | |||
| 675ed08425 | |||
| 8da41cad6f | |||
| 2b5b5d7188 | |||
| d328c3ae4d | |||
| 546d0bf7f4 | |||
| 678b5f1ece | |||
| 7cb50de30d | |||
| d39846fa18 | |||
| cf28ecc7c2 | |||
| cf5a6c72fe | |||
| 85fcb8a73c | |||
| 79a77d4e1d | |||
| b795634d70 | |||
| cf3b268ef3 | |||
| ef555796a4 | |||
| 404366d552 | |||
| 3dc5efee9a | |||
| 0c1d7d7f09 | |||
| 9ec9610a3b | |||
| 9b7a850607 | |||
| 43f10bad7a | |||
| 3f8853c7c5 | |||
| fed8b1a24b | |||
| 6a4c08a7c4 | |||
| 9608e5a31f | |||
| 5d16edee2e | |||
| cc5eabdfab | |||
| 56febb46cc | |||
| eab151d295 | |||
| 76eb088d4e | |||
| ee088ff35c | |||
| 75d2d080a3 | |||
| 2d69a4fba8 | |||
| e8793231d1 | |||
| 7df8da2f59 | |||
| ae4ba48ce2 | |||
| c0c0bedbba | |||
| 76c88420ca | |||
| 7225c2d70f | |||
| d2fae7607b | |||
| d1b3f5718f | |||
| c2ecb1891c | |||
| 9e4c7862f9 | |||
| 0d04ecd587 | |||
| a59b602b54 | |||
| eb3c7710d7 | |||
| ef982a3aba | |||
| 90eb1c604b | |||
| e339831f0c | |||
| dc2a24ad25 | |||
| da6b7ec55f | |||
| f2f4b05911 | |||
| a742867377 | |||
| 3be908e6bd |
@@ -54,10 +54,10 @@
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Castle.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Castle.Core.4.3.1\lib\net45\Castle.Core.dll</HintPath>
|
||||
<HintPath>..\packages\Castle.Core.4.4.0\lib\net45\Castle.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Moq, Version=4.10.0.0, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Moq.4.10.1\lib\net45\Moq.dll</HintPath>
|
||||
<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>
|
||||
@@ -65,11 +65,11 @@
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Core" />
|
||||
<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.0\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
||||
<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.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.1\lib\netstandard2.0\System.Threading.Tasks.Extensions.dll</HintPath>
|
||||
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.2\lib\netstandard2.0\System.Threading.Tasks.Extensions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using System;
|
||||
using ASCOM.Meade.net;
|
||||
using ASCOM.Meade.net.AstroMaths;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace AstroMath.UnitTests
|
||||
@@ -52,16 +52,16 @@ namespace AstroMath.UnitTests
|
||||
public void UTtoGST_book()
|
||||
{
|
||||
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));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void UTtoGST()
|
||||
public void UTtoGst()
|
||||
{
|
||||
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));
|
||||
}
|
||||
@@ -71,16 +71,16 @@ namespace AstroMath.UnitTests
|
||||
{
|
||||
double gst = 4.668119;
|
||||
var longitude = -64;
|
||||
var lst = _astroMath.GSTtoLST(gst, longitude);
|
||||
var lst = _astroMath.GsTtoLst(gst, longitude);
|
||||
Assert.That(lst, Is.EqualTo(0.4014523333333333));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GSTtoLST()
|
||||
public void GsTtoLst()
|
||||
{
|
||||
double gst = 14.257589512545053;
|
||||
var longitude = -1.7833333333333332;
|
||||
var lst = _astroMath.GSTtoLST(gst, longitude);
|
||||
var lst = _astroMath.GsTtoLst(gst, longitude);
|
||||
Assert.That(lst, Is.EqualTo(14.138700623656163));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
@@ -32,5 +31,5 @@ using System.Runtime.InteropServices;
|
||||
// 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.6.0.0")]
|
||||
[assembly: AssemblyFileVersion("0.6.0.0")]
|
||||
[assembly: AssemblyVersion("0.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("0.0.0.0")]
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Castle.Core" version="4.3.1" targetFramework="net472" />
|
||||
<package id="Moq" version="4.10.1" 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.0" targetFramework="net472" />
|
||||
<package id="System.Threading.Tasks.Extensions" version="4.5.1" targetFramework="net472" />
|
||||
<package id="System.Runtime.CompilerServices.Unsafe" version="4.5.2" targetFramework="net472" />
|
||||
<package id="System.Threading.Tasks.Extensions" version="4.5.2" targetFramework="net472" />
|
||||
</packages>
|
||||
@@ -9,13 +9,10 @@
|
||||
#define UseChooser
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using ASCOM.DriverAccess;
|
||||
|
||||
namespace ASCOM
|
||||
namespace ASCOM.MeadeGeneric
|
||||
{
|
||||
class Program
|
||||
{
|
||||
@@ -24,11 +21,11 @@ namespace ASCOM
|
||||
// Uncomment the code that's required
|
||||
#if UseChooser
|
||||
// choose the device
|
||||
string id = ASCOM.DriverAccess.Focuser.Choose("ASCOM.MeadeGeneric.Focuser");
|
||||
string id = Focuser.Choose("ASCOM.MeadeGeneric.Focuser");
|
||||
if (string.IsNullOrEmpty(id))
|
||||
return;
|
||||
// create this device
|
||||
ASCOM.DriverAccess.Focuser device = new ASCOM.DriverAccess.Focuser(id);
|
||||
Focuser device = new Focuser(id);
|
||||
#else
|
||||
// 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");
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
@@ -32,5 +31,5 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
|
||||
[assembly: AssemblyVersion("0.6.0.0")]
|
||||
[assembly: AssemblyFileVersion("0.6.0.0")]
|
||||
[assembly: AssemblyVersion("0.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("0.0.0.0")]
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
<?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>
|
||||
@@ -0,0 +1,36 @@
|
||||
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")]
|
||||
@@ -43,6 +43,6 @@
|
||||
<!-- <?endif ?> -->
|
||||
|
||||
<!-- Set installer version based on the file version of the main assembly. -->
|
||||
<!--<?define ProductVersion="!(bind.FileVersion.filLocalServerAssembly)"?>-->
|
||||
<?define ProductVersion="0.6.0.0"?>
|
||||
<?define ProductVersion="!(bind.FileVersion.filLocalServerAssembly)"?>
|
||||
<!--<?define ProductVersion="0.7.0.0"?>-->
|
||||
</Include>
|
||||
@@ -12,8 +12,18 @@
|
||||
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
|
||||
|
||||
<MediaTemplate EmbedCab="yes" />
|
||||
|
||||
<Property Id="REGISTRYROOT" Value="Software\Cjdawson.com Ltd\Database Patcher" />
|
||||
|
||||
<Property Id="ASCOMPLATFORMVERSION">
|
||||
<RegistrySearch Id="AscomPlatformVersion"
|
||||
Root="HKLM"
|
||||
Key="SOFTWARE\ASCOM\Platform"
|
||||
Name="Platform Version"
|
||||
Type="raw" />
|
||||
</Property>
|
||||
|
||||
<Condition Message="This application requires Ascom Platform 6.4 SP1 or higher. Please install this before installing the driver.">
|
||||
<![CDATA[Installed OR ASCOMPLATFORMVERSION >= "6.4.1"]]>
|
||||
</Condition>
|
||||
|
||||
<PropertyRef Id="NETFRAMEWORK40FULL"/>
|
||||
<Condition Message="This application requires .NET Framework 4.0 or higher. Please install the .NET Framework then run this installer again.">
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
<#
|
||||
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
|
||||
@@ -0,0 +1,142 @@
|
||||
<?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>x86</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.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.2\lib\portable-net45+win8+wp8+wpa81\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>
|
||||
@@ -0,0 +1,35 @@
|
||||
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
@@ -0,0 +1,11 @@
|
||||
<?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>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/></startup></configuration>
|
||||
@@ -0,0 +1,9 @@
|
||||
<?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.2" targetFramework="net45" requireReinstallation="true" />
|
||||
</packages>
|
||||
@@ -0,0 +1,12 @@
|
||||
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,38 +1,17 @@
|
||||
using System;
|
||||
using ASCOM.Utilities;
|
||||
|
||||
namespace ASCOM.Meade.net
|
||||
namespace ASCOM.Meade.net.AstroMaths
|
||||
{
|
||||
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
|
||||
public class AstroMaths : IAstroMaths
|
||||
{
|
||||
|
||||
//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)
|
||||
{
|
||||
var ut = DateTimeToDecimalHours( utcDateTime);
|
||||
var gst = UTtoGST( utcDateTime);
|
||||
var lst = GSTtoLST( gst, longitude);
|
||||
var gst = UTtoGst( utcDateTime);
|
||||
var lst = GsTtoLst( gst, longitude);
|
||||
var raHours = rightAscension;
|
||||
var h1 = lst - raHours;
|
||||
var h = h1;
|
||||
@@ -45,8 +24,8 @@ namespace ASCOM.Meade.net
|
||||
|
||||
public double HourAngleToRightAscension(DateTime utcDateTime, double longitude, double hourAngle )
|
||||
{
|
||||
var gst = UTtoGST(utcDateTime);
|
||||
var lst = GSTtoLST( gst, longitude);
|
||||
var gst = UTtoGst(utcDateTime);
|
||||
var lst = GsTtoLst( gst, longitude);
|
||||
var raHours = hourAngle;
|
||||
var h1 = lst - raHours;
|
||||
var h = h1;
|
||||
@@ -150,7 +129,7 @@ namespace ASCOM.Meade.net
|
||||
}
|
||||
|
||||
//todo convert to extension method
|
||||
public double UTtoGST(DateTime utcDateTime)
|
||||
public double UTtoGst(DateTime utcDateTime)
|
||||
{
|
||||
Util util = new Util();
|
||||
|
||||
@@ -192,7 +171,7 @@ namespace ASCOM.Meade.net
|
||||
return t1;
|
||||
}
|
||||
|
||||
public double GSTtoLST(double gst, double longitude)
|
||||
public double GsTtoLst(double gst, double longitude)
|
||||
{
|
||||
var l = longitude/ 15;
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace ASCOM.Meade.net.AstroMaths
|
||||
{
|
||||
public class EquatorialCoordinates
|
||||
{
|
||||
public double RightAscension { get; set; }
|
||||
public double Declination { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace ASCOM.Meade.net.AstroMaths
|
||||
{
|
||||
public class HorizonCoordinates
|
||||
{
|
||||
public double Altitude { get; set; }
|
||||
public double Azimuth { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<#
|
||||
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
|
||||
@@ -68,14 +68,39 @@
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<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" />
|
||||
<Reference Include="ASCOM.Controls, 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.Exceptions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL" />
|
||||
<Reference Include="ASCOM.SettingsProvider, 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" />
|
||||
<Reference Include="ASCOM.Utilities.Video, Version=6.1.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>
|
||||
<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="System" />
|
||||
<Reference Include="System.configuration" />
|
||||
<Reference Include="System.Configuration.Install" />
|
||||
@@ -88,7 +113,11 @@
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="AstroMaths.cs" />
|
||||
<Compile Include="AstroMaths\AltitudeData.cs" />
|
||||
<Compile Include="AstroMaths\AstroMaths.cs" />
|
||||
<Compile Include="AstroMaths\EquatorialCoordinates.cs" />
|
||||
<Compile Include="AstroMaths\HorizonCoordinates.cs" />
|
||||
<Compile Include="AstroMaths\IAstroMaths.cs" />
|
||||
<Compile Include="StringExtensions.cs" />
|
||||
<Compile Include="Telescope.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
@@ -115,6 +144,8 @@
|
||||
<None Include="app.config" />
|
||||
<None Include="ASCOM.png" />
|
||||
<None Include="ASCOMDriverTemplate.snk" />
|
||||
<None Include="BootstrapAscomProfileStore.ps1" />
|
||||
<None Include="packages.config" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
<ProjectConfiguration>
|
||||
<Settings>
|
||||
<UseCPUArchitecture>x86</UseCPUArchitecture>
|
||||
</Settings>
|
||||
</ProjectConfiguration>
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
@@ -35,5 +34,5 @@ using System.Runtime.InteropServices;
|
||||
// by using the '*' as shown below:
|
||||
//
|
||||
// TODO - Set your driver's version here
|
||||
[assembly: AssemblyVersion("0.6.0.0")]
|
||||
[assembly: AssemblyFileVersion("0.6.0.0")]
|
||||
[assembly: AssemblyVersion("0.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("0.0.0.0")]
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using ASCOM.DeviceInterface;
|
||||
using System.Collections;
|
||||
using System.Threading;
|
||||
@@ -21,10 +17,10 @@ namespace ASCOM.Meade.net
|
||||
[Guid("288838d1-bbf9-4ce0-9ee1-86ecf38b45c9")]
|
||||
[ClassInterface(ClassInterfaceType.None)]
|
||||
[ComVisible(true)]
|
||||
public class Rate : ASCOM.DeviceInterface.IRate
|
||||
public class Rate : IRate
|
||||
{
|
||||
private double maximum = 0;
|
||||
private double minimum = 0;
|
||||
private double _maximum = 0;
|
||||
private double _minimum = 0;
|
||||
|
||||
//
|
||||
// Default constructor - Internal prevents public creation
|
||||
@@ -32,8 +28,8 @@ namespace ASCOM.Meade.net
|
||||
//
|
||||
internal Rate(double minimum, double maximum)
|
||||
{
|
||||
this.maximum = maximum;
|
||||
this.minimum = minimum;
|
||||
_maximum = maximum;
|
||||
_minimum = minimum;
|
||||
}
|
||||
|
||||
#region Implementation of IRate
|
||||
@@ -45,14 +41,14 @@ namespace ASCOM.Meade.net
|
||||
|
||||
public double Maximum
|
||||
{
|
||||
get { return this.maximum; }
|
||||
set { this.maximum = value; }
|
||||
get => _maximum;
|
||||
set => _maximum = value;
|
||||
}
|
||||
|
||||
public double Minimum
|
||||
{
|
||||
get { return this.minimum; }
|
||||
set { this.minimum = value; }
|
||||
get => _minimum;
|
||||
set => _minimum = value;
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -74,8 +70,8 @@ namespace ASCOM.Meade.net
|
||||
[ComVisible(true)]
|
||||
public class AxisRates : IAxisRates, IEnumerable
|
||||
{
|
||||
private TelescopeAxes axis;
|
||||
private readonly Rate[] rates;
|
||||
private TelescopeAxes _axis;
|
||||
private readonly Rate[] _rates;
|
||||
|
||||
//
|
||||
// Constructor - Internal prevents public creation
|
||||
@@ -83,7 +79,7 @@ namespace ASCOM.Meade.net
|
||||
//
|
||||
internal AxisRates(TelescopeAxes axis)
|
||||
{
|
||||
this.axis = axis;
|
||||
_axis = axis;
|
||||
//
|
||||
// This collection must hold zero or more Rate objects describing the
|
||||
// rates of motion ranges for the Telescope.MoveAxis() method
|
||||
@@ -100,26 +96,23 @@ namespace ASCOM.Meade.net
|
||||
// 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) }
|
||||
//this.rates = new Rate[0];
|
||||
this.rates = new Rate[] { new Rate(1, 1), new Rate(2, 2), new Rate(3, 3), new Rate(4, 4) };
|
||||
_rates = new Rate[] { new Rate(1, 1), new Rate(2, 2), new Rate(3, 3), new Rate(4, 4) };
|
||||
break;
|
||||
case TelescopeAxes.axisSecondary:
|
||||
// TODO Initialize this array with any Secondary axis rates that your driver may provide
|
||||
//this.rates = new Rate[0];
|
||||
this.rates = new Rate[] { new Rate(1, 1), new Rate(2, 2), new Rate(3, 3), new Rate(4, 4) };
|
||||
_rates = new Rate[] { new Rate(1, 1), new Rate(2, 2), new Rate(3, 3), new Rate(4, 4) };
|
||||
break;
|
||||
case TelescopeAxes.axisTertiary:
|
||||
// TODO Initialize this array with any Tertiary axis rates that your driver may provide
|
||||
this.rates = new Rate[0];
|
||||
_rates = new Rate[0];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#region IAxisRates Members
|
||||
|
||||
public int Count
|
||||
{
|
||||
get { return this.rates.Length; }
|
||||
}
|
||||
public int Count => _rates.Length;
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
@@ -128,13 +121,10 @@ namespace ASCOM.Meade.net
|
||||
|
||||
public IEnumerator GetEnumerator()
|
||||
{
|
||||
return rates.GetEnumerator();
|
||||
return _rates.GetEnumerator();
|
||||
}
|
||||
|
||||
public IRate this[int index]
|
||||
{
|
||||
get { return this.rates[index - 1]; } // 1-based
|
||||
}
|
||||
public IRate this[int index] => _rates[index - 1];
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -159,11 +149,11 @@ namespace ASCOM.Meade.net
|
||||
[ComVisible(true)]
|
||||
public class TrackingRates : ITrackingRates, IEnumerable, IEnumerator
|
||||
{
|
||||
private readonly DriveRates[] trackingRates;
|
||||
private readonly DriveRates[] _trackingRates;
|
||||
|
||||
// this is used to make the index thread safe
|
||||
private readonly ThreadLocal<int> pos = new ThreadLocal<int>(() => { return -1; });
|
||||
private static readonly object lockObj = new object();
|
||||
private readonly ThreadLocal<int> _pos = new ThreadLocal<int>(() => { return -1; });
|
||||
private static readonly object LockObj = new object();
|
||||
|
||||
//
|
||||
// Default constructor - Internal prevents public creation
|
||||
@@ -176,20 +166,17 @@ namespace ASCOM.Meade.net
|
||||
// the tracking rates supported by your telescope. The one value
|
||||
// (tracking rate) that MUST be supported is driveSidereal!
|
||||
//
|
||||
this.trackingRates = new[] { DriveRates.driveSidereal, DriveRates.driveLunar };
|
||||
_trackingRates = new[] { DriveRates.driveSidereal, DriveRates.driveLunar };
|
||||
// TODO Initialize this array with any additional tracking rates that your driver may provide
|
||||
}
|
||||
|
||||
#region ITrackingRates Members
|
||||
|
||||
public int Count
|
||||
{
|
||||
get { return this.trackingRates.Length; }
|
||||
}
|
||||
public int Count => _trackingRates.Length;
|
||||
|
||||
public IEnumerator GetEnumerator()
|
||||
{
|
||||
pos.Value = -1;
|
||||
_pos.Value = -1;
|
||||
return this as IEnumerator;
|
||||
}
|
||||
|
||||
@@ -198,10 +185,7 @@ namespace ASCOM.Meade.net
|
||||
// TODO Add any required object cleanup here
|
||||
}
|
||||
|
||||
public DriveRates this[int index]
|
||||
{
|
||||
get { return this.trackingRates[index - 1]; } // 1-based
|
||||
}
|
||||
public DriveRates this[int index] => _trackingRates[index - 1];
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -211,22 +195,22 @@ namespace ASCOM.Meade.net
|
||||
{
|
||||
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();
|
||||
}
|
||||
return trackingRates[pos.Value];
|
||||
return _trackingRates[_pos.Value];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool MoveNext()
|
||||
{
|
||||
lock (lockObj)
|
||||
lock (LockObj)
|
||||
{
|
||||
if (++pos.Value >= trackingRates.Length)
|
||||
if (++_pos.Value >= _trackingRates.Length)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -236,7 +220,7 @@ namespace ASCOM.Meade.net
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
pos.Value = -1;
|
||||
_pos.Value = -1;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
+453
-435
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="ASCOM.Platform" version="6.4.2" targetFramework="net40" />
|
||||
</packages>
|
||||
@@ -0,0 +1,36 @@
|
||||
<#
|
||||
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
|
||||
+104
-159
@@ -1,45 +1,14 @@
|
||||
//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
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Text;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
using ASCOM;
|
||||
using ASCOM.Astrometry;
|
||||
using ASCOM.Astrometry.AstroUtils;
|
||||
using ASCOM.Utilities;
|
||||
using ASCOM.DeviceInterface;
|
||||
using System.Globalization;
|
||||
using System.Collections;
|
||||
using System.Reflection;
|
||||
using ASCOM.Meade.net.Wrapper;
|
||||
using ASCOM.Utilities.Interfaces;
|
||||
|
||||
namespace ASCOM.Meade.net
|
||||
@@ -69,39 +38,26 @@ namespace ASCOM.Meade.net
|
||||
/// The DeviceID is used by ASCOM applications to load the driver at runtime.
|
||||
/// </summary>
|
||||
//internal static string driverID = "ASCOM.Meade.net.Focuser";
|
||||
internal static string driverID = Marshal.GenerateProgIdForType(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
private static readonly string DriverId = Marshal.GenerateProgIdForType(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
// TODO Change the descriptive string for your driver then remove this line
|
||||
/// <summary>
|
||||
/// Driver description that displays in the ASCOM Chooser.
|
||||
/// </summary>
|
||||
private static string driverDescription = "Meade Generic";
|
||||
private static readonly string DriverDescription = "Meade Generic";
|
||||
|
||||
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;
|
||||
private static string _comPort; // Variables to hold the currrent device configuration
|
||||
|
||||
/// <summary>
|
||||
/// Private variable to hold an ASCOM Utilities object
|
||||
/// </summary>
|
||||
private Util utilities;
|
||||
|
||||
/// <summary>
|
||||
/// Private variable to hold an ASCOM AstroUtilities object to provide the Range method
|
||||
/// </summary>
|
||||
private AstroUtils astroUtilities;
|
||||
private readonly IUtil _utilities;
|
||||
|
||||
/// <summary>
|
||||
/// Variable to hold the trace logger object (creates a diagnostic log file with information that you specify)
|
||||
/// </summary>
|
||||
internal static TraceLogger tl;
|
||||
internal static TraceLogger Tl;
|
||||
|
||||
private readonly ISharedResourcesWrapper _sharedResourcesWrapper;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Meade.net"/> class.
|
||||
@@ -109,16 +65,23 @@ namespace ASCOM.Meade.net
|
||||
/// </summary>
|
||||
public Focuser()
|
||||
{
|
||||
tl = new TraceLogger("", "Meade.net.focusser");
|
||||
//todo move this out to IOC
|
||||
_utilities = new Util(); //Initialise util object
|
||||
_sharedResourcesWrapper = new SharedResourcesWrapper();
|
||||
|
||||
Initialise();
|
||||
}
|
||||
|
||||
private void Initialise()
|
||||
{
|
||||
Tl = new TraceLogger("", "Meade.net.focusser");
|
||||
|
||||
Tl.LogMessage("Focuser", "Starting initialisation");
|
||||
ReadProfile(); // Read device configuration from the ASCOM Profile store
|
||||
|
||||
tl.LogMessage("Focuser", "Starting initialisation");
|
||||
IsConnected = false; // Initialise connected to false
|
||||
|
||||
connectedState = false; // Initialise connected to false
|
||||
utilities = new Util(); //Initialise util object
|
||||
astroUtilities = new AstroUtils(); // Initialise astro utilities object
|
||||
|
||||
tl.LogMessage("Focuser", "Completed initialisation");
|
||||
Tl.LogMessage("Focuser", "Completed initialisation");
|
||||
}
|
||||
|
||||
|
||||
@@ -136,17 +99,17 @@ namespace ASCOM.Meade.net
|
||||
/// </summary>
|
||||
public void SetupDialog()
|
||||
{
|
||||
tl.LogMessage("SetupDialog", "Opening setup dialog");
|
||||
SharedResources.SetupDialog();
|
||||
Tl.LogMessage("SetupDialog", "Opening setup dialog");
|
||||
_sharedResourcesWrapper.SetupDialog();
|
||||
ReadProfile();
|
||||
tl.LogMessage("SetupDialog", "complete");
|
||||
Tl.LogMessage("SetupDialog", "complete");
|
||||
}
|
||||
|
||||
public ArrayList SupportedActions
|
||||
{
|
||||
get
|
||||
{
|
||||
tl.LogMessage("SupportedActions Get", "Returning empty arraylist");
|
||||
Tl.LogMessage("SupportedActions Get", "Returning empty arraylist");
|
||||
return new ArrayList();
|
||||
}
|
||||
}
|
||||
@@ -154,7 +117,7 @@ namespace ASCOM.Meade.net
|
||||
public string Action(string actionName, string actionParameters)
|
||||
{
|
||||
LogMessage("", "Action {0}, parameters {1} not implemented", actionName, actionParameters);
|
||||
throw new ASCOM.ActionNotImplementedException("Action " + actionName + " is not implemented by this driver");
|
||||
throw new ActionNotImplementedException("Action " + actionName + " is not implemented by this driver");
|
||||
}
|
||||
|
||||
public void CommandBlind(string command, bool raw)
|
||||
@@ -162,7 +125,7 @@ namespace ASCOM.Meade.net
|
||||
CheckConnected("CommandBlind");
|
||||
// Call CommandString and return as soon as it finishes
|
||||
//this.CommandString(command, raw);
|
||||
SharedResources.SendBlind(command);
|
||||
_sharedResourcesWrapper.SendBlind(command);
|
||||
// or
|
||||
//throw new ASCOM.MethodNotImplementedException("CommandBlind");
|
||||
// DO NOT have both these sections! One or the other
|
||||
@@ -174,7 +137,7 @@ namespace ASCOM.Meade.net
|
||||
//string ret = CommandString(command, raw);
|
||||
// TODO decode the return string and return true or false
|
||||
// or
|
||||
throw new ASCOM.MethodNotImplementedException("CommandBool");
|
||||
throw new MethodNotImplementedException("CommandBool");
|
||||
// DO NOT have both these sections! One or the other
|
||||
}
|
||||
|
||||
@@ -184,21 +147,17 @@ namespace ASCOM.Meade.net
|
||||
// it's a good idea to put all the low level communication with the device here,
|
||||
// then all communication calls this function
|
||||
// you need something to ensure that only one command is in progress at a time
|
||||
return SharedResources.SendString(command);
|
||||
return _sharedResourcesWrapper.SendString(command);
|
||||
|
||||
throw new ASCOM.MethodNotImplementedException("CommandString");
|
||||
throw new MethodNotImplementedException("CommandString");
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
// Clean up the tracelogger and util objects
|
||||
tl.Enabled = false;
|
||||
tl.Dispose();
|
||||
tl = null;
|
||||
utilities.Dispose();
|
||||
utilities = null;
|
||||
astroUtilities.Dispose();
|
||||
astroUtilities = null;
|
||||
Tl.Enabled = false;
|
||||
Tl.Dispose();
|
||||
Tl = null;
|
||||
}
|
||||
|
||||
public bool Connected
|
||||
@@ -210,7 +169,7 @@ namespace ASCOM.Meade.net
|
||||
}
|
||||
set
|
||||
{
|
||||
tl.LogMessage("Connected", "Set {0}", value);
|
||||
Tl.LogMessage("Connected", "Set {0}", value);
|
||||
if (value == IsConnected)
|
||||
return;
|
||||
|
||||
@@ -218,39 +177,39 @@ namespace ASCOM.Meade.net
|
||||
{
|
||||
try
|
||||
{
|
||||
SharedResources.Connect("Serial");
|
||||
_sharedResourcesWrapper.Connect("Serial");
|
||||
try
|
||||
{
|
||||
SelectSite(1);
|
||||
SetLongFormat(true);
|
||||
|
||||
connectedState = true;
|
||||
IsConnected = true;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
SharedResources.Disconnect("Serial");
|
||||
_sharedResourcesWrapper.Disconnect("Serial");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
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
|
||||
{
|
||||
LogMessage("Connected Set", "Disconnecting from port {0}", comPort);
|
||||
SharedResources.Disconnect("Serial");
|
||||
connectedState = false;
|
||||
LogMessage("Connected Set", "Disconnecting from port {0}", _comPort);
|
||||
_sharedResourcesWrapper.Disconnect("Serial");
|
||||
IsConnected = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void SetLongFormat(bool setLongFormat)
|
||||
{
|
||||
SharedResources.Lock(() =>
|
||||
_sharedResourcesWrapper.Lock(() =>
|
||||
{
|
||||
var result = SharedResources.SendString(":GZ#");
|
||||
var result = _sharedResourcesWrapper.SendString(":GZ#");
|
||||
//:GZ# Get telescope azimuth
|
||||
//Returns: DDD*MM#T or DDD*MM’SS#
|
||||
//The current telescope Azimuth depending on the selected precision.
|
||||
@@ -259,8 +218,8 @@ namespace ASCOM.Meade.net
|
||||
|
||||
if (isLongFormat != setLongFormat)
|
||||
{
|
||||
utilities.WaitForMilliseconds(500);
|
||||
SharedResources.SendBlind(":U#");
|
||||
_utilities.WaitForMilliseconds(500);
|
||||
_sharedResourcesWrapper.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
|
||||
@@ -271,7 +230,7 @@ namespace ASCOM.Meade.net
|
||||
|
||||
private void SelectSite(int site)
|
||||
{
|
||||
SharedResources.SendBlind($":W{site}#");
|
||||
_sharedResourcesWrapper.SendBlind($":W{site}#");
|
||||
//:W<n>#
|
||||
//Set current site to<n>, an ASCII digit in the range 1..4
|
||||
//Returns: Nothing
|
||||
@@ -282,8 +241,8 @@ namespace ASCOM.Meade.net
|
||||
// TODO customise this device description
|
||||
get
|
||||
{
|
||||
tl.LogMessage("Description Get", driverDescription);
|
||||
return driverDescription;
|
||||
Tl.LogMessage("Description Get", DriverDescription);
|
||||
return DriverDescription;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -291,10 +250,10 @@ namespace ASCOM.Meade.net
|
||||
{
|
||||
get
|
||||
{
|
||||
Version version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
|
||||
Version version = Assembly.GetExecutingAssembly().GetName().Version;
|
||||
// TODO customise this driver description
|
||||
string driverInfo = "Information about the driver itself. Version: " + String.Format(CultureInfo.InvariantCulture, "{0}.{1}", version.Major, version.Minor);
|
||||
tl.LogMessage("DriverInfo Get", driverInfo);
|
||||
Tl.LogMessage("DriverInfo Get", driverInfo);
|
||||
return driverInfo;
|
||||
}
|
||||
}
|
||||
@@ -303,9 +262,9 @@ namespace ASCOM.Meade.net
|
||||
{
|
||||
get
|
||||
{
|
||||
Version version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
|
||||
Version version = Assembly.GetExecutingAssembly().GetName().Version;
|
||||
string driverVersion = String.Format(CultureInfo.InvariantCulture, "{0}.{1}", version.Major, version.Minor);
|
||||
tl.LogMessage("DriverVersion Get", driverVersion);
|
||||
Tl.LogMessage("DriverVersion Get", driverVersion);
|
||||
return driverVersion;
|
||||
}
|
||||
}
|
||||
@@ -325,8 +284,8 @@ namespace ASCOM.Meade.net
|
||||
get
|
||||
{
|
||||
//string name = "Short driver name - please customise";
|
||||
string name = driverDescription;
|
||||
tl.LogMessage("Name Get", name);
|
||||
string name = DriverDescription;
|
||||
Tl.LogMessage("Name Get", name);
|
||||
return name;
|
||||
}
|
||||
}
|
||||
@@ -339,14 +298,14 @@ namespace ASCOM.Meade.net
|
||||
{
|
||||
get
|
||||
{
|
||||
tl.LogMessage("Absolute Get", false.ToString());
|
||||
Tl.LogMessage("Absolute Get", false.ToString());
|
||||
return false; // This is a relative focuser
|
||||
}
|
||||
}
|
||||
|
||||
public void Halt()
|
||||
{
|
||||
tl.LogMessage("Halt", "Halting");
|
||||
Tl.LogMessage("Halt", "Halting");
|
||||
|
||||
CheckConnected("Halt");
|
||||
|
||||
@@ -354,11 +313,11 @@ namespace ASCOM.Meade.net
|
||||
Stopwatch stopwatch = Stopwatch.StartNew();
|
||||
while (stopwatch.ElapsedMilliseconds < 1000)
|
||||
{
|
||||
SharedResources.SendBlind(":FQ#");
|
||||
_sharedResourcesWrapper.SendBlind(":FQ#");
|
||||
//:FQ# Halt Focuser Motion
|
||||
//Returns: Nothing
|
||||
|
||||
utilities.WaitForMilliseconds(250);
|
||||
_utilities.WaitForMilliseconds(250);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -366,7 +325,7 @@ namespace ASCOM.Meade.net
|
||||
{
|
||||
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
|
||||
}
|
||||
}
|
||||
@@ -375,13 +334,13 @@ namespace ASCOM.Meade.net
|
||||
{
|
||||
get
|
||||
{
|
||||
tl.LogMessage("Link Get", this.Connected.ToString());
|
||||
return this.Connected; // Direct function to the connected method, the Link method is just here for backwards compatibility
|
||||
Tl.LogMessage("Link Get", Connected.ToString());
|
||||
return Connected; // Direct function to the connected method, the Link method is just here for backwards compatibility
|
||||
}
|
||||
set
|
||||
{
|
||||
tl.LogMessage("Link Set", value.ToString());
|
||||
this.Connected = value; // Direct function to the connected method, the Link method is just here for backwards compatibility
|
||||
Tl.LogMessage("Link Set", value.ToString());
|
||||
Connected = value; // Direct function to the connected method, the Link method is just here for backwards compatibility
|
||||
}
|
||||
}
|
||||
|
||||
@@ -390,7 +349,7 @@ namespace ASCOM.Meade.net
|
||||
{
|
||||
get
|
||||
{
|
||||
tl.LogMessage("MaxIncrement Get", _maxIncrement.ToString());
|
||||
Tl.LogMessage("MaxIncrement Get", _maxIncrement.ToString());
|
||||
return _maxIncrement; // Maximum change in one move
|
||||
}
|
||||
}
|
||||
@@ -400,45 +359,45 @@ namespace ASCOM.Meade.net
|
||||
{
|
||||
get
|
||||
{
|
||||
tl.LogMessage("MaxStep Get", _maxStep.ToString());
|
||||
Tl.LogMessage("MaxStep Get", _maxStep.ToString());
|
||||
return _maxStep;
|
||||
}
|
||||
}
|
||||
|
||||
public void Move(int Position)
|
||||
public void Move(int position)
|
||||
{
|
||||
tl.LogMessage("Move", Position.ToString());
|
||||
Tl.LogMessage("Move", position.ToString());
|
||||
CheckConnected("Move");
|
||||
|
||||
//todo implement backlash compensation
|
||||
//todo implement direction reverse
|
||||
//todo implement dynamic braking
|
||||
|
||||
if (Position < -MaxIncrement || Position > MaxIncrement)
|
||||
if (position < -MaxIncrement || position > MaxIncrement)
|
||||
{
|
||||
throw new ASCOM.InvalidValueException($"position out of range {-MaxIncrement} < {Position} < {MaxIncrement}");
|
||||
throw new InvalidValueException($"position out of range {-MaxIncrement} < {position} < {MaxIncrement}");
|
||||
}
|
||||
|
||||
if (Position == 0)
|
||||
if (position == 0)
|
||||
return;
|
||||
|
||||
if (Position > 0)
|
||||
if (position > 0)
|
||||
{
|
||||
//desired move direction is out
|
||||
MoveFocuser(true, Math.Abs(Position));
|
||||
MoveFocuser(true, Math.Abs(position));
|
||||
}
|
||||
else
|
||||
{
|
||||
//desired move direction is in
|
||||
MoveFocuser(false, Math.Abs(Position));
|
||||
MoveFocuser(false, Math.Abs(position));
|
||||
}
|
||||
}
|
||||
|
||||
private void MoveFocuser(bool directionOut, int steps)
|
||||
{
|
||||
SharedResources.Lock(() =>
|
||||
_sharedResourcesWrapper.Lock(() =>
|
||||
{
|
||||
//SharedResources.SendBlind(":FF#");
|
||||
//_sharedResourcesWrapper.SendBlind(":FF#");
|
||||
//:FF# Set Focus speed to fastest setting
|
||||
//Returns: Nothing
|
||||
|
||||
@@ -448,44 +407,37 @@ namespace ASCOM.Meade.net
|
||||
//:F<n># Autostar, Autostar II – set focuser speed to <n> where <n> is an ASCII digit 1..4
|
||||
//Returns: Nothing
|
||||
//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.
|
||||
Stopwatch stopwatch = Stopwatch.StartNew();
|
||||
while (stopwatch.ElapsedMilliseconds < steps)
|
||||
{
|
||||
SharedResources.SendBlind(directionOut ? ":F+#" : ":F-#");
|
||||
_sharedResourcesWrapper.SendBlind(directionOut ? ":F+#" : ":F-#");
|
||||
//:F+# Start Focuser moving inward (toward objective)
|
||||
//Returns: None
|
||||
|
||||
//:F-# Start Focuser moving outward (away from objective)
|
||||
//Returns: None
|
||||
|
||||
utilities.WaitForMilliseconds(250);
|
||||
_utilities.WaitForMilliseconds(250);
|
||||
}
|
||||
|
||||
Halt();
|
||||
|
||||
//This gives the focuser time to physically stop.
|
||||
utilities.WaitForMilliseconds(1000);
|
||||
_utilities.WaitForMilliseconds(1000);
|
||||
});
|
||||
}
|
||||
|
||||
public int Position
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new ASCOM.PropertyNotImplementedException("Position", false);
|
||||
//return focuserPosition; // Return the focuser position
|
||||
}
|
||||
}
|
||||
public int Position => throw new PropertyNotImplementedException("Position", false);
|
||||
|
||||
public double StepSize
|
||||
{
|
||||
get
|
||||
{
|
||||
tl.LogMessage("StepSize Get", "Not implemented");
|
||||
throw new ASCOM.PropertyNotImplementedException("StepSize", false);
|
||||
Tl.LogMessage("StepSize Get", "Not implemented");
|
||||
throw new PropertyNotImplementedException("StepSize", false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -493,13 +445,13 @@ namespace ASCOM.Meade.net
|
||||
{
|
||||
get
|
||||
{
|
||||
tl.LogMessage("TempComp Get", false.ToString());
|
||||
Tl.LogMessage("TempComp Get", false.ToString());
|
||||
return false;
|
||||
}
|
||||
set
|
||||
{
|
||||
tl.LogMessage("TempComp Set", "Not implemented");
|
||||
throw new ASCOM.PropertyNotImplementedException("TempComp", false);
|
||||
Tl.LogMessage("TempComp Set", "Not implemented");
|
||||
throw new PropertyNotImplementedException("TempComp", false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -507,7 +459,7 @@ namespace ASCOM.Meade.net
|
||||
{
|
||||
get
|
||||
{
|
||||
tl.LogMessage("TempCompAvailable Get", false.ToString());
|
||||
Tl.LogMessage("TempCompAvailable Get", false.ToString());
|
||||
return false; // Temperature compensation is not available in this driver
|
||||
}
|
||||
}
|
||||
@@ -516,8 +468,8 @@ namespace ASCOM.Meade.net
|
||||
{
|
||||
get
|
||||
{
|
||||
tl.LogMessage("Temperature Get", "Not implemented");
|
||||
throw new ASCOM.PropertyNotImplementedException("Temperature", false);
|
||||
Tl.LogMessage("Temperature Get", "Not implemented");
|
||||
throw new PropertyNotImplementedException("Temperature", false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -537,18 +489,18 @@ namespace ASCOM.Meade.net
|
||||
/// This is harmless if the driver is already registered/unregistered.
|
||||
/// </summary>
|
||||
/// <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 ASCOM.Utilities.Profile())
|
||||
using (var p = new Profile())
|
||||
{
|
||||
P.DeviceType = "Focuser";
|
||||
p.DeviceType = "Focuser";
|
||||
if (bRegister)
|
||||
{
|
||||
P.Register(driverID, driverDescription);
|
||||
p.Register(DriverId, DriverDescription);
|
||||
}
|
||||
else
|
||||
{
|
||||
P.Unregister(driverID);
|
||||
p.Unregister(DriverId);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -571,9 +523,9 @@ namespace ASCOM.Meade.net
|
||||
/// This technique should mean that it is never necessary to manually register a driver with ASCOM.
|
||||
/// </remarks>
|
||||
[ComRegisterFunction]
|
||||
public static void RegisterASCOM(Type t)
|
||||
public static void RegisterAscom(Type t)
|
||||
{
|
||||
RegUnregASCOM(true);
|
||||
RegUnregAscom(true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -594,9 +546,9 @@ namespace ASCOM.Meade.net
|
||||
/// This technique should mean that it is never necessary to manually unregister a driver from ASCOM.
|
||||
/// </remarks>
|
||||
[ComUnregisterFunction]
|
||||
public static void UnregisterASCOM(Type t)
|
||||
public static void UnregisterAscom(Type t)
|
||||
{
|
||||
RegUnregASCOM(false);
|
||||
RegUnregAscom(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -604,14 +556,7 @@ namespace ASCOM.Meade.net
|
||||
/// <summary>
|
||||
/// Returns true if there is a valid connection to the driver hardware
|
||||
/// </summary>
|
||||
private bool IsConnected
|
||||
{
|
||||
get
|
||||
{
|
||||
// TODO check that the driver hardware connection exists and is connected to the hardware
|
||||
return connectedState;
|
||||
}
|
||||
}
|
||||
private bool IsConnected { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Use this function to throw an exception if we aren't connected to the hardware
|
||||
@@ -621,7 +566,7 @@ namespace ASCOM.Meade.net
|
||||
{
|
||||
if (!IsConnected)
|
||||
{
|
||||
throw new ASCOM.NotConnectedException(message);
|
||||
throw new NotConnectedException(message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -630,9 +575,9 @@ namespace ASCOM.Meade.net
|
||||
/// </summary>
|
||||
internal void ReadProfile()
|
||||
{
|
||||
var profileProperties = SharedResources.ReadProfile();
|
||||
tl.Enabled = profileProperties.TraceLogger;
|
||||
comPort = profileProperties.ComPort;
|
||||
var profileProperties = _sharedResourcesWrapper.ReadProfile();
|
||||
Tl.Enabled = profileProperties.TraceLogger;
|
||||
_comPort = profileProperties.ComPort;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -644,7 +589,7 @@ namespace ASCOM.Meade.net
|
||||
internal static void LogMessage(string identifier, string message, params object[] args)
|
||||
{
|
||||
var msg = string.Format(message, args);
|
||||
tl.LogMessage(identifier, msg);
|
||||
Tl.LogMessage(identifier, msg);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
@@ -80,14 +80,39 @@
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<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" />
|
||||
<Reference Include="ASCOM.Controls, 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.Exceptions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL" />
|
||||
<Reference Include="ASCOM.SettingsProvider, 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" />
|
||||
<Reference Include="ASCOM.Utilities.Video, Version=6.1.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>
|
||||
<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="System" />
|
||||
<Reference Include="System.configuration" />
|
||||
<Reference Include="System.Configuration.Install" />
|
||||
@@ -124,6 +149,8 @@
|
||||
<None Include="app.config" />
|
||||
<None Include="ASCOM.png" />
|
||||
<None Include="ASCOMDriverTemplate.snk" />
|
||||
<None Include="BootstrapAscomProfileStore.ps1" />
|
||||
<None Include="packages.config" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
<ProjectConfiguration>
|
||||
<Settings>
|
||||
<UseCPUArchitecture>x86</UseCPUArchitecture>
|
||||
</Settings>
|
||||
</ProjectConfiguration>
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
@@ -35,5 +34,5 @@ using System.Runtime.InteropServices;
|
||||
// by using the '*' as shown below:
|
||||
//
|
||||
// TODO - Set your driver's version here
|
||||
[assembly: AssemblyVersion("0.6.0.0")]
|
||||
[assembly: AssemblyFileVersion("0.6.0.0")]
|
||||
[assembly: AssemblyVersion("0.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("0.0.0.0")]
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="ASCOM.Platform" version="6.4.2" targetFramework="net40" />
|
||||
</packages>
|
||||
@@ -21,6 +21,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AstroMath.UnitTests", "Astr
|
||||
EndProject
|
||||
Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "Meade.net.Setup", "Meade.net.Setup\Meade.net.Setup.wixproj", "{8EEB5C25-8394-4257-8E57-CDED47CB6F1B}"
|
||||
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
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -106,6 +108,18 @@ Global
|
||||
{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.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
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
@@ -114,6 +128,7 @@ Global
|
||||
{D5207217-61C7-4E94-8097-91DBACE57D2A} = {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}
|
||||
{B7EEEEFD-5BFF-443D-981C-7B8AB5DFDE33} = {0958D817-269C-44BE-BEFB-F3E6A409DE91}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {3C0509DC-C7F5-48DC-920D-DCFD9C879BD2}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
<SolutionConfiguration>
|
||||
<Settings>
|
||||
<AllowParallelTestExecution>True</AllowParallelTestExecution>
|
||||
<CopyReferencedAssembliesToWorkspace>True</CopyReferencedAssembliesToWorkspace>
|
||||
<SolutionConfigured>True</SolutionConfigured>
|
||||
</Settings>
|
||||
</SolutionConfiguration>
|
||||
@@ -0,0 +1,16 @@
|
||||
<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>
|
||||
@@ -0,0 +1,36 @@
|
||||
<#
|
||||
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
|
||||
+59
-69
@@ -33,43 +33,43 @@ namespace ASCOM.Meade.net
|
||||
#region Access to ole32.dll functions for class factories
|
||||
|
||||
// Define two common GUID objects for public usage.
|
||||
public static Guid IID_IUnknown = new Guid("{00000000-0000-0000-C000-000000000046}");
|
||||
public static Guid IID_IDispatch = new Guid("{00020400-0000-0000-C000-000000000046}");
|
||||
private static readonly Guid _iidIUnknown = new Guid("{00000000-0000-0000-C000-000000000046}");
|
||||
private static readonly Guid _iidIDispatch = new Guid("{00020400-0000-0000-C000-000000000046}");
|
||||
|
||||
[Flags]
|
||||
enum CLSCTX : uint
|
||||
enum Clsctx : uint
|
||||
{
|
||||
CLSCTX_INPROC_SERVER = 0x1,
|
||||
CLSCTX_INPROC_HANDLER = 0x2,
|
||||
CLSCTX_LOCAL_SERVER = 0x4,
|
||||
CLSCTX_INPROC_SERVER16 = 0x8,
|
||||
CLSCTX_REMOTE_SERVER = 0x10,
|
||||
CLSCTX_INPROC_HANDLER16 = 0x20,
|
||||
CLSCTX_RESERVED1 = 0x40,
|
||||
CLSCTX_RESERVED2 = 0x80,
|
||||
CLSCTX_RESERVED3 = 0x100,
|
||||
CLSCTX_RESERVED4 = 0x200,
|
||||
CLSCTX_NO_CODE_DOWNLOAD = 0x400,
|
||||
CLSCTX_RESERVED5 = 0x800,
|
||||
CLSCTX_NO_CUSTOM_MARSHAL = 0x1000,
|
||||
CLSCTX_ENABLE_CODE_DOWNLOAD = 0x2000,
|
||||
CLSCTX_NO_FAILURE_LOG = 0x4000,
|
||||
CLSCTX_DISABLE_AAA = 0x8000,
|
||||
CLSCTX_ENABLE_AAA = 0x10000,
|
||||
CLSCTX_FROM_DEFAULT_CONTEXT = 0x20000,
|
||||
CLSCTX_INPROC = CLSCTX_INPROC_SERVER | CLSCTX_INPROC_HANDLER,
|
||||
CLSCTX_SERVER = CLSCTX_INPROC_SERVER | CLSCTX_LOCAL_SERVER | CLSCTX_REMOTE_SERVER,
|
||||
CLSCTX_ALL = CLSCTX_SERVER | CLSCTX_INPROC_HANDLER
|
||||
ClsctxInprocServer = 0x1,
|
||||
ClsctxInprocHandler = 0x2,
|
||||
ClsctxLocalServer = 0x4,
|
||||
ClsctxInprocServer16 = 0x8,
|
||||
ClsctxRemoteServer = 0x10,
|
||||
ClsctxInprocHandler16 = 0x20,
|
||||
ClsctxReserved1 = 0x40,
|
||||
ClsctxReserved2 = 0x80,
|
||||
ClsctxReserved3 = 0x100,
|
||||
ClsctxReserved4 = 0x200,
|
||||
ClsctxNoCodeDownload = 0x400,
|
||||
ClsctxReserved5 = 0x800,
|
||||
ClsctxNoCustomMarshal = 0x1000,
|
||||
ClsctxEnableCodeDownload = 0x2000,
|
||||
ClsctxNoFailureLog = 0x4000,
|
||||
ClsctxDisableAaa = 0x8000,
|
||||
ClsctxEnableAaa = 0x10000,
|
||||
ClsctxFromDefaultContext = 0x20000,
|
||||
ClsctxInproc = ClsctxInprocServer | ClsctxInprocHandler,
|
||||
ClsctxServer = ClsctxInprocServer | ClsctxLocalServer | ClsctxRemoteServer,
|
||||
ClsctxAll = ClsctxServer | ClsctxInprocHandler
|
||||
}
|
||||
|
||||
[Flags]
|
||||
enum REGCLS : uint
|
||||
enum Regcls : uint
|
||||
{
|
||||
REGCLS_SINGLEUSE = 0,
|
||||
REGCLS_MULTIPLEUSE = 1,
|
||||
REGCLS_MULTI_SEPARATE = 2,
|
||||
REGCLS_SUSPENDED = 4,
|
||||
REGCLS_SURROGATE = 8
|
||||
RegclsSingleuse = 0,
|
||||
RegclsMultipleuse = 1,
|
||||
RegclsMultiSeparate = 2,
|
||||
RegclsSuspended = 4,
|
||||
RegclsSurrogate = 8
|
||||
}
|
||||
//
|
||||
// CoRegisterClassObject() is used to register a Class Factory
|
||||
@@ -109,70 +109,60 @@ namespace ASCOM.Meade.net
|
||||
|
||||
#region Constructor and Private ClassFactory Data
|
||||
|
||||
protected Type m_ClassType;
|
||||
protected Guid m_ClassId;
|
||||
protected ArrayList m_InterfaceTypes;
|
||||
protected uint m_ClassContext;
|
||||
protected uint m_Flags;
|
||||
protected UInt32 m_locked = 0;
|
||||
protected uint m_Cookie;
|
||||
protected string m_progid;
|
||||
private readonly Type _mClassType;
|
||||
private Guid _mClassId;
|
||||
private readonly ArrayList _mInterfaceTypes;
|
||||
private UInt32 _mLocked = 0;
|
||||
private uint _mCookie;
|
||||
private readonly string _mProgid;
|
||||
|
||||
public ClassFactory(Type type)
|
||||
{
|
||||
if (type == null)
|
||||
throw new ArgumentNullException("type");
|
||||
m_ClassType = type;
|
||||
_mClassType = type;
|
||||
|
||||
//PWGS Get the ProgID from the MetaData
|
||||
m_progid = Marshal.GenerateProgIdForType(type);
|
||||
m_ClassId = Marshal.GenerateGuidForType(type); // Should be nailed down by [Guid(...)]
|
||||
m_ClassContext = (uint)CLSCTX.CLSCTX_LOCAL_SERVER; // Default
|
||||
m_Flags = (uint)REGCLS.REGCLS_MULTIPLEUSE | // Default
|
||||
(uint)REGCLS.REGCLS_SUSPENDED;
|
||||
m_InterfaceTypes = new ArrayList();
|
||||
_mProgid = Marshal.GenerateProgIdForType(type);
|
||||
_mClassId = Marshal.GenerateGuidForType(type); // Should be nailed down by [Guid(...)]
|
||||
ClassContext = (uint)Clsctx.ClsctxLocalServer; // Default
|
||||
Flags = (uint)Regcls.RegclsMultipleuse | // Default
|
||||
(uint)Regcls.RegclsSuspended;
|
||||
_mInterfaceTypes = new ArrayList();
|
||||
foreach (Type T in type.GetInterfaces()) // Save all of the implemented interfaces
|
||||
m_InterfaceTypes.Add(T);
|
||||
_mInterfaceTypes.Add(T);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Common ClassFactory Methods
|
||||
public uint ClassContext
|
||||
{
|
||||
get { return m_ClassContext; }
|
||||
set { m_ClassContext = value; }
|
||||
}
|
||||
public uint ClassContext { get; }
|
||||
|
||||
public Guid ClassId
|
||||
{
|
||||
get { return m_ClassId; }
|
||||
set { m_ClassId = value; }
|
||||
get => _mClassId;
|
||||
set => _mClassId = value;
|
||||
}
|
||||
|
||||
public uint Flags
|
||||
{
|
||||
get { return m_Flags; }
|
||||
set { m_Flags = value; }
|
||||
}
|
||||
public uint Flags { get; }
|
||||
|
||||
public bool RegisterClassObject()
|
||||
{
|
||||
// Register the class factory
|
||||
int i = CoRegisterClassObject
|
||||
(
|
||||
ref m_ClassId,
|
||||
ref _mClassId,
|
||||
this,
|
||||
m_ClassContext,
|
||||
m_Flags,
|
||||
out m_Cookie
|
||||
ClassContext,
|
||||
Flags,
|
||||
out _mCookie
|
||||
);
|
||||
return (i == 0);
|
||||
}
|
||||
|
||||
public bool RevokeClassObject()
|
||||
{
|
||||
int i = CoRevokeClassObject(m_Cookie);
|
||||
int i = CoRevokeClassObject(_mCookie);
|
||||
return (i == 0);
|
||||
}
|
||||
|
||||
@@ -201,25 +191,25 @@ namespace ASCOM.Meade.net
|
||||
//
|
||||
// Handle specific requests for implemented interfaces
|
||||
//
|
||||
foreach (Type iType in m_InterfaceTypes)
|
||||
foreach (Type iType in _mInterfaceTypes)
|
||||
{
|
||||
if (riid == Marshal.GenerateGuidForType(iType))
|
||||
{
|
||||
ppvObject = Marshal.GetComInterfaceForObject(Activator.CreateInstance(m_ClassType), iType);
|
||||
ppvObject = Marshal.GetComInterfaceForObject(Activator.CreateInstance(_mClassType), iType);
|
||||
return;
|
||||
}
|
||||
}
|
||||
//
|
||||
// Handle requests for IDispatch or IUnknown on the class
|
||||
//
|
||||
if (riid == IID_IDispatch)
|
||||
if (riid == _iidIDispatch)
|
||||
{
|
||||
ppvObject = Marshal.GetIDispatchForObject(Activator.CreateInstance(m_ClassType));
|
||||
ppvObject = Marshal.GetIDispatchForObject(Activator.CreateInstance(_mClassType));
|
||||
return;
|
||||
}
|
||||
else if (riid == IID_IUnknown)
|
||||
else if (riid == _iidIUnknown)
|
||||
{
|
||||
ppvObject = Marshal.GetIUnknownForObject(Activator.CreateInstance(m_ClassType));
|
||||
ppvObject = Marshal.GetIUnknownForObject(Activator.CreateInstance(_mClassType));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -8,35 +8,35 @@ namespace ASCOM.Meade.net
|
||||
/// </summary>
|
||||
class GarbageCollection
|
||||
{
|
||||
protected bool m_bContinueThread;
|
||||
protected bool m_GCWatchStopped;
|
||||
protected int m_iInterval;
|
||||
protected ManualResetEvent m_EventThreadEnded;
|
||||
private bool _mbContinueThread;
|
||||
private bool _mGcWatchStopped;
|
||||
private readonly int _miInterval;
|
||||
private readonly ManualResetEvent _mEventThreadEnded;
|
||||
|
||||
public GarbageCollection(int iInterval)
|
||||
{
|
||||
m_bContinueThread = true;
|
||||
m_GCWatchStopped = false;
|
||||
m_iInterval = iInterval;
|
||||
m_EventThreadEnded = new ManualResetEvent(false);
|
||||
_mbContinueThread = true;
|
||||
_mGcWatchStopped = false;
|
||||
_miInterval = iInterval;
|
||||
_mEventThreadEnded = new ManualResetEvent(false);
|
||||
}
|
||||
|
||||
public void GCWatch()
|
||||
public void GcWatch()
|
||||
{
|
||||
// Pause for a moment to provide a delay to make threads more apparent.
|
||||
while (ContinueThread())
|
||||
{
|
||||
GC.Collect();
|
||||
Thread.Sleep(m_iInterval);
|
||||
Thread.Sleep(_miInterval);
|
||||
}
|
||||
m_EventThreadEnded.Set();
|
||||
_mEventThreadEnded.Set();
|
||||
}
|
||||
|
||||
protected bool ContinueThread()
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
return m_bContinueThread;
|
||||
return _mbContinueThread;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,14 +44,14 @@ namespace ASCOM.Meade.net
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
m_bContinueThread = false;
|
||||
_mbContinueThread = false;
|
||||
}
|
||||
}
|
||||
|
||||
public void WaitForThreadToStop()
|
||||
{
|
||||
m_EventThreadEnded.WaitOne();
|
||||
m_EventThreadEnded.Reset();
|
||||
_mEventThreadEnded.WaitOne();
|
||||
_mEventThreadEnded.Reset();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+87
-90
@@ -15,17 +15,14 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
using System.Drawing;
|
||||
using System.Collections;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Reflection;
|
||||
using ASCOM.Utilities;
|
||||
using Microsoft.Win32;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Security.Principal;
|
||||
using System.Diagnostics;
|
||||
using ASCOM;
|
||||
|
||||
namespace ASCOM.Meade.net
|
||||
{
|
||||
@@ -34,52 +31,52 @@ namespace ASCOM.Meade.net
|
||||
|
||||
#region Access to kernel32.dll, user32.dll, and ole32.dll functions
|
||||
[Flags]
|
||||
enum CLSCTX : uint
|
||||
enum Clsctx : uint
|
||||
{
|
||||
CLSCTX_INPROC_SERVER = 0x1,
|
||||
CLSCTX_INPROC_HANDLER = 0x2,
|
||||
CLSCTX_LOCAL_SERVER = 0x4,
|
||||
CLSCTX_INPROC_SERVER16 = 0x8,
|
||||
CLSCTX_REMOTE_SERVER = 0x10,
|
||||
CLSCTX_INPROC_HANDLER16 = 0x20,
|
||||
CLSCTX_RESERVED1 = 0x40,
|
||||
CLSCTX_RESERVED2 = 0x80,
|
||||
CLSCTX_RESERVED3 = 0x100,
|
||||
CLSCTX_RESERVED4 = 0x200,
|
||||
CLSCTX_NO_CODE_DOWNLOAD = 0x400,
|
||||
CLSCTX_RESERVED5 = 0x800,
|
||||
CLSCTX_NO_CUSTOM_MARSHAL = 0x1000,
|
||||
CLSCTX_ENABLE_CODE_DOWNLOAD = 0x2000,
|
||||
CLSCTX_NO_FAILURE_LOG = 0x4000,
|
||||
CLSCTX_DISABLE_AAA = 0x8000,
|
||||
CLSCTX_ENABLE_AAA = 0x10000,
|
||||
CLSCTX_FROM_DEFAULT_CONTEXT = 0x20000,
|
||||
CLSCTX_INPROC = CLSCTX_INPROC_SERVER | CLSCTX_INPROC_HANDLER,
|
||||
CLSCTX_SERVER = CLSCTX_INPROC_SERVER | CLSCTX_LOCAL_SERVER | CLSCTX_REMOTE_SERVER,
|
||||
CLSCTX_ALL = CLSCTX_SERVER | CLSCTX_INPROC_HANDLER
|
||||
ClsctxInprocServer = 0x1,
|
||||
ClsctxInprocHandler = 0x2,
|
||||
ClsctxLocalServer = 0x4,
|
||||
ClsctxInprocServer16 = 0x8,
|
||||
ClsctxRemoteServer = 0x10,
|
||||
ClsctxInprocHandler16 = 0x20,
|
||||
ClsctxReserved1 = 0x40,
|
||||
ClsctxReserved2 = 0x80,
|
||||
ClsctxReserved3 = 0x100,
|
||||
ClsctxReserved4 = 0x200,
|
||||
ClsctxNoCodeDownload = 0x400,
|
||||
ClsctxReserved5 = 0x800,
|
||||
ClsctxNoCustomMarshal = 0x1000,
|
||||
ClsctxEnableCodeDownload = 0x2000,
|
||||
ClsctxNoFailureLog = 0x4000,
|
||||
ClsctxDisableAaa = 0x8000,
|
||||
ClsctxEnableAaa = 0x10000,
|
||||
ClsctxFromDefaultContext = 0x20000,
|
||||
ClsctxInproc = ClsctxInprocServer | ClsctxInprocHandler,
|
||||
ClsctxServer = ClsctxInprocServer | ClsctxLocalServer | ClsctxRemoteServer,
|
||||
ClsctxAll = ClsctxServer | ClsctxInprocHandler
|
||||
}
|
||||
|
||||
[Flags]
|
||||
enum COINIT : uint
|
||||
enum Coinit : uint
|
||||
{
|
||||
/// Initializes the thread for multi-threaded object concurrency.
|
||||
COINIT_MULTITHREADED = 0x0,
|
||||
CoinitMultithreaded = 0x0,
|
||||
/// Initializes the thread for apartment-threaded object concurrency.
|
||||
COINIT_APARTMENTTHREADED = 0x2,
|
||||
CoinitApartmentthreaded = 0x2,
|
||||
/// Disables DDE for Ole1 support.
|
||||
COINIT_DISABLE_OLE1DDE = 0x4,
|
||||
CoinitDisableOle1Dde = 0x4,
|
||||
/// Trades memory for speed.
|
||||
COINIT_SPEED_OVER_MEMORY = 0x8
|
||||
CoinitSpeedOverMemory = 0x8
|
||||
}
|
||||
|
||||
[Flags]
|
||||
enum REGCLS : uint
|
||||
enum Regcls : uint
|
||||
{
|
||||
REGCLS_SINGLEUSE = 0,
|
||||
REGCLS_MULTIPLEUSE = 1,
|
||||
REGCLS_MULTI_SEPARATE = 2,
|
||||
REGCLS_SUSPENDED = 4,
|
||||
REGCLS_SURROGATE = 8
|
||||
RegclsSingleuse = 0,
|
||||
RegclsMultipleuse = 1,
|
||||
RegclsMultiSeparate = 2,
|
||||
RegclsSuspended = 4,
|
||||
RegclsSurrogate = 8
|
||||
}
|
||||
|
||||
|
||||
@@ -97,7 +94,7 @@ namespace ASCOM.Meade.net
|
||||
// We will need this API to post a WM_QUIT message to the main
|
||||
// thread in order to terminate this application.
|
||||
[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);
|
||||
|
||||
// GetCurrentThreadId() allows us to obtain the thread id of the
|
||||
@@ -108,21 +105,21 @@ namespace ASCOM.Meade.net
|
||||
#endregion
|
||||
|
||||
#region Private Data
|
||||
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 frmMain s_MainForm = null; // Reference to our main form
|
||||
private static ArrayList s_ComObjectAssys; // Dynamically loaded assemblies containing served COM objects
|
||||
private static ArrayList s_ComObjectTypes; // Served COM object types
|
||||
private static ArrayList s_ClassFactories; // Served COM object class factories
|
||||
private static string s_appId = "{4e68ec46-5ffc-49e7-b298-38a548df0bfd}"; // Our AppId
|
||||
private static readonly Object lockObject = new object();
|
||||
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 FrmMain _sMainForm = null; // Reference to our main form
|
||||
private static ArrayList _sComObjectAssys; // Dynamically loaded assemblies containing served COM objects
|
||||
private static ArrayList _sComObjectTypes; // Served COM object types
|
||||
private static ArrayList _sClassFactories; // Served COM object class factories
|
||||
private static string _sAppId = "{4e68ec46-5ffc-49e7-b298-38a548df0bfd}"; // Our AppId
|
||||
private static readonly Object LockObject = new object();
|
||||
#endregion
|
||||
|
||||
// This property returns the main thread's id.
|
||||
public static uint MainThreadId { get; private set; } // Stores the main thread's thread id.
|
||||
|
||||
// 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
|
||||
@@ -131,9 +128,9 @@ namespace ASCOM.Meade.net
|
||||
{
|
||||
get
|
||||
{
|
||||
lock (lockObject)
|
||||
lock (LockObject)
|
||||
{
|
||||
return objsInUse;
|
||||
return _objsInUse;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -142,14 +139,14 @@ namespace ASCOM.Meade.net
|
||||
public static int CountObject()
|
||||
{
|
||||
// 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.
|
||||
public static int UncountObject()
|
||||
{
|
||||
// Decrement the global count of objects.
|
||||
return Interlocked.Decrement(ref objsInUse);
|
||||
return Interlocked.Decrement(ref _objsInUse);
|
||||
}
|
||||
|
||||
// Returns the current server lock count.
|
||||
@@ -157,9 +154,9 @@ namespace ASCOM.Meade.net
|
||||
{
|
||||
get
|
||||
{
|
||||
lock (lockObject)
|
||||
lock (LockObject)
|
||||
{
|
||||
return serverLocks;
|
||||
return _serverLocks;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -169,7 +166,7 @@ namespace ASCOM.Meade.net
|
||||
public static int CountLock()
|
||||
{
|
||||
// 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
|
||||
@@ -177,7 +174,7 @@ namespace ASCOM.Meade.net
|
||||
public static int UncountLock()
|
||||
{
|
||||
// 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
|
||||
@@ -189,11 +186,11 @@ namespace ASCOM.Meade.net
|
||||
//
|
||||
public static void ExitIf()
|
||||
{
|
||||
lock (lockObject)
|
||||
lock (LockObject)
|
||||
{
|
||||
if ((ObjectsCount <= 0) && (ServerLockCount <= 0))
|
||||
{
|
||||
if (StartedByCOM)
|
||||
if (StartedByCom)
|
||||
{
|
||||
UIntPtr wParam = new UIntPtr(0);
|
||||
IntPtr lParam = new IntPtr(0);
|
||||
@@ -216,8 +213,8 @@ namespace ASCOM.Meade.net
|
||||
//
|
||||
private static bool LoadComObjectAssemblies()
|
||||
{
|
||||
s_ComObjectAssys = new ArrayList();
|
||||
s_ComObjectTypes = new ArrayList();
|
||||
_sComObjectAssys = new ArrayList();
|
||||
_sComObjectTypes = new ArrayList();
|
||||
|
||||
// put everything into one folder, the same as the server.
|
||||
string assyPath = Assembly.GetEntryAssembly().Location;
|
||||
@@ -246,8 +243,8 @@ namespace ASCOM.Meade.net
|
||||
if (attrbutes.Length > 0)
|
||||
{
|
||||
//MessageBox.Show("Adding Type: " + type.Name + " " + type.FullName);
|
||||
s_ComObjectTypes.Add(type); //PWGS - much simpler
|
||||
s_ComObjectAssys.Add(so);
|
||||
_sComObjectTypes.Add(type); //PWGS - much simpler
|
||||
_sComObjectAssys.Add(so);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -342,10 +339,10 @@ namespace ASCOM.Meade.net
|
||||
//
|
||||
// HKCR\APPID\appid
|
||||
//
|
||||
using (RegistryKey key = Registry.ClassesRoot.CreateSubKey("APPID\\" + s_appId))
|
||||
using (RegistryKey key = Registry.ClassesRoot.CreateSubKey("APPID\\" + _sAppId))
|
||||
{
|
||||
key.SetValue(null, assyDescription);
|
||||
key.SetValue("AppID", s_appId);
|
||||
key.SetValue("AppID", _sAppId);
|
||||
key.SetValue("AuthenticationLevel", 1, RegistryValueKind.DWord);
|
||||
}
|
||||
//
|
||||
@@ -354,7 +351,7 @@ namespace ASCOM.Meade.net
|
||||
using (RegistryKey key = Registry.ClassesRoot.CreateSubKey(string.Format("APPID\\{0}",
|
||||
Application.ExecutablePath.Substring(Application.ExecutablePath.LastIndexOf('\\') + 1))))
|
||||
{
|
||||
key.SetValue("AppID", s_appId);
|
||||
key.SetValue("AppID", _sAppId);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -370,7 +367,7 @@ namespace ASCOM.Meade.net
|
||||
//
|
||||
// For each of the driver assemblies
|
||||
//
|
||||
foreach (Type type in s_ComObjectTypes)
|
||||
foreach (Type type in _sComObjectTypes)
|
||||
{
|
||||
bool bFail = false;
|
||||
try
|
||||
@@ -386,7 +383,7 @@ namespace ASCOM.Meade.net
|
||||
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("AppId", s_appId);
|
||||
key.SetValue("AppId", _sAppId);
|
||||
using (RegistryKey key2 = key.CreateSubKey("Implemented Categories"))
|
||||
{
|
||||
key2.CreateSubKey("{62C8FE65-4EBB-45e7-B440-6E39B2CDBF29}");
|
||||
@@ -420,10 +417,10 @@ namespace ASCOM.Meade.net
|
||||
// Pull the display name from the ServedClassName attribute.
|
||||
attr = Attribute.GetCustomAttribute(type, typeof(ServedClassNameAttribute)); //PWGS Changed to search type for attribute rather than assembly
|
||||
string chooserName = ((ServedClassNameAttribute)attr).DisplayName ?? "MultiServer";
|
||||
using (var P = new ASCOM.Utilities.Profile())
|
||||
using (var p = new Profile())
|
||||
{
|
||||
P.DeviceType = deviceType;
|
||||
P.Register(progid, chooserName);
|
||||
p.DeviceType = deviceType;
|
||||
p.Register(progid, chooserName);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -456,14 +453,14 @@ namespace ASCOM.Meade.net
|
||||
//
|
||||
// Local server's DCOM/AppID information
|
||||
//
|
||||
Registry.ClassesRoot.DeleteSubKey(string.Format("APPID\\{0}", s_appId), false);
|
||||
Registry.ClassesRoot.DeleteSubKey(string.Format("APPID\\{0}", _sAppId), false);
|
||||
Registry.ClassesRoot.DeleteSubKey(string.Format("APPID\\{0}",
|
||||
Application.ExecutablePath.Substring(Application.ExecutablePath.LastIndexOf('\\') + 1)), false);
|
||||
|
||||
//
|
||||
// For each of the driver assemblies
|
||||
//
|
||||
foreach (Type type in s_ComObjectTypes)
|
||||
foreach (Type type in _sComObjectTypes)
|
||||
{
|
||||
string clsid = Marshal.GenerateGuidForType(type).ToString("B");
|
||||
string progid = Marshal.GenerateProgIdForType(type);
|
||||
@@ -490,10 +487,10 @@ namespace ASCOM.Meade.net
|
||||
//
|
||||
// ASCOM
|
||||
//
|
||||
using (var P = new ASCOM.Utilities.Profile())
|
||||
using (var p = new Profile())
|
||||
{
|
||||
P.DeviceType = deviceType;
|
||||
P.Unregister(progid);
|
||||
p.DeviceType = deviceType;
|
||||
p.Unregister(progid);
|
||||
}
|
||||
}
|
||||
catch (Exception) { }
|
||||
@@ -509,11 +506,11 @@ namespace ASCOM.Meade.net
|
||||
//
|
||||
private static bool RegisterClassFactories()
|
||||
{
|
||||
s_ClassFactories = new ArrayList();
|
||||
foreach (Type type in s_ComObjectTypes)
|
||||
_sClassFactories = new ArrayList();
|
||||
foreach (Type type in _sComObjectTypes)
|
||||
{
|
||||
ClassFactory factory = new ClassFactory(type); // Use default context & flags
|
||||
s_ClassFactories.Add(factory);
|
||||
_sClassFactories.Add(factory);
|
||||
if (!factory.RegisterClassObject())
|
||||
{
|
||||
MessageBox.Show("Failed to register class factory for " + type.Name,
|
||||
@@ -528,7 +525,7 @@ namespace ASCOM.Meade.net
|
||||
private static void RevokeClassFactories()
|
||||
{
|
||||
ClassFactory.SuspendClassObjects(); // Prevent race conditions
|
||||
foreach (ClassFactory factory in s_ClassFactories)
|
||||
foreach (ClassFactory factory in _sClassFactories)
|
||||
factory.RevokeClassObject();
|
||||
}
|
||||
#endregion
|
||||
@@ -552,7 +549,7 @@ namespace ASCOM.Meade.net
|
||||
switch (args[0].ToLower())
|
||||
{
|
||||
case "-embedding":
|
||||
StartedByCOM = true; // Indicate COM started us
|
||||
StartedByCom = true; // Indicate COM started us
|
||||
break;
|
||||
|
||||
case "-register":
|
||||
@@ -578,7 +575,7 @@ namespace ASCOM.Meade.net
|
||||
}
|
||||
}
|
||||
else
|
||||
StartedByCOM = false;
|
||||
StartedByCom = false;
|
||||
|
||||
return bRet;
|
||||
}
|
||||
@@ -598,24 +595,24 @@ namespace ASCOM.Meade.net
|
||||
if (!ProcessArguments(args)) return; // Register/Unregister
|
||||
|
||||
// Initialize critical member variables.
|
||||
objsInUse = 0;
|
||||
serverLocks = 0;
|
||||
_objsInUse = 0;
|
||||
_serverLocks = 0;
|
||||
MainThreadId = GetCurrentThreadId();
|
||||
Thread.CurrentThread.Name = "Main Thread";
|
||||
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
s_MainForm = new frmMain();
|
||||
if (StartedByCOM) s_MainForm.WindowState = FormWindowState.Minimized;
|
||||
_sMainForm = new FrmMain();
|
||||
if (StartedByCom) _sMainForm.WindowState = FormWindowState.Minimized;
|
||||
|
||||
// Register the class factories of the served objects
|
||||
RegisterClassFactories();
|
||||
|
||||
// Start up the garbage collection thread.
|
||||
GarbageCollection GarbageCollector = new GarbageCollection(1000);
|
||||
Thread GCThread = new Thread(new ThreadStart(GarbageCollector.GCWatch));
|
||||
GCThread.Name = "Garbage Collection Thread";
|
||||
GCThread.Start();
|
||||
GarbageCollection garbageCollector = new GarbageCollection(1000);
|
||||
Thread gcThread = new Thread(new ThreadStart(garbageCollector.GcWatch));
|
||||
gcThread.Name = "Garbage Collection Thread";
|
||||
gcThread.Start();
|
||||
|
||||
//
|
||||
// Start the message loop. This serializes incoming calls to our
|
||||
@@ -623,7 +620,7 @@ namespace ASCOM.Meade.net
|
||||
//
|
||||
try
|
||||
{
|
||||
Application.Run(s_MainForm);
|
||||
Application.Run(_sMainForm);
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -633,8 +630,8 @@ namespace ASCOM.Meade.net
|
||||
RevokeClassFactories();
|
||||
|
||||
// Now stop the Garbage Collector thread.
|
||||
GarbageCollector.StopThread();
|
||||
GarbageCollector.WaitForThreadToStop();
|
||||
garbageCollector.StopThread();
|
||||
garbageCollector.WaitForThreadToStop();
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace ASCOM.Meade.net.Localization
|
||||
internal class LocalisationHelper
|
||||
{
|
||||
private const string LocalizationNamespace = "LocalisationTest.Localization.Resources.Localization";
|
||||
ResourceManager _resourceManager;
|
||||
private readonly ResourceManager _resourceManager;
|
||||
|
||||
public LocalisationHelper()
|
||||
{
|
||||
|
||||
@@ -83,10 +83,39 @@
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<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" />
|
||||
<Reference Include="ASCOM.Exceptions, 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" />
|
||||
<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="System" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
@@ -102,7 +131,9 @@
|
||||
<Compile Include="GarbageCollection.cs" />
|
||||
<Compile Include="Localization\LocalisationHelper.cs" />
|
||||
<Compile Include="LocalServer.cs" />
|
||||
<Compile Include="ProfileProperties.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Wrapper\SharedResourcesWrapper.cs" />
|
||||
<EmbeddedResource Include="frmMain.resx">
|
||||
<SubType>Designer</SubType>
|
||||
<DependentUpon>frmMain.cs</DependentUpon>
|
||||
@@ -133,6 +164,8 @@
|
||||
<Content Include="ASCOM.ico" />
|
||||
<Content Include="ASCOM.png" />
|
||||
<Content Include="ReadMe.htm" />
|
||||
<None Include="BootstrapAscomProfileStore.ps1" />
|
||||
<None Include="packages.config" />
|
||||
<None Include="Resources\ASCOM.bmp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@@ -156,7 +189,6 @@
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<!-- 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.
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace ASCOM.Meade.net
|
||||
{
|
||||
public class ProfileProperties
|
||||
{
|
||||
// properies that are part of the profile
|
||||
public string ComPort { get; set; }
|
||||
public bool TraceLogger { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
@@ -21,7 +20,7 @@ using System.Runtime.InteropServices;
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("0.6.0.0")]
|
||||
[assembly: AssemblyFileVersion("0.6.0.0")]
|
||||
[assembly: AssemblyVersion("0.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("0.0.0.0")]
|
||||
|
||||
[assembly: ComVisibleAttribute(false)]
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace ASCOM.Meade.net
|
||||
|
||||
@@ -1,12 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using ASCOM.Utilities;
|
||||
using ASCOM.Meade.net;
|
||||
|
||||
namespace ASCOM.Meade.net
|
||||
{
|
||||
@@ -29,12 +24,12 @@ namespace ASCOM.Meade.net
|
||||
{
|
||||
System.Diagnostics.Process.Start("http://ascom-standards.org/");
|
||||
}
|
||||
catch (System.ComponentModel.Win32Exception noBrowser)
|
||||
catch (Win32Exception noBrowser)
|
||||
{
|
||||
if (noBrowser.ErrorCode == -2147467259)
|
||||
MessageBox.Show(noBrowser.Message);
|
||||
}
|
||||
catch (System.Exception other)
|
||||
catch (Exception other)
|
||||
{
|
||||
MessageBox.Show(other.Message);
|
||||
}
|
||||
|
||||
@@ -15,19 +15,10 @@
|
||||
//
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using ASCOM;
|
||||
using ASCOM.Utilities;
|
||||
|
||||
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>
|
||||
/// 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.
|
||||
@@ -39,10 +30,10 @@ namespace ASCOM.Meade.net
|
||||
public static class SharedResources
|
||||
{
|
||||
// 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.
|
||||
private static ASCOM.Utilities.Serial s_sharedSerial; // Shared serial port
|
||||
private static Serial _sSharedSerial; // Shared serial port
|
||||
|
||||
//
|
||||
// Public access to shared resources
|
||||
@@ -67,7 +58,7 @@ namespace ASCOM.Meade.net
|
||||
/// <summary>
|
||||
/// Shared serial port
|
||||
/// </summary>
|
||||
public static ASCOM.Utilities.Serial SharedSerial => s_sharedSerial ?? (s_sharedSerial = new ASCOM.Utilities.Serial());
|
||||
public static Serial SharedSerial => _sSharedSerial ?? (_sSharedSerial = new Serial());
|
||||
|
||||
/// <summary>
|
||||
/// number of connections to the shared serial port
|
||||
@@ -76,7 +67,7 @@ namespace ASCOM.Meade.net
|
||||
|
||||
public static void SendBlind(string message)
|
||||
{
|
||||
lock (lockObject)
|
||||
lock (LockObject)
|
||||
{
|
||||
SharedSerial.ClearBuffers();
|
||||
SharedSerial.Transmit(message);
|
||||
@@ -99,7 +90,7 @@ namespace ASCOM.Meade.net
|
||||
/// <returns></returns>
|
||||
public static string SendString(string message)
|
||||
{
|
||||
lock (lockObject)
|
||||
lock (LockObject)
|
||||
{
|
||||
SharedSerial.ClearBuffers();
|
||||
SharedSerial.Transmit(message);
|
||||
@@ -109,7 +100,7 @@ namespace ASCOM.Meade.net
|
||||
|
||||
public static string SendChar(string message)
|
||||
{
|
||||
lock (lockObject)
|
||||
lock (LockObject)
|
||||
{
|
||||
SharedSerial.ClearBuffers();
|
||||
SharedSerial.Transmit(message);
|
||||
@@ -119,7 +110,7 @@ namespace ASCOM.Meade.net
|
||||
|
||||
public static string ReadTerminated()
|
||||
{
|
||||
lock (lockObject)
|
||||
lock (LockObject)
|
||||
{
|
||||
return SharedSerial.ReceiveTerminated("#");
|
||||
}
|
||||
@@ -137,7 +128,7 @@ namespace ASCOM.Meade.net
|
||||
{
|
||||
set
|
||||
{
|
||||
lock (lockObject)
|
||||
lock (LockObject)
|
||||
{
|
||||
if (value)
|
||||
{
|
||||
@@ -155,47 +146,47 @@ namespace ASCOM.Meade.net
|
||||
}
|
||||
}
|
||||
}
|
||||
get { return SharedSerial.Connected; }
|
||||
get => SharedSerial.Connected;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Profile
|
||||
|
||||
internal static string driverID = "ASCOM.MeadeGeneric.Telescope";
|
||||
private const string DriverId = "ASCOM.MeadeGeneric.Telescope";
|
||||
|
||||
// Constants used for Profile persistence
|
||||
internal static string comPortProfileName = "COM Port";
|
||||
internal static string traceStateProfileName = "Trace Level";
|
||||
private const string ComPortProfileName = "COM Port";
|
||||
private const string TraceStateProfileName = "Trace Level";
|
||||
|
||||
public static void WriteProfile(ProfileProperties profileProperties)
|
||||
{
|
||||
lock (lockObject)
|
||||
lock (LockObject)
|
||||
{
|
||||
using (Profile driverProfile = new Profile())
|
||||
{
|
||||
driverProfile.DeviceType = "Telescope";
|
||||
driverProfile.WriteValue(driverID, traceStateProfileName, profileProperties.TraceLogger.ToString());
|
||||
driverProfile.WriteValue(driverID, comPortProfileName, profileProperties.ComPort);
|
||||
driverProfile.WriteValue(DriverId, TraceStateProfileName, profileProperties.TraceLogger.ToString());
|
||||
driverProfile.WriteValue(DriverId, ComPortProfileName, profileProperties.ComPort);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static readonly string comPortDefault = "COM1";
|
||||
internal static string traceStateDefault = "false";
|
||||
private const string ComPortDefault = "COM1";
|
||||
private const string TraceStateDefault = "false";
|
||||
|
||||
public static ProfileProperties ReadProfile()
|
||||
{
|
||||
lock (lockObject)
|
||||
lock (LockObject)
|
||||
{
|
||||
ProfileProperties profileProperties = new ProfileProperties();
|
||||
using (Profile driverProfile = new Profile())
|
||||
{
|
||||
driverProfile.DeviceType = "Telescope";
|
||||
profileProperties.ComPort =
|
||||
driverProfile.GetValue(driverID, comPortProfileName, string.Empty, comPortDefault);
|
||||
profileProperties.TraceLogger = Convert.ToBoolean(driverProfile.GetValue(driverID,
|
||||
traceStateProfileName, string.Empty, traceStateDefault));
|
||||
driverProfile.GetValue(DriverId, ComPortProfileName, string.Empty, ComPortDefault);
|
||||
profileProperties.TraceLogger = Convert.ToBoolean(driverProfile.GetValue(DriverId,
|
||||
TraceStateProfileName, string.Empty, TraceStateDefault));
|
||||
}
|
||||
|
||||
return profileProperties;
|
||||
@@ -218,14 +209,14 @@ namespace ASCOM.Meade.net
|
||||
|
||||
var profileProperties = ReadProfile();
|
||||
|
||||
using (SetupDialogForm F = new SetupDialogForm())
|
||||
using (SetupDialogForm f = new SetupDialogForm())
|
||||
{
|
||||
F.SetProfile(profileProperties);
|
||||
f.SetProfile(profileProperties);
|
||||
|
||||
var result = F.ShowDialog();
|
||||
var result = f.ShowDialog();
|
||||
if (result == System.Windows.Forms.DialogResult.OK)
|
||||
{
|
||||
profileProperties = F.GetProfile();
|
||||
profileProperties = f.GetProfile();
|
||||
|
||||
WriteProfile(profileProperties); // Persist device configuration values to the ASCOM Profile store
|
||||
}
|
||||
@@ -233,15 +224,7 @@ namespace ASCOM.Meade.net
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region AutostarProducts
|
||||
|
||||
public const string AUTOSTAR497 = "Autostar";
|
||||
|
||||
public const string AUTOSTAR497_31EE = "31Ee";
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Multi Driver handling
|
||||
|
||||
public static string ProductName { get; private set; } = string.Empty;
|
||||
@@ -261,7 +244,7 @@ namespace ASCOM.Meade.net
|
||||
/// 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
|
||||
/// </summary>
|
||||
private static Dictionary<string, DeviceHardware> connectedDevices = new Dictionary<string, DeviceHardware>();
|
||||
private static readonly Dictionary<string, DeviceHardware> _connectedDevices = new Dictionary<string, DeviceHardware>();
|
||||
|
||||
/// <summary>
|
||||
/// This is called in the driver Connect(true) property,
|
||||
@@ -270,26 +253,26 @@ namespace ASCOM.Meade.net
|
||||
/// <param name="deviceId"></param>
|
||||
public static void Connect(string deviceId)
|
||||
{
|
||||
lock (lockObject)
|
||||
lock (LockObject)
|
||||
{
|
||||
if (!connectedDevices.ContainsKey(deviceId))
|
||||
connectedDevices.Add(deviceId, new DeviceHardware());
|
||||
connectedDevices[deviceId].count++; // increment the value
|
||||
if (!_connectedDevices.ContainsKey(deviceId))
|
||||
_connectedDevices.Add(deviceId, new DeviceHardware());
|
||||
_connectedDevices[deviceId].Count++; // increment the value
|
||||
|
||||
if (deviceId == "Serial")
|
||||
{
|
||||
if (connectedDevices[deviceId].count == 1)
|
||||
if (_connectedDevices[deviceId].Count == 1)
|
||||
{
|
||||
var profileProperties = ReadProfile();
|
||||
SharedResources.SharedSerial.PortName = profileProperties.ComPort;
|
||||
SharedResources.SharedSerial.DTREnable = false;
|
||||
SharedResources.SharedSerial.RTSEnable = false;
|
||||
SharedResources.SharedSerial.DataBits = 8;
|
||||
SharedResources.SharedSerial.StopBits = SerialStopBits.One;
|
||||
SharedResources.SharedSerial.Parity = SerialParity.None;
|
||||
SharedResources.SharedSerial.Speed = SerialSpeed.ps9600;
|
||||
SharedResources.SharedSerial.Handshake = SerialHandshake.None;
|
||||
SharedResources.SharedSerial.Connected = true;
|
||||
SharedSerial.PortName = profileProperties.ComPort;
|
||||
SharedSerial.DTREnable = false;
|
||||
SharedSerial.RTSEnable = false;
|
||||
SharedSerial.DataBits = 8;
|
||||
SharedSerial.StopBits = SerialStopBits.One;
|
||||
SharedSerial.Parity = SerialParity.None;
|
||||
SharedSerial.Speed = SerialSpeed.ps9600;
|
||||
SharedSerial.Handshake = SerialHandshake.None;
|
||||
SharedSerial.Connected = true;
|
||||
|
||||
ProductName = SendString(":GVP#");
|
||||
FirmwareVersion = SendString(":GVN#");
|
||||
@@ -300,17 +283,17 @@ namespace ASCOM.Meade.net
|
||||
|
||||
public static void Disconnect(string deviceId)
|
||||
{
|
||||
lock (lockObject)
|
||||
lock (LockObject)
|
||||
{
|
||||
if (connectedDevices.ContainsKey(deviceId))
|
||||
if (_connectedDevices.ContainsKey(deviceId))
|
||||
{
|
||||
connectedDevices[deviceId].count--;
|
||||
if (connectedDevices[deviceId].count <= 0)
|
||||
_connectedDevices[deviceId].Count--;
|
||||
if (_connectedDevices[deviceId].Count <= 0)
|
||||
{
|
||||
connectedDevices.Remove(deviceId);
|
||||
_connectedDevices.Remove(deviceId);
|
||||
if (deviceId == "Serial")
|
||||
{
|
||||
SharedResources.SharedSerial.Connected = false;
|
||||
SharedSerial.Connected = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -319,8 +302,8 @@ namespace ASCOM.Meade.net
|
||||
|
||||
public static bool IsConnected(string deviceId)
|
||||
{
|
||||
if (connectedDevices.ContainsKey(deviceId))
|
||||
return (connectedDevices[deviceId].count > 0);
|
||||
if (_connectedDevices.ContainsKey(deviceId))
|
||||
return (_connectedDevices[deviceId].Count > 0);
|
||||
else
|
||||
return false;
|
||||
}
|
||||
@@ -329,7 +312,7 @@ namespace ASCOM.Meade.net
|
||||
|
||||
public static void Lock(Action action)
|
||||
{
|
||||
lock (lockObject)
|
||||
lock (LockObject)
|
||||
{
|
||||
action();
|
||||
}
|
||||
@@ -337,7 +320,7 @@ namespace ASCOM.Meade.net
|
||||
|
||||
public static T Lock<T>(Func<T> func)
|
||||
{
|
||||
lock (lockObject)
|
||||
lock (LockObject)
|
||||
{
|
||||
return func();
|
||||
}
|
||||
@@ -351,7 +334,7 @@ namespace ASCOM.Meade.net
|
||||
{
|
||||
private int _count;
|
||||
|
||||
internal int count
|
||||
internal int Count
|
||||
{
|
||||
set => _count = value;
|
||||
get => _count;
|
||||
@@ -359,7 +342,7 @@ namespace ASCOM.Meade.net
|
||||
|
||||
internal DeviceHardware()
|
||||
{
|
||||
count = 0;
|
||||
Count = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
using System;
|
||||
|
||||
namespace ASCOM.Meade.net.Wrapper
|
||||
{
|
||||
public interface ISharedResourcesWrapper
|
||||
{
|
||||
string Autostar497 { get; }
|
||||
string Autostar49731Ee { get; }
|
||||
|
||||
string Autostar49743Eg { get;}
|
||||
|
||||
void Connect(string deviceId);
|
||||
void Disconnect(string deviceId);
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
public class SharedResourcesWrapper : ISharedResourcesWrapper
|
||||
{
|
||||
#region AutostarProducts
|
||||
|
||||
public string Autostar497 => "Autostar";
|
||||
|
||||
public string Autostar49731Ee => "31Ee";
|
||||
public string Autostar49743Eg => "43Eg";
|
||||
|
||||
#endregion
|
||||
|
||||
public void Connect(string deviceId)
|
||||
{
|
||||
SharedResources.Connect( deviceId);
|
||||
}
|
||||
|
||||
public void Disconnect(string deviceId)
|
||||
{
|
||||
SharedResources.Disconnect(deviceId);
|
||||
}
|
||||
|
||||
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 ProfileProperties ReadProfile()
|
||||
{
|
||||
return SharedResources.ReadProfile();
|
||||
}
|
||||
|
||||
public void SetupDialog()
|
||||
{
|
||||
SharedResources.SetupDialog();
|
||||
}
|
||||
}
|
||||
}
|
||||
Generated
+2
-2
@@ -2,7 +2,7 @@ using System;
|
||||
|
||||
namespace ASCOM.Meade.net
|
||||
{
|
||||
partial class frmMain
|
||||
partial class FrmMain
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
@@ -48,7 +48,7 @@ namespace ASCOM.Meade.net
|
||||
this.ClientSize = new System.Drawing.Size(233, 52);
|
||||
this.Controls.Add(this.label1);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
|
||||
this.Name = "frmMain";
|
||||
this.Name = "FrmMain";
|
||||
this.Text = "Meade.net Driver Server";
|
||||
this.ResumeLayout(false);
|
||||
|
||||
|
||||
@@ -1,17 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace ASCOM.Meade.net
|
||||
{
|
||||
public partial class frmMain : Form
|
||||
public partial class FrmMain : Form
|
||||
{
|
||||
delegate void SetTextCallback(string text);
|
||||
|
||||
public frmMain()
|
||||
public FrmMain()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="ASCOM.Platform" version="6.4.2" targetFramework="net40" />
|
||||
</packages>
|
||||
@@ -9,11 +9,8 @@
|
||||
#define UseChooser
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace ASCOM
|
||||
namespace ASCOM.Meade.net
|
||||
{
|
||||
class Program
|
||||
{
|
||||
@@ -22,11 +19,11 @@ namespace ASCOM
|
||||
// Uncomment the code that's required
|
||||
#if UseChooser
|
||||
// choose the device
|
||||
string id = ASCOM.DriverAccess.Telescope.Choose("ASCOM.MeadeGeneric.Telescope");
|
||||
string id = DriverAccess.Telescope.Choose("ASCOM.MeadeGeneric.Telescope");
|
||||
if (string.IsNullOrEmpty(id))
|
||||
return;
|
||||
// create this device
|
||||
ASCOM.DriverAccess.Telescope device = new ASCOM.DriverAccess.Telescope(id);
|
||||
DriverAccess.Telescope device = new DriverAccess.Telescope(id);
|
||||
#else
|
||||
// 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");
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
@@ -32,5 +31,5 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
|
||||
[assembly: AssemblyVersion("0.6.0.0")]
|
||||
[assembly: AssemblyFileVersion("0.6.0.0")]
|
||||
[assembly: AssemblyVersion("0.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("0.0.0.0")]
|
||||
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
<?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>
|
||||
Reference in New Issue
Block a user