1- using System ;
2- using System . Collections . ObjectModel ;
1+ using log4net ;
2+ using NETworkManager . Models ;
3+ using NETworkManager . Models . Network ;
4+ using System ;
35using System . IO ;
46using System . Linq ;
57using System . Xml . Serialization ;
6- using log4net ;
7- using NETworkManager . Controls ;
8- using NETworkManager . Models ;
9- using NETworkManager . Models . Network ;
10- using NETworkManager . Models . PowerShell ;
118
129namespace NETworkManager . Settings ;
1310
@@ -189,7 +186,7 @@ public static void Upgrade(Version fromVersion, Version toVersion)
189186 if ( fromVersion < new Version ( 2023 , 11 , 28 , 0 ) )
190187 UpgradeTo_2023_11_28_0 ( ) ;
191188
192-
189+
193190 // 2024.11.11.0
194191 if ( fromVersion < new Version ( 2024 , 11 , 11 , 0 ) )
195192 UpgradeTo_2024_11_11_0 ( ) ;
@@ -205,7 +202,7 @@ public static void Upgrade(Version fromVersion, Version toVersion)
205202 Log . Info ( "Settings upgrade finished!" ) ;
206203 }
207204
208- /// <summary>
205+ /// <summary>
209206 /// Method to apply changes for version 2023.3.7.0.
210207 /// </summary>
211208 private static void UpgradeTo_2023_3_7_0 ( )
@@ -217,14 +214,14 @@ private static void UpgradeTo_2023_3_7_0()
217214 Current . General_ApplicationList . Add ( ApplicationManager . GetDefaultList ( )
218215 . First ( x => x . Name == ApplicationName . SNTPLookup ) ) ;
219216 Current . SNTPLookup_SNTPServers =
220- new ObservableCollection < ServerConnectionInfoProfile > ( SNTPServer . GetDefaultList ( ) ) ;
217+ [ .. SNTPServer . GetDefaultList ( ) ] ;
221218
222219 // Add IP Scanner custom commands
223220 foreach ( var customCommand in from customCommand in IPScannerCustomCommand . GetDefaultList ( )
224- let customCommandFound =
225- Current . IPScanner_CustomCommands . FirstOrDefault ( x => x . Name == customCommand . Name )
226- where customCommandFound == null
227- select customCommand )
221+ let customCommandFound =
222+ Current . IPScanner_CustomCommands . FirstOrDefault ( x => x . Name == customCommand . Name )
223+ where customCommandFound == null
224+ select customCommand )
228225 {
229226 Log . Info ( $ "Add \" { customCommand . Name } \" to \" IPScanner_CustomCommands\" ...") ;
230227 Current . IPScanner_CustomCommands . Add ( customCommand ) ;
@@ -251,7 +248,7 @@ private static void UpgradeTo_2023_3_7_0()
251248 // Add new DNS lookup profiles
252249 Log . Info ( "Init \" DNSLookup_DNSServers_v2\" with default DNS servers..." ) ;
253250 Current . DNSLookup_DNSServers =
254- new ObservableCollection < DNSServerConnectionInfoProfile > ( DNSServer . GetDefaultList ( ) ) ;
251+ [ .. DNSServer . GetDefaultList ( ) ] ;
255252 }
256253
257254 /// <summary>
@@ -263,7 +260,7 @@ private static void UpgradeTo_2023_4_26_0()
263260
264261 // Add SNMP OID profiles
265262 Log . Info ( "Add SNMP OID profiles..." ) ;
266- Current . SNMP_OidProfiles = new ObservableCollection < SNMPOIDProfileInfo > ( SNMPOIDProfile . GetDefaultList ( ) ) ;
263+ Current . SNMP_OidProfiles = [ .. SNMPOIDProfile . GetDefaultList ( ) ] ;
267264 }
268265
269266 /// <summary>
@@ -297,9 +294,9 @@ private static void UpgradeTo_2023_11_28_0()
297294 // Add DNS lookup profiles after refactoring
298295 Log . Info ( "Init \" DNSLookup_DNSServers\" with default DNS servers..." ) ;
299296 Current . DNSLookup_DNSServers =
300- new ObservableCollection < DNSServerConnectionInfoProfile > ( DNSServer . GetDefaultList ( ) ) ;
297+ [ .. DNSServer . GetDefaultList ( ) ] ;
301298 }
302-
299+
303300 /// <summary>
304301 /// Method to apply changes for version 2024.11.11.0.
305302 /// </summary>
@@ -309,7 +306,7 @@ private static void UpgradeTo_2024_11_11_0()
309306
310307 Log . Info ( "Reset ApplicationList to default..." ) ;
311308 Current . General_ApplicationList =
312- new ObservableSetCollection < ApplicationInfo > ( ApplicationManager . GetDefaultList ( ) ) ;
309+ [ .. ApplicationManager . GetDefaultList ( ) ] ;
313310 }
314311
315312 /// <summary>
@@ -319,6 +316,13 @@ private static void UpgradeTo_2024_11_11_0()
319316 private static void UpgradeToLatest ( Version version )
320317 {
321318 Log . Info ( $ "Apply upgrade to { version } ...") ;
319+
320+ // Add Hosts editor application
321+ Log . Info ( "Add new app \" Hosts Editor\" ..." ) ;
322+
323+ Current . General_ApplicationList . Insert (
324+ ApplicationManager . GetDefaultList ( ) . ToList ( ) . FindIndex ( x => x . Name == ApplicationName . HostsEditor ) ,
325+ ApplicationManager . GetDefaultList ( ) . First ( x => x . Name == ApplicationName . HostsEditor ) ) ;
322326 }
323327
324328 #endregion
0 commit comments