public LazyTransactionService(ITransactionRepository transactionRepository, IFinTsService finTsService, IDate date, IInputOutput io)
 {
     this.finTsService          = finTsService;
     this.transactionRepository = transactionRepository;
     this.date = date;
     this.io   = io;
 }
Example #2
0
 public BankAndBankInMatcher(
     IInputOutput input_output,
     IBankAndBankInLoader bank_and_bank_in_loader)
 {
     _input_output            = input_output;
     _bank_and_bank_in_loader = bank_and_bank_in_loader;
 }
Example #3
0
 protected PlayerTurnState(IGame game, IIntelligenceContextFactory contextFactory, IIntelligenceContext context, IInputOutput io)
 {
     Game           = game;
     ContextFactory = contextFactory;
     Context        = context;
     IO             = io;
 }
 public LazyTransactionService(ITransactionRepository transactionRepository, IFinTsService finTsService, IDate date, IInputOutput io)
 {
     this.finTsService = finTsService;
     this.transactionRepository = transactionRepository;
     this.date = date;
     this.io = io;
 }
Example #5
0
 public GameNotStartedState(GameSettings settings, IGameInitializer gameInitializer, IIntelligenceContextFactory contextFactory, IInputOutput io)
 {
     _settings        = settings;
     _gameInitializer = gameInitializer;
     _contextFactory  = contextFactory;
     _io = io;
 }
Example #6
0
        public void OnRequest(IInputOutput aServer, dynamic aJson)
        {
            dynamic resp = new ExpandoObject();
            var     dict = aJson;

            if (!_leverageSet.Contains(dict["leverage"]))
            {
                resp           = Utils.MakeResponseObject(false, -1, "杠杆不正确");
                aServer.Output = JsonConvert.SerializeObject(resp);
                return;
            }
            var args = new TradeTransInfoArgsResult
            {
                type    = Convert.ToInt32(dict["type"]),
                cmd     = Convert.ToInt16(dict["cmd"]),
                orderby = Convert.ToInt32(dict["mt4UserID"]),
                price   = Convert.ToDouble(dict["price"]),
                order   = Convert.ToInt32(dict["mt4OrderID"]),
                symbol  = string.Format("{0}{1}", dict["symbol"], dict["leverage"]),
                volume  = Convert.ToInt32(dict["volume"]),
                sl      = Convert.ToDouble(dict["sl"]),
                tp      = Convert.ToDouble(dict["tp"]),
            };
            //if(args.type == TradeTransInfoTypes.TT_BR_BALANCE)
            var result = aServer.MT4.TradeTransaction(ref args);

            resp.is_succ   = result == 0;
            resp.errMsg    = Utils.GetErrorMessage(result);
            resp.errCode   = (int)result;
            aServer.Output = JsonConvert.SerializeObject(resp);
        }
 public ContentProcessorLauncher(IContentProcessor contentProcessor, IWordsRepository wordsRepository, ITextFileReader textFileReader, IInputOutput inputOutput)
 {
     _contentProcessor = contentProcessor;
     _wordsRepository = wordsRepository;
     _textFileReader = textFileReader;
     _inputOutput = inputOutput;
 }
Example #8
0
        public static bool ChooseStartingPlayer(IGameBoard gameBoard, IInputOutput printer)
        {
            printer.Print("\nWhich player starts first O or X\n\n>>> ");
            var  choice = 'E';
            bool completed;

            try
            {
                choice = (char)Convert.ChangeType(printer.Read(), typeof(char));
                if (char.ToUpper(choice) == 'O' || char.ToUpper(choice) == 'X')
                {
                    completed = true;
                    ((IGameBoardWinning)gameBoard).PlayerStarts(char.ToUpper(choice));
                }
                else
                {
                    gameBoard.PrintBoard();
                    printer.Print("\nPlease choose either O or X", true);
                    completed = false;
                }
            }
            catch
            {
                gameBoard.PrintBoard();
                printer.Print("\nPlease choose either O or X", true);
                completed = false;
            }
            return(completed);
        }
Example #9
0
 public Board(IInputOutput concoleInputOutput, ISettingsProvider settingsProvider)
 {
     this.cio          = (ConsoleInputOutput)concoleInputOutput;
     this.gameSettings = settingsProvider.GetGameSettings();
     this.BoardSizeX   = this.gameSettings.BoardSizeX;
     this.BoardSizeY   = this.gameSettings.BoardSizeY;
 }
        private void Update_bank_balance(
            ActualBankOutFile actual_bank_out_file,
            ISpreadsheet spreadsheet,
            IInputOutput input_output)
        {
            input_output.Output_line("Writing bank balance to spreadsheet...");

            IList <ActualBankRecord> potential_balance_rows = actual_bank_out_file.Get_potential_balance_rows().ToList();

            if (!potential_balance_rows.Any())
            {
                input_output.Output_line("");
                input_output.Get_generic_input(ReconConsts.CantFindBalanceRow);
            }
            else
            {
                ActualBankRecord balance_row = Choose_balance_row(potential_balance_rows, input_output);

                string balance_description = String.Format(
                    ReconConsts.BankBalanceDescription,
                    ReconConsts.Bank_descriptor,
                    balance_row.Description,
                    balance_row.Main_amount().To_csv_string(true),
                    balance_row.Date.ToString(@"dd\/MM\/yyyy"));

                spreadsheet.Update_balance_on_totals_sheet(
                    Codes.Bank_bal,
                    balance_row.Balance,
                    balance_description,
                    balance_column: ReconConsts.BankBalanceAmountColumn,
                    text_column: ReconConsts.BankBalanceTextColumn,
                    code_column: ReconConsts.BankBalanceCodeColumn,
                    input_output: input_output);
            }
        }
Example #11
0
 public void Do_actions_which_require_third_party_data_access(
     IDataFile <ActualBankRecord> third_party_file,
     IDataFile <BankRecord> owned_file,
     ISpreadsheet spreadsheet,
     IInputOutput input_output)
 {
 }
Example #12
0
        public Menu(
            Point start,
            int whidth,
            int height,
            IInputOutput io,
            IPhraseProvider phraseProvider)
        {
            this.start  = start;
            this.whidth = whidth;
            this.height = height;

            this.io = io;

            Pages = new Dictionary <string, IPage>
            {
                { phraseProvider.GetPhrase(Phrase.HeaderMain), new MainPage(phraseProvider) },

                { phraseProvider.GetPhrase(Phrase.HeaderHistory), new HistoryPage(phraseProvider) },
                { phraseProvider.GetPhrase(Phrase.HeaderTraderList), new TraderListPage(phraseProvider) },
                { phraseProvider.GetPhrase(Phrase.HeaderTraderManaging), new TraderManagingPage(phraseProvider) },

                { phraseProvider.GetPhrase(Phrase.HeaderAddTrader), new AddTraderPage(phraseProvider) },
                { phraseProvider.GetPhrase(Phrase.HeaderAddShare), new AddSharePage(phraseProvider) },
                { phraseProvider.GetPhrase(Phrase.HeaderChandeShare), new ChangeSharePage(phraseProvider) },

                { phraseProvider.GetPhrase(Phrase.HeaderWhiteList), new WhiteListPage(phraseProvider) },
                { phraseProvider.GetPhrase(Phrase.HeaderOrangeList), new OrangeListPage(phraseProvider) },
                { phraseProvider.GetPhrase(Phrase.HeaderBlackList), new BlackListPage(phraseProvider) }
            };
            page = Pages[phraseProvider.GetPhrase(Phrase.HeaderMain)];
        }
Example #13
0
 public void Do_actions_which_require_third_party_data_access(
     IDataFile <CredCard2Record> third_party_file,
     IDataFile <CredCard2InOutRecord> owned_file,
     ISpreadsheet spreadsheet,
     IInputOutput input_output)
 {
 }
 public ContentProcessorLauncher(IContentProcessor contentProcessor, IWordsRepository wordsRepository, ITextFileReader textFileReader, IInputOutput inputOutput)
 {
     _contentProcessor = contentProcessor;
     _wordsRepository  = wordsRepository;
     _textFileReader   = textFileReader;
     _inputOutput      = inputOutput;
 }
