File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff 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 )
You can’t perform that action at this time.
0 commit comments