Example #1
0
            bool HasConditions(HotstringDefinition hotstring)
            {
                string history = this.history.ToString();

                if (history.Length == 0)
                {
                    return(false);
                }

                var compare = (hotstring.EnabledOptions & HotstringDefinition.Options.CaseSensitive) == HotstringDefinition.Options.CaseSensitive ?
                              StringComparison.CurrentCulture : StringComparison.CurrentCultureIgnoreCase;

                int x = history.Length - hotstring.Sequence.Length - 1;

                if ((hotstring.EnabledOptions & HotstringDefinition.Options.AutoTrigger) == HotstringDefinition.Options.AutoTrigger)
                {
                    if (!history.EndsWith(hotstring.Sequence, compare))
                    {
                        return(false);
                    }
                }
                else
                {
                    if (history.Length < hotstring.Sequence.Length + 1)
                    {
                        return(false);
                    }

                    if (hotstring.EndChars.IndexOf(history[history.Length - 1]) == -1)
                    {
                        return(false);
                    }

                    if (!history.Substring(x--, hotstring.Sequence.Length).Equals(hotstring.Sequence, compare))
                    {
                        return(false);
                    }
                }

                if ((hotstring.EnabledOptions & HotstringDefinition.Options.Nested) != HotstringDefinition.Options.Nested)
                {
                    if (x > -1 && char.IsLetterOrDigit(history[x]))
                    {
                        return(false);
                    }
                }

                return(true);
            }
Example #2
0
 public void Remove(HotstringDefinition hotstring)
 {
     hotstrings.Remove(hotstring);
 }
Example #3
0
 public HotstringDefinition Add(HotstringDefinition hotstring)
 {
     hotstrings.Add(hotstring);
     return hotstring;
 }
Example #4
0
            bool HasConditions(HotstringDefinition hotstring)
            {
                string history = this.history.ToString();

                if (history.Length == 0)
                    return false;

                var compare = (hotstring.EnabledOptions & HotstringDefinition.Options.CaseSensitive) == HotstringDefinition.Options.CaseSensitive ?
                    StringComparison.CurrentCulture : StringComparison.CurrentCultureIgnoreCase;

                int x = history.Length - hotstring.Sequence.Length - 1;

                if ((hotstring.EnabledOptions & HotstringDefinition.Options.AutoTrigger) == HotstringDefinition.Options.AutoTrigger)
                {
                    if (!history.EndsWith(hotstring.Sequence, compare))
                        return false;
                }
                else
                {
                    if (history.Length < hotstring.Sequence.Length + 1)
                        return false;

                    if (hotstring.EndChars.IndexOf(history[history.Length - 1]) == -1)
                        return false;

                    if (!history.Substring(x--, hotstring.Sequence.Length).Equals(hotstring.Sequence, compare))
                        return false;
                }

                if ((hotstring.EnabledOptions & HotstringDefinition.Options.Nested) != HotstringDefinition.Options.Nested)
                    if (x > -1 && char.IsLetterOrDigit(history[x]))
                        return false;

                return true;
            }
Example #5
0
 public HotstringDefinition Add(HotstringDefinition hotstring)
 {
     hotstrings.Add(hotstring);
     return(hotstring);
 }
Example #6
0
 public void Remove(HotstringDefinition hotstring)
 {
     hotstrings.Remove(hotstring);
 }