Exemplo n.º 1
0
 protected Command(Data data, string[] input, HardwareFactory hardwareFactory, SoftwareFactory softwareFactory)
 {
     this.input = input;
     this.data = data;
     this.hardwareFactory = hardwareFactory;
     this.softwareFactory = softwareFactory;
 }
        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]));

            }
        }
Exemplo n.º 3
0
        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();
            }
        }
 public RegisterLightSoftware(Data data, string[] input, HardwareFactory hardwareFactory, SoftwareFactory softwareFactory)
     : base(data, input, hardwareFactory, softwareFactory)
 {
 }
 public ReleaseSoftwareComponent(Data data, string[] input, HardwareFactory hardwareFactory, SoftwareFactory softwareFactory)
     : base(data, input, hardwareFactory, softwareFactory)
 {
 }
Exemplo n.º 6
0
 protected RegisterSoftware(Data data, string[] input, HardwareFactory hardwareFactory, SoftwareFactory softwareFactory)
     : base(data, input, hardwareFactory, softwareFactory)
 {
 }
Exemplo n.º 7
0
 public Business(String connectionString)
 {
     REPOSITORY = new Data(connectionString);
 }
Exemplo n.º 8
0
 public Dump(Data data, string[] input, HardwareFactory hardwareFactory, SoftwareFactory softwareFactory)
     : base(data, input, hardwareFactory, softwareFactory)
 {
 }