コード例 #1
0
ファイル: Command.cs プロジェクト: AlexanderKrustev/SoftUni
 protected Command(Data data, string[] input, HardwareFactory hardwareFactory, SoftwareFactory softwareFactory)
 {
     this.input = input;
     this.data = data;
     this.hardwareFactory = hardwareFactory;
     this.softwareFactory = softwareFactory;
 }
コード例 #2
0
        public Command ParseCommand(Data data, string[] input, HardwareFactory hardwareFactory, SoftwareFactory softwareFactory)
        {
            switch (input[0])
            {
                case "RegisterPowerHardware": return new RegisterPowerHardware(data,input,hardwareFactory,softwareFactory);
                case "RegisterHeavyHardware": return new RegisterHeavyHardware(data, input,hardwareFactory, softwareFactory);
                case "RegisterExpressSoftware": return new RegisterExpressSoftware(data, input, hardwareFactory, softwareFactory);
                case "RegisterLightSoftware": return  new RegisterLightSoftware(data, input,hardwareFactory,softwareFactory);
                case "Analyze": return new Analyze(data, input,hardwareFactory, softwareFactory);
                case "ReleaseSoftwareComponent": return  new ReleaseSoftwareComponent(data, input,hardwareFactory,softwareFactory);
                case "System Split": return new SystemSplit(data, input,hardwareFactory, softwareFactory);
                case "Dump": return new Dump(data, input, hardwareFactory, softwareFactory);
                case "Restore": return new Restore(data, input, hardwareFactory, softwareFactory);
                case "Destroy": return new Destroy(data, input, hardwareFactory, softwareFactory);
                case "DumpAnalyze": return new DumpAnalyze(data, input, hardwareFactory, softwareFactory);

                default: throw new ArgumentException(string.Format("Incorrect Comand {0}",input[0]));

            }
        }
コード例 #3
0
ファイル: Startup.cs プロジェクト: AlexanderKrustev/SoftUni
        static void Main()
        {
            string input = Console.ReadLine();
            Data data=new Data();
            CommandInterpreter commandHandler=new CommandInterpreter();
            HardwareFactory hardwareFactory=new HardwareFactory();
            SoftwareFactory softwareFactory= new SoftwareFactory();

            while (true)
            {
                string[] inputParameters = input.Split(new[] {'(', ')', ','}, StringSplitOptions.RemoveEmptyEntries);

                Command c=commandHandler.ParseCommand(data, inputParameters, hardwareFactory, softwareFactory);
                c.Execute();

                if (inputParameters[0].Equals("System Split"))
                {
                    break;
                }
                input = Console.ReadLine();
            }
        }
コード例 #4
0
 public RegisterLightSoftware(Data data, string[] input, HardwareFactory hardwareFactory, SoftwareFactory softwareFactory)
     : base(data, input, hardwareFactory, softwareFactory)
 {
 }
コード例 #5
0
 public ReleaseSoftwareComponent(Data data, string[] input, HardwareFactory hardwareFactory, SoftwareFactory softwareFactory)
     : base(data, input, hardwareFactory, softwareFactory)
 {
 }
コード例 #6
0
 protected RegisterSoftware(Data data, string[] input, HardwareFactory hardwareFactory, SoftwareFactory softwareFactory)
     : base(data, input, hardwareFactory, softwareFactory)
 {
 }
コード例 #7
0
 public Business(String connectionString)
 {
     REPOSITORY = new Data(connectionString);
 }
コード例 #8
0
ファイル: Dump.cs プロジェクト: AlexanderKrustev/SoftUni
 public Dump(Data data, string[] input, HardwareFactory hardwareFactory, SoftwareFactory softwareFactory)
     : base(data, input, hardwareFactory, softwareFactory)
 {
 }