Exemple #1
0
        public TcpServer(string address)
        {
            AddressEntry[] entries = NDesk.DBus.Address.Parse(address);
            AddressEntry   entry   = entries[0];

            if (entry.Method != "tcp")
            {
                throw new Exception();
            }

            string val;

            if (entry.Properties.TryGetValue("port", out val))
            {
                port = UInt32.Parse(val);
            }

            if (entry.GUID == UUID.Zero)
            {
                entry.GUID = UUID.Generate();
            }
            Id = entry.GUID;

            /*
             * Id = entry.GUID;
             * if (Id == UUID.Zero)
             *      Id = UUID.Generate ();
             */

            this.address = entry.ToString();
            //Console.WriteLine ("Server address: " + Address);
        }
Exemple #2
0
        public UnixServer(string address)
        {
            AddressEntry[] entries = NDesk.DBus.Address.Parse(address);
            AddressEntry   entry   = entries[0];

            if (entry.Method != "unix")
            {
                throw new Exception();
            }

            string val;

            if (entry.Properties.TryGetValue("path", out val))
            {
                unixPath   = val;
                isAbstract = false;
            }
            else if (entry.Properties.TryGetValue("abstract", out val))
            {
                unixPath   = val;
                isAbstract = true;
            }

            if (String.IsNullOrEmpty(unixPath))
            {
                throw new Exception("Address path is invalid");
            }

            if (entry.GUID == UUID.Zero)
            {
                entry.GUID = UUID.Generate();
            }
            Id = entry.GUID;

            /*
             * Id = entry.GUID;
             * if (Id == UUID.Zero)
             *      Id = UUID.Generate ();
             */

            this.address = entry.ToString();
            //Console.WriteLine ("Server address: " + Address);
        }
Exemple #3
0
        public WinServer(string address)
        {
            AddressEntry[] entries = NDesk.DBus.Address.Parse(address);
            AddressEntry   entry   = entries[0];

            if (entry.Method != "win")
            {
                throw new Exception();
            }

            string val;

            if (entry.Properties.TryGetValue("path", out val))
            {
                pipePath = val;
            }

            if (String.IsNullOrEmpty(pipePath))
            {
                throw new Exception("Address path is invalid");
            }

            if (entry.GUID == UUID.Zero)
            {
                entry.GUID = UUID.Generate();
            }
            Id = entry.GUID;

            /*
             * Id = entry.GUID;
             * if (Id == UUID.Zero)
             *      Id = UUID.Generate ();
             */

            this.address = entry.ToString();
            Console.WriteLine("Server address: " + Address);
        }