Exemple #1
0
        public CustomSettings ReadXml()
        {
            if (File.Exists(Fields.XMLFileName))
            {
                XmlSerializer ser    = new XmlSerializer(typeof(CustomSettings));
                TextReader    reader = new StreamReader(Fields.XMLFileName);

                try
                {
                    Fields = ser.Deserialize(reader) as CustomSettings;
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                    Console.WriteLine("-----------------------------");
                    Console.WriteLine("Warning : Default settings loaded");
                }
                finally
                {
                    reader.Close();
                }
            }
            else
            {
                WriteXml();
            }
            return(Fields);
        }
Exemple #2
0
 public DatagramReceiver(CustomSettings settings, DatagramCollector datagramCollector)
 {
     _settings          = settings;
     _datagramCollector = datagramCollector;
 }
Exemple #3
0
 public SettingsLoader()
 {
     Fields = new CustomSettings();
 }
Exemple #4
0
 public DatagramSender(CustomSettings settings, DatagramGenerator datagramGenerator)
 {
     _settings          = settings;
     _datagramGenerator = datagramGenerator;
 }