private String getPOSNameAndVersion()
{
string REG_KEY = "HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\CloverSDK";
String name = "unset";
String version = "unset";
try
{
Object rName = Registry.GetValue(REG_KEY, "ExternalPOSName", "unset");
Object rVersion = Registry.GetValue(REG_KEY, "ExternalPOSVersion", "unset");
name = rName.ToString();
version = rVersion.ToString();
} catch (Exception e)
{
EventLog.WriteEntry(SERVICE_NAME, e.Message);
}
// not needed if the target Platform in the build is set to x86. The previous key path will resolve to the WOW6443Node as needed
/*
if (name.Equals("unset"))
{
REG_KEY = "HKEY_LOCAL_MACHINE\\Software\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\CloverSDK";
try
{
Object rName = Registry.GetValue(REG_KEY, "ExternalPOSName", "unset");
Object rVersion = Registry.GetValue(REG_KEY, "ExternalPOSVersion", "unset");
name = rName.ToString();
version = rVersion.ToString();
}
catch (Exception e)
{
System.Diagnostics.EventLog.WriteEntry(SERVICE_NAME, e.Message);
}
}
*/
if (name.Equals("unset") || version.Equals("unset"))
{
EventLog.WriteEntry(SERVICE_NAME, "POS Name or Version is not correctly set. The service will not run until they are appropriately intialized.");
throw new Exception("Invalid external POS name or version. The REST service cannot run without correctly configured <ExternalPOSName> and <ExternalPOSVersion> registry keys.");
}
EventLog.WriteEntry(SERVICE_NAME, "POS Name:Version from registry = " + name + ":" + version);
return name + ":" + version;
}