Example #15
0
        private static void PrintSalute(IInputOutput inputOutput)
        {
            var assembly     = Assembly.GetExecutingAssembly();
            var assemblyName = assembly.GetName();

            inputOutput.WriteLine("{0} {1}", assemblyName.Name, assemblyName.Version);
        }
Example #16
0
        public void OnRequest(IInputOutput aServer, dynamic aJson)
        {
            int  mt4_id    = aJson["mt4UserID"];
            int  pub_topic = aJson["topic"];
            bool turn_to   = aJson["turn_to"];

            MT4ID = mt4_id;
            Topic = string.Format("Equity:{0}", pub_topic);
            if (turn_to)
            {
                if (!_existsTask.ContainsKey(pub_topic))
                {
                    var task = Task.Factory.StartNew(OnProc);
                    _existsTask.TryAdd(pub_topic, this);
                }
            }
            else
            {
                PubEquityTopic runing = null;
                _existsTask.TryRemove(pub_topic, out runing);
                if (runing != null)
                {
                    runing.CanRun = false;
                }
            }
            dynamic resp = new ExpandoObject();

            resp.is_succ   = true;
            resp.errMsg    = Utils.GetErrorMessage(0);
            resp.errCode   = 0;
            aServer.Output = JsonConvert.SerializeObject(resp);
        }
 public MiniPLInterpreter(string sampleProgram, ISymbolTable symbolTable, IInputOutput io)
 {
     this.sampleProgram = sampleProgram;
     this.io            = io;
     this.ast           = null;
     this.symbolTable   = symbolTable;
 }
Example #18
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FigureManager" /> class.
 /// </summary>
 /// <param name="io">Input/Output component</param>
 /// <param name="figureStile">Figure stile</param>
 public FigureManager(
     IInputOutput io,
     string figureStile)
 {
     this.io          = io;
     this.figureStile = figureStile;
 }
Example #19
0
 public Game(Player player, Dealer dealer, IDeck shuffledDeck, IInputOutput iio, GameState gameState = GameState.Initial)
 {
     Player       = player;
     Dealer       = dealer;
     ShuffledDeck = shuffledDeck;
     _iio         = iio;
     GameState    = gameState;
 }
Example #20
0
 public void Generate_ad_hoc_data(
     IInputOutput input_output,
     ISpreadsheet spreadsheet,
     ICSVFile <BankRecord> pending_file,
     BudgetingMonths budgeting_months,
     DataLoadingInformation <ActualBankRecord, BankRecord> data_loading_info)
 {
 }
 public InterpreterVisitor(ISymbolTable symbolTable, IInputOutput inputOutput)
 {
     this.symbolTable = symbolTable;
     this.inputOutput = inputOutput;
     initializeStacks();
     this.intType = false;
     this.strType = false;
 }
Example #22
0
 public void Merge_bespoke_data_with_pending_file(
     IInputOutput input_output,
     ISpreadsheet spreadsheet,
     ICSVFile <BankRecord> pending_file,
     BudgetingMonths budgeting_months,
     DataLoadingInformation <ActualBankRecord, BankRecord> data_loading_info)
 {
 }
Example #23
0
 public void Generate_ad_hoc_data(
     IInputOutput input_output,
     ISpreadsheet spreadsheet,
     ICSVFile <CredCard2InOutRecord> pending_file,
     BudgetingMonths budgeting_months,
     DataLoadingInformation <CredCard2Record, CredCard2InOutRecord> data_loading_info)
 {
 }
        private void Update_owed_CHB(IInputOutput input_output, ISpreadsheet spreadsheet, BudgetingMonths budgeting_months)
        {
            var input = input_output.Get_input("Do you want to add to the CHB total? The answer is probably No if you're not doing monthly transaction budgeting this time. Enter y/Y for Yes.");

            if (!String.IsNullOrEmpty(input) && input.ToUpper() == "Y")
            {
                spreadsheet.Update_owed_CHB(budgeting_months);
            }
        }
