Skip to content

Commit 286d588

Browse files
committed
Merge remote-tracking branch 'otherthing/master' into offline-settings
2 parents e36c80e + 7ba7ae9 commit 286d588

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

novideo_srgb/MainViewModel.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,12 @@ public void SaveConfig()
131131
{
132132
try
133133
{
134+
List<XElement> offlineEntries = null;
135+
if (File.Exists(_configPath))
136+
{
137+
List<XElement> config = XElement.Load(_configPath).Descendants("monitor").ToList();
138+
offlineEntries = config.FindAll(x => !Monitors.Any(m => m.Path == (string)x.Attribute("path")));
139+
}
134140
var xElem = new XElement("monitors",
135141
Monitors.Select(x =>
136142
new XElement("monitor", new XAttribute("path", x.Path),
@@ -147,6 +153,10 @@ public void SaveConfig()
147153
new XAttribute("green_scaler", x.GreenScaler),
148154
new XAttribute("blue_scaler", x.BlueScaler),
149155
new XAttribute("linear_scale_space", x.LinearScaleSpace))));
156+
if (offlineEntries != null)
157+
{
158+
xElem.Add(offlineEntries);
159+
}
150160
xElem.Save(_configPath);
151161
}
152162
catch (Exception ex)

0 commit comments

Comments
 (0)