Skip to content
Snippets Groups Projects
Commit 66355b47 authored by Niko Ehrenfeuchter's avatar Niko Ehrenfeuchter :keyboard:
Browse files

Rename path variables for status and config files.

Just for laziness reasons, to facilitate auto-completion.
parent a6d00d78
No related branches found
No related tags found
No related merge requests found
...@@ -23,8 +23,8 @@ namespace AutoTx ...@@ -23,8 +23,8 @@ namespace AutoTx
// naming convention: variables ending with "Path" are strings, variables // naming convention: variables ending with "Path" are strings, variables
// ending with "Dir" are DirectoryInfo objects // ending with "Dir" are DirectoryInfo objects
private string _configPath; private string _pathToConfig;
private string _statusPath; private string _pathToStatus;
private string _incomingPath; private string _incomingPath;
private string _managedPath; private string _managedPath;
...@@ -164,8 +164,8 @@ namespace AutoTx ...@@ -164,8 +164,8 @@ namespace AutoTx
try { try {
_transferState = TxState.Stopped; _transferState = TxState.Stopped;
var baseDir = AppDomain.CurrentDomain.BaseDirectory; var baseDir = AppDomain.CurrentDomain.BaseDirectory;
_configPath = Path.Combine(baseDir, "configuration.xml"); _pathToConfig = Path.Combine(baseDir, "configuration.xml");
_statusPath = Path.Combine(baseDir, "status.xml"); _pathToStatus = Path.Combine(baseDir, "status.xml");
LoadConfigXml(); LoadConfigXml();
LoadStatusXml(); LoadStatusXml();
...@@ -190,14 +190,14 @@ namespace AutoTx ...@@ -190,14 +190,14 @@ namespace AutoTx
/// </summary> /// </summary>
private void LoadConfigXml() { private void LoadConfigXml() {
try { try {
_config = ServiceConfig.Deserialize(_configPath); _config = ServiceConfig.Deserialize(_pathToConfig);
_incomingPath = Path.Combine(_config.SourceDrive, _config.IncomingDirectory); _incomingPath = Path.Combine(_config.SourceDrive, _config.IncomingDirectory);
_managedPath = Path.Combine(_config.SourceDrive, _config.ManagedDirectory); _managedPath = Path.Combine(_config.SourceDrive, _config.ManagedDirectory);
Log.Debug("Loaded config from [{0}]", _configPath); Log.Debug("Loaded config from [{0}]", _pathToConfig);
} }
catch (ConfigurationErrorsException ex) { catch (ConfigurationErrorsException ex) {
Log.Error("ERROR validating configuration file [{0}]: {1}", Log.Error("ERROR validating configuration file [{0}]: {1}",
_configPath, ex.Message); _pathToConfig, ex.Message);
throw new Exception("Error validating configuration."); throw new Exception("Error validating configuration.");
} }
catch (Exception ex) { catch (Exception ex) {
...@@ -216,14 +216,14 @@ namespace AutoTx ...@@ -216,14 +216,14 @@ namespace AutoTx
/// </summary> /// </summary>
private void LoadStatusXml() { private void LoadStatusXml() {
try { try {
Log.Debug("Trying to load status from [{0}]", _statusPath); Log.Debug("Trying to load status from [{0}]", _pathToStatus);
_status = ServiceStatus.Deserialize(_statusPath, _config); _status = ServiceStatus.Deserialize(_pathToStatus, _config);
Log.Debug("Loaded status from [{0}]", _statusPath); Log.Debug("Loaded status from [{0}]", _pathToStatus);
} }
catch (Exception ex) { catch (Exception ex) {
// FIXME: combine log and admin-email! // FIXME: combine log and admin-email!
var msg = string.Format("Error loading status XML from [{0}]: {1} {2}", var msg = string.Format("Error loading status XML from [{0}]: {1} {2}",
_statusPath, ex.Message, ex.StackTrace); _pathToStatus, ex.Message, ex.StackTrace);
Log.Error(msg); Log.Error(msg);
SendAdminEmail(msg); SendAdminEmail(msg);
// this should terminate the service process: // this should terminate the service process:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment