diff --git a/AstroMath.UnitTests/AstroMath.UnitTests.csproj b/AstroMath.UnitTests/AstroMath.UnitTests.csproj index 14292b4..ecf9b7d 100644 --- a/AstroMath.UnitTests/AstroMath.UnitTests.csproj +++ b/AstroMath.UnitTests/AstroMath.UnitTests.csproj @@ -39,7 +39,7 @@ bin\x86\Debug\ DEBUG;TRACE full - x86 + AnyCPU prompt MinimumRecommendedRules.ruleset diff --git a/FocuserTestConsole/FocuserTestConsole.csproj b/FocuserTestConsole/FocuserTestConsole.csproj index 09329fa..34cf2fd 100644 --- a/FocuserTestConsole/FocuserTestConsole.csproj +++ b/FocuserTestConsole/FocuserTestConsole.csproj @@ -36,6 +36,25 @@ 4 false + + true + bin\Debug\ + DEBUG;TRACE + full + AnyCPU + prompt + MinimumRecommendedRules.ruleset + true + + + bin\Release\ + TRACE + true + pdbonly + AnyCPU + prompt + MinimumRecommendedRules.ruleset + diff --git a/Meade.net.Focuser.UnitTests/Meade.net.Focuser.UnitTests.csproj b/Meade.net.Focuser.UnitTests/Meade.net.Focuser.UnitTests.csproj index 8181584..fb2522e 100644 --- a/Meade.net.Focuser.UnitTests/Meade.net.Focuser.UnitTests.csproj +++ b/Meade.net.Focuser.UnitTests/Meade.net.Focuser.UnitTests.csproj @@ -24,7 +24,7 @@ DEBUG;TRACE prompt 4 - x86 + AnyCPU pdbonly diff --git a/Meade.net.Setup.0.7.3.101-test.msi b/Meade.net.Setup.0.7.3.101-test.msi deleted file mode 100644 index 5a621f2..0000000 Binary files a/Meade.net.Setup.0.7.3.101-test.msi and /dev/null differ diff --git a/Meade.net.Setup/AscomFocuserDriver.wxs b/Meade.net.Setup/AscomFocuserDriver.wxs index 67ae64a..84136ec 100644 --- a/Meade.net.Setup/AscomFocuserDriver.wxs +++ b/Meade.net.Setup/AscomFocuserDriver.wxs @@ -18,41 +18,6 @@ Vital="yes" Assembly=".net" AssemblyApplication="filFocuserDriverAssembly" /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Meade.net.Setup/AscomLocalServer.wxs b/Meade.net.Setup/AscomLocalServer.wxs index ccfc9c4..7b3a867 100644 --- a/Meade.net.Setup/AscomLocalServer.wxs +++ b/Meade.net.Setup/AscomLocalServer.wxs @@ -12,21 +12,31 @@ Assembly=".net" AssemblyApplication="filLocalServerAssembly" /> - - - - - - - - - - - - - - - + + + + + + + + + + + + + \ No newline at end of file diff --git a/Meade.net.Setup/AscomTelescopeDriver.wxs b/Meade.net.Setup/AscomTelescopeDriver.wxs index 86379d8..a6f8b16 100644 --- a/Meade.net.Setup/AscomTelescopeDriver.wxs +++ b/Meade.net.Setup/AscomTelescopeDriver.wxs @@ -18,41 +18,6 @@ Vital="yes" Assembly=".net" AssemblyApplication="filTelescopeDriverAssembly" /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Meade.net.Telescope.UnitTests/Meade.net.Telescope.UnitTests.csproj b/Meade.net.Telescope.UnitTests/Meade.net.Telescope.UnitTests.csproj index 930def6..9fcbe99 100644 --- a/Meade.net.Telescope.UnitTests/Meade.net.Telescope.UnitTests.csproj +++ b/Meade.net.Telescope.UnitTests/Meade.net.Telescope.UnitTests.csproj @@ -26,7 +26,7 @@ prompt 4 false - x86 + AnyCPU pdbonly diff --git a/Meade.net.Telescope/Meade.net.Telescope.csproj b/Meade.net.Telescope/Meade.net.Telescope.csproj index 70efc87..37a57ba 100644 --- a/Meade.net.Telescope/Meade.net.Telescope.csproj +++ b/Meade.net.Telescope/Meade.net.Telescope.csproj @@ -46,7 +46,7 @@ prompt 4 true - x86 + AnyCPU false @@ -65,7 +65,7 @@ ..\bin\Debug\ - x86 + AnyCPU diff --git a/Meade.net.Telescope/Telescope.cs b/Meade.net.Telescope/Telescope.cs index e83f852..cf94f12 100644 --- a/Meade.net.Telescope/Telescope.cs +++ b/Meade.net.Telescope/Telescope.cs @@ -30,7 +30,7 @@ namespace ASCOM.Meade.net /// [Guid("d9fd4b3e-c4f1-48ac-a16f-d02eef30d86f")] [ProgId("ASCOM.MeadeGeneric.Telescope")] - [ServedClassName("Meade.net Telescope")] + [ServedClassName("Meade Generic")] [ClassInterface(ClassInterfaceType.None)] public class Telescope : ReferenceCountedObjectBase, ITelescopeV3 { diff --git a/Meade.net.focuser/Focuser.cs b/Meade.net.focuser/Focuser.cs index 95476d2..81cccf4 100644 --- a/Meade.net.focuser/Focuser.cs +++ b/Meade.net.focuser/Focuser.cs @@ -28,7 +28,7 @@ namespace ASCOM.Meade.net /// [Guid("a32ac647-bf0f-42f9-8ab0-d166fa5884ad")] [ProgId("ASCOM.MeadeGeneric.focuser")] - [ServedClassName("Meade.net Focuser")] + [ServedClassName("Meade Generic")] [ClassInterface(ClassInterfaceType.None)] public class Focuser : ReferenceCountedObjectBase, IFocuserV3 { diff --git a/Meade.net.focuser/Meade.net.focuser.csproj b/Meade.net.focuser/Meade.net.focuser.csproj index d161efc..cbde904 100644 --- a/Meade.net.focuser/Meade.net.focuser.csproj +++ b/Meade.net.focuser/Meade.net.focuser.csproj @@ -66,7 +66,7 @@ DEBUG;TRACE true full - x86 + AnyCPU prompt MinimumRecommendedRules.ruleset diff --git a/Meade.net.sln b/Meade.net.sln index e916044..7cf5f7f 100644 --- a/Meade.net.sln +++ b/Meade.net.sln @@ -71,21 +71,23 @@ Global {A97E3AEC-F11D-49DA-B259-DE99DA813A86}.Release|x64.Build.0 = Release|Any CPU {A97E3AEC-F11D-49DA-B259-DE99DA813A86}.Release|x86.ActiveCfg = Release|x86 {A97E3AEC-F11D-49DA-B259-DE99DA813A86}.Release|x86.Build.0 = Release|x86 - {D5207217-61C7-4E94-8097-91DBACE57D2A}.Debug|Any CPU.ActiveCfg = Debug|x86 + {D5207217-61C7-4E94-8097-91DBACE57D2A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D5207217-61C7-4E94-8097-91DBACE57D2A}.Debug|Any CPU.Build.0 = Debug|Any CPU {D5207217-61C7-4E94-8097-91DBACE57D2A}.Debug|x64.ActiveCfg = Debug|x86 {D5207217-61C7-4E94-8097-91DBACE57D2A}.Debug|x64.Build.0 = Debug|x86 {D5207217-61C7-4E94-8097-91DBACE57D2A}.Debug|x86.ActiveCfg = Debug|x86 {D5207217-61C7-4E94-8097-91DBACE57D2A}.Debug|x86.Build.0 = Debug|x86 - {D5207217-61C7-4E94-8097-91DBACE57D2A}.Release|Any CPU.ActiveCfg = Release|x86 + {D5207217-61C7-4E94-8097-91DBACE57D2A}.Release|Any CPU.ActiveCfg = Release|Any CPU {D5207217-61C7-4E94-8097-91DBACE57D2A}.Release|x64.ActiveCfg = Release|x86 {D5207217-61C7-4E94-8097-91DBACE57D2A}.Release|x86.ActiveCfg = Release|x86 {D5207217-61C7-4E94-8097-91DBACE57D2A}.Release|x86.Build.0 = Release|x86 - {AABC96B8-C462-4B3A-9B5F-2929E3CB7A49}.Debug|Any CPU.ActiveCfg = Debug|x86 + {AABC96B8-C462-4B3A-9B5F-2929E3CB7A49}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AABC96B8-C462-4B3A-9B5F-2929E3CB7A49}.Debug|Any CPU.Build.0 = Debug|Any CPU {AABC96B8-C462-4B3A-9B5F-2929E3CB7A49}.Debug|x64.ActiveCfg = Debug|x86 {AABC96B8-C462-4B3A-9B5F-2929E3CB7A49}.Debug|x64.Build.0 = Debug|x86 {AABC96B8-C462-4B3A-9B5F-2929E3CB7A49}.Debug|x86.ActiveCfg = Debug|x86 {AABC96B8-C462-4B3A-9B5F-2929E3CB7A49}.Debug|x86.Build.0 = Debug|x86 - {AABC96B8-C462-4B3A-9B5F-2929E3CB7A49}.Release|Any CPU.ActiveCfg = Release|x86 + {AABC96B8-C462-4B3A-9B5F-2929E3CB7A49}.Release|Any CPU.ActiveCfg = Release|Any CPU {AABC96B8-C462-4B3A-9B5F-2929E3CB7A49}.Release|x64.ActiveCfg = Release|x86 {AABC96B8-C462-4B3A-9B5F-2929E3CB7A49}.Release|x86.ActiveCfg = Release|x86 {AABC96B8-C462-4B3A-9B5F-2929E3CB7A49}.Release|x86.Build.0 = Release|x86 @@ -101,12 +103,13 @@ Global {AD4959DD-33D7-4C3F-8DB0-7361D8E74A95}.Release|x64.Build.0 = Release|Any CPU {AD4959DD-33D7-4C3F-8DB0-7361D8E74A95}.Release|x86.ActiveCfg = Release|x86 {AD4959DD-33D7-4C3F-8DB0-7361D8E74A95}.Release|x86.Build.0 = Release|x86 - {8EEB5C25-8394-4257-8E57-CDED47CB6F1B}.Debug|Any CPU.ActiveCfg = Debug|x64 - {8EEB5C25-8394-4257-8E57-CDED47CB6F1B}.Debug|Any CPU.Build.0 = Debug|x64 + {8EEB5C25-8394-4257-8E57-CDED47CB6F1B}.Debug|Any CPU.ActiveCfg = Debug|x86 + {8EEB5C25-8394-4257-8E57-CDED47CB6F1B}.Debug|Any CPU.Build.0 = Debug|x86 {8EEB5C25-8394-4257-8E57-CDED47CB6F1B}.Debug|x64.ActiveCfg = Debug|x64 {8EEB5C25-8394-4257-8E57-CDED47CB6F1B}.Debug|x86.ActiveCfg = Debug|x86 {8EEB5C25-8394-4257-8E57-CDED47CB6F1B}.Debug|x86.Build.0 = Debug|x86 {8EEB5C25-8394-4257-8E57-CDED47CB6F1B}.Release|Any CPU.ActiveCfg = Release|x86 + {8EEB5C25-8394-4257-8E57-CDED47CB6F1B}.Release|Any CPU.Build.0 = Release|x86 {8EEB5C25-8394-4257-8E57-CDED47CB6F1B}.Release|x64.ActiveCfg = Release|x86 {8EEB5C25-8394-4257-8E57-CDED47CB6F1B}.Release|x86.ActiveCfg = Release|x86 {8EEB5C25-8394-4257-8E57-CDED47CB6F1B}.Release|x86.Build.0 = Release|x86 diff --git a/Meade.net/AssemblyInfo.cs b/Meade.net/AssemblyInfo.cs new file mode 100644 index 0000000..04b5aaf --- /dev/null +++ b/Meade.net/AssemblyInfo.cs @@ -0,0 +1,90 @@ +using System; +using System.Reflection; +using System.Runtime.InteropServices; +using System.Resources; + +namespace ASCOM.Meade.net +{ + public class AssemblyInfo + { + // The assembly information values. + public string Title = "", Description = "", Company = "", + Product = "", Copyright = "", Trademark = "", + AssemblyVersion = "", FileVersion = "", Guid = "", + NeutralLanguage = ""; + public bool IsComVisible = false; + + // Return a particular assembly attribute value. + public static T GetAssemblyAttribute(Assembly assembly) + where T : Attribute + { + // Get attributes of this type. + object[] attributes = + assembly.GetCustomAttributes(typeof(T), true); + + // If we didn't get anything, return null. + if ((attributes == null) || (attributes.Length == 0)) + return null; + + // Convert the first attribute value into + // the desired type and return it. + return (T)attributes[0]; + } + + // Constructors. + public AssemblyInfo() + : this(Assembly.GetExecutingAssembly()) + { + } + + public AssemblyInfo(Assembly assembly) + { + // Get values from the assembly. + AssemblyTitleAttribute titleAttr = + GetAssemblyAttribute(assembly); + if (titleAttr != null) Title = titleAttr.Title; + + AssemblyDescriptionAttribute assemblyAttr = + GetAssemblyAttribute(assembly); + if (assemblyAttr != null) Description = + assemblyAttr.Description; + + AssemblyCompanyAttribute companyAttr = + GetAssemblyAttribute(assembly); + if (companyAttr != null) Company = companyAttr.Company; + + AssemblyProductAttribute productAttr = + GetAssemblyAttribute(assembly); + if (productAttr != null) Product = productAttr.Product; + + AssemblyCopyrightAttribute copyrightAttr = + GetAssemblyAttribute(assembly); + if (copyrightAttr != null) Copyright = copyrightAttr.Copyright; + + AssemblyTrademarkAttribute trademarkAttr = + GetAssemblyAttribute(assembly); + if (trademarkAttr != null) Trademark = trademarkAttr.Trademark; + + var version = assembly.GetName().Version; + AssemblyVersion = $"{version.Major}.{version.Minor}.{version.Build}.{version.Revision}"; + + + AssemblyFileVersionAttribute fileVersionAttr = + GetAssemblyAttribute(assembly); + if (fileVersionAttr != null) FileVersion = + fileVersionAttr.Version; + + GuidAttribute guidAttr = GetAssemblyAttribute(assembly); + if (guidAttr != null) Guid = guidAttr.Value; + + NeutralResourcesLanguageAttribute languageAttr = + GetAssemblyAttribute(assembly); + if (languageAttr != null) NeutralLanguage = + languageAttr.CultureName; + + ComVisibleAttribute comAttr = + GetAssemblyAttribute(assembly); + if (comAttr != null) IsComVisible = comAttr.Value; + } + } +} diff --git a/Meade.net/LocalServer.cs b/Meade.net/LocalServer.cs index ddafa39..4fb6769 100644 --- a/Meade.net/LocalServer.cs +++ b/Meade.net/LocalServer.cs @@ -29,6 +29,8 @@ namespace ASCOM.Meade.net public static class Server { + private const string DRIVER_NAME = "Meade Generic"; + #region Access to kernel32.dll, user32.dll, and ole32.dll functions [Flags] enum Clsctx : uint @@ -256,8 +258,8 @@ namespace ASCOM.Meade.net } catch (Exception e) { - MessageBox.Show("Failed to load served COM class assembly " + fi.Name + " - " + e.Message, - "Meade.net", MessageBoxButtons.OK, MessageBoxIcon.Stop); + MessageBox.Show($"Failed to load served COM class assembly {fi.Name} - {e.Message}", + DRIVER_NAME, MessageBoxButtons.OK, MessageBoxIcon.Stop); return false; } @@ -293,12 +295,11 @@ namespace ASCOM.Meade.net try { Process.Start(si); } catch (System.ComponentModel.Win32Exception) { - MessageBox.Show("The Meade.net was not " + (arg == "/register" ? "registered" : "unregistered") + - " because you did not allow it.", "Meade.net", MessageBoxButtons.OK, MessageBoxIcon.Warning); + MessageBox.Show($"The {DRIVER_NAME} was not {(arg == "/register" ? "registered" : "unregistered")} because you did not allow it.", DRIVER_NAME, MessageBoxButtons.OK, MessageBoxIcon.Warning); } catch (Exception ex) { - MessageBox.Show(ex.ToString(), "Meade.net", MessageBoxButtons.OK, MessageBoxIcon.Stop); + MessageBox.Show(ex.ToString(), DRIVER_NAME, MessageBoxButtons.OK, MessageBoxIcon.Stop); } return; } @@ -356,8 +357,8 @@ namespace ASCOM.Meade.net } catch (Exception ex) { - MessageBox.Show("Error while registering the server:\n" + ex.ToString(), - "Meade.net", MessageBoxButtons.OK, MessageBoxIcon.Stop); + MessageBox.Show($"Error while registering the server:\n{ex}", + DRIVER_NAME, MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } finally @@ -426,7 +427,7 @@ namespace ASCOM.Meade.net catch (Exception ex) { MessageBox.Show("Error while registering the server:\n" + ex.ToString(), - "Meade.net", MessageBoxButtons.OK, MessageBoxIcon.Stop); + DRIVER_NAME, MessageBoxButtons.OK, MessageBoxIcon.Stop); bFail = true; } finally @@ -514,7 +515,7 @@ namespace ASCOM.Meade.net if (!factory.RegisterClassObject()) { MessageBox.Show("Failed to register class factory for " + type.Name, - "Meade.net", MessageBoxButtons.OK, MessageBoxIcon.Stop); + DRIVER_NAME, MessageBoxButtons.OK, MessageBoxIcon.Stop); return false; } } @@ -570,7 +571,7 @@ namespace ASCOM.Meade.net default: MessageBox.Show("Unknown argument: " + args[0] + "\nValid are : -register, -unregister and -embedding", - "Meade.net", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); + DRIVER_NAME, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); break; } } diff --git a/Meade.net/Meade.net.csproj b/Meade.net/Meade.net.csproj index d8277ba..e5b1b9c 100644 --- a/Meade.net/Meade.net.csproj +++ b/Meade.net/Meade.net.csproj @@ -43,6 +43,7 @@ AnyCPU MinimumRecommendedRules.ruleset true + false pdbonly @@ -68,7 +69,7 @@ ..\bin\Debug\ DEBUG;TRACE full - x86 + AnyCPU prompt MinimumRecommendedRules.ruleset true @@ -121,6 +122,7 @@ + diff --git a/Meade.net/Properties/AssemblyInfo.cs b/Meade.net/Properties/AssemblyInfo.cs index c121a1e..a2c5fb1 100644 --- a/Meade.net/Properties/AssemblyInfo.cs +++ b/Meade.net/Properties/AssemblyInfo.cs @@ -8,7 +8,7 @@ using System.Runtime.InteropServices; [assembly: AssemblyDescription("ASCOM multi-interface server for Meade.net")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("cjdawson.com")] -[assembly: AssemblyProduct("")] +[assembly: AssemblyProduct("ASCOM Meade Generic")] [assembly: AssemblyCopyright("Copyright © 2019 cjdawson.com")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] diff --git a/Meade.net/SetupDialogForm.cs b/Meade.net/SetupDialogForm.cs index 645ca81..6815a09 100644 --- a/Meade.net/SetupDialogForm.cs +++ b/Meade.net/SetupDialogForm.cs @@ -1,8 +1,6 @@ using System; using System.ComponentModel; -using System.Diagnostics; using System.Runtime.InteropServices; -using System.Text; using System.Windows.Forms; namespace ASCOM.Meade.net @@ -13,6 +11,10 @@ namespace ASCOM.Meade.net public SetupDialogForm() { InitializeComponent(); + + var assemblyInfo = new AssemblyInfo(); + + Text = $"{assemblyInfo.Product} Settings ({assemblyInfo.AssemblyVersion})"; } private void cmdCancel_Click(object sender, EventArgs e) // Cancel button event handler @@ -113,5 +115,20 @@ namespace ASCOM.Meade.net { UpdateOKButton(); } + + public void SetReadOnlyMode() + { + foreach (Control control in Controls) + { + control.Enabled = false; + } + + cmdCancel.Enabled = true; + //cmdOK.Enabled = false; + //comboBoxComPort.Enabled = false; + //chkTrace.Enabled = false; + //txtGuideRate.Enabled = false; + //cboPrecision.Enabled = false; + } } } \ No newline at end of file diff --git a/Meade.net/SetupDialogForm.resx b/Meade.net/SetupDialogForm.resx index fd6059a..69e65d4 100644 --- a/Meade.net/SetupDialogForm.resx +++ b/Meade.net/SetupDialogForm.resx @@ -178,7 +178,7 @@ 12, 9 - 123, 31 + 274, 31 2 diff --git a/Meade.net/SharedResources.cs b/Meade.net/SharedResources.cs index cd5209f..8ed30b9 100644 --- a/Meade.net/SharedResources.cs +++ b/Meade.net/SharedResources.cs @@ -15,6 +15,7 @@ // using System; using System.Collections.Generic; +using System.Linq; using ASCOM.Utilities; namespace ASCOM.Meade.net @@ -226,7 +227,12 @@ namespace ASCOM.Meade.net using (SetupDialogForm f = new SetupDialogForm()) { f.SetProfile(profileProperties); - + + if (IsConnected()) + { + f.SetReadOnlyMode(); + } + var result = f.ShowDialog(); if (result == System.Windows.Forms.DialogResult.OK) { @@ -332,6 +338,17 @@ namespace ASCOM.Meade.net } } + public static bool IsConnected() + { + foreach (var device in _connectedDevices) + { + if (device.Value.Count > 0) + return true; + } + + return false; + } + public static bool IsConnected(string deviceId) { if (_connectedDevices.ContainsKey(deviceId)) diff --git a/TelescopeTestConsole/TelescopeTestConsole.csproj b/TelescopeTestConsole/TelescopeTestConsole.csproj index 625da99..e0115a5 100644 --- a/TelescopeTestConsole/TelescopeTestConsole.csproj +++ b/TelescopeTestConsole/TelescopeTestConsole.csproj @@ -16,7 +16,7 @@ 512 - x86 + AnyCPU true full false @@ -36,6 +36,25 @@ 4 false + + true + bin\Debug\ + DEBUG;TRACE + full + AnyCPU + prompt + MinimumRecommendedRules.ruleset + true + + + bin\Release\ + TRACE + true + pdbonly + AnyCPU + prompt + MinimumRecommendedRules.ruleset +