Stan0033

Untitled

Jul 8th, 2021
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.30 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3. using System.Collections.Generic;
  4.  
  5. namespace apps
  6. {
  7. class Program
  8. {
  9. static string Get() { return Console.ReadLine(); }
  10. static string JoinListToString(List<string> list)
  11. {
  12. string joinedString = string.Empty;
  13. for (int i = 0; i < list.Count; i++)
  14. {
  15. joinedString += list[i];
  16. }
  17. return joinedString;
  18. }
  19. static void Main()
  20. {
  21. string RawActivationKey = Get();
  22.  
  23. List<string> SplitRawActivationKey = new List<string>();
  24. foreach (char c in RawActivationKey) { SplitRawActivationKey.Add(c.ToString()); }
  25.  
  26.  
  27. while (true)
  28. {
  29. string command = Get();
  30. if (command == "Generate") { break; }
  31. else
  32. {
  33. string[] parts = command.Split(">>>").ToArray();
  34. if (parts.Length == 2)
  35. {
  36. string value = parts[1];
  37. if (RawActivationKey.Contains(value))
  38. {
  39. Console.WriteLine($"{RawActivationKey} contains {value}");
  40. }
  41. else
  42. {
  43. Console.WriteLine($"Substring not found!");
  44. }
  45. }
  46. if (parts.Length == 4)
  47. {
  48. int indexStart = int.Parse(parts[2] );
  49. int indexEnd = int.Parse(parts[3]);
  50. string Case = parts[1];
  51.  
  52. if (Case == "Upper")
  53. {
  54.  
  55. while (indexStart < indexEnd)
  56. {
  57. SplitRawActivationKey[indexStart] = SplitRawActivationKey[indexStart].ToUpper();
  58. indexStart++;
  59. }
  60.  
  61. }
  62. else
  63. {
  64. while (indexStart < indexEnd)
  65. {
  66. SplitRawActivationKey[indexStart] = SplitRawActivationKey[indexStart].ToLower();
  67. indexStart++;
  68. }
  69. }
  70. RawActivationKey = JoinListToString(SplitRawActivationKey);
  71. Console.WriteLine(RawActivationKey);
  72. }
  73. if (parts.Length == 3)
  74. {
  75. int indexStart = int.Parse(parts[1]);
  76. int indexEnd = int.Parse(parts[2]);
  77. while (indexStart < indexEnd)
  78. {
  79. SplitRawActivationKey[indexStart] = "";
  80. indexStart++;
  81. }
  82. RawActivationKey = JoinListToString(SplitRawActivationKey);
  83. Console.WriteLine(RawActivationKey);
  84. }
  85. }
  86. }
  87.  
  88. Console.WriteLine($"Your activation key is: {RawActivationKey}");
  89. }
  90. }
  91. }
Advertisement
Add Comment
Please, Sign In to add comment