Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
auto-tx
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
vamp
auto-tx
Commits
9585edf8
Commit
9585edf8
authored
7 years ago
by
Niko Ehrenfeuchter
Browse files
Options
Downloads
Patches
Plain Diff
Split loading of config and status into separate methods.
parent
17c58ddb
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
AutoTx/AutoTx.cs
+17
-5
17 additions, 5 deletions
AutoTx/AutoTx.cs
with
17 additions
and
5 deletions
AutoTx/AutoTx.cs
+
17
−
5
View file @
9585edf8
...
...
@@ -92,7 +92,7 @@ namespace AutoTx
}
/// <summary>
/// Load
s
the initial settings.
/// Load the initial settings.
/// </summary>
private
void
LoadSettings
()
{
try
{
...
...
@@ -102,7 +102,8 @@ namespace AutoTx
_configPath
=
Path
.
Combine
(
baseDir
,
"configuration.xml"
);
_statusPath
=
Path
.
Combine
(
baseDir
,
"status.xml"
);
LoadConfigStatusXml
();
LoadConfigXml
();
LoadStatusXml
();
_roboCommand
=
new
RoboCommand
();
}
...
...
@@ -116,10 +117,11 @@ namespace AutoTx
CheckConfiguration
();
}
/// <summary>
/// Load
s
the configuration
and status
xml file
s
.
/// Load the configuration xml file.
/// </summary>
private
void
LoadConfig
Status
Xml
()
{
private
void
LoadConfigXml
()
{
try
{
_config
=
ServiceConfig
.
Deserialize
(
_configPath
);
writeLogDebug
(
"Loaded config from "
+
_configPath
);
...
...
@@ -129,17 +131,27 @@ namespace AutoTx
// this should terminate the service process:
throw
new
Exception
(
"Error loading config."
);
}
}
/// <summary>
/// Load the status xml file.
/// </summary>
private
void
LoadStatusXml
()
{
try
{
writeLogDebug
(
"Trying to load status from "
+
_statusPath
);
_status
=
ServiceStatus
.
Deserialize
(
_statusPath
);
writeLogDebug
(
"Loaded status from "
+
_statusPath
);
}
catch
(
Exception
ex
)
{
writeLog
(
"Error loading status XML: "
+
ex
.
Message
,
true
);
writeLog
(
"Error loading status XML from ["
+
_statusPath
+
"]: "
+
ex
.
Message
+
"\n"
+
ex
.
StackTrace
,
true
);
// this should terminate the service process:
throw
new
Exception
(
"Error loading status."
);
}
}
/// <summary>
/// Check if loaded configuration is valid, print a summary to the log.
/// </summary>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment