コード例 #1
0
ファイル: QH_Mods.cs プロジェクト: tivec/QuickMods
        internal static string GetModName(ApplicationLauncherButton button, out string Tooltip)
        {
            Tooltip = "";
            if (button == null)
            {
                return("None");
            }
            string nameSpace, id, toolTip;

            if (ToolbarControl.IsStockButtonManaged(button, out nameSpace, out id, out toolTip))
            {
                if (toolTip != "")
                {
                    Tooltip = toolTip;
                }
                else
                {
                    Tooltip = nameSpace;
                }
                return(id +
                       button.GetInstanceID().ToString());
            }
            Tooltip = button.onTrue.Method.Module.Assembly.GetName().Name;
            return(Tooltip +
                   button.GetInstanceID().ToString());
        }
コード例 #2
0
 internal bool isThisApp(ApplicationLauncherButton AppLauncherButton)
 {
     if (AppLauncherButton == null)
     {
         return(false);
     }
     return(appLauncherButton.GetInstanceID() == AppLauncherButton.GetInstanceID());
 }
コード例 #3
0
ファイル: QH_Hide.cs プロジェクト: stasikos/QuickMods
        void PopulateAppLauncherButtons(bool force = false)
        {
            if (!QStockToolbar.isAvailable || (!First && !force))
            {
                return;
            }
            Log("Begin PopulateAppLauncherButtons", "QHide");
            bool _cansave = false;

            ApplicationLauncherButton[] _appLauncherButtons = (ApplicationLauncherButton[])Resources.FindObjectsOfTypeAll(typeof(ApplicationLauncherButton));
            for (int _i = _appLauncherButtons.Length - 1; _i >= 0; --_i)
            {
                ApplicationLauncherButton _appLauncherButton = _appLauncherButtons[_i];
                if (!QStockToolbar.isModApp(_appLauncherButton) || QStockToolbar.Instance.isThisApp(_appLauncherButton))
                {
                    continue;
                }
                Log("Mods: " + QMods.GetModName(_appLauncherButton) + " " + _appLauncherButton.GetInstanceID(), "QHide");
                QMods _QData = ModsToolbar.Find(q => q.AppRef == QMods.GetAppRef(_appLauncherButton));
                if (_QData != null)
                {
                    if (_QData.ModName != "None" && _QData.isActive)
                    {
                        if (!_QData.isThisApp(_appLauncherButton))
                        {
                            _QData.Refresh(_appLauncherButton);
                        }
                        if (_QData.isHidden != QSettings.Instance.isHidden)
                        {
                            _QData.isHidden = QSettings.Instance.isHidden;
                        }
                        continue;
                    }
                    ModsToolbar.Remove(_QData);
                    //Log ("Deleted an lost AppLauncherButton", "QHide");
                }
                _QData = new QMods(_appLauncherButton);
                ModsToolbar.Add(_QData);
                _cansave = true;
                Log("Added the AppLauncherButton of: " + _QData.ModName, "QHide");
            }
            if (_cansave)
            {
                QSettings.Instance.Save();
            }
            Log("End PopulateAppLauncherButtons", "QHide");
            Log("AppLauncherButtons count: " + _appLauncherButtons.Length, "QHide");
            Log("ModsToolbar count: " + ModsToolbar.Count, "QHide");
            Log("ModHasFirstConfig count: " + QSettings.Instance.ModHasFirstConfig.Count, "QHide");
        }