aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/AppBase/ConfigurationHelper.cs
diff options
context:
space:
mode:
authorMark Monteiro <marknr.monteiro@protonmail.com>2020-04-26 11:44:42 -0400
committerMark Monteiro <marknr.monteiro@protonmail.com>2020-04-26 11:44:42 -0400
commit93649ad77b1e6b005a9b7a33d4c82bbce6189ecc (patch)
tree225dc540a6166ed8ae13a4159cb1811a6c600f3c /Emby.Server.Implementations/AppBase/ConfigurationHelper.cs
parent00a0e013c695a3741218985afadd31265a6ddb40 (diff)
parentf81833693d0cae476d923f704451bb794a78da8a (diff)
Merge remote-tracking branch 'upstream/master' into simplify-https-config
Diffstat (limited to 'Emby.Server.Implementations/AppBase/ConfigurationHelper.cs')
-rw-r--r--Emby.Server.Implementations/AppBase/ConfigurationHelper.cs26
1 files changed, 12 insertions, 14 deletions
diff --git a/Emby.Server.Implementations/AppBase/ConfigurationHelper.cs b/Emby.Server.Implementations/AppBase/ConfigurationHelper.cs
index 854d7b4cb..0b681fddf 100644
--- a/Emby.Server.Implementations/AppBase/ConfigurationHelper.cs
+++ b/Emby.Server.Implementations/AppBase/ConfigurationHelper.cs
@@ -36,24 +36,22 @@ namespace Emby.Server.Implementations.AppBase
configuration = Activator.CreateInstance(type);
}
- using (var stream = new MemoryStream())
- {
- xmlSerializer.SerializeToStream(configuration, stream);
-
- // Take the object we just got and serialize it back to bytes
- var newBytes = stream.ToArray();
+ using var stream = new MemoryStream();
+ xmlSerializer.SerializeToStream(configuration, stream);
- // If the file didn't exist before, or if something has changed, re-save
- if (buffer == null || !buffer.SequenceEqual(newBytes))
- {
- Directory.CreateDirectory(Path.GetDirectoryName(path));
+ // Take the object we just got and serialize it back to bytes
+ var newBytes = stream.ToArray();
- // Save it after load in case we got new items
- File.WriteAllBytes(path, newBytes);
- }
+ // If the file didn't exist before, or if something has changed, re-save
+ if (buffer == null || !buffer.SequenceEqual(newBytes))
+ {
+ Directory.CreateDirectory(Path.GetDirectoryName(path));
- return configuration;
+ // Save it after load in case we got new items
+ File.WriteAllBytes(path, newBytes);
}
+
+ return configuration;
}
}
}