Ejemplo n.º 1
0
        public static void Main(String[] args)
        {
            Configuration config = new Configuration ();
            /*
            //config["grp1"]["key1"] = "foo!";

            //configurationGroup g = new configurationGroup ();

            //config ["flinstones"] ["barney"] = "Betty";

            //g ["foo"] = "bar";
            //g ["fred"] = "wilma";
            //config ["flinstones"] ["fred"] = "Wilma";
            //config ["flinstones"] = g;
            //config ["flinstones"] ["barney"] = "Betty";

            Console.WriteLine ("{0}", config);
            Console.WriteLine ("{0}", config ["flinstones"] ["foo"]);
            //config ["flinstones"] ["barney"] = "Betty";

            config.Parse (@";This is a sample configuration file
            key1 = val1
            key2 = val2
            [group]
            key1 = hello
            key2 = world
            key3=!!!!!
            key2=galaxy
            [yet another group]
            this is a keyword     =     and this is a value ; and just a dummy comment
            ");

            config ["foo"] ["foo1"] = "val1";
            config ["foo"] ["foo3"] = "val3";
            config ["foo"] ["foo2"] = "val2";
            */
            Console.WriteLine (config);
            config.Save ();

            /*
             *

            configuration config2 = new configuration ();
            config2.parse (config.ToString ());

            Console.WriteLine (config2);*/
        }
Ejemplo n.º 2
0
        // : base(serverINI, listenPort)
        public NotificationServer(string serverINI, int listenPort, string machinesINI)
        {
            Thread.CurrentThread.CurrentCulture = new CultureInfo ("en-US");
            network.setReceiveAction (Receiver);
            config = new Configuration (serverINI);
            machines = new Configuration (machinesINI);

            if (listenPort < 1 && config ["server"] ["serverPort"] != null)
                listenPort = int.Parse (config ["server"] ["serverPort"]);

            /*if (config ["server"] ["serverPort"] != null && config ["server"] ["serverPort"] != "")
                serverPort = int.Parse (config ["server"] ["serverPort"]);
            else
                serverPort = 7778;*/

            if (config ["server"] ["serverAddress"] == null || config ["client"] ["serverAddress"] == "0.0.0.0")
                address = ip.AddressList[0].ToString();

            setProperties (address,
                listenPort,
                "server",
                address,
                listenPort);
        }