예제 #1
0
        public GameCreationManager(IPluginClient pluginClient, ISerializer serializer)
        {
            this.createGameService = new PluginService<CreateGameClientMessage, GameInviteReceivedServerMessage>(GamifyClientMessageType.CreateGame, GamifyServerMessageType.GameInviteReceived, pluginClient, serializer);
            this.acceptGameService = new PluginService<AcceptGameClientMessage, GameCreatedServerMessage>(GamifyClientMessageType.AcceptGame, GamifyServerMessageType.GameCreated, pluginClient, serializer);
            this.rejectGameService = new PluginService<RejectGameClientMessage, GameRejectedServerMessage>(GamifyClientMessageType.RejectGame, GamifyServerMessageType.GameRejected, pluginClient, serializer);

            this.createGameService.NotificationReceived += (sender, args) =>
            {
                if (this.GameInviteNotificationReceived != null)
                {
                    this.GameInviteNotificationReceived(this, args);
                }
            };

            this.acceptGameService.NotificationReceived += (sender, args) =>
            {
                if (this.GameCreatedNotificationReceived != null)
                {
                    this.GameCreatedNotificationReceived(this, args);
                }
            };

            this.rejectGameService.NotificationReceived += (sender, args) =>
            {
                if (this.GameRejectedNotificationReceived != null)
                {
                    this.GameRejectedNotificationReceived(this, args);
                }
            };
        }
예제 #2
0
 public void RegisterMenu(IPluginClient pluginClient, MenuType menuType, string menuText, bool fRegister)
 {
     foreach (Plugin plugin in this.dicPluginInstances.Values)
     {
         if (plugin.Instance != pluginClient)
         {
             continue;
         }
         if (fRegister)
         {
             if ((menuType & MenuType.Bar) == MenuType.Bar)
             {
                 this.dicFullNamesMenuRegistered_Sys[plugin.PluginInformation.PluginID] = menuText;
             }
             if ((menuType & MenuType.Tab) == MenuType.Tab)
             {
                 this.dicFullNamesMenuRegistered_Tab[plugin.PluginInformation.PluginID] = menuText;
             }
         }
         else
         {
             if ((menuType & MenuType.Bar) == MenuType.Bar)
             {
                 this.dicFullNamesMenuRegistered_Sys.Remove(plugin.PluginInformation.PluginID);
             }
             if ((menuType & MenuType.Tab) == MenuType.Tab)
             {
                 this.dicFullNamesMenuRegistered_Tab.Remove(plugin.PluginInformation.PluginID);
             }
         }
         break;
     }
 }
예제 #3
0
        /// <summary>
        /// Compile all plugin language packs
        /// </summary>
        public static void CompileLanguagePacks()
        {
            if (Plugins.Count == 0)
            {
                return;
            }

            foreach (PluginData pd in Plugins)
            {
                IPluginClient plugin = pd.Plugin;
                if (plugin.LanguagePacks == null)
                {
                    continue;
                }

                foreach (ILanguagePack lp in plugin.LanguagePacks)
                {
                    LanguagePack l = new LanguagePack();
                    l.Valid    = true;
                    l.Author   = lp.Author;
                    l.Language = lp.Language;
                    l.Name     = lp.Name;
                    l.Picture  = lp.Flag;
                    l.Table    = lp.Table;
                    LanguageManager.AddPack(l);
                }
            }
        }
