Ejemplo n.º 1
0
 public static DBProperties createProperties()
 {
     Dictionary<string, string> dictionary = new Dictionary<string, string>();
     foreach (var row in File.ReadAllLines("conf.properties"))
     {
         if (!row.StartsWith("#") && ! (row.Length==0))
         {
             dictionary.Add(row.Split('=')[0], string.Join("=", row.Split('=').Skip(1).ToArray()));
         }
     }
     DBProperties dbProperties = new DBProperties();
     dbProperties.setIp(dictionary["ip"]);
     dbProperties.setPort(Int32.Parse(dictionary["port"]));
     dbProperties.setUseMulticast(Boolean.Parse(dictionary["useMulticast"]));
     dbProperties.setMulticastIp(dictionary["multicastIp"]);
     dbProperties.setMulticastPort(Int32.Parse(dictionary["multicastPort"]));
     dbProperties.setUseUDP(Boolean.Parse(dictionary["useUDP"]));
     dbProperties.setNetworkInterface(dictionary["networkInterface"]);
     dbProperties.setNumberOfUDPConnections(Int32.Parse(dictionary["numberOfUDPConnections"]));
     dbProperties.setFirstUDPPortNumber(Int32.Parse(dictionary["firstUDPPortNumber"]));
     dbProperties.setUserName(dictionary["userName"]);
     dbProperties.setPassword(dictionary["password"]);
     return dbProperties;
 }