Ejemplo n.º 1
0
 private static ToolStripItem CreateMenuItem_AppLauncher_Virtual(string key, bool fReorderEnabled, RegistryKey rkSub, EventPack ep)
 {
     string[] valueNames = rkSub.GetValueNames();
     if ((valueNames != null) && (valueNames.Length > 0))
     {
         List <ToolStripItem> list = new List <ToolStripItem>();
         foreach (string str in valueNames)
         {
             string[] appVals = QTUtility2.ReadRegBinary <string>(str, rkSub);
             if (appVals != null)
             {
                 if ((appVals.Length == 3) || (appVals.Length == 4))
                 {
                     list.Add(CreateMenuItem_AppLauncher(str, appVals, ep));
                 }
             }
             else
             {
                 using (RegistryKey key2 = rkSub.OpenSubKey(str, false)) {
                     if (key2 != null)
                     {
                         ToolStripItem item = CreateMenuItem_AppLauncher_Virtual(str, fReorderEnabled, key2, ep);
                         if (item != null)
                         {
                             list.Add(item);
                         }
                     }
                 }
             }
         }
         if (list.Count > 0)
         {
             QMenuItem item2 = new QMenuItem(key, new MenuItemArguments(key, MenuTarget.VirtualFolder, MenuGenre.Application));
             item2.ImageKey = "folder";
             item2.Name     = key;
             DropDownMenuReorderable reorderable = new DropDownMenuReorderable(null);
             reorderable.ReorderEnabled    = fReorderEnabled;
             reorderable.MessageParent     = ep.MessageParentHandle;
             reorderable.ItemRightClicked += ep.ItemRightClickEventHandler;
             reorderable.ImageList         = QTUtility.ImageListGlobal;
             reorderable.AddItemsRange(list.ToArray(), "userappItem");
             reorderable.ItemClicked     += new ToolStripItemClickedEventHandler(MenuUtility.virtualDirectory_DropDownItemClicked);
             reorderable.ReorderFinished += new MenuReorderedEventHandler(MenuUtility.virtualDirectory_ReorderFinished);
             string name = rkSub.Name;
             reorderable.Name = name.Substring(name.IndexOf(@"Software\Quizo\QTTabBar\UserApps\"));
             item2.DropDown   = reorderable;
             return(item2);
         }
     }
     return(null);
 }
Ejemplo n.º 2
0
 public static void Initialize()
 {
     using (RegistryKey key = Registry.CurrentUser.CreateSubKey(@"Software\Quizo\QTTabBar\Plugins")) {
         if (key != null)
         {
             string[]    strArray = QTUtility2.ReadRegBinary <string>("Buttons_Order", key);
             string[]    array    = QTUtility2.ReadRegBinary <string>("Enabled", key);
             PluginKey[] keyArray = QTUtility2.ReadRegBinary <PluginKey>("ShortcutKeys", key);
             QTUtility.Path_PluginLangFile = (string)key.GetValue("LanguageFile", string.Empty);
             using (RegistryKey key2 = key.CreateSubKey("Paths")) {
                 bool flag = (array != null) && (array.Length > 0);
                 foreach (string str in key2.GetValueNames())
                 {
                     string path = (string)key2.GetValue(str, string.Empty);
                     if (path.Length > 0)
                     {
                         PluginAssembly pa = new PluginAssembly(path);
                         if (pa.PluginInfosExist)
                         {
                             if (flag)
                             {
                                 foreach (PluginInformation information in pa.PluginInformations)
                                 {
                                     if (Array.IndexOf <string>(array, information.PluginID) != -1)
                                     {
                                         information.Enabled = true;
                                         pa.Enabled          = true;
                                         if (information.PluginType == PluginType.Static)
                                         {
                                             LoadStatics(information, pa, false);
                                         }
                                     }
                                 }
                             }
                             dicPluginAssemblies[path] = pa;
                         }
                     }
                 }
             }
             if ((strArray != null) && (strArray.Length > 0))
             {
                 foreach (string str3 in strArray)
                 {
                     foreach (PluginAssembly assembly2 in dicPluginAssemblies.Values)
                     {
                         PluginInformation information2;
                         if (assembly2.TryGetPluginInformation(str3, out information2))
                         {
                             if (information2.Enabled)
                             {
                                 lstPluginButtonsOrder.Add(str3);
                             }
                             break;
                         }
                     }
                 }
             }
             if (keyArray != null)
             {
                 List <int> list = new List <int>();
                 foreach (PluginKey key3 in keyArray)
                 {
                     if (key3.Keys != null)
                     {
                         QTUtility.dicPluginShortcutKeys[key3.PluginID] = key3.Keys;
                         for (int i = 0; i < key3.Keys.Length; i++)
                         {
                             list.Add(key3.Keys[i]);
                         }
                     }
                 }
                 QTUtility.PluginShortcutKeysCache = list.ToArray();
             }
         }
     }
 }