예제 #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="App"/> class.
        /// </summary>
        /// <param name="owner">The owner program.</param>
        /// <param name="plugin">The plugin.</param>
        /// <param name="assemblyName">The assembly containg the plugin code and resources.</param>
        public App(Application owner, IPluginClient plugin, string assemblyName)
        {
            Owner        = owner;
            Plugin       = plugin;
            AssemblyName = assemblyName;

            // Ensure only one instance is running at a time.
            Logger.Write(Category.Debug, "Checking uniqueness");

            try
            {
                AppGuid = Plugin.Guid;
                if (AppGuid == Guid.Empty)
                {
                    // In case the guid is provided by the project settings and not source code.
                    Contract.RequireNotNull(Assembly.GetEntryAssembly(), out Assembly EntryAssembly);
                    Contract.RequireNotNull(EntryAssembly.GetCustomAttribute <GuidAttribute>(), out GuidAttribute AppGuidAttribute);
                    AppGuid = Guid.Parse(AppGuidAttribute.Value);
                }

                string AppUniqueId = AppGuid.ToString("B").ToUpperInvariant();

                // Try to create a global named event with a unique name. If we can create it we are first, otherwise there is another instance.
                // In that case, we just abort.
                bool createdNew;
                InstanceEvent = new EventWaitHandle(false, EventResetMode.ManualReset, AppUniqueId, out createdNew);
                if (!createdNew)
                {
                    Logger.Write(Category.Warning, "Another instance is already running");
                    InstanceEvent.Close();
                    InstanceEvent = null;
                    Owner.Shutdown();
                    return;
                }
            }
            catch (Exception e)
            {
                Logger.Write(Category.Error, $"(from App) {e.Message}");

                Owner.Shutdown();
                return;
            }

            // This code is here mostly to make sure that the Taskbar static class is initialized ASAP.
            // The taskbar rectangle is never empty. And if it is, we have no purpose.
            if (TaskbarLocation.ScreenBounds.IsEmpty)
            {
                Owner.Shutdown();
            }
            else
            {
                Owner.Startup += OnStartup;

                // Make sure we stop only on a call to Shutdown. This is for plugins that have a main window, we don't want to exit when it's closed.
                Owner.ShutdownMode = ShutdownMode.OnExplicitShutdown;
            }
        }
예제 #5
0
            private string InstanceToFullName(IPluginClient pluginClient, bool fTypeFullName)
            {
                Plugin plugin = dicPluginInstances.Values.FirstOrDefault(plugin1 => plugin1.Instance == pluginClient);

                return(plugin == null
                        ? null
                        : fTypeFullName
                                ? plugin.PluginInformation.TypeFullName
                                : plugin.PluginInformation.PluginID);
            }
예제 #6
0
 public string InstanceToFullName(IPluginClient pluginClient, bool fTypeFullName)
 {
     foreach (Plugin plugin in this.dicPluginInstances.Values)
     {
         if (plugin.Instance == pluginClient)
         {
             return(fTypeFullName ? plugin.PluginInformation.TypeFullName : plugin.PluginInformation.PluginID);
         }
     }
     return(string.Empty);
 }
예제 #7
0
            public bool TryGetLocalizedStrings(IPluginClient pluginClient, int count, out string[] arrStrings)
            {
                string key = InstanceToFullName(pluginClient, true);

                if (key.Length > 0 && dicLocalizingStrings.TryGetValue(key, out arrStrings) && arrStrings != null && arrStrings.Length == count)
                {
                    return(true);
                }
                arrStrings = null;
                return(false);
            }
예제 #8
0
 /// <summary>
 /// Get plugin data by IPluginClient
 /// </summary>
 /// <param name="plugin">Plugin</param>
 /// <returns>Plugin Data</returns>
 public static PluginData GetPluginData(IPluginClient plugin)
 {
     foreach (PluginData pd in Plugins)
     {
         if (pd.Plugin == plugin)
         {
             return(pd);
         }
     }
     return(null);
 }
예제 #9
0
 public void Close(EndCode code) {
     if(pluginClient != null) {
         try {
             pluginClient.Close(code);
         }
         catch(Exception exception) {
             PluginManager.HandlePluginException(exception, IntPtr.Zero, pluginInfo.Name, "Closing plugin.");
         }
         pluginClient = null;
     }
     pluginInfo = null;
 }
