public static void Deserialize(ref MainSettings dataMainSettings, ref Rs485Settings dataRs485Settings, ref EthernetSettings dataEthernetSettings, ref HartSettings dataHartSettings)
 {
     Deserialize(ref dataMainSettings);
     Deserialize(ref dataRs485Settings);
     Deserialize(ref dataEthernetSettings);
     Deserialize(ref dataHartSettings);
 }
 public static void Deserialize(ref EthernetSettings dataEthernetSettings)
 {
     if (dataEthernetSettings == null) throw new ArgumentNullException("dataEthernetSettings");
     var reader = new System.Xml.Serialization.XmlSerializer(typeof(EthernetSettings));
     using (StreamReader file = new StreamReader(@"settings/EthernetSettings.xml"))
     {
         dataEthernetSettings = (EthernetSettings)reader.Deserialize(file);
         file.Close();
     }
 }
        public static void Serialize(EthernetSettings dataEthernetSettings)
        {
            if (!Directory.Exists("settings"))
                Directory.CreateDirectory("settings");

            var writer = new System.Xml.Serialization.XmlSerializer(typeof(EthernetSettings));
            using (StreamWriter file = new StreamWriter(@"settings/EthernetSettings.xml"))
            {
                writer.Serialize(file, dataEthernetSettings);
                file.Close();
            }
        }
 public static void Serialize(MainSettings dataMainSettings, Rs485Settings dataRs485Settings, EthernetSettings dataEthernetSettings, HartSettings dataHartSettings)
 {
     Serialize(dataMainSettings);
     Serialize(dataRs485Settings);
     Serialize(dataEthernetSettings);
     Serialize(dataHartSettings);
 }