Code tidyup
This commit is contained in:
+11
-10
@@ -29,6 +29,8 @@ namespace ASCOM.Meade.net
|
|||||||
public static class Server
|
public static class Server
|
||||||
{
|
{
|
||||||
|
|
||||||
|
private const string DRIVER_NAME = "Meade Generic";
|
||||||
|
|
||||||
#region Access to kernel32.dll, user32.dll, and ole32.dll functions
|
#region Access to kernel32.dll, user32.dll, and ole32.dll functions
|
||||||
[Flags]
|
[Flags]
|
||||||
enum Clsctx : uint
|
enum Clsctx : uint
|
||||||
@@ -256,8 +258,8 @@ namespace ASCOM.Meade.net
|
|||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
MessageBox.Show("Failed to load served COM class assembly " + fi.Name + " - " + e.Message,
|
MessageBox.Show($"Failed to load served COM class assembly {fi.Name} - {e.Message}",
|
||||||
"Meade Generic", MessageBoxButtons.OK, MessageBoxIcon.Stop);
|
DRIVER_NAME, MessageBoxButtons.OK, MessageBoxIcon.Stop);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -293,12 +295,11 @@ namespace ASCOM.Meade.net
|
|||||||
try { Process.Start(si); }
|
try { Process.Start(si); }
|
||||||
catch (System.ComponentModel.Win32Exception)
|
catch (System.ComponentModel.Win32Exception)
|
||||||
{
|
{
|
||||||
MessageBox.Show("The Meade Generic was not " + (arg == "/register" ? "registered" : "unregistered") +
|
MessageBox.Show($"The {DRIVER_NAME} was not {(arg == "/register" ? "registered" : "unregistered")} because you did not allow it.", DRIVER_NAME, MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||||
" because you did not allow it.", "Meade Generic", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
MessageBox.Show(ex.ToString(), "Meade Generic", MessageBoxButtons.OK, MessageBoxIcon.Stop);
|
MessageBox.Show(ex.ToString(), DRIVER_NAME, MessageBoxButtons.OK, MessageBoxIcon.Stop);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -356,8 +357,8 @@ namespace ASCOM.Meade.net
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
MessageBox.Show("Error while registering the server:\n" + ex.ToString(),
|
MessageBox.Show($"Error while registering the server:\n{ex}",
|
||||||
"Meade Generic", MessageBoxButtons.OK, MessageBoxIcon.Stop);
|
DRIVER_NAME, MessageBoxButtons.OK, MessageBoxIcon.Stop);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
@@ -426,7 +427,7 @@ namespace ASCOM.Meade.net
|
|||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
MessageBox.Show("Error while registering the server:\n" + ex.ToString(),
|
MessageBox.Show("Error while registering the server:\n" + ex.ToString(),
|
||||||
"Meade Generic", MessageBoxButtons.OK, MessageBoxIcon.Stop);
|
DRIVER_NAME, MessageBoxButtons.OK, MessageBoxIcon.Stop);
|
||||||
bFail = true;
|
bFail = true;
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
@@ -514,7 +515,7 @@ namespace ASCOM.Meade.net
|
|||||||
if (!factory.RegisterClassObject())
|
if (!factory.RegisterClassObject())
|
||||||
{
|
{
|
||||||
MessageBox.Show("Failed to register class factory for " + type.Name,
|
MessageBox.Show("Failed to register class factory for " + type.Name,
|
||||||
"Meade Generic", MessageBoxButtons.OK, MessageBoxIcon.Stop);
|
DRIVER_NAME, MessageBoxButtons.OK, MessageBoxIcon.Stop);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -570,7 +571,7 @@ namespace ASCOM.Meade.net
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
MessageBox.Show("Unknown argument: " + args[0] + "\nValid are : -register, -unregister and -embedding",
|
MessageBox.Show("Unknown argument: " + args[0] + "\nValid are : -register, -unregister and -embedding",
|
||||||
"Meade Generic", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
DRIVER_NAME, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user