Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- using System.Collections.Generic;
- namespace apps
- {
- class Program
- {
- static string Get() { return Console.ReadLine(); }
- static string JoinListToString(List<string> list)
- {
- string joinedString = string.Empty;
- for (int i = 0; i < list.Count; i++)
- {
- joinedString += list[i];
- }
- return joinedString;
- }
- static void Main()
- {
- string RawActivationKey = Get();
- List<string> SplitRawActivationKey = new List<string>();
- foreach (char c in RawActivationKey) { SplitRawActivationKey.Add(c.ToString()); }
- while (true)
- {
- string command = Get();
- if (command == "Generate") { break; }
- else
- {
- string[] parts = command.Split(">>>").ToArray();
- if (parts.Length == 2)
- {
- string value = parts[1];
- if (RawActivationKey.Contains(value))
- {
- Console.WriteLine($"{RawActivationKey} contains {value}");
- }
- else
- {
- Console.WriteLine($"Substring not found!");
- }
- }
- if (parts.Length == 4)
- {
- int indexStart = int.Parse(parts[2] );
- int indexEnd = int.Parse(parts[3]);
- string Case = parts[1];
- if (Case == "Upper")
- {
- while (indexStart < indexEnd)
- {
- SplitRawActivationKey[indexStart] = SplitRawActivationKey[indexStart].ToUpper();
- indexStart++;
- }
- }
- else
- {
- while (indexStart < indexEnd)
- {
- SplitRawActivationKey[indexStart] = SplitRawActivationKey[indexStart].ToLower();
- indexStart++;
- }
- }
- RawActivationKey = JoinListToString(SplitRawActivationKey);
- Console.WriteLine(RawActivationKey);
- }
- if (parts.Length == 3)
- {
- int indexStart = int.Parse(parts[1]);
- int indexEnd = int.Parse(parts[2]);
- while (indexStart < indexEnd)
- {
- SplitRawActivationKey[indexStart] = "";
- indexStart++;
- }
- RawActivationKey = JoinListToString(SplitRawActivationKey);
- Console.WriteLine(RawActivationKey);
- }
- }
- }
- Console.WriteLine($"Your activation key is: {RawActivationKey}");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment