Move computers from xml file c# to dictionary with read/write capabilities -


i writing application run service , check computers once hour see if up. have computerlist.xml file reading , writing to. format of xml file is

<computers>   <primaryservers>     <location1 type="primary">        <ipaddress>192.168.1.2</ipaddress>        <isalive>true</ipaddress>     </location1>     <location2></location2>   </primaryservers>   <secondaryservers>      <location1 type="secondary">         <ipaddress></ipaddress>         etc...      </location1>   </secondaryservers>   <clients>      etc... <type="client">   </clients> </computers> 

each location has different number of computers , i'd store values use in other methods , write bool file whether or not host alive after has been checked.

the idea application check if primary server alive, if it's not checks see if clients alive, if down know network down between sites , nothing, if server down, pushes out hosts file clients alive, redirecting traffic secondary server. use failover clustering lob application on server not allow this.

all i'm looking way read xml file, discern between primaries, secondaries, , clients, retrieve values , store them in dictionary. i've written code see if alive or not return each devices isalive status, need write xml have persistent data in case server rebooted. there not enough computers justify database.

thanks in advance.

you can use xmldocument class read , save xml document. it's in system.xml.

read more here:

https://msdn.microsoft.com/en-us/library/system.xml.xmldocument%28v=vs.110%29.aspx?f=255&mspperror=-2147217396


Comments

Popular posts from this blog

html - Styling progress bar with inline style -

java - Oracle Sql developer error: could not install some modules -

How to use autoclose brackets in Jupyter notebook? -