예제 #1
0
        static void UnregisterFunction(Type t)
        {
            try {
                // Create the registrar object
                GoogleDesktopRegistrarClass registrar = new GoogleDesktopRegistrarClass();

                // Unregister ourselves
                registrar.UnregisterComponent(controlGuid);
            } catch (Exception e) {
                MessageBox.Show("Exception thrown during registration. Description=" + e.Message);
            }
        }
예제 #2
0
        static void RegisterFunction(Type t)
        {
            try {
                // Set the 'MiscStatus' value in registry to a valid value
                string keyName = @"CLSID\" + t.GUID.ToString("B");
                using (RegistryKey key = Registry.ClassesRoot.OpenSubKey(keyName, true)) {
                    key.CreateSubKey("Control").Close();
                    using (RegistryKey subkey = key.CreateSubKey("MiscStatus")) {
                        subkey.SetValue("", "131457");
                    }
                    key.CreateSubKey("Control").Close();
                    key.SetValue("", pluginName);
                    using (RegistryKey subkey = key.CreateSubKey("Description")) {
                        subkey.SetValue("", pluginDesc);
                    }
                }

                // Create the registrar object
                GoogleDesktopRegistrarClass registrar = new GoogleDesktopRegistrarClass();

                // Start component registration by specifying our attributes
                object[] descriptions =
                {
                    "Title",       pluginName,
                    "Description", pluginName,
                    "Icon",        ""
                };
                registrar.StartComponentRegistration(controlGuid, descriptions);

                // A single component can register for multiple plugins with Google Desktop.
                // Here we register a single display plugin.
                IGoogleDesktopRegisterDisplayPlugin displayRegistration =
                    (IGoogleDesktopRegisterDisplayPlugin)
                    registrar.GetRegistrationInterface("GoogleDesktop.DisplayPluginRegistration");

                displayRegistration.RegisterPlugin(controlGuid, false);

                // Done with component registration.
                registrar.FinishComponentRegistration();
            } catch (Exception e) {
                MessageBox.Show("Exception thrown during registration. Description=" + e.Message);
            }
        }
예제 #3
0
        public GooglePlugin()
        {
            int cookie;

            RegistryKey key = Registry.CurrentUser.OpenSubKey (RegkeyPath, true);
            if (key == null) {
                key = Registry.CurrentUser.CreateSubKey (RegkeyPath);
            }

            object val = key.GetValue ("google-cookie");
            if (val == null) {
                string guid = "{" + Guid.NewGuid ().ToString () + "}";
                GoogleDesktopRegistrar reg = new GoogleDesktopRegistrarClass ();
                reg.StartComponentRegistration (guid, new object[] {
                    "Title", "Tangerine Google Plugin",
                    "Description", "Google plugin for the Tangerine music server",
                    "Icon", ""
                });

                IGoogleDesktopRegisterQueryPlugin qreg = (IGoogleDesktopRegisterQueryPlugin) reg.GetRegistrationInterface ("GoogleDesktop.QueryRegistration");
                cookie = qreg.RegisterPlugin (guid, true);
                reg.FinishComponentRegistration ();

                key.SetValue ("google-cookie", cookie);
            } else {
                cookie = (int) val;
            }

            GoogleDesktopQueryAPIClass query = new GoogleDesktopQueryAPIClass ();
            IGoogleDesktopQueryResultSet results = query.Query (cookie, "|filetype:mp3 |filetype:aac |filetype:m4a |filetype:m4b |filetype:wma", "file", 1);

            IGoogleDesktopQueryResultItem item;
            while ((item = results.Next ()) != null) {
                if (item.schema == "Google.Desktop.MediaFile") {
                    try {
                        AddTrack (item);
                    } catch (Exception e) {
                    }
                }
            }
        }
