Example #1
0
        public override string ToString()
        {
            if (!ActionStringKeys.Any())
            {
                return(string.Empty);
            }

            var spacebarAlias = Globals.AliasResources.GetString("spacebar") ?? "spacebar";

            if (ActionStringKeys.Count == 1)
            {
                if (ActionStringKeys[0] == " ")
                {
                    return(spacebarAlias);
                }
                return((ActionStringKeys[0].StartsWith("vk")) ? ActionStringKeys[0].Split('_')[1]
                    : ActionStringKeys[0]);
            }

            var copyActionList = ActionStringKeys.ToList();

            if (Globals.ModKeysVirtualKeyCodes.Any(x => VirtualKeys.Contains(x)) &&
                VirtualKeys.Count > 1 && !Globals.ModKeysVirtualKeyCodes.Contains(VirtualKeys[0]) &&
                ActionStringKeys.All(x => !Globals.PolishSigns.Contains(x)))
            {
                copyActionList.Reverse();
            }

            var last = copyActionList.Last();

            if (last.Contains("_"))
            {
                if (last.Split('_').Any())
                {
                    copyActionList[copyActionList.Count - 1] = last.Split('_')[1];
                }
            }
            var result = (VirtualKeys
                          .Any(x => Globals.ModKeysVirtualKeyCodes.Any(y => y == x)) &&
                          !IsActionWithLeftArrowAdded() &&
                          ActionStringKeys.All(x => !Globals.PolishSigns.Contains(x)))
                ? String.Join(" + ", copyActionList).Replace("-", "")
                         .Replace(spacebarAlias, " ")
                :string.Join("", ActionStringKeys)
                         .Replace(spacebarAlias, " ");

            return(result);
        }
Example #2
0
 public bool IsActionWithPolishSigns()
 {
     return(ActionStringKeys.Any(x => Globals.PolishSigns.Contains(x)));
 }