Example #25
0
        public void Merge_bespoke_data_with_pending_file(
            IInputOutput input_output,
            ISpreadsheet spreadsheet,
            ICSVFile <CredCard2InOutRecord> pending_file,
            BudgetingMonths budgeting_months,
            DataLoadingInformation <CredCard2Record, CredCard2InOutRecord> data_loading_info)
        {
            var most_recent_cred_card_direct_debit = spreadsheet.Get_most_recent_row_containing_text <BankRecord>(
                MainSheetNames.Bank_out,
                ReconConsts.Cred_card2_dd_description,
                new List <int> {
                ReconConsts.DescriptionColumn, ReconConsts.DdDescriptionColumn
            });

            var statement_date = new DateTime();
            var next_date      = most_recent_cred_card_direct_debit.Date.AddMonths(1);
            var input          = input_output.Get_input(string.Format(
                                                            ReconConsts.AskForCredCardDirectDebit,
                                                            ReconConsts.Cred_card2_name,
                                                            next_date.ToShortDateString()));
            double new_balance = 0;

            while (input != "0")
            {
                if (double.TryParse(input, out new_balance))
                {
                    new_balance = new_balance * -1;
                    pending_file.Records.Add(new CredCard2InOutRecord
                    {
                        Date                = next_date,
                        Description         = ReconConsts.Cred_card2_regular_pymt_description,
                        Unreconciled_amount = new_balance
                    });
                }
                statement_date = next_date.AddMonths(-1);
                next_date      = next_date.Date.AddMonths(1);
                input          = input_output.Get_input(string.Format(
                                                            ReconConsts.AskForCredCardDirectDebit,
                                                            ReconConsts.Cred_card2_name,
                                                            next_date.ToShortDateString()));
            }

            if (!new_balance.Double_equals(0))
            {
                spreadsheet.Update_balance_on_totals_sheet(
                    Codes.Cred_card2_bal,
                    new_balance,
                    string.Format(
                        ReconConsts.CredCardBalanceDescription,
                        ReconConsts.Cred_card2_name,
                        $"{statement_date.ToString("MMM")} {statement_date.Year}"),
                    balance_column: 5,
                    text_column: 6,
                    code_column: 4,
                    input_output: input_output);
            }
        }
 public Minesweeper(Board board, Player player, IInputOutput iio, IMineGenerator iMineGenerator)
 {
     _board          = board;
     _player         = player;
     _iio            = iio;
     _hintCalculator = new HintCalculator(board);
     _iMineGenerator = iMineGenerator;
     GameStatus      = GameStatus.AwaitingFirstMove;
 }
Example #27
0
        public void OnRequest(IInputOutput aServer, dynamic aJson)
        {
            dynamic resp = new ExpandoObject();

            resp.is_succ   = true;
            resp.now       = TimeServer.Now.ToTime32();
            resp.err_msg   = "";
            aServer.Output = JsonConvert.SerializeObject(resp);
        }
Example #28
0
 public TicTacToe(Board board, Player player1, Player player2, IInputOutput iio)
 {
     _board       = board ?? throw new ArgumentException(nameof(board));
     _player1     = player1 ?? throw new ArgumentException(nameof(player1));
     _player2     = player2 ?? throw new ArgumentException(nameof(player2));
     _iio         = iio ?? throw new ArgumentException(nameof(iio));
     _winningMove = new WinningMove(board);
     GameStatus   = GameStatus.Playing;
 }
        public CompressorApplication(IInputOutput io, ILogger logger, IStreamFactory streamFactory, ICompressorSettings settings)
        {
            _io            = io ?? throw new ArgumentNullException(nameof(io));
            _logger        = logger ?? throw new ArgumentNullException(nameof(logger));
            _streamFactory = streamFactory ?? throw new ArgumentNullException(nameof(streamFactory));
            _settings      = settings ?? throw new ArgumentNullException(nameof(settings));

            _inputReader = new GzipperUserInputReader(_io);
        }
