public Stream GetAvailableOutputFormatParams()
        {
            List <ContentType> Types = new List <ContentType>();

            foreach (IOInterface _io_plugin in _Plugins.Values)
            {
                Types.Add(_io_plugin.ContentType);
            }

            var _ContentType = HttpServer.GetBestMatchingAcceptHeader(Types.ToArray());

            IOInterface plugin = null;

            if (_Plugins.TryGetValue(_ContentType.MediaType, out plugin))
            {
                try
                {
                    return(new MemoryStream(Encoding.UTF8.GetBytes(plugin.ListAvailParams())));
                }
                catch (NotImplementedException)
                {
                    return(null);
                }
            }
            else
            {
                return(null);
            }
        }
 public CommandProcessor(GameBoard board, Scoreboard score, IOInterface userIteractor, CommandParser commandParser)
 {
     this.gameBoard = board;
     this.scoreBoard = score;
     this.userIteractor = userIteractor;
     this.currentBoardState = new GameBoardMemory();
     this.currentBoardState.Memento = board.SaveMemento();
     this.commandParser = commandParser;
     this.remainingLives = INITIAL_LIVES;
 }
        public void GenerateResultOutput(IQueryResult myResult, Dictionary <String, String> myParams)
        {
            List <ContentType> Types = new List <ContentType>();

            foreach (IOInterface _io_plugin in _Plugins.Values)
            {
                Types.Add(_io_plugin.ContentType);
            }

            var _ContentType = HttpServer.GetBestMatchingAcceptHeader(Types.ToArray());

            IOInterface plugin = null;


            if (_Plugins.TryGetValue(_ContentType.MediaType, out plugin))
            {
                var content = plugin.GenerateOutputResult(myResult, myParams);
                ExportContent(_ServerID, System.Text.Encoding.UTF8.GetBytes(content), plugin.ContentType);
            }
            else
            {
                _ErrorMsg.Error406_NotAcceptable(String.Format("The server does not support the requested content type {0} ", _ContentType.ToString()));
            }
        }
 /// <summary>
 /// Sets the IO interface
 /// </summary>
 /// <param name="userInterractor">IOInterface instance</param>
 public void SetIOInterface(IOInterface userInterractor)
 {
     iface = userInterractor;
 }
 /// <summary>
 /// Creates an instance of the GameEngine class
 /// </summary>
 /// <param name="processor">The command processor to be used by the engine</param>
 /// <param name="interactor">The user interactor to be used by the engine</param>
 /// <param name="board">The game board to be used by the engine</param>
 public GameEngine(CommandProcessor processor, IOInterface interactor, GameBoard board)
 {
     this.commandProcessor = processor;
     this.userInteractor = interactor;
     this.board = board;
 }
Exemple #6
0
 protected CoreComponent(int unityBufferSize)
 {
     io = new IOInterface(unityBufferSize, this);
 }