Advertisement
Guest User

Untitled

a guest
Nov 14th, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 6.25 KB | None | 0 0
  1. using System;
  2. using Shell;
  3. using System.Collections.Generic;
  4.  
  5. namespace Shell
  6. {
  7.     class GhostsShell : Shell
  8.     {
  9.         //int asd;
  10.         bool nappal;
  11.         bool eneklo, huhogo, kacago;
  12.         bool enekloelozo, huhogoelozo, kacagoelozo;
  13.         bool ablaknyitva;
  14.         bool orgonaltunk;
  15.         bool hanynapja;
  16.         bool jatek;
  17.         List<string> muveletek;
  18.  
  19.         public GhostsShell()
  20.         {
  21.             AddCommand(new New(this));
  22.             AddCommand(new Print(this));
  23.             AddCommand(new Open(this));
  24.             AddCommand(new Close(this));
  25.             AddCommand(new Get(this));
  26.             AddCommand(new Play(this));
  27.             AddCommand(new Play(this));
  28.             AddCommand(new Go(this));
  29.         }
  30.  
  31.         class Print : Command
  32.         {
  33.             GhostsShell shell;
  34.             public Print(GhostsShell sh) : base("print")
  35.             {
  36.                 shell = sh;
  37.             }
  38.  
  39.             public override bool Execute(params string[] args)
  40.             {
  41.                 if (args.Length != 0) return false;
  42.                 Console.WriteLine(shell.nappal ? "nappal van" : "ejjel van");
  43.                 if (shell.nappal)
  44.                 {
  45.                     Console.WriteLine(shell.ablaknyitva ? "nyitva az ablak" : "az ablak zarva");
  46.                     Console.WriteLine(shell.orgonaltunk ? "orgonaltunk" : "nem orgonaltunk");
  47.                     shell.nappal = !shell.nappal;
  48.                 }
  49.                 else
  50.                 {
  51.                     Console.WriteLine(shell.kacago ? "kacag" : "nem kacag");
  52.                     Console.WriteLine(shell.eneklo ? "enekel" : "nem enekel");
  53.                     Console.WriteLine(shell.huhogo ? "huhog" : "nem huhog");
  54.                     //shell.hanynapja = shell.kacago || shell.eneklo || shell.huhogo ? 0 : shell.hanynapja?;
  55.                    
  56.                 }
  57.                 return true;
  58.  
  59.             }
  60.         }
  61.         class Open : Command
  62.         {
  63.             GhostsShell shell;
  64.             public Open(GhostsShell sh) : base("open")
  65.             {
  66.                 shell = sh;
  67.             }
  68.  
  69.             public override bool Execute(params string[] args)
  70.             {
  71.                 if (!shell.jatek) return false;
  72.                 if (shell.nappal == false) return false;
  73.                 if (args.Length != 1) return false;
  74.                 if (!args[0].Equals("windows")) return false;
  75.                 shell.ablaknyitva = true;
  76.                 return true;
  77.             }
  78.         }
  79.  
  80.         class Close : Command
  81.         {
  82.             GhostsShell shell;
  83.             public Close(GhostsShell sh) : base("close")
  84.             {
  85.                 shell = sh;
  86.             }
  87.  
  88.             public override bool Execute(params string[] args)
  89.             {
  90.                 if (!shell.jatek) return false;
  91.                 if (shell.nappal == false) return false;
  92.                 if (args.Length != 1) return false;
  93.                 if (!args[0].Equals("windows")) return false;
  94.                 shell.ablaknyitva = false;
  95.                 return true;
  96.             }
  97.         }
  98.  
  99.         class Play : Command
  100.         {
  101.             GhostsShell shell;
  102.             public Play(GhostsShell sh) : base("play")
  103.             {
  104.                 shell = sh;
  105.             }
  106.  
  107.             public override bool Execute(params string[] args)
  108.             {
  109.                 if (!shell.jatek) return false;
  110.                 if (!shell.nappal) return false;
  111.                 if (args.Length != 1) return false;
  112.                 if (!args[1].Equals("organ")) return false;
  113.                 if (shell.orgonaltunk) return false;
  114.                 shell.orgonaltunk = true;
  115.                 return true;
  116.             }
  117.         }
  118.  
  119.         class Go : Command
  120.         {
  121.             GhostsShell shell;
  122.             public Go(GhostsShell sh) : base("go")
  123.             {
  124.                 shell = sh;
  125.             }
  126.  
  127.             public override bool Execute(params string[] args)
  128.             {
  129.                 if (!shell.jatek) return false;
  130.                 if (!shell.nappal) return false;
  131.                 if (args.Length != 2) return false;
  132.                 if (!args[0].Equals("to") || args[1].Equals("bed")) return false;
  133.                
  134.                 shell.nappal = !shell.nappal;
  135.                 return true;
  136.             }
  137.         }
  138.  
  139.         class Get : Command
  140.         {
  141.             GhostsShell shell;
  142.             public Get(GhostsShell sh) : base("get")
  143.             {
  144.                 shell = sh;
  145.             }
  146.  
  147.             public override bool Execute(params string[] args)
  148.             {
  149.                 if (!shell.jatek) return false;
  150.                 if (shell.nappal) return false;
  151.                 if (args.Length != 1) return false;
  152.                 if (!args[0].Equals("up")) return false;
  153.  
  154.                 shell.nappal = !shell.nappal;
  155.                 shell.kacagoelozo = shell.kacago;
  156.                 shell.huhogoelozo = shell.huhogo;
  157.                 shell.enekloelozo = shell.eneklo;
  158.  
  159.                 shell.huhogo = shell.kacagoelozo;
  160.  
  161.                 Console.WriteLine();
  162.                 return true;
  163.             }
  164.         }
  165.  
  166.         class New : Command
  167.         {
  168.             GhostsShell shell;
  169.             public New(GhostsShell sh) : base("new")
  170.             {
  171.                 shell = sh;
  172.             }
  173.            
  174.             public override bool Execute(params string[] args)
  175.             {
  176.                
  177.                 if (args.Length > 1) return false;
  178.                 if (args.Length == 1 && !args[0].Equals("initial")) return false;
  179.                 if (args.Length == 1)
  180.                 {
  181.                     shell.nappal = false;
  182.                     shell.kacago = shell.huhogo = shell.eneklo = true;
  183.                 }
  184.                 else
  185.                 {
  186.                     shell.kacago = shell.IsLaughing();
  187.                     shell.eneklo = shell.IsSinging();
  188.                     shell.huhogo = shell.IsHooting();
  189.                 }
  190.                 shell.jatek = true;
  191.                 return true;
  192.             }
  193.         }
  194.  
  195.  
  196.     }
  197.  
  198.     public class Program
  199.     {
  200.         public static void Main(string[] args)
  201.         {
  202.             Shell sh = new GhostsShell();
  203.             sh.ReadEvalPrint();
  204.         }
  205.     }
  206. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement