Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

42 Zeilen
1.4 KiB

  1. // This code is distributed under MIT license.
  2. // Copyright (c) 2010-2018 George Mamaladze
  3. // See license.txt or https://mit-license.org/
  4. using System.Linq;
  5. namespace Gma.System.MouseKeyHook
  6. {
  7. /// <summary>
  8. /// Describes key or key combination sequences. e.g. Control+Z,Z
  9. /// </summary>
  10. public class Sequence : SequenceBase<Combination>
  11. {
  12. private Sequence(Combination[] combinations) : base(combinations)
  13. {
  14. }
  15. /// <summary>
  16. /// Creates an instance of sequence object from parameters representing keys or key combinations.
  17. /// </summary>
  18. /// <param name="combinations"></param>
  19. /// <returns></returns>
  20. public static Sequence Of(params Combination[] combinations)
  21. {
  22. return new Sequence(combinations);
  23. }
  24. /// <summary>
  25. /// Creates an instance of sequnce object from string.
  26. /// The string must contain comma ',' delimited list of strings describing keys or key combinations.
  27. /// Examples: 'A,B,C' 'Alt+R,S', 'Shift+R,Alt+K'
  28. /// </summary>
  29. /// <param name="text"></param>
  30. /// <returns></returns>
  31. public static Sequence FromString(string text)
  32. {
  33. var parts = text.Split(',');
  34. var combinations = parts.Select(Combination.FromString).ToArray();
  35. return new Sequence(combinations);
  36. }
  37. }
  38. }