예제 #10
0
 public Plugin Load(string pluginID)
 {
     if (File.Exists(Path))
     {
         try {
             PluginInformation information;
             if (dicPluginInformations.TryGetValue(pluginID, out information))
             {
                 IPluginClient pluginClient = assembly.CreateInstance(information.TypeFullName) as IPluginClient;
                 if (pluginClient != null)
                 {
                     Plugin     plugin = new Plugin(pluginClient, information);
                     IBarButton button = pluginClient as IBarButton;
                     if (button != null)
                     {
                         Image imageLarge = information.ImageLarge;
                         Image imageSmall = information.ImageSmall;
                         try {
                             Image image  = button.GetImage(true);
                             Image image4 = button.GetImage(false);
                             if (image != null)
                             {
                                 information.ImageLarge = image;
                                 if (imageLarge != null)
                                 {
                                     imageLarge.Dispose();
                                 }
                             }
                             if (image4 != null)
                             {
                                 information.ImageSmall = image4;
                                 if (imageSmall != null)
                                 {
                                     imageSmall.Dispose();
                                 }
                             }
                         }
                         catch (Exception exception) {
                             PluginManager.HandlePluginException(exception, IntPtr.Zero, information.Name, "Getting image from pluging.");
                             throw;
                         }
                     }
                     return(plugin);
                 }
             }
         }
         catch (Exception exception2) {
             QTUtility2.MakeErrorLog(exception2, null);
         }
     }
     return(null);
 }
예제 #11
0
 public void Close(EndCode code)
 {
     if (pluginClient != null)
     {
         try {
             pluginClient.Close(code);
         }
         catch (Exception exception) {
             PluginManager.HandlePluginException(exception, IntPtr.Zero, pluginInfo.Name, "Closing plugin.");
         }
         pluginClient = null;
     }
     pluginInfo = null;
 }
예제 #12
0
        /// <nodoc />
        public Plugin(string id, string path, Process process, IPluginClient pluginClient)
        {
            Contract.RequiresNotNullOrEmpty(id, "plugin id is null");
            Contract.RequiresNotNullOrEmpty(path, "plugin path is null");
            Contract.RequiresNotNull(process, "plugin process is null");
            Contract.RequiresNotNull(pluginClient, "pluginclient is null");

            Id                         = id;
            FilePath                   = path;
            Name                       = Path.GetFileName(path);
            PluginProcess              = process;
            PluginClient               = pluginClient;
            Status                     = PluginStatus.Initialized;
            PluginProcess.Exited      += HandleProcessExisted;
            m_startCompletionTaskSoure = TaskSourceSlim.Create <Unit>();
        }
예제 #13
0
        /// <nodoc />
        public Plugin(string id, string path, Task pluginTask, CancellationTokenSource cancellationTokenSource, IPluginClient pluginClient)
        {
            Contract.RequiresNotNullOrEmpty(id, "plugin id is null");
            Contract.RequiresNotNullOrEmpty(path, "plugin path is null");
            Contract.RequiresNotNull(pluginTask, "plugin task is null");
            Contract.RequiresNotNull(pluginClient, "pluginclient is null");

            Id         = id;
            FilePath   = path;
            Name       = Path.GetFileName(path);
            PluginTask = pluginTask;
            PluginTaskCancellationTokenSource = cancellationTokenSource;
            PluginClient = pluginClient;
            Status       = PluginStatus.Initialized;
            m_startCompletionTaskSoure = TaskSourceSlim.Create <Unit>();
        }
