Advertisement
radidim

P01.Activation_Keys (C# Shell App Paste)

Jun 2nd, 2020
1,058
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.43 KB | None | 0 0
  1. //Disclaimer: The creator of 'C# Shell (C# Offline Compiler)' is in no way responsible for the code posted by any user.
  2. using System;
  3. using System.IO;
  4. using System.Linq;
  5. using System.Collections.Generic;
  6.  
  7. namespace CSharp_Shell
  8. {
  9.  
  10.     public static class Program
  11.     {
  12.         public static void Main()
  13.         {
  14.             var raw = Console.ReadLine();
  15.             var substring = String.Empty;
  16.             while(true)
  17.             {
  18.                 var input = Console.ReadLine();
  19.                 if(input=="Generate")
  20.                 {
  21.                     break;
  22.                 }
  23.                 var command  = input.Split(">>>");
  24.                 if(command[0] == "Contains")
  25.                 {
  26.                     substring = command[1];
  27.                     if(raw.Contains(substring))
  28.                     {
  29.                         Console.WriteLine($"{raw} contains {substring}");
  30.                     }
  31.                     else
  32.                     {
  33.                         Console.WriteLine("Substring not found!");
  34.                     }
  35.                 }
  36.                 if(command[0] == "Flip")
  37.                 {
  38.                    
  39.                     if(command[1] == "Upper")
  40.                     {
  41.                        
  42.                         var startIndex = int.Parse(command[2]);
  43.                         var endIndex = int.Parse(command[3]);
  44.                         var length = endIndex-startIndex;
  45.                         substring = raw.Substring(startIndex, length);
  46.                         var curr = raw.Replace(substring, substring.ToUpper());
  47.                         raw = curr;
  48.                         Console.WriteLine(raw);
  49.                        
  50.                     }
  51.                     if(command[1] == "Lower")
  52.                     {
  53.                         var startIndex = int.Parse(command[2]);
  54.                         var endIndex = int.Parse(command[3]);
  55.                         var length = endIndex - startIndex;
  56.                         substring = raw.Substring(startIndex, length);
  57.                         var curr = raw.Replace(substring, substring.ToLower());
  58.                         raw = curr;
  59.                         Console.WriteLine(raw);
  60.                        
  61.                     }
  62.                 }
  63.                 if(command[0] == "Slice")
  64.                 {
  65.                     var startIndex = int.Parse(command[1]);
  66.                     var endIndex = int.Parse(command[2]);
  67.                     var length = endIndex - startIndex;
  68.                     var curr = raw.Remove(startIndex, length);
  69.                     raw = curr;
  70.                     Console.WriteLine(raw);
  71.                 }
  72.            
  73.            }
  74.            Print(raw);
  75.         }
  76.         public static void Print(string raw)
  77.         {
  78.             Console.WriteLine($"Your activation key is: {raw}");
  79.         }
  80.     }
  81. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement