public static string ConvertShortcutToString(Shortcut shortcut)
		{
			string shortcutString = Convert.ToString(shortcut);
			StringBuilder result = new StringBuilder(shortcutString);

			if (shortcutString.StartsWith("Alt"))
			{
				result.Insert(3, " + ");
			}
			else if (shortcutString.StartsWith("CtrlShift"))
			{
				result.Insert(9, " + ");
				result.Insert(4, " + ");
			}
			else if (shortcutString.StartsWith("Ctrl"))
			{
				result.Insert(4, " + ");
			}
			else if (shortcutString.StartsWith("Shift"))
			{
				result.Insert(5, " + ");
			}

			return result.ToString();
		}
예제 #2
0
파일: TextShortcut.cs 프로젝트: rsdn/janus
		public TextShortcut(string methodName,
			string shortName, string longName, Shortcut shortcut)
		{
			MethodName = methodName;
			_shortcut = shortcut;
			ShortName = shortName;
			LongName = longName;
		}
예제 #3
0
		private void Initialize(Bitmap bitmap, Shortcut shortcut, EventHandler handler, ImageList list, int imageIndex)
		{
			OwnerDraw = true;
			this.Shortcut = shortcut;
			icon = bitmap;
			clickHandler = handler;
			imageList = list;
			this.imageIndex = imageIndex;
		}
		/// <summary>
		/// Initialize a new instance of the <see cref="ConfigurationUICommand"/> class.
		/// </summary>		
		/// <param name="serviceProvider">The a mechanism for retrieving a service object; that is, an object that provides custom support to other objects.</param>
		/// <param name="text">The text for the command.</param>
		/// <param name="longText">The text that will be in the status bar.</param>
		/// <param name="commandState">One of the <see cref="CommandState"/> values.</param>		
		/// <param name="command">The command to execute.</param>		
		/// <param name="shortcut">A short cut for the command.</param>
		/// <param name="insertionPoint">One of the <see cref="InsertionPoint"/> values.</param>
		/// <param name="icon">The icon for the command.</param>
		public ConfigurationUICommand(IServiceProvider serviceProvider, string text,
			string longText, CommandState commandState,
			ConfigurationNodeCommand command, Shortcut shortcut,
			InsertionPoint insertionPoint, Icon icon) 
			: this(serviceProvider,
			text, longText, commandState, NodeMultiplicity.Allow, command, null,
			shortcut, insertionPoint, icon)
		{			
		}
예제 #5
0
        private static string ShortcutToString(Shortcut shortcut)
        {
            if (shortcut != Shortcut.None)
            {
                Keys keys = (Keys)shortcut;
                return TypeDescriptor.GetConverter(keys.GetType()).ConvertToString(keys);
            }

            return null;
        }
예제 #6
0
		protected bool RegisterHotkey(Shortcut key)
		{	//register hotkey
			int mod=0;
			Keys k2=Keys.None;
			if (((int)key & (int)Keys.Alt)==(int)Keys.Alt) {mod+=(int)Win32.Modifiers.MOD_ALT;k2=Keys.Alt;}
			if (((int)key & (int)Keys.Shift)==(int)Keys.Shift) {mod+=(int)Win32.Modifiers.MOD_SHIFT;k2=Keys.Shift;}
			if (((int)key & (int)Keys.Control)==(int)Keys.Control) {mod+=(int)Win32.Modifiers.MOD_CONTROL;k2=Keys.Control;}
			
			System.Diagnostics.Debug.Write(mod.ToString()+" ");
			System.Diagnostics.Debug.WriteLine((((int)key)-((int)k2)).ToString());

			return Win32.User32.RegisterHotKey(m_Window.Handle,this.GetType().GetHashCode(),(int)mod,((int)key)-((int)k2));
		}
예제 #7
0
 private static MenuItem AddMenuItem(
     Menu menu, string text, EventHandler handler, object context,
     Shortcut shortcut = Shortcut.None)
 {
     var item = new MenuItem(text, handler)
     {
         Tag = context,
         Shortcut = shortcut,
         ShowShortcut = shortcut != Shortcut.None
     };
     menu.MenuItems.Add(item);
     return item;
 }
 /// <summary>
 /// Initialize a new instance of the <see cref="ConfigurationUICommand"/> class.
 /// </summary>
 /// <param name="serviceProvider">The a mechanism for retrieving a service object; that is, an object that provides custom support to other objects.</param>
 /// <param name="text">The text for the command.</param>
 /// <param name="longText">The text that will be in the status bar.</param>
 /// <param name="commandState">One of the <see cref="CommandState"/> values.</param>
 /// <param name="multiplicity">One of the <see cref="NodeMultiplicity"/> values.</param>
 /// <param name="command">The command to execute.</param>
 /// <param name="nodeType">The node type that will be created when the command is executed.</param>
 /// <param name="shortcut">A short cut for the command.</param>
 /// <param name="insertionPoint">One of the <see cref="InsertionPoint"/> values.</param>
 /// <param name="icon">The icon for the command.</param>
 public ConfigurationUICommand(IServiceProvider serviceProvider, string text,
                               string longText, CommandState commandState, NodeMultiplicity multiplicity,
                               ConfigurationNodeCommand command, Type nodeType, Shortcut shortcut,
                               InsertionPoint insertionPoint, Icon icon)
 {
     this.text            = text;
     this.longText        = longText;
     this.commandState    = commandState;
     this.command         = command;
     this.nodeType        = nodeType;
     this.insertionPoint  = insertionPoint;
     this.shortcut        = shortcut;
     this.icon            = icon;
     this.serviceProvider = serviceProvider;
     this.multiplicity    = multiplicity;
 }
예제 #9
0
 /// <summary>
 /// <para>Initializes a new instance of the class with a specified caption, event handler, associated shortcut key, icon, status bar text, and the insertion point for the menu item.</para>
 /// </summary>
 /// <param name="text">
 /// <para>The caption for the menu item.</para>
 /// </param>
 /// <param name="command">
 /// <para>The <see cref="ConfigurationNodeCommand"/> to execute.</para>
 /// </param>
 /// <param name="node">
 /// <para>The <see cref="ConfigurationNode"/> to execute the command upon.</para>
 /// </param>
 /// <param name="shortcut">
 /// <para>One of the <see cref="Shortcut"/> values.</para>
 /// </param>
 /// <param name="statusBarText">
 /// <para>The text for the status bar.</para>
 /// </param>
 /// <param name="insertionPoint">
 /// <para>One of the <see cref="InsertionPoint"/> values.</para>
 /// </param>
 public ConfigurationMenuItem(string text, ConfigurationNodeCommand command, ConfigurationNode node, Shortcut shortcut, string statusBarText, InsertionPoint insertionPoint)
     : base(text, null, shortcut)
 {
     if (command == null)
     {
         throw new ArgumentNullException("command");
     }
     if (node == null)
     {
         throw new ArgumentNullException("node");
     }
     this.statusBarText = statusBarText;
     this.insertionPoint = insertionPoint;
     this.command = command;
     this.node = node;
 }
예제 #10
0
        /// <summary>
        /// Map the specified Shortcut value to a Keys value (note: this operation is a reverse
        /// lookup in a hashtable so may be slightly expensive)
        /// </summary>
        /// <param name="shortcut">Shortcut value to map</param>
        /// <returns>Keys that the Shortcut maps to</returns>
        public static Keys MapToKeys(Shortcut shortcut)
        {
            // search for the shortcut value
            IDictionaryEnumerator tableEnumerator = keysToShortcutTable.GetEnumerator();

            while (tableEnumerator.MoveNext())
            {
                if ((Shortcut)tableEnumerator.Value == shortcut)
                {
                    return((Keys)tableEnumerator.Key);
                }
            }

            // if we didn't find any value then return 'empty' Keys
            return(Keys.None);
        }
예제 #11
0
        public override void Deserialize(IDataReader reader)
        {
            this.barType = (uint)reader.ReadByte();
            if (this.barType < 0U)
            {
                throw new Exception("Forbidden value (" + (object)this.barType + ") on element of ShortcutBarContentMessage.barType.");
            }
            uint num = (uint)reader.ReadUShort();

            for (int index = 0; (long)index < (long)num; ++index)
            {
                Shortcut instance = ProtocolTypeManager.GetInstance <Shortcut>((uint)reader.ReadUShort());
                instance.Deserialize(reader);
                this.shortcuts.Add(instance);
            }
        }
예제 #12
0
        public void Upsert(Shortcut shortcut)
        {
            var option = new UpdateOptions {
                IsUpsert = true
            };
            var filter = Builders <Shortcut> .Filter.Where(x => x.id == shortcut.id && x.business_id == shortcut.business_id);

            _mongoClient.excuteMongoLinqUpdate <Shortcut>(filter, shortcut, option,
                                                          _appSettings.Value.MongoDB.ConnectionString, _appSettings.Value.MongoDB.Database, shortcuts,
                                                          true, "", DateTime.Now.AddMinutes(10)).Wait();

            CacheBase.cacheModifyAllKeyLinq(new List <string>()
            {
                shortcut.id
            });
        }
		/// <summary>
		/// Initialize a new instance of the <see cref="ConfigurationUICommand"/> class.
		/// </summary>		
		/// <param name="serviceProvider">The a mechanism for retrieving a service object; that is, an object that provides custom support to other objects.</param>
		/// <param name="text">The text for the command.</param>
		/// <param name="longText">The text that will be in the status bar.</param>
		/// <param name="commandState">One of the <see cref="CommandState"/> values.</param>		
		/// <param name="multiplicity">One of the <see cref="NodeMultiplicity"/> values.</param>
		/// <param name="command">The command to execute.</param>		
		/// <param name="nodeType">The node type that will be created when the command is executed.</param>
		/// <param name="shortcut">A short cut for the command.</param>
		/// <param name="insertionPoint">One of the <see cref="InsertionPoint"/> values.</param>
		/// <param name="icon">The icon for the command.</param>
		public ConfigurationUICommand(IServiceProvider serviceProvider, string text,
			string longText, CommandState commandState, NodeMultiplicity multiplicity,
			ConfigurationNodeCommand command, Type nodeType, Shortcut shortcut, 
			InsertionPoint insertionPoint, Icon icon)
		{
			this.text = text;
			this.longText = longText;
			this.commandState = commandState;
			this.command = command;
			this.nodeType = nodeType;
			this.insertionPoint = insertionPoint;
			this.shortcut = shortcut;
			this.icon = icon;
			this.serviceProvider = serviceProvider;
			this.multiplicity = multiplicity;
		}
예제 #14
0
        public static void ExecuteShortcut(Shortcut shortcut)
        {
            foreach (Action action in shortcut.Actions)
            {
                switch (action.Type)
                {
                case "command":
                    CommandAction ca = action as CommandAction;
                    System.Diagnostics.Process          process   = new System.Diagnostics.Process();
                    System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
                    if (!ca.KeepOpen)
                    {
                        startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
                        startInfo.Arguments   = $"/C {ca.Command}";
                    }
                    else
                    {
                        startInfo.Arguments = $"/k {ca.Command}";
                    }

                    startInfo.FileName = "cmd.exe";
                    process.StartInfo  = startInfo;
                    process.Start();
                    break;

                case "file":
                    FileAction fa = action as FileAction;
                    System.Diagnostics.Process.Start(fa.Path);
                    break;

                case "folder":
                    FolderAction foa = action as FolderAction;
                    System.Diagnostics.Process.Start(foa.Path);
                    break;

                case "software":
                    SoftwareAction sa = action as SoftwareAction;
                    System.Diagnostics.Process.Start(sa.Path);
                    break;

                case "website":
                    WebsiteAction wa = action as WebsiteAction;
                    System.Diagnostics.Process.Start(wa.Url);
                    break;
                }
            }
        }
예제 #15
0
        public void Sync_Shortcut()
        {
            var archive = new Shortcut {
                FullName = Get("CubeICE 圧縮")
            };
            var extract = new Shortcut {
                FullName = Get("CubeICE 解凍")
            };
            var settings = new Shortcut {
                FullName = Get("CubeICE 設定")
            };

            var src = new ShortcutSetting {
                Directory = Results
            };
            var menu = Preset.Compress |
                       Preset.CompressDetails |
                       Preset.Extract |
                       Preset.Settings;

            src.Preset = menu;
            Assert.That(src.Preset, Is.EqualTo(menu));

            src.Load();
            Assert.That(src.Preset.HasFlag(Preset.Compress), Is.False);
            Assert.That(src.Preset.HasFlag(Preset.CompressDetails), Is.True);
            Assert.That(src.Preset.HasFlag(Preset.Extract), Is.False);
            Assert.That(src.Preset.HasFlag(Preset.Settings), Is.False);

            src.Preset = menu;
            src.Save();
            Assert.That(archive.Exists, Is.True);
            Assert.That(extract.Exists, Is.True);
            Assert.That(settings.Exists, Is.True);

            src.Preset = Preset.None;
            src.Load();
            Assert.That(src.Preset.HasFlag(Preset.Compress), Is.True);
            Assert.That(src.Preset.HasFlag(Preset.Extract), Is.True);
            Assert.That(src.Preset.HasFlag(Preset.Settings), Is.True);

            src.Preset = Preset.None;
            src.Save();
            Assert.That(archive.Exists, Is.False);
            Assert.That(extract.Exists, Is.False);
            Assert.That(settings.Exists, Is.False);
        }
예제 #16
0
        private void CreateShortcuts()
        {
            var closeShortcut = new Shortcut("Close Application", "Saves everything and closes the application. Never displays a dialog.");

            shortcutManager.Add("application.close", closeShortcut, new ShortcutBinding(Key.Escape));

            // reader shortcuts
            shortcutManager.Add(
                "reader.next-page", new Shortcut(
                    "Next Page",
                    "Navigates to the next page in the reader if there is one."),
                new ShortcutBinding(Key.D),
                new ShortcutBinding(Key.Right));

            shortcutManager.Add(
                "reader.previous-page", new Shortcut(
                    "Previous Page",
                    "Navigates to the previous page in the reader if there is one."),
                new ShortcutBinding(Key.A),
                new ShortcutBinding(Key.Left));

            shortcutManager.Add(
                "reader.fit-vertically",
                new Shortcut(
                    "Fit Vertically",
                    "Resizes the page to fill the vertical space completely."),
                new ShortcutBinding(Key.V));

            shortcutManager.Add(
                "reader.fit-horizonally",
                new Shortcut(
                    "Fit Horizontally",
                    "Resizes the page to fill the horizontal space completely."),
                new ShortcutBinding(Key.H));

            shortcutManager.Add(
                "reader.fit-original",
                new Shortcut(
                    "Original Size",
                    "Shows the page in its original size."),
                new ShortcutBinding(Key.B));



            applicationCloseBinding = shortcutManager.Bind("application.close",
                                                           s => new ManualBinder(s, () => TryClose()));
        }
        public void SyncUpdate()
        {
            var archive = new Shortcut {
                FullName = GetResultsWith("CubeICE 圧縮")
            };
            var extract = new Shortcut {
                FullName = GetResultsWith("CubeICE 解凍")
            };
            var settings = new Shortcut {
                FullName = GetResultsWith("CubeICE 設定")
            };

            var src = new ShortcutSettings {
                Directory = Results
            };
            var menu = PresetMenu.Archive |
                       PresetMenu.ArchiveDetails |
                       PresetMenu.Extract |
                       PresetMenu.Settings;

            src.Preset = menu;
            Assert.That(src.Preset, Is.EqualTo(menu));

            src.Sync();
            Assert.That(src.Preset.HasFlag(PresetMenu.Archive), Is.False);
            Assert.That(src.Preset.HasFlag(PresetMenu.ArchiveDetails), Is.True);
            Assert.That(src.Preset.HasFlag(PresetMenu.Extract), Is.False);
            Assert.That(src.Preset.HasFlag(PresetMenu.Settings), Is.False);

            src.Preset = menu;
            src.Update();
            Assert.That(archive.Exists, Is.True);
            Assert.That(extract.Exists, Is.True);
            Assert.That(settings.Exists, Is.True);

            src.Preset = PresetMenu.None;
            src.Sync();
            Assert.That(src.Preset.HasFlag(PresetMenu.Archive), Is.True);
            Assert.That(src.Preset.HasFlag(PresetMenu.Extract), Is.True);
            Assert.That(src.Preset.HasFlag(PresetMenu.Settings), Is.True);

            src.Preset = PresetMenu.None;
            src.Update();
            Assert.That(archive.Exists, Is.False);
            Assert.That(extract.Exists, Is.False);
            Assert.That(settings.Exists, Is.False);
        }
예제 #18
0
 /**
  * Creates a shortcut from a string
  */
 private Keys ToShortcut(string shortcutText)
 {
     try
     {
         Shortcut shortcut = (Shortcut)Enum.Parse(typeof(Shortcut), shortcutText);
         if (!this.Shortcuts.Contains(shortcut))
         {
             this.Shortcuts.Add(shortcut);
         }
         return((Keys)shortcut);
     }
     catch (Exception ex)
     {
         ErrorHandler.ShowError("Specified shortcut (" + shortcutText + ") not found.", ex);
         return(Keys.None);
     }
 }
예제 #19
0
    public static bool handleShortcut(Keys keys)
    {
        // look for a registered shortcut
        Shortcut shortcut = findRegisteredShortcut(keys);

        if (shortcut == null)
        {
            return(false);
        }

        // found one - execute it
        ILog logger = LogManager.GetLogger("shortcuts");

        logger.Info($"Executing shortcut: {shortcut}");
        shortcut.executeShortcut();
        return(true);
    }
예제 #20
0
        private static Shortcut CreateShortcut()
        {
            Shortcut shortcut = new Shortcut()
            {
                ShortcutPath = System.IO.Path.Combine(
                    Environment.GetFolderPath(Environment.SpecialFolder.StartMenu),
                    "Programs",
                    string.Format(
                        "{0}.lnk",
                        Assembly.GetExecutingAssembly().GetCustomAttribute <AssemblyProductAttribute>().Product)),
                TargetPath     = Assembly.GetExecutingAssembly().Location,
                AppUserModelID = aumid,
                AppUserModelToastActivatorCLSID = typeof(NotificationActivator).GUID
            };

            return(shortcut);
        }
예제 #21
0
        internal static bool Check(this Shortcut shortcut)
        {
            if (string.IsNullOrEmpty(shortcut.Name) ||
                string.IsNullOrEmpty(shortcut.Target))
            {
                return(false);
            }

            foreach (var item in InvalidChars)
            {
                if (shortcut.Name.Contains(item))
                {
                    return(false);
                }
            }
            return(true);
        }
예제 #22
0
        /// <summary>
        /// Returns human-readeble form of the shortcut
        /// </summary>
        private string GetTextFor(Shortcut shortcut)
        {
            StringBuilder b = new StringBuilder(System.Enum.GetName(typeof(Shortcut), shortcut));

            for (int i = 0; i < b.Length; i++)
            {
                char prev = i > 0 ? b[i - 1] : '?';

                if (i > 0 && (char.IsUpper(b[i]) || (char.IsDigit(b[i]) && !char.IsDigit(prev) && prev != 'F')))
                {
                    b.Insert(i, "+");
                    i += 1;
                }
            }

            return(b.ToString());
        }
            public int TranslateAccelerator(ref NativeWrapper.MSG msg, ref Guid group, int nCmdID)
            {
                if (msg.message != WM_CHAR)
                {
                    if (ModifierKeys == Keys.Shift || ModifierKeys == Keys.Alt || ModifierKeys == Keys.Control)
                    {
                        int      num = ((int)msg.wParam) | (int)ModifierKeys;
                        Shortcut s   = (Shortcut)num;
                        if (shortcutBlacklist.Contains(s))
                        {
                            return(S_OK);
                        }
                    }
                }

                return(S_FALSE);
            }
예제 #24
0
 public void Deserialize(IDataReader reader)
 {
     MasterId    = reader.ReadDouble();
     SlaveId     = reader.ReadDouble();
     SlaveSpells = new SpellItem[reader.ReadShort()];
     for (var i = 0; i < SlaveSpells.Length; i++)
     {
         (SlaveSpells[i] = new SpellItem()).Deserialize(reader);
     }
     SlaveStats = new CharacterCharacteristicsInformations();
     SlaveStats.Deserialize(reader);
     Shortcuts = new Shortcut[reader.ReadShort()];
     for (var i = 0; i < Shortcuts.Length; i++)
     {
         (Shortcuts[i] = new Shortcut()).Deserialize(reader);
     }
 }
예제 #25
0
        private void InitControl(ShortcutType shortcutType)
        {
            ShortcutType = shortcutType;

            // Set up the underlying Shortcut class
            Shortcut      = new Shortcut();
            eventBlock    = true;
            Shortcut.Name = "My Shortcut";
            SetDefaultAction();

            // Set up right UI:
            SetIcon();
            InitUiBasedOnType();
            SetFieldValuesFromShortcut();

            eventBlock = false;
        }
    static bool CheckInput(Shortcut key, InputFn InputFn)
    {
        List <KeyCode> keyCodes;

        if (TryGetKeyCodes(key, out keyCodes))
        {
            foreach (KeyCode keyCode in keyCodes)
            {
                if (InputFn(keyCode))
                {
                    return(true);
                }
            }
        }

        return(false);
    }
예제 #27
0
        public ApiResponse Create([FromBody] ShortCutModel model)
        {
            ApiResponse response = new ApiResponse();
            Shortcut    sc       = new Shortcut {
                name = model.name, shortcut = model.shortcut, business_id = model.business_id, created_by = model.created_by
            };

            try
            {
                sc.shortcut = sc.shortcut ?? "";
                sc.shortcut = sc.shortcut.Trim();
                if (string.IsNullOrWhiteSpace(sc.shortcut))
                {
                    response.msg += "Shortcut cannot be empty" + model.business_id;
                }


                sc.name = sc.name ?? "";
                sc.name = sc.name.Trim();
                if (string.IsNullOrWhiteSpace(sc.name))
                {
                    response.msg += "Name cannot be empty" + model.business_id;
                }

                if (!string.IsNullOrWhiteSpace(model.business_id) && !string.IsNullOrWhiteSpace(sc.name) && !string.IsNullOrWhiteSpace(sc.shortcut))
                {
                    sc.id          = Core.Helpers.CommonHelper.GenerateDigitUniqueNumber();
                    sc.business_id = model.business_id;
                    response.data  = _shortcutService.Create(sc);
                    response.ok    = true;
                }
            }
            catch (Exception ex)
            {
                _logService.Create(new Log
                {
                    message  = ex.Message,
                    category = "Shortcut",
                    link     = $"{Request.HttpContext.Request.Scheme}://{Request.HttpContext.Request.Host}{Request.HttpContext.Request.Path}{Request.HttpContext.Request.QueryString}",
                    details  = JsonConvert.SerializeObject(ex.StackTrace),
                    name     = string.Format("Add shortcut: {0} to business_id: {1}", sc.name, model.business_id)
                });
            }

            return(response);
        }
예제 #28
0
        protected virtual void Dispose(bool disposing)
        {
            if (!disposing)
            {
                return;
            }

            shortcut.Bindings.CollectionChanged -= BindingsOnCollectionChanged;

            foreach (var binding in Bindings)
            {
                Unbind(binding);
            }

            shortcut = null;
            Bindings.Clear();
        }
예제 #29
0
        /// <summary>
        /// Parse a list of shortcut instructions from an Xml file into shortcut objects
        /// </summary>
        /// <param name="shortcuts">The list of shortcuts to parse into</param>
        /// <param name="filename">The name of the file to parse from</param>
        public static void AddShortcutsFromFile(List <Shortcut> shortcuts, string filename)
        {
            //make an Xml document to get all shortcuts
            XmlDocument doc = LoadXmlDocument(filename, XmlLoadType.FromFile);

            if (doc == null)
            {
                Logging.Error("Failed to parse Xml shortcut file, skipping");
                return;
            }
            //make new patch object for each entry
            //remember to add lots of logging
            XmlNodeList XMLshortcuts = GetXmlNodesFromXPath(doc, "//shortcuts/shortcut");

            if (XMLshortcuts == null || XMLshortcuts.Count == 0)
            {
                Logging.Warning("File {0} contains no shortcut entries", filename);
                return;
            }
            Logging.Info("Adding {0} shortcuts from shortcutFile: {1}", XMLshortcuts.Count, filename);
            foreach (XmlNode patchNode in XMLshortcuts)
            {
                Shortcut sc = new Shortcut();
                //we have the patchNode "patch" object, now we need to get it's children to actually get the properties of said patch
                foreach (XmlNode property in patchNode.ChildNodes)
                {
                    //each element in the Xml gets put into the
                    //the corresponding attribute for the Patch instance
                    switch (property.Name)
                    {
                    case "path":
                        sc.Path = property.InnerText.Trim();
                        break;

                    case "name":
                        sc.Name = property.InnerText.Trim();
                        break;

                    case "enabled":
                        sc.Enabled = CommonUtils.ParseBool(property.InnerText.Trim(), false);
                        break;
                    }
                }
                shortcuts.Add(sc);
            }
        }
예제 #30
0
        private bool?OpenShortcutWindow(Shortcut shortcut, bool isNew)
        {
            EditShortcutWindow window = new EditShortcutWindow(shortcut);

            window.Owner = this;
            bool?result = window.ShowDialog();

            if (result.HasValue && result.Value)
            {
                if (isNew)
                {
                    this.ShortcutList.Add(shortcut);
                }
            }

            return(result);
        }
예제 #31
0
        public static void SetPrefs()
        {
            PreferencesInternal.SetBool(PreferenceKeys.pbStripProBuilderOnBuild, pbStripProBuilderOnBuild);
            PreferencesInternal.SetBool(PreferenceKeys.pbDisableAutoUV2Generation, pbDisableAutoUV2Generation);
            PreferencesInternal.SetBool(PreferenceKeys.pbShowSceneInfo, pbShowSceneInfo, PreferenceLocation.Global);
            PreferencesInternal.SetInt(PreferenceKeys.pbToolbarLocation, (int)pbToolbarLocation, PreferenceLocation.Global);

            PreferencesInternal.SetBool(PreferenceKeys.pbUseUnityColors, pbUseUnityColors, PreferenceLocation.Global);
            PreferencesInternal.SetBool(PreferenceKeys.pbSelectedFaceDither, pbSelectedFaceDither, PreferenceLocation.Global);
            PreferencesInternal.SetFloat(PreferenceKeys.pbLineHandleSize, pbLineHandleSize, PreferenceLocation.Global);
            PreferencesInternal.SetFloat(PreferenceKeys.pbVertexHandleSize, pbVertexHandleSize, PreferenceLocation.Global);
            PreferencesInternal.SetFloat(PreferenceKeys.pbWireframeSize, pbWireframeSize, PreferenceLocation.Global);
            PreferencesInternal.SetColor(PreferenceKeys.pbSelectedFaceColor, faceSelectedColor, PreferenceLocation.Global);
            PreferencesInternal.SetColor(PreferenceKeys.pbWireframeColor, pbWireframeColor, PreferenceLocation.Global);
            PreferencesInternal.SetColor(PreferenceKeys.pbPreselectionColor, pbPreselectionColor, PreferenceLocation.Global);
            PreferencesInternal.SetColor(PreferenceKeys.pbSelectedVertexColor, vertexSelectedColor, PreferenceLocation.Global);
            PreferencesInternal.SetColor(PreferenceKeys.pbUnselectedVertexColor, vertexUnselectedColor, PreferenceLocation.Global);
            PreferencesInternal.SetColor(PreferenceKeys.pbSelectedEdgeColor, pbSelectedEdgeColor, PreferenceLocation.Global);
            PreferencesInternal.SetColor(PreferenceKeys.pbUnselectedEdgeColor, pbUnselectedEdgeColor, PreferenceLocation.Global);

            PreferencesInternal.SetString(PreferenceKeys.pbDefaultShortcuts, Shortcut.ShortcutsToString(defaultShortcuts), PreferenceLocation.Global);
//          PreferencesInternal.SetMaterial(PreferenceKeys.pbDefaultMaterial, pbDefaultMaterial);
            PreferencesInternal.SetInt(PreferenceKeys.pbDefaultCollider, (int)defaultColliderType);
            PreferencesInternal.SetInt(PreferenceKeys.pbShadowCastingMode, (int)pbShadowCastingMode);
            PreferencesInternal.SetInt(PreferenceKeys.pbDefaultStaticFlags, (int)pbDefaultStaticFlags);
            PreferencesInternal.SetBool(PreferenceKeys.pbDefaultOpenInDockableWindow, defaultOpenInDockableWindow, PreferenceLocation.Global);
            PreferencesInternal.SetBool(PreferenceKeys.pbShowEditorNotifications, pbShowEditorNotifications, PreferenceLocation.Global);
            PreferencesInternal.SetBool(PreferenceKeys.pbForceConvex, pbForceConvex);
            PreferencesInternal.SetBool(PreferenceKeys.pbForceVertexPivot, pbForceVertexPivot, PreferenceLocation.Global);
            PreferencesInternal.SetBool(PreferenceKeys.pbForceGridPivot, pbForceGridPivot, PreferenceLocation.Global);
            PreferencesInternal.SetBool(PreferenceKeys.pbPerimeterEdgeBridgeOnly, pbPerimeterEdgeBridgeOnly, PreferenceLocation.Global);
            PreferencesInternal.SetBool(PreferenceKeys.pbPBOSelectionOnly, pbPBOSelectionOnly, PreferenceLocation.Global);
            PreferencesInternal.SetBool(PreferenceKeys.pbCloseShapeWindow, pbCloseShapeWindow, PreferenceLocation.Global);
            PreferencesInternal.SetBool(PreferenceKeys.pbUVEditorFloating, pbUVEditorFloating, PreferenceLocation.Global);
            PreferencesInternal.SetBool(PreferenceKeys.pbUniqueModeShortcuts, pbUniqueModeShortcuts, PreferenceLocation.Global);
            PreferencesInternal.SetBool(PreferenceKeys.pbIconGUI, pbIconGUI, PreferenceLocation.Global);
            PreferencesInternal.SetBool(PreferenceKeys.pbShiftOnlyTooltips, pbShiftOnlyTooltips, PreferenceLocation.Global);
            PreferencesInternal.SetBool(PreferenceKeys.pbMeshesAreAssets, pbMeshesAreAssets);
            PreferencesInternal.SetBool(PreferenceKeys.pbEnableExperimental, pbEnableExperimental, PreferenceLocation.Global);
            PreferencesInternal.SetBool(PreferenceKeys.pbShowMissingLightmapUvWarning, showMissingLightmapUvWarning, PreferenceLocation.Global);
            PreferencesInternal.SetBool(PreferenceKeys.pbShowPreselectionHighlight, pbShowPreselectionHighlight, PreferenceLocation.Global);
            PreferencesInternal.SetFloat(PreferenceKeys.pbUVGridSnapValue, pbUVGridSnapValue, PreferenceLocation.Global);

            ProBuilderEditor.ReloadSettings();
            SceneView.RepaintAll();
        }
예제 #32
0
        public static void Install()
        {
            Shortcut shortcut = CreateShortcut();

            if (!Shortcut.ShortcutExist(shortcut))
            {
                Shortcut.InstallShortcut(shortcut);
            }

            if (!Available)
            {
                return;
            }

            RegisterComServer();
            RegisterActivator();
        }
예제 #33
0
        /// <summary>
        /// Adds a model element in this model element
        /// </summary>
        /// <param name="copy"></param>
        public override void AddModelElement(Utils.IModelElement element)
        {
            ShortcutFolder folder = element as ShortcutFolder;

            if (folder != null)
            {
                appendFolders(folder);
            }
            else
            {
                Shortcut shortcut = element as Shortcut;
                if (shortcut != null)
                {
                    appendShortcuts(shortcut);
                }
            }
        }
예제 #34
0
        void ReadMenuShortcut(XmlReader reader)
        {
            string   command  = string.Empty;
            Shortcut shortcut = Shortcut.None;
            bool     display  = false;

            if (reader.GetAttribute("display") != null && reader.GetAttribute("display").Length > 0)
            {
                display = bool.Parse(reader.GetAttribute("display"));
            }

            while (reader.Read())
            {
                XmlNodeType nodeType = reader.MoveToContent();
                if (nodeType == XmlNodeType.Element)
                {
                    if (reader.Name == "command")
                    {
                        command = reader.ReadString();
                    }
                    else if (reader.Name == "shortcutEnumValue")
                    {
                        try
                        {
                            shortcut = (Shortcut)Enum.Parse(typeof(Shortcut), reader.ReadString());
                            AddShortcut(command, shortcut);
                            if (display)
                            {
                                _displayedShortcuts.Add(command, true);
                            }
                        }
                        catch (System.FormatException e)
                        {
                            //TODO: Log this.
                            Console.WriteLine(e.Message);
                        }
                    }
                }
                if (nodeType == XmlNodeType.EndElement && reader.Name == "shortcut")
                {
                    return;
                }
            }
            Debug.Assert(false, "Should never reach here");
        }
예제 #35
0
        public IWorkItem GetParameterFromSelectedSuggestion(IWorkItem selectedSuggestion)
        {
            OSD.Menu.Menu     bookmarkMenu     = new OSD.Menu.Menu(null, "Bookmarks", Settings.Current.EnsoLearnAsOpenCommandsFolder, true, false, true, false, null, true, new OSD.Menu.MenuItemChosenDelegate(MenuItemChoosen));
            OSD.Menu.MenuItem selectedMenuItem = OSD.Menu.Menu.ShowMenu(bookmarkMenu);
            if (selectedMenuItem != null)
            {
                string   shortcutFilePath = (string)selectedMenuItem.tag;
                Shortcut bookmarkShortcut = WorkItemsProviders.Shortcuts.Shortcuts.ReadShortcutFile(shortcutFilePath);
                bookmarkShortcut.provider = this;
                selectedSuggestion        = (IWorkItem)bookmarkShortcut;
            }
            else
            {
                selectedSuggestion = null;
            }

            return(selectedSuggestion);
        }
예제 #36
0
        //-------------------------------------------------------------------------

        private int GetIndexOfShortcut(Shortcut s)
        {
            int index         = 0;
            int indexToReturn = -1;

            foreach (Shortcut shortcut in this.shortcuts)
            {
                if (shortcut.name.Equals(s.name))
                {
                    indexToReturn = index;
                    break;
                }

                index++;
            }

            return(indexToReturn);
        }
예제 #37
0
        void LoadSettings()
        {
            EditorMeshHandles.ResetPreferences();

            m_ScenePickerPreferences = new ScenePickerPreferences()
            {
                maxPointerDistance        = ScenePickerPreferences.maxPointerDistanceFuzzy,
                cullMode                  = m_BackfaceSelectEnabled ? CullingMode.None : CullingMode.Back,
                selectionModifierBehavior = m_SelectModifierBehavior,
                rectSelectMode            = m_DragSelectRectMode
            };

            // workaround for old single-key shortcuts
            if (s_Shortcuts.value == null || s_Shortcuts.value.Length < 1)
            {
                s_Shortcuts.SetValue(Shortcut.DefaultShortcuts().ToArray(), true);
            }
        }
예제 #38
0
 private void SwitchButton(Key key)
 {
     SetFocus();
     if (Main != Key.Unknown)
     {
         buttons[Main].State = KeyboardButtonState.None;
         if (key == Main)
         {
             Main = Key.Unknown;
             return;
         }
     }
     if (buttons.TryGetValue(key, out var btn) && Shortcut.ValidateMainKey(key))
     {
         Main      = key;
         btn.State = KeyboardButtonState.Hold;
     }
 }
예제 #39
0
 private void ChangeShortcut(Shortcut shortcut)
 {
     spnShortcut.TryInvoke(
         () => {
         /* 先移除 StackPanel 內容 */
         spnShortcut.Children.Clear();
         /* 依照捷徑放回去 */
         if (shortcut.HasFlag(Shortcut.Note))
         {
             spnShortcut.Children.Add(btnNote);
         }
         if (shortcut.HasFlag(Shortcut.Calculator))
         {
             spnShortcut.Children.Add(btnCalc);
         }
     }
         );
 }
예제 #40
0
	public MenuItem(MenuMerge mergeType, int mergeOrder, Shortcut shortcut,
					String text, EventHandler onClick, EventHandler onPopup,
					EventHandler onSelect, MenuItem[] items)
			: base(items)
			{
				this.flags = ItemFlags.Default;
				this.mergeType = mergeType;
				this.mergeOrder = mergeOrder;
				this.shortcut = shortcut;
				this.text = text;
				if(onClick != null)
				{
					Click += onClick;
				}
				if(onPopup != null)
				{
					Popup += onPopup;
				}
				if(onSelect != null)
				{
					Select += onSelect;
				}
			}
예제 #41
0
 public MenuCommand(string text, Shortcut shortcut)
 {
     InternalConstruct(text, null, -1, shortcut, null);
 }
예제 #42
0
		public ToolBarItem(Image image, string text, EventHandler clickHandler, Shortcut shortcut)
		{
			Initialize(image, text, clickHandler, shortCut, null);
		}
예제 #43
0
        protected bool RegisterHotkey(Shortcut key)
        {
            //register hotkey
            int mod = 0;
            Keys k2 = Keys.None;
            if (((int)key & (int)Keys.Alt) == (int)Keys.Alt)
            {
                mod |= (int)Win32.Modifiers.MOD_ALT;
                k2 |= Keys.Alt;
            }

            if (((int)key & (int)Keys.Shift) == (int)Keys.Shift)
            {
                mod |= (int)Win32.Modifiers.MOD_SHIFT;
                k2 |= Keys.Shift;
            }

            if (((int)key & (int)Keys.Control) == (int)Keys.Control)
            {
                mod |= (int)Win32.Modifiers.MOD_CONTROL;
                k2 |= Keys.Control;
            }

            int nonModifiedKey = (int)key - (int)k2;

            return Win32.User32.RegisterHotKey(m_Window.Handle, this.GetType().GetHashCode(), (int)mod, nonModifiedKey);
        }
 /// <summary>
 /// Format a shortcut as a string.
 /// </summary>
 /// <param name="shortcut">Shortcut to format.</param>
 /// <returns>String format of shortcut.</returns>
 private string FormatShortcutString(Shortcut shortcut)
 {
     return KeyboardHelper.FormatShortcutString(shortcut);
 }
예제 #45
0
		protected bool GenerateShortcut(Shortcut sc, MenuCommandCollection mcc)
		{
			foreach(MenuCommand mc in mcc)
			{
				// Does the command match?
				if (mc.Enabled && (mc.Shortcut == sc))
				{
					// Generate event for command
					mc.OnClick(EventArgs.Empty);

					return true;
				}
				else
				{
					// Any child items to test?
					if (mc.MenuCommands.Count > 0)
					{
						// Recursive descent of all collections
						if (GenerateShortcut(sc, mc.MenuCommands))
							return true;
					}
				}
			}

			return false;
		}
예제 #46
0
 public MenuCommand(string text, 
                    ImageList imageList, 
                    int imageIndex, 
                    Shortcut shortcut, 
                    EventHandler clickHandler)
 {
     InternalConstruct(text, imageList, imageIndex, shortcut, clickHandler);
 }
예제 #47
0
        public override void Execute(DirectoryInfo targetDirectory, PortableEnvironment portableEnvironment)
        {
            var shortcut = new Shortcut
                               {
                                   FileName = Path.Combine(portableEnvironment.Shortcuts.StartMenuTargetDirectory, FileName),
                                   Target = Path.Combine(targetDirectory.FullName, Target),
                                   Arguments = Arguments,
                                   WorkingDirectory = string.IsNullOrWhiteSpace(WorkingDirectory) ? null : Path.Combine(targetDirectory.FullName, WorkingDirectory),
                                   IconPath = string.IsNullOrWhiteSpace(IconPath) ? null : Path.Combine(targetDirectory.FullName, IconPath),
                                   DisplayMode = DisplayMode,
                                   Description = Description,
                               };

            // Create the link file.
            portableEnvironment.Shortcuts.Add(shortcut);
        }
예제 #48
0
 public bool ShouldIgnore(Shortcut shortcut)
 {
     if (maskedShortcuts != null && maskedShortcuts.Contains(shortcut))
         return true;
     return false;
 }
예제 #49
0
 /// <summary>
 /// Instructs the command manager to respond to the shortcut again.
 /// </summary>
 public void UnignoreShortcut(Shortcut shortcut)
 {
     Trace.Assert(maskedShortcuts != null, "UnignoreShortcut called before IgnoreShortcut");
     if (maskedShortcuts != null)
     {
         bool wasPresent = maskedShortcuts.Remove(shortcut);
         Trace.Assert(wasPresent, "Shortcut " + shortcut + " was not masked");
         if (maskedShortcuts.Count == 0)
             maskedShortcuts = null;
     }
 }