예제 #14
0
        public GameSelectionManager(IPluginClient pluginClient, ISerializer serializer)
        {
            this.openGameService = new PluginService<OpenGameClientMessage, GameInformationReceivedServerMessage>(GamifyClientMessageType.OpenGame, GamifyServerMessageType.GameInformationReceived, pluginClient, serializer);
            this.activeGamesService = new PluginService<GetActiveGamesClientMessage, ActiveGamesListServerMessage>(GamifyClientMessageType.GetActiveGames, GamifyServerMessageType.ActiveGamesList, pluginClient, serializer);
            this.pendingGamesService = new PluginService<GetPendingGamesClientMessage, PendingGamesListServerMessage>(GamifyClientMessageType.GetPendingGames, GamifyServerMessageType.PendingGamesList, pluginClient, serializer);
            this.finishedGamesService = new PluginService<GetFinishedGamesClientMessage, FinishedGamesListServerMessage>(GamifyClientMessageType.GetFinishedGames, GamifyServerMessageType.FinishedGamesList, pluginClient, serializer);

            this.openGameService.NotificationReceived += (sender, args) =>
            {
                if (this.GameInformationNotificationReceived != null)
                {
                    this.GameInformationNotificationReceived(this, args);
                }
            };

            this.activeGamesService.NotificationReceived += (sender, args) =>
            {
                if (this.ActiveGamesNotificationReceived != null)
                {
                    this.ActiveGamesNotificationReceived(this, args);
                }
            };

            this.pendingGamesService.NotificationReceived += (sender, args) =>
            {
                if (this.PendingGamesNotificationReceived != null)
                {
                    this.PendingGamesNotificationReceived(this, args);
                }
            };

            this.finishedGamesService.NotificationReceived += (sender, args) =>
            {
                if (this.FinishedGamesNotificationReceived != null)
                {
                    this.FinishedGamesNotificationReceived(this, args);
                }
            };
        }
예제 #15
0
        private void AddPluginIcon(MenuItem iconSubmenu, IPluginClient plugin)
        {
            Guid SubmenuGuid = plugin.Guid;

            // Protection against plugins reusing a guid...
            if (!IconSelectionTable.ContainsKey(SubmenuGuid))
            {
                RoutedUICommand SubmenuCommand = new RoutedUICommand();
                SubmenuCommand.Text = PluginManager.GuidToString(SubmenuGuid);

                // The currently preferred plugin will be checked as so.
                string SubmenuHeader    = plugin.Name;
                bool   SubmenuIsChecked = SubmenuGuid == PluginManager.PreferredPluginGuid;
                Bitmap SubmenuIcon      = plugin.SelectionBitmap;

                AddMenuCommand(SubmenuCommand, OnCommandSelectPreferred);
                MenuItem PluginMenu = CreateMenuItem(SubmenuCommand, SubmenuHeader, SubmenuIsChecked, SubmenuIcon);
                TaskbarIcon.PrepareMenuItem(PluginMenu, true, true);
                iconSubmenu.Items.Add(PluginMenu);

                IconSelectionTable.Add(SubmenuGuid, SubmenuCommand);
            }
        }
예제 #16
0
        /// <summary>
        /// Compile all plugin load tasks
        /// </summary>
        public static void CompileLoadTasks()
        {
            if (Plugins.Count == 0)
            {
                return;
            }

            foreach (PluginData pd in Plugins)
            {
                IPluginClient plugin = pd.Plugin;
                if (plugin.LoadTasks == null)
                {
                    continue;
                }

                foreach (KeyValuePair <string, Action> l in plugin.LoadTasks)
                {
                    LoadTaskWrapper lt = new LoadTaskWrapper();
                    lt.LoadTask = l;
                    LoadManager.AddTask(lt);
                }
            }
        }
예제 #17
0
 /// <summary>
 /// Compile a readable description for a plugin
 /// </summary>
 /// <param name="plugin">Plugin</param>
 /// <returns>Description</returns>
 public static String CompilePluginDesc(IPluginClient plugin)
 {
     return(plugin.Name + " by " + plugin.Author + " (v" + plugin.Version + ")");
 }