Example #30
0
 public BlackJack(IList <Player> players, IInputOutput iio, Player dealer)
 {
     _playerList = players;
     _iio        = iio;
     _dealer     = dealer;
     for (var i = 0; i < _playerList.Count; i++)
     {
         Console.WriteLine($"Player:{i + 1}");
     }
 }
 public BankAndBankInMatcher(
     IInputOutput input_output,
     ISpreadsheetRepoFactory spreadsheet_factory,
     IBankAndBankInLoader bank_and_bank_in_loader)
 {
     _input_output                = input_output;
     _spreadsheet_factory         = spreadsheet_factory;
     _bank_and_bank_in_loader     = bank_and_bank_in_loader;
     MatchedExpectedIncomeRecords = new List <ExpectedIncomeRecord>();
 }
Example #32
0
        private void PrintSalute(IInputOutput inputOutput)
        {
            //var assembly = Assembly.GetExecutingAssembly();
            //var assemblyName = assembly.GetName();
            //inputOutput.WriteLine("{0} {1}", assemblyName.Name, assemblyName.Version);
            var appVer  = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();
            var bootVer = Resources.GetString(Resources.StringResources.BOOTLOADER_VER);

            inputOutput.WriteLine($" GHI Electronics, LLC{Strings.NewLine}----------------------{Strings.NewLine}   Boot Loader {bootVer} App Ver.{appVer}{Strings.NewLine}");
        }
        public static void RunFactorial(IInputOutput io, IMathOperations math)
        {
            io.WriteLine("Michael Wright");
              io.WriteLine("CS 2450\n");

              io.Write("Enter a number to get a factorial: ");
              int factorialNumber = 0;
              bool parseSucceeded = int.TryParse(io.ReadLine(), out factorialNumber);
              if (!parseSucceeded)
              {
            return;
              }

              int sum = math.Factorial(factorialNumber);

              io.WriteLine("Factorial Value is {0}", sum);
              io.ReadLine();
        }
 public TanByPrompt(IInputOutput io)
 {
     this.io = io;
 }
 public ContentProcessorLauncher(IInputOutput inputOutput) : this(new ContentProcessor(), new WordsRepository(), new TextFileReader(), inputOutput )
 {
     
 }
 public ActionSepa(IInputOutput io)
     : base(io)
 {
 }
 public void SetupDependencies()
 {
     _mockMath = MockRepository.GenerateMock<IMathOperations>();
       _mockIO = MockRepository.GenerateMock<IInputOutput>();
 }
 public ActionBalance(IInputOutput io)
     : base(io)
 {
 }
 public ActionPersist(IInputOutput io)
     : base(io)
 {
 }
 public TanSourceFactory(IInputOutput io)
 {
     this.io = io;
 }
 public ActionXml(IInputOutput io)
     : base(io)
 {
 }
 public ContentProcessor(IInputOutput inputOutput)
 {
     _inputOutput = inputOutput;
 }
 public ActionRemittDebit(IInputOutput io)
     : base(io)
 {
 }
 protected ActionBase(IInputOutput io)
 {
     Io = io;
 }
Example #45
0
 public PrettyPrintWalker(IInputOutput io)
 {
     IO = io;
 }
Example #46
0
 public ExecuteWalker(IInputOutput io)
 {
     Context = new Context();
     IO = io;
 }
 public static void AddAccount(IBank localBank, IInputOutput io)
 {
     throw new NotImplementedException();
 }
 public CommandLineHelper(IInputOutput io)
 {
     this.io = io;
 }
 public TanByList(IInputOutput io)
 {
     this.io = io;
 }
 public static void Balance(IBank localBank, IInputOutput io)
 {
     throw new NotImplementedException();
 }
 public ActionStatement(IInputOutput io)
     : base(io)
 {
 }
 public static void Withdrawal(IBank localBank, IInputOutput io, ITransactionFactory transactionFactory)
 {
     throw new NotImplementedException();
 }
 public FinTsService(IActionFactory actionFactory, ITanSourceFactory tanSourceFactory, IInputOutput io)
 {
     this.actionFactory = actionFactory;
     this.tanSourceFactory = tanSourceFactory;
     this.io = io;
 }
 public TriangleCalculator(IInputOutput io)
 {
     throw new System.NotImplementedException();
 }