public static SenderConfiguration Load(XmlNode xml) { SenderConfiguration result = new SenderConfiguration(); result.ServerIP = IPAddress.Parse(xml.Attributes["serverIP"].Value); result.ServerPort = int.Parse(xml.Attributes["serverPort"].Value); return(result); }
public static Configuration Load(string fileName) { if (__instance == null) { if (!File.Exists(fileName)) { throw new FileNotFoundException(fileName); } XmlDocument xml = new XmlDocument(); xml.Load(fileName); XmlNode node = xml.SelectSingleNode("/configuration/settings/sender"); __instance = new Configuration(); __instance.Sender = SenderConfiguration.Load(node); node = xml.SelectSingleNode("/configuration/settings/receiver"); __instance.Receiver = ReceiverConfiguration.Load(node); } return(__instance); }