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
2bef5457
Commit
2bef5457
authored
7 years ago
by
Niko Ehrenfeuchter
Browse files
Options
Downloads
Patches
Plain Diff
Make common configuration file optional.
Refers to
#29
parent
8296ac2d
No related branches found
Branches containing commit
Tags
2.1
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ATxCommon/Serializables/ServiceConfig.cs
+7
-4
7 additions, 4 deletions
ATxCommon/Serializables/ServiceConfig.cs
with
7 additions
and
4 deletions
ATxCommon/Serializables/ServiceConfig.cs
+
7
−
4
View file @
2bef5457
...
...
@@ -281,12 +281,15 @@ namespace ATxCommon.Serializables
// behaviour of the .NET XmlSerializer on duplicates: only the first occurrence is
// used, all other ones are silentley being discarded - this way we simply append the
// contents of the common config file to the host-specific and deserialize then:
var
common
=
XElement
.
Load
(
commonFile
);
Log
.
Debug
(
"Loaded common configuration XML file: [{0}]"
,
commonFile
);
var
combined
=
XElement
.
Load
(
specificFile
);
Log
.
Debug
(
"Loaded host specific configuration XML file: [{0}]"
,
specificFile
);
combined
.
Add
(
common
.
Nodes
());
Log
.
Trace
(
"Combined XML structure:\n\n{0}\n\n"
,
combined
);
// the common configuration file is optional, so check if it exists at all:
if
(
File
.
Exists
(
commonFile
))
{
var
common
=
XElement
.
Load
(
commonFile
);
Log
.
Debug
(
"Loaded common configuration XML file: [{0}]"
,
commonFile
);
combined
.
Add
(
common
.
Nodes
());
Log
.
Trace
(
"Combined XML structure:\n\n{0}\n\n"
,
combined
);
}
using
(
var
reader
=
XmlReader
.
Create
(
new
StringReader
(
combined
.
ToString
())))
{
Log
.
Debug
(
"Trying to parse combined XML."
);
...
...
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