Ejemplo n.º 1
0
        public static void Initialize()
        {
            if (initialized)
            {
                return;
            }

            initialized = true;

            lock (thread_wait) {
                ThreadPool.QueueUserWorkItem(IterateThread);
                Monitor.Wait(thread_wait);
            }

            if (!bus.NameHasOwner("org.freedesktop.Avahi"))
            {
                throw new ApplicationException("Could not find org.freedesktop.Avahi");
            }

            server = GetObject <IAvahiServer> ("/");
            uint api_version = server.GetAPIVersion();

            if (api_version < MINIMUM_AVAHI_API_VERSION)
            {
                throw new ApplicationException(String.Format("Avahi API version " +
                                                             "{0} is required, but {1} is what the server returned.",
                                                             MINIMUM_AVAHI_API_VERSION, api_version));
            }
        }
Ejemplo n.º 2
0
        public static void Initialize()
        {
            if (initialized)
            {
                return;
            }

            initialized = true;

            ConnectToSystemBus();

            if (!bus.NameHasOwner("org.freedesktop.Avahi"))
            {
                throw new ApplicationException("Could not find org.freedesktop.Avahi");
            }

            server = GetObject <IAvahiServer> ("/");
            uint api_version = server.GetAPIVersion();

            if (api_version < MINIMUM_AVAHI_API_VERSION)
            {
                throw new ApplicationException(String.Format("Avahi API version " +
                                                             "{0} is required, but {1} is what the server returned.",
                                                             MINIMUM_AVAHI_API_VERSION, api_version));
            }
        }