예제 #4
0
        static void UnregisterFunction(Type t)
        {
            try {
            // Create the registrar object
            GoogleDesktopRegistrarClass registrar = new GoogleDesktopRegistrarClass();

            // Unregister ourselves
            registrar.UnregisterComponent(controlGuid);
              } catch (Exception e) {
            MessageBox.Show("Exception thrown during registration. Description=" + e.Message);
              }
        }
예제 #5
0
        static void RegisterFunction(Type t)
        {
            try {
            // Set the 'MiscStatus' value in registry to a valid value
            string keyName = @"CLSID\" + t.GUID.ToString("B");
            using (RegistryKey key = Registry.ClassesRoot.OpenSubKey(keyName, true)) {
              key.CreateSubKey("Control").Close();
              using (RegistryKey subkey = key.CreateSubKey("MiscStatus")) {
            subkey.SetValue("", "131457");
              }
              key.CreateSubKey("Control").Close();
              key.SetValue("",pluginName);
              using (RegistryKey subkey = key.CreateSubKey("Description")) {
            subkey.SetValue("", pluginDesc);
              }
            }

            // Create the registrar object
            GoogleDesktopRegistrarClass registrar = new GoogleDesktopRegistrarClass();

            // Start component registration by specifying our attributes
            object[] descriptions = {
              "Title", pluginName,
              "Description", pluginName,
              "Icon", ""
            };
            registrar.StartComponentRegistration(controlGuid, descriptions);

            // A single component can register for multiple plugins with Google Desktop.
            // Here we register a single display plugin.
            IGoogleDesktopRegisterDisplayPlugin displayRegistration =
              (IGoogleDesktopRegisterDisplayPlugin)
              registrar.GetRegistrationInterface("GoogleDesktop.DisplayPluginRegistration");

            displayRegistration.RegisterPlugin(controlGuid, false);

            // Done with component registration.
            registrar.FinishComponentRegistration();
              } catch (Exception e) {
            MessageBox.Show("Exception thrown during registration. Description=" + e.Message);
              }
        }
예제 #6
0
        static void RegisterFunction(Type t)
        {
            try
            {
                // Set the 'MiscStatus' value in registry to a valid value
                string keyName = @"CLSID\" + t.GUID.ToString("B");
                Log.Debug("Register: Creating Registry Keys");
                using (RegistryKey key = Registry.ClassesRoot.OpenSubKey(keyName, true))
                {
                    key.CreateSubKey("Control").Close();
                    using (RegistryKey subkey = key.CreateSubKey("MiscStatus"))
                    {
                        subkey.SetValue("", "131457");
                    }
                    key.SetValue("", pluginName);
                    using (RegistryKey subkey = key.CreateSubKey("Description"))
                    {
                        subkey.SetValue("", pluginDescription);
                    }
                }

                Log.Debug("Register: Creating registrar Object");
                // Create the registrar object
                GoogleDesktopRegistrarClass registrar = new GoogleDesktopRegistrarClass();

                Log.Debug("Register: Filling Description Array");
                // Start component registration by specifying our attributes
                object[] descriptions = {
                                            "Title", pluginName,
                                            "Description", pluginDescription,
                                            "Icon", ""
                                        };
                registrar.StartComponentRegistration(controlGuid, descriptions);

                Log.Debug("Register: Registering Display Plugin");
                // A single component can register for multiple plugins with Google Desktop.
                // Here we register a single display plugin.
                IGoogleDesktopRegisterDisplayPlugin displayRegistration =
                    (IGoogleDesktopRegisterDisplayPlugin)
                    registrar.GetRegistrationInterface("GoogleDesktop.DisplayPluginRegistration");
                displayRegistration.RegisterPlugin(controlGuid, true);

                Log.Debug("Register: Finish Component Registration");
                // Done with component registration.
                registrar.FinishComponentRegistration();
                Log.Debug("Register: Successfully Completed");
            }
            catch (Exception e)
            {
                Log.Error("Exception thrown during registration. Description=" + e.Message);
                MessageBox.Show("The Plugin could not be registered. Please try uninstalling the Plugin and reinstalling it. If that doesn't work contact the author for support");
            }
        }