예제 #18
0
 internal void RemoveEvents(IPluginClient pluginClient)
 {
     if (TabChanged != null)
     {
         foreach (PluginEventHandler handler in TabChanged.GetInvocationList())
         {
             if (handler.Target == pluginClient)
             {
                 TabChanged = (PluginEventHandler)Delegate.Remove(TabChanged, handler);
             }
         }
     }
     if (TabAdded != null)
     {
         foreach (PluginEventHandler handler2 in TabAdded.GetInvocationList())
         {
             if (handler2.Target == pluginClient)
             {
                 TabAdded = (PluginEventHandler)Delegate.Remove(TabAdded, handler2);
             }
         }
     }
     if (TabRemoved != null)
     {
         foreach (PluginEventHandler handler3 in TabRemoved.GetInvocationList())
         {
             if (handler3.Target == pluginClient)
             {
                 TabRemoved = (PluginEventHandler)Delegate.Remove(TabRemoved, handler3);
             }
         }
     }
     if (NavigationComplete != null)
     {
         foreach (PluginEventHandler handler4 in NavigationComplete.GetInvocationList())
         {
             if (handler4.Target == pluginClient)
             {
                 NavigationComplete = (PluginEventHandler)Delegate.Remove(NavigationComplete, handler4);
             }
         }
     }
     if (SelectionChanged != null)
     {
         foreach (PluginEventHandler handler5 in SelectionChanged.GetInvocationList())
         {
             if (handler5.Target == pluginClient)
             {
                 SelectionChanged = (PluginEventHandler)Delegate.Remove(SelectionChanged, handler5);
             }
         }
     }
     if (ExplorerStateChanged != null)
     {
         foreach (PluginEventHandler handler6 in ExplorerStateChanged.GetInvocationList())
         {
             if (handler6.Target == pluginClient)
             {
                 ExplorerStateChanged = (PluginEventHandler)Delegate.Remove(ExplorerStateChanged, handler6);
             }
         }
     }
     if (SettingsChanged != null)
     {
         foreach (PluginEventHandler handler7 in SettingsChanged.GetInvocationList())
         {
             if (handler7.Target == pluginClient)
             {
                 SettingsChanged = (PluginEventHandler)Delegate.Remove(SettingsChanged, handler7);
             }
         }
     }
     if (MouseEnter != null)
     {
         foreach (EventHandler handler8 in MouseEnter.GetInvocationList())
         {
             if (handler8.Target == pluginClient)
             {
                 MouseEnter = (EventHandler)Delegate.Remove(MouseEnter, handler8);
             }
         }
     }
     if (PointedTabChanged != null)
     {
         foreach (PluginEventHandler handler9 in PointedTabChanged.GetInvocationList())
         {
             if (handler9.Target == pluginClient)
             {
                 PointedTabChanged = (PluginEventHandler)Delegate.Remove(PointedTabChanged, handler9);
             }
         }
     }
     if (MouseLeave != null)
     {
         foreach (EventHandler handler10 in MouseLeave.GetInvocationList())
         {
             if (handler10.Target == pluginClient)
             {
                 MouseLeave = (EventHandler)Delegate.Remove(MouseLeave, handler10);
             }
         }
     }
     if (MenuRendererChanged != null)
     {
         foreach (EventHandler handler11 in MenuRendererChanged.GetInvocationList())
         {
             if (handler11.Target == pluginClient)
             {
                 MenuRendererChanged = (EventHandler)Delegate.Remove(MenuRendererChanged, handler11);
             }
         }
     }
 }
예제 #19
0
 private string InstanceToFullName(IPluginClient pluginClient, bool fTypeFullName)
 {
     Plugin plugin = dicPluginInstances.Values.FirstOrDefault(plugin1 => plugin1.Instance == pluginClient);
     return plugin == null
             ? null
             : fTypeFullName
                     ? plugin.PluginInformation.TypeFullName
                     : plugin.PluginInformation.PluginID;
 }