예제 #50
0
 /// <summary>
 /// Instructs the command manager to ignore the shortcut until
 /// UnignoreShortcut is called.
 ///
 /// LIMITATION: You cannot currently ignore an AdvancedShortcut
 /// (i.e. one based on Keys instead of Shortcut).
 /// </summary>
 public void IgnoreShortcut(Shortcut shortcut)
 {
     if (maskedShortcuts == null)
         maskedShortcuts = new HashSet();
     bool isNewElement = maskedShortcuts.Add(shortcut);
     Debug.Assert(isNewElement, "Shortcut " + shortcut + " was already masked");
 }
예제 #51
0
		public MenuItemEx(string name, ImageList imageList, int imageIndex, Shortcut shortcut, EventHandler handler) : this(name, handler)
		{
			Initialize(icon, shortcut, handler, imageList, imageIndex);
		}
예제 #52
0
		public MenuItemEx(string name, Bitmap icon, Shortcut shortcut, EventHandler handler) : this(name, handler)
		{
			Initialize(icon, shortcut, handler, null, -1);
		}
예제 #53
0
 public MenuCommand(string text, Shortcut shortcut, EventHandler clickHandler)
 {
     InternalConstruct(text, null, -1, shortcut, clickHandler);
 }
예제 #54
0
 public MxMenuItem(string text, string helpText, Shortcut shortcut)
     : base(MenuMerge.Add, 0, shortcut, text, null, null, null, null)
 {
     this._helpText = helpText;
     if (shortcut != Shortcut.None)
     {
         this._shortcutText = TypeDescriptor.GetConverter(typeof(Keys)).ConvertToString((Keys) shortcut);
     }
     base.OwnerDraw = true;
 }
예제 #55
0
 public MenuCommand(string text, ImageList imageList, int imageIndex, Shortcut shortcut)
 {
     InternalConstruct(text, imageList, imageIndex, shortcut, null);
 }
예제 #56
0
 public MxMenuItem(string text, string helpText, EventHandler clickHandler, Shortcut shortcut, Image glyph)
     : base(MenuMerge.Add, 0, shortcut, text, clickHandler, null, null, null)
 {
     this._helpText = helpText;
     if (shortcut != Shortcut.None)
     {
         this._shortcutText = TypeDescriptor.GetConverter(typeof(Keys)).ConvertToString((Keys) shortcut);
     }
     this._glyph = glyph;
     base.OwnerDraw = true;
 }
예제 #57
0
        protected void InternalConstruct(string text, 
                                         ImageList imageList, 
                                         int imageIndex, 
                                         Shortcut shortcut, 
                                         EventHandler clickHandler)
        {
            // Save parameters
            _text = text;
            _imageList = imageList;
            _imageIndex = imageIndex;
            _shortcut = shortcut;
            _description = text;

            if (clickHandler != null)
                Click += clickHandler;

            // Define defaults for others
            _enabled = true;
            _checked = false;
            _radioCheck = false;
            _break = false;
            _tag = null;
            _visible = true;
            _infrequent = false;
            _image = null;

            // Create the collection of embedded menu commands
            _menuItems = new MenuCommandCollection();
        }
