public static ReceiverConfiguration Load(XmlNode xml) { ReceiverConfiguration result = new ReceiverConfiguration(); result.ListenIP = IPAddress.Parse(xml.Attributes["listenIP"].Value); result.ListenPort = int.Parse(xml.Attributes["listenPort"].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); }