public ClientProcessor(MathsProccessor.MathsProccessorClient client, ICalcIO calcIO, ICalcInputParser parser) { this.client = client; this.calcIO = calcIO; this.parser = parser; operationsCount = 0; clientID = Guid.NewGuid().ToString(); mathOperations = new Dictionary <char, Func <Arguments, Result> > { ['='] = (args) => client.Set(args), ['+'] = (args) => client.Add(args), ['-'] = (args) => client.Sub(args), ['*'] = (args) => client.Mul(args), ['/'] = (args) => client.Div(args), }; systemOperations = new Dictionary <char, Func <bool> > { ['q'] = () => false, ['#'] = () => { var input = parser.ReadInt(x => x > 0 && x <= operationsCount); var result = client.Jmp(new Arguments() { ID = clientID, Input = input }).Value; calcIO.WriteLine($"[#{++operationsCount}] = {result}"); return(true); }, }; }
public ProcessorStorageFilesWork(IMathBuffer maths, ICalcIO calcIO, IOperationsHistory operationsHistory, IExpressionParser mathExpressionParser, IPathReader filePathReader, ICalcInputParser inputParser) { Maths = maths; CalcIO = calcIO; OperationsHistory = operationsHistory; MathExpressionParser = mathExpressionParser; FilePathReader = filePathReader; InputParser = inputParser; }
public ProcessorStorage(IMathBuffer maths, ICalcIO calcIO, ICalcInputParser inputParser) { Maths = maths; CalcIO = calcIO; InputParser = inputParser; }