예제 #20
0
 public Plugin(IPluginClient pluginClient, PluginInformation pluginInfo) {
     this.pluginClient = pluginClient;
     this.pluginInfo = pluginInfo;
     fBackgroundButtonIsSupported = ((pluginInfo.PluginType == PluginType.Background) && ((pluginClient is IBarButton) || (pluginClient is IBarCustomItem))) || ((pluginInfo.PluginType == PluginType.BackgroundMultiple) && (pluginClient is IBarMultipleCustomItems));
 }
예제 #21
0
        /// <summary>
        /// Gets the command enabled status.
        /// </summary>
        /// <param name="command">The command.</param>
        /// <returns>The enabled status.</returns>
        public static bool GetMenuIsEnabled(ICommand command)
        {
            IPluginClient Plugin = CommandTable[command];

            return(Plugin.GetMenuIsEnabled(command));
        }
예제 #22
0
        public static Bitmap GetMenuIcon(ICommand Command)
        {
            IPluginClient Plugin = CommandTable[Command];

            return(Plugin.GetMenuIcon(Command));
        }
예제 #23
0
 public void RegisterMenu(IPluginClient pluginClient, MenuType menuType, string menuText, bool fRegister) {
     pluginManager.RegisterMenu(pluginClient, menuType, menuText, fRegister);
 }
예제 #24
0
 public bool OpenPlugin(IPluginClient pluginClient, out string[] shortcutActions) {
     pluginClient.Open(this, shellBrowser);
     return pluginClient.QueryShortcutKeys(out shortcutActions);
 }
예제 #25
0
        /// <summary>
        /// Load a plugin by assembly
        /// </summary>
        /// <param name="a">Plugin Assembly</param>
        /// <returns>Success</returns>
        public static bool LoadPlugin(Assembly a)
        {
            String ass = "Unknown";

            try
            {
                ass = a.GetName().Name;
                Type pluginType = a.GetType(ass + ".Plugin");
                if (pluginType != null)
                {
                    IPluginClient ipc = (IPluginClient)Activator.CreateInstance(pluginType);
                    ipc.Host = PluginServer;

                    Settings s = null;
                    if (!File.Exists("data\\" + ass + ".aps"))
                    {
                        try
                        {
                            SettingDefaults sd = SettingsHost.DefaultsFromInterface(ipc.DefaultSettings);
                            s      = new Settings(sd);
                            s.Data = sd.Defaults;
                            s.Save("data\\" + ass + ".aps");
                        }
                        catch (Exception ex)
                        {
                            ErrorHandler.CreateError(ex, "The plugin " + ipc.Name + " was unable to create it's settings file");
                        }
                    }
                    else
                    {
                        try
                        {
                            SettingDefaults sd = SettingsHost.DefaultsFromInterface(ipc.DefaultSettings);
                            s = new Settings(sd);
                            s.Load("data\\" + ass + ".aps");

                            if (sd.Defaults.Count != ipc.DefaultSettings.Defaults.Count)
                            {
                                try
                                {
                                    if (File.Exists("data\\" + ass + ".aps.old"))
                                    {
                                        File.Delete("data\\" + ass + ".aps.old");
                                    }

                                    File.Copy("data\\" + ass + ".aps", "data\\" + ass + ".aps.old");
                                    File.Delete("data\\" + ass + ".aps");
                                    ErrorHandler.CreateError(new Exception(""), "The plugin " + ipc.Name + " has outdated or corrupted setting defaults - the settings file has been deleted and backed up");
                                }
                                catch (Exception ex)
                                {
                                    ErrorHandler.CreateError(ex, "The plugin " + ipc.Name + " has outdated or corrupted setting defaults - the settings file could not be deleted automatically and must manually be deleted");
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            ErrorHandler.CreateError(ex, "The plugin " + ipc.Name + " was unable to load it's settings file");
                        }
                    }

                    PluginData pd = null;
                    pd = new PluginData(ipc, new SettingsHost(pd, s));
                    Plugins.Add(pd);
                    Utils.Log("Loaded plugin: " + CompilePluginDesc(ipc), LogType.INFO);
                }
                else
                {
                    Utils.Log("Invalid plugin type: " + ass + ".Plugin", LogType.INFO);
                }
                return(true);
            }
            catch (Exception ex)
            {
                Utils.Log("Failed to load plugin: " + ass + " (" + ex.Message + ")", LogType.ERROR);
            }
            return(false);
        }
예제 #26
0
 public static void Show(IPluginClient plugin, DockState state = DockState.Unknown)
 {
 }
예제 #27
0
 public IPluginSettings GetSettings(IPluginClient plugin)
 {
     return(PluginManager.GetPluginData(plugin).Settings);
 }
예제 #28
0
        public static string GetMenuHeader(ICommand Command)
        {
            IPluginClient Plugin = CommandTable[Command];

            return(Plugin.GetMenuHeader(Command));
        }
예제 #29
0
 public void RegisterMenu(IPluginClient pluginClient, MenuType menuType, string menuText, bool fRegister)
 {
     foreach(Plugin plugin in dicPluginInstances.Values.Where(plugin => plugin.Instance == pluginClient)) {
         if(fRegister) {
             if((menuType & MenuType.Bar) == MenuType.Bar) {
                 dicFullNamesMenuRegistered_Sys[plugin.PluginInformation.PluginID] = menuText;
             }
             if((menuType & MenuType.Tab) == MenuType.Tab) {
                 dicFullNamesMenuRegistered_Tab[plugin.PluginInformation.PluginID] = menuText;
             }
         }
         else {
             if((menuType & MenuType.Bar) == MenuType.Bar) {
                 dicFullNamesMenuRegistered_Sys.Remove(plugin.PluginInformation.PluginID);
             }
             if((menuType & MenuType.Tab) == MenuType.Tab) {
                 dicFullNamesMenuRegistered_Tab.Remove(plugin.PluginInformation.PluginID);
             }
         }
         break;
     }
 }
예제 #30
0
        public static bool GetMenuIsChecked(ICommand Command)
        {
            IPluginClient Plugin = CommandTable[Command];

            return(Plugin.GetMenuIsChecked(Command));
        }
예제 #31
0
 public bool TryGetLocalizedStrings(IPluginClient pluginClient, int count, out string[] arrStrings)
 {
     string key = InstanceToFullName(pluginClient, true);
     if(key.Length > 0 && dicLocalizingStrings.TryGetValue(key, out arrStrings) && arrStrings != null && arrStrings.Length == count) {
         return true;
     }
     arrStrings = null;
     return false;
 }
예제 #32
0
        public static void OnExecuteCommand(ICommand Command)
        {
            IPluginClient Plugin = CommandTable[Command];

            Plugin.OnExecuteCommand(Command);
        }
예제 #33
0
 internal void RemoveEvents(IPluginClient pluginClient)
 {
     if(TabChanged != null) {
         foreach(PluginEventHandler handler in TabChanged.GetInvocationList()) {
             if(handler.Target == pluginClient) {
                 TabChanged = (PluginEventHandler)Delegate.Remove(TabChanged, handler);
             }
         }
     }
     if(TabAdded != null) {
         foreach(PluginEventHandler handler2 in TabAdded.GetInvocationList()) {
             if(handler2.Target == pluginClient) {
                 TabAdded = (PluginEventHandler)Delegate.Remove(TabAdded, handler2);
             }
         }
     }
     if(TabRemoved != null) {
         foreach(PluginEventHandler handler3 in TabRemoved.GetInvocationList()) {
             if(handler3.Target == pluginClient) {
                 TabRemoved = (PluginEventHandler)Delegate.Remove(TabRemoved, handler3);
             }
         }
     }
     if(NavigationComplete != null) {
         foreach(PluginEventHandler handler4 in NavigationComplete.GetInvocationList()) {
             if(handler4.Target == pluginClient) {
                 NavigationComplete = (PluginEventHandler)Delegate.Remove(NavigationComplete, handler4);
             }
         }
     }
     if(SelectionChanged != null) {
         foreach(PluginEventHandler handler5 in SelectionChanged.GetInvocationList()) {
             if(handler5.Target == pluginClient) {
                 SelectionChanged = (PluginEventHandler)Delegate.Remove(SelectionChanged, handler5);
             }
         }
     }
     if(ExplorerStateChanged != null) {
         foreach(PluginEventHandler handler6 in ExplorerStateChanged.GetInvocationList()) {
             if(handler6.Target == pluginClient) {
                 ExplorerStateChanged = (PluginEventHandler)Delegate.Remove(ExplorerStateChanged, handler6);
             }
         }
     }
     if(SettingsChanged != null) {
         foreach(PluginEventHandler handler7 in SettingsChanged.GetInvocationList()) {
             if(handler7.Target == pluginClient) {
                 SettingsChanged = (PluginEventHandler)Delegate.Remove(SettingsChanged, handler7);
             }
         }
     }
     if(MouseEnter != null) {
         foreach(EventHandler handler8 in MouseEnter.GetInvocationList()) {
             if(handler8.Target == pluginClient) {
                 MouseEnter = (EventHandler)Delegate.Remove(MouseEnter, handler8);
             }
         }
     }
     if(PointedTabChanged != null) {
         foreach(PluginEventHandler handler9 in PointedTabChanged.GetInvocationList()) {
             if(handler9.Target == pluginClient) {
                 PointedTabChanged = (PluginEventHandler)Delegate.Remove(PointedTabChanged, handler9);
             }
         }
     }
     if(MouseLeave != null) {
         foreach(EventHandler handler10 in MouseLeave.GetInvocationList()) {
             if(handler10.Target == pluginClient) {
                 MouseLeave = (EventHandler)Delegate.Remove(MouseLeave, handler10);
             }
         }
     }
     if(MenuRendererChanged != null) {
         foreach(EventHandler handler11 in MenuRendererChanged.GetInvocationList()) {
             if(handler11.Target == pluginClient) {
                 MenuRendererChanged = (EventHandler)Delegate.Remove(MenuRendererChanged, handler11);
             }
         }
     }
 }
예제 #34
0
 /// <summary>
 /// Create a new plugin data class
 /// </summary>
 /// <param name="a">Plugin</param>
 /// <param name="b">Settings Wrapper</param>
 public PluginData(IPluginClient a, IPluginSettings b)
 {
     Plugin   = a;
     Settings = b;
 }
예제 #35
0
 public bool TryGetLocalizedStrings(IPluginClient pluginClient, int count, out string[] arrStrings) {
     string key = this.pluginManager.InstanceToFullName(pluginClient, true);
     if(((key.Length > 0) && this.dicLocalizingStrings.TryGetValue(key, out arrStrings)) && ((arrStrings != null) && (arrStrings.Length == count))) {
         return true;
     }
     arrStrings = null;
     return false;
 }
예제 #36
0
 public Plugin(IPluginClient pluginClient, PluginInformation pluginInfo)
 {
     this.pluginClient            = pluginClient;
     this.pluginInfo              = pluginInfo;
     fBackgroundButtonIsSupported = ((pluginInfo.PluginType == PluginType.Background) && ((pluginClient is IBarButton) || (pluginClient is IBarCustomItem))) || ((pluginInfo.PluginType == PluginType.BackgroundMultiple) && (pluginClient is IBarMultipleCustomItems));
 }
예제 #37
0
 private static void InitializePlugin(IPluginClient plugin, bool isElevated, Dispatcher dispatcher, ITracer logger)
 {
     RegistryTools.Settings Settings = new RegistryTools.Settings("TaskbarIconHost", GuidToString(plugin.Guid), logger);
     plugin.Initialize(isElevated, dispatcher, Settings, logger);
 }