예제 #58
0
            /// <summary>
            /// Load all configuration and override the current values
            /// </summary>
            /// <returns></returns>
            public static bool ConfigurationLoad()
            {
                // Check if config file is present
                Restore(ConfigFile);
                bool Protocols = false;
                if (File.Exists(ConfigFile))
                {
                    try
                    {
                        XmlDocument configuration = new XmlDocument();
                        configuration.Load(ConfigFile);
                        lock (Configuration.ShortcutKeylist)
                        {
                            Configuration.ShortcutKeylist = new List<Shortcut>();
                        }
                        lock (Ignoring.IgnoreList)
                        {
                            Ignoring.IgnoreList.Clear();
                        }
                        lock (Configuration.HighlighterList)
                        {
                            Configuration.HighlighterList = new List<Network.Highlighter>();
                        }
                        lock (NetworkData.Networks)
                        {
                            NetworkData.Networks.Clear();
                        }
                        lock (Configuration.UserData.History)
                        {
                            Configuration.UserData.History.Clear();
                        }
                        Commands.ClearAliases();
                        foreach (XmlNode node in configuration.ChildNodes)
                        {
                            if (node.Name == "configuration.pidgeon")
                            {
                                foreach (XmlNode curr in node.ChildNodes)
                                {
                                    if (curr.Name == "history")
                                    {
                                        lock (Configuration.UserData.History)
                                        {
                                            Configuration.UserData.History.Add(curr.InnerText);
                                        }
                                        continue;
                                    }
                                    if (curr.Attributes == null)
                                    {
                                        continue;
                                    }
                                    if (curr.Attributes.Count > 0)
                                    {
                                        if (curr.Name.StartsWith("extension.", StringComparison.Ordinal))
                                        {
                                            Configuration.SetConfig(curr.Name.Substring(10), curr.InnerText);
                                            continue;
                                        }
                                        if (curr.Name == "alias")
                                        {
                                            Commands.RegisterAlias(curr.Attributes[0].InnerText, curr.Attributes[1].InnerText, bool.Parse(curr.Attributes[2].InnerText));
                                            continue;
                                        }
                                        if (curr.Name == "network")
                                        {
                                            if (curr.Attributes.Count > 3)
                                            {
                                                NetworkData.NetworkInfo info = new NetworkData.NetworkInfo();
                                                foreach (XmlAttribute xx in curr.Attributes)
                                                {
                                                    switch (xx.Name.ToLower())
                                                    {
                                                        case "name":
                                                            info.Name = xx.Value;
                                                            break;
                                                        case "server":
                                                            info.Server = xx.Value;
                                                            break;
                                                        case "ssl":
                                                            info.SSL = bool.Parse(xx.Value);
                                                            break;
                                                    }
                                                }
                                                lock (NetworkData.Networks)
                                                {
                                                    NetworkData.Networks.Add(info);
                                                }
                                            }
                                            continue;
                                        }
                                        if (curr.Name == "window")
                                        {
                                            string name = curr.InnerText;
                                            PidgeonGtkToolkit.PidgeonForm.Info w = new PidgeonGtkToolkit.PidgeonForm.Info();
                                            if (curr.Attributes == null)
                                            {
                                                continue;
                                            }
                                            foreach (XmlAttribute option in curr.Attributes)
                                            {
                                                if (curr.Value == null)
                                                {
                                                    // invalid config
                                                    continue;
                                                }
                                                switch (option.Name)
                                                {
                                                    case "width":
                                                        w.Width = int.Parse(curr.Value);
                                                        break;
                                                    case "height":
                                                        w.Height = int.Parse(curr.Value);
                                                        break;
                                                    case "x":
                                                        w.X = int.Parse(curr.Value);
                                                        break;
                                                    case "y":
                                                        w.Y = int.Parse(curr.Value);
                                                        break;
                                                }
                                            }
                                            lock (PidgeonGtkToolkit.PidgeonForm.WindowInfo)
                                            {
                                                if (!PidgeonGtkToolkit.PidgeonForm.WindowInfo.ContainsKey(name))
                                                {
                                                    PidgeonGtkToolkit.PidgeonForm.WindowInfo.Add(name, w);
                                                }
                                            }
                                        }
                                        if (curr.Name == "ignore")
                                        {
                                            if (curr.Attributes.Count > 3)
                                            {
                                                Ignoring.Ignore.Type _t = Ignoring.Ignore.Type.Everything;
                                                if (curr.Attributes[3].Value == "User")
                                                {
                                                    _t = Ignoring.Ignore.Type.User;
                                                }
                                                Ignoring.Ignore ignore = new Ignoring.Ignore(bool.Parse(curr.Attributes[0].Value), bool.Parse(curr.Attributes[1].Value), curr.Attributes[2].Value, _t);
                                                lock (Ignoring.IgnoreList)
                                                {
                                                    Ignoring.IgnoreList.Add(ignore);
                                                }
                                            }
                                            continue;
                                        }

                                        if (curr.Name == "list")
                                        {
                                            if (curr.Attributes.Count > 2)
                                            {
                                                Network.Highlighter list = new Network.Highlighter();
                                                list.simple = bool.Parse(curr.Attributes[0].Value);
                                                list.text = curr.Attributes[1].Value;
                                                list.enabled = bool.Parse(curr.Attributes[2].Value);
                                                lock (Configuration.HighlighterList)
                                                {
                                                    Configuration.HighlighterList.Add(list);
                                                }
                                            }
                                            continue;
                                        }

                                        if (curr.Name == "protocol")
                                        {
                                            if (!Protocols)
                                            {
                                                Configuration.Parser.Protocols.Clear();
                                                Protocols = true;
                                            }
                                            Configuration.Parser.Protocols.Add(curr.InnerText);
                                            continue;
                                        }

                                        if (curr.Name == "shortcut")
                                        {
                                            if (curr.Attributes.Count > 2)
                                            {
                                                Shortcut list = new Shortcut(ParseKey(curr.Attributes[0].Value), bool.Parse(curr.Attributes[1].Value), bool.Parse(curr.Attributes[2].Value), bool.Parse(curr.Attributes[3].Value));
                                                list.data = curr.InnerText;
                                                Configuration.ShortcutKeylist.Add(list);
                                            }
                                            continue;
                                        }
                                        if (curr.Attributes.Count > 0)
                                        {
                                            if (curr.Attributes[0].Name == "confname")
                                            {
                                                switch (curr.Attributes[0].Value)
                                                {
                                                    case "Configuration.Window.x1":
                                                    case "location.x1":
                                                        Configuration.Window.TextboxLeft = int.Parse(curr.InnerText);
                                                        break;
                                                    case "Configuration.Window.window_size":
                                                    case "window.size":
                                                        Configuration.Window.WindowSize = int.Parse(curr.InnerText);
                                                        break;
                                                    case "Configuration.Window.x4":
                                                    case "location.x4":
                                                        Configuration.Window.SidebarLeft = int.Parse(curr.InnerText);
                                                        break;
                                                    case "Configuration.Window.Window_Maximized":
                                                    case "location.maxi":
                                                        Configuration.Window.Window_Maximized = bool.Parse(curr.InnerText);
                                                        break;
                                                    case "timestamp.display":
                                                    case "Configuration.Scrollback.chat_timestamp":
                                                        Configuration.Scrollback.chat_timestamp = bool.Parse(curr.InnerText);
                                                        break;
                                                    case "Configuration.UserData.nick":
                                                    case "network.nick":
                                                        Configuration.UserData.nick = curr.InnerText;
                                                        break;
                                                    case "Configuration.UserData.Nick2":
                                                    case "network.n2":
                                                        Configuration.UserData.Nick2 = curr.InnerText;
                                                        break;
                                                    case "Configuration.UserData.ident":
                                                    case "network.ident":
                                                        Configuration.UserData.ident = curr.InnerText;
                                                        break;
                                                    case "Configuration.irc.DisplayCtcp":
                                                    case "scrollback.showctcp":
                                                        Configuration.irc.DisplayCtcp = bool.Parse(curr.InnerText);
                                                        break;
                                                    case "Configuration.Scrollback.format_nick":
                                                    case "formats.user":
                                                        Configuration.Scrollback.format_nick = curr.InnerText;
                                                        break;
                                                    case "Configuration.Scrollback.format_date":
                                                    case "formats.date":
                                                        Configuration.Scrollback.format_date = curr.InnerText;
                                                        break;
                                                    case "Configuration.Scrollback.timestamp_mask":
                                                    case "formats.datetime":
                                                        Configuration.Scrollback.timestamp_mask = curr.InnerText;
                                                        break;
                                                    case "Configuration.ChannelModes.aggressive_whois":
                                                    case "irc.auto.whois":
                                                        Configuration.ChannelModes.aggressive_whois = bool.Parse(curr.InnerText);
                                                        break;
                                                    case "Configuration.ChannelModes.aggressive_bans":
                                                    case "irc.auto.bans":
                                                        Configuration.ChannelModes.aggressive_bans = bool.Parse(curr.InnerText);
                                                        break;
                                                    case "Configuration.ChannelModes.aggressive_exception":
                                                    case "irc.auto.exception":
                                                        Configuration.ChannelModes.aggressive_exception = bool.Parse(curr.InnerText);
                                                        break;
                                                    case "Configuration.ChannelModes.aggressive_channel":
                                                    case "irc.auto.channels":
                                                        Configuration.ChannelModes.aggressive_channel = bool.Parse(curr.InnerText);
                                                        break;
                                                    case "Configuration.ChannelModes.aggressive_invites":
                                                    case "irc.auto.invites":
                                                        Configuration.ChannelModes.aggressive_invites = bool.Parse(curr.InnerText);
                                                        break;
                                                    case "Configuration.ChannelModes.aggressive_mode":
                                                    case "irc.auto.mode":
                                                        Configuration.ChannelModes.aggressive_mode = bool.Parse(curr.InnerText);
                                                        break;
                                                    case "Configuration.irc.DefaultReason":
                                                    case "network.reason":
                                                        Configuration.irc.DefaultReason = curr.InnerText;
                                                        break;
                                                    case "Configuration.Logs.logs_name":
                                                    case "logs.type":
                                                        Configuration.Logs.logs_name = curr.InnerText;
                                                        break;
                                                    case "logs.html":
                                                    case "Configuration.Logs.logs_html":
                                                        Configuration.Logs.logs_html = bool.Parse(curr.InnerText);
                                                        break;
                                                    case "logs.dir":
                                                    case "Configuration.Logs.logs_dir":
                                                        Configuration.Logs.logs_dir = curr.InnerText;
                                                        break;
                                                    case "logs.xml":
                                                    case "Configuration.Logs.logs_xml":
                                                        Configuration.Logs.logs_xml = bool.Parse(curr.InnerText);
                                                        break;
                                                    case "logs.txt":
                                                    case "Configuration.Logs.logs_txt":
                                                        Configuration.Logs.logs_txt = bool.Parse(curr.InnerText);
                                                        break;
                                                    case "Configuration.Scrollback.scrollback_plimit":
                                                    case "scrollback_plimit":
                                                        Configuration.Scrollback.scrollback_plimit = int.Parse(curr.InnerText);
                                                        break;
                                                    case "notification.tray":
                                                    case "Configuration.Kernel.Notice":
                                                        Configuration.Kernel.Notice = bool.Parse(curr.InnerText);
                                                        break;
                                                    case "pidgeon.size":
                                                    case "Configuration.Services.Depth":
                                                        Configuration.Services.Depth = int.Parse(curr.InnerText);
                                                        break;
                                                    case "Configuration.UserData.LastNick":
                                                    case "history.nick":
                                                        Configuration.UserData.LastNick = curr.InnerText;
                                                        break;
                                                    case "Configuration.Kernel.NetworkSniff":
                                                    case "sniffer":
                                                        Configuration.Kernel.NetworkSniff = bool.Parse(curr.InnerText);
                                                        break;
                                                    case "Configuration.UserData.LastHost":
                                                    case "history.host":
                                                        Configuration.UserData.LastHost = curr.InnerText;
                                                        break;
                                                    case "Configuration.Kernel.CheckUpdate":
                                                    case "updater.check":
                                                        Configuration.Kernel.CheckUpdate = bool.Parse(curr.InnerText);
                                                        break;
                                                    case "Configuration.UserData.LastPort":
                                                    case "history.port":
                                                        Configuration.UserData.LastPort = curr.InnerText;
                                                        break;
                                                    case "Configuration.Parser.Separators":
                                                    case "delimiters":
                                                        List<char> temp = new List<char>();
                                                        foreach (char part in curr.InnerText)
                                                        {
                                                            temp.Add(part);
                                                        }
                                                        Configuration.Parser.Separators = temp;
                                                        break;
                                                    case "colors.changelinks":
                                                    case "Configuration.Colors.ChangeLinks":
                                                        Configuration.Colors.ChangeLinks = bool.Parse(curr.InnerText);
                                                        break;
                                                    case "Configuration.Kernel.Debugging":
                                                    case "debugger":
                                                        Configuration.Kernel.Debugging = bool.Parse(curr.InnerText);
                                                        break;
                                                    case "Configuration.Services.UsingCache":
                                                    case "services.usingcache":
                                                        Configuration.Services.UsingCache = bool.Parse(curr.InnerText);
                                                        break;
                                                    case "Configuration.irc.mq":
                                                    case "message_mq":
                                                        Configuration.irc.mq = int.Parse(curr.InnerText);
                                                        break;
                                                    case "logs.services.log.type":
                                                    case "Configuration.Logs.ServicesLogs":
                                                        Configuration.Logs.ServiceLogs type = Configuration.Logs.ServiceLogs.none;
                                                        switch (curr.InnerText.ToLower())
                                                        {
                                                            case "incremental":
                                                                type = Configuration.Logs.ServiceLogs.incremental;
                                                                break;
                                                            case "full":
                                                                type = Configuration.Logs.ServiceLogs.full;
                                                                break;
                                                        }
                                                        Configuration.Logs.ServicesLogs = type;
                                                        break;
                                                    case "Configuration.Window.history":
                                                        Configuration.Window.History = int.Parse(curr.InnerText);
                                                        break;
                                                    case "userdata.openlinkinbrowser":
                                                    case "Configuration.UserData.OpenLinkInBrowser":
                                                        Configuration.UserData.OpenLinkInBrowser = bool.Parse(curr.InnerText);
                                                        break;
                                                    case "Configuration.Parser.formatter":
                                                    case "formatter":
                                                        Configuration.Parser.formatter = bool.Parse(curr.InnerText);
                                                        break;
                                                    case "Configuration.Memory.MaximumChannelBufferSize":
                                                    case "system.maximumchannelbuffersize":
                                                        Configuration.Memory.MaximumChannelBufferSize = int.Parse(curr.InnerText);
                                                        break;
                                                    case "Configuration.Memory.EnableSimpleViewCache":
                                                    case "system.enablesimpleviewcache":
                                                        Configuration.Memory.EnableSimpleViewCache = bool.Parse(curr.InnerText);
                                                        break;
                                                    case "Configuration.Search.Y":
                                                    case "Configuration.Window.Search_Y":
                                                        Configuration.Window.Search_Y = int.Parse(curr.InnerText);
                                                        break;
                                                    case "Configuration.Search.X":
                                                    case "Configuration.Window.Search_X":
                                                        Configuration.Window.Search_X = int.Parse(curr.InnerText);
                                                        break;
                                                    case "Configuration.Kernel.Profiler":
                                                        Configuration.Kernel.Profiler = bool.Parse(curr.InnerText);
                                                        break;
                                                    case "Configuration.irc.FirewallCTCP":
                                                        Configuration.irc.FirewallCTCP = bool.Parse(curr.InnerText);
                                                        break;
                                                    case "Configuration.Kernel.MaximalRingLogSize":
                                                    case "maximumlog":
                                                        Configuration.Kernel.MaximalRingLogSize = int.Parse(curr.InnerText);
                                                        break;
                                                    case "Configuration.Parser.ParserCache":
                                                        Configuration.Parser.ParserCache = int.Parse(curr.InnerText);
                                                        break;
                                                    case "Configuration.Kernel.Profiler_Minimal":
                                                        Configuration.Kernel.Profiler_Minimal = int.Parse(curr.InnerText);
                                                        break;
                                                    case "Configuration.UserData.TrayIcon":
                                                        Configuration.UserData.TrayIcon = bool.Parse(curr.InnerText);
                                                        break;
                                                    case "Configuration.UserData.LastSSL":
                                                        Configuration.UserData.LastSSL = bool.Parse(curr.InnerText);
                                                        break;
                                                    case "Configuration.Window.MiddleClick_Side":
                                                        Configuration.Window.MiddleClick_Side = from1(curr.InnerText);
                                                        break;
                                                    case "SelectedLanguage":
                                                        Core.SelectedLanguage = curr.InnerText;
                                                        break;
                                                    case "Configuration.Media.NotificationSound":
                                                        Configuration.Media.NotificationSound = bool.Parse(curr.InnerText);
                                                        break;
                                                    case "Configuration.CurrentSkin":
                                                        Skin.ReloadSkin(curr.InnerText);
                                                        break;
                                                    case "Configuration.Window.RememberPosition":
                #pragma warning disable
                                                        Configuration.Window.RememberPosition = bool.Parse(curr.InnerText);
                                                        break;
                #pragma warning restore
                                                    case "Configuration.irc.DefaultCTCPPort":
                                                        Configuration.irc.DefaultCTCPPort = uint.Parse(curr.InnerText);
                                                        break;
                                                    case "Configuration.irc.CertificateDCC":
                                                        Configuration.irc.CertificateDCC = curr.InnerText;
                                                        break;
                                                    case "Configuration.UserData.SwitchWindowOnJoin":
                                                        Configuration.UserData.SwitchWindowOnJoin = bool.Parse(curr.InnerText);
                                                        break;
                                                    case "Configuration.Window.DoubleClick":
                                                        if (!Enum.TryParse<Configuration.UserList_MouseClick>(curr.InnerText, out Configuration.Window.DoubleClick))
                                                        {
                                                            Configuration.Window.DoubleClick = Configuration.UserList_MouseClick.Nothing;
                                                        }
                                                        break;
                                                    case "Configuration.Window.MiddleClick":
                                                        if (!Enum.TryParse<Configuration.UserList_MouseClick>(curr.InnerText, out Configuration.Window.MiddleClick))
                                                        {
                                                            Configuration.Window.MiddleClick = Configuration.UserList_MouseClick.Nothing;
                                                        }
                                                        break;
                                                    case "Configuration.irc.ShowReplyForCTCP":
                                                        Configuration.irc.ShowReplyForCTCP = bool.Parse(curr.InnerText);
                                                        break;
                                                    case "Configuration.irc.FriendlyWhois":
                                                        Configuration.irc.FriendlyWhois = bool.Parse(curr.InnerText);
                                                        break;
                                                    case "Configuration.irc.DetailedVersion":
                                                        Configuration.irc.DetailedVersion = bool.Parse(curr.InnerText);
                                                        break;
                                                    case "Configuration.irc.NetworkEncoding":
                                                        switch (curr.InnerText)
                                                        {
                                                            case "System.Text.Encoding.ASCIIEncoding":
                                                                Configuration.irc.NetworkEncoding = System.Text.Encoding.ASCII;
                                                                break;
                                                            case "System.Text.Encoding.UTF32Encoding":
                                                                Configuration.irc.NetworkEncoding = System.Text.Encoding.UTF32;
                                                                break;
                                                            case "System.Text.Encoding.UnicodeEncoding":
                                                                Configuration.irc.NetworkEncoding = System.Text.Encoding.Unicode;
                                                                break;
                                                            case "System.Text.Encoding.UTF7Encoding":
                                                                Configuration.irc.NetworkEncoding = System.Text.Encoding.UTF7;
                                                                break;
                                                        }
                                                        break;
                                                    case "Configuration.Parser.InputTrim":
                                                        Configuration.Parser.InputTrim = bool.Parse(curr.InnerText);
                                                        break;
                                                    case "Configuration.Kernel.KernelDump":
                                                        Configuration.Kernel.KernelDump = bool.Parse(curr.InnerText);
                                                        break;
                                                    case "Configuration.Window.NotifyPrivate":
                                                        Configuration.Window.NotifyPrivate = bool.Parse(curr.InnerText);
                                                        break;
                                                    case "Configuration.irc.DisplayMode":
                                                        Configuration.irc.DisplayMode = bool.Parse(curr.InnerText);
                                                        break;
                                                    case "Configuration.Scrollback.UnderlineBold":
                                                        Configuration.Scrollback.UnderlineBold = bool.Parse(curr.InnerText);
                                                        break;
                                                    case "Configuration.irc.IgnoreInvites":
                                                        Configuration.irc.IgnoreInvites = bool.Parse(curr.InnerText);
                                                        break;
                                                    case "Configuration.Scrollback.KeepSpecialCharsSimple":
                                                        Configuration.Scrollback.KeepSpecialCharsSimple = bool.Parse(curr.InnerText);
                                                        break;
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                    catch (Exception f)
                    {
                        handleException(f);
                        return false;
                    }
                }
                return true;
            }
예제 #59
0
		public MenuItemEx(string name, EventHandler handler, Shortcut shortcut) : this(name, handler)
		{
			Initialize(null, shortcut, handler, null, -1);
		}
 //
 // Summary:
 //     Initializes a new instance of the class with a specified caption, event handler,
 //     and associated shortcut key for the menu item.
 //
 // Parameters:
 //   text:
 //     The caption for the menu item.
 //
 //   onClick:
 //     The System.EventHandler that handles the System.Windows.Forms.MenuItem.Click
 //     event for this menu item.
 //
 //   shortcut:
 //     One of the System.Windows.Forms.Shortcut values.
 public MenuItem(string text, EventHandler onClick, Shortcut shortcut) { }