Consolidated key names
This commit is contained in:
@@ -21,6 +21,9 @@ namespace TimberWinR.ServiceHost
|
|||||||
{
|
{
|
||||||
internal class Program
|
internal class Program
|
||||||
{
|
{
|
||||||
|
const string KeyPath = @"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\TimberWinR";
|
||||||
|
const string KeyName = "ImagePath";
|
||||||
|
|
||||||
private static void Main(string[] args)
|
private static void Main(string[] args)
|
||||||
{
|
{
|
||||||
Arguments arguments = new Arguments();
|
Arguments arguments = new Arguments();
|
||||||
@@ -50,11 +53,8 @@ namespace TimberWinR.ServiceHost
|
|||||||
hostConfigurator.SetServiceName("TimberWinR");
|
hostConfigurator.SetServiceName("TimberWinR");
|
||||||
|
|
||||||
hostConfigurator.AfterInstall(() =>
|
hostConfigurator.AfterInstall(() =>
|
||||||
{
|
{
|
||||||
const string keyPath = @"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\TimberWinR";
|
var currentValue = Registry.GetValue(KeyPath, KeyName, "").ToString();
|
||||||
const string keyName = "ImagePath";
|
|
||||||
|
|
||||||
var currentValue = Registry.GetValue(keyPath, keyName, "").ToString();
|
|
||||||
if (!string.IsNullOrEmpty(currentValue))
|
if (!string.IsNullOrEmpty(currentValue))
|
||||||
{
|
{
|
||||||
AddServiceParameter("-configFile", arguments.ConfigFile);
|
AddServiceParameter("-configFile", arguments.ConfigFile);
|
||||||
@@ -69,29 +69,25 @@ namespace TimberWinR.ServiceHost
|
|||||||
|
|
||||||
private static void AddServiceParameter(string paramName, string value)
|
private static void AddServiceParameter(string paramName, string value)
|
||||||
{
|
{
|
||||||
string keyPath = @"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\TimberWinR";
|
|
||||||
string keyName = "ImagePath";
|
string currentValue = Registry.GetValue(KeyPath, KeyName, "").ToString();
|
||||||
|
|
||||||
string currentValue = Registry.GetValue(keyPath, keyName, "").ToString();
|
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(paramName) && !currentValue.Contains(string.Format("{0} ", paramName)))
|
if (!string.IsNullOrEmpty(paramName) && !currentValue.Contains(string.Format("{0} ", paramName)))
|
||||||
{
|
{
|
||||||
currentValue += string.Format(" {0} \"{1}\"", paramName, value.Replace("\\\\", "\\"));
|
currentValue += string.Format(" {0} \"{1}\"", paramName, value.Replace("\\\\", "\\"));
|
||||||
Registry.SetValue(keyPath, keyName, currentValue);
|
Registry.SetValue(KeyPath, KeyName, currentValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void AddServiceParameter(string paramName, int value)
|
private static void AddServiceParameter(string paramName, int value)
|
||||||
{
|
{
|
||||||
string keyPath = @"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\TimberWinR";
|
|
||||||
string keyName = "ImagePath";
|
string currentValue = Registry.GetValue(KeyPath, KeyName, "").ToString();
|
||||||
|
|
||||||
string currentValue = Registry.GetValue(keyPath, keyName, "").ToString();
|
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(paramName) && !currentValue.Contains(string.Format("{0}:", paramName)))
|
if (!string.IsNullOrEmpty(paramName) && !currentValue.Contains(string.Format("{0}:", paramName)))
|
||||||
{
|
{
|
||||||
currentValue += string.Format(" {0}:{1}", paramName, value);
|
currentValue += string.Format(" {0}:{1}", paramName, value);
|
||||||
Registry.SetValue(keyPath, keyName, currentValue);
|
Registry.SetValue(KeyPath, KeyName, currentValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ namespace TimberWinR.Diagnostics
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LogManager.GetCurrentClassLogger().Error("Tcp Exception", ex);
|
LogManager.GetCurrentClassLogger().Error(ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ namespace TimberWinR.Inputs
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LogManager.GetCurrentClassLogger().Error("Error Deleting Checkpoint File", ex);
|
LogManager.GetCurrentClassLogger().Error(ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ namespace TimberWinR.Inputs
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LogManager.GetCurrentClassLogger().Error("Tcp Exception", ex);
|
LogManager.GetCurrentClassLogger().Error(ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (clientStream != null)
|
if (clientStream != null)
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ namespace TimberWinR.Inputs
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LogManager.GetCurrentClassLogger().Error("WindowsEventListener", ex);
|
LogManager.GetCurrentClassLogger().Error(ex);
|
||||||
firstQuery = true;
|
firstQuery = true;
|
||||||
oLogQuery = new LogQuery();
|
oLogQuery = new LogQuery();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user