Exemplo n.º 1
0
        public BotHarness(BotMeta meta, string botDir, string workDir)
            : base(meta.NickName ?? meta.Author ?? meta.Email)
        {
            BotMeta = meta;
            BotDir  = botDir;
            WorkDir = workDir;

            _inMemoryLogger = new InMemoryLogger();
            Logger          = _inMemoryLogger;

            switch (meta.BotType)
            {
            case BotMeta.BotTypes.CSharp:
            case BotMeta.BotTypes.CPlusPlus:
            case BotMeta.BotTypes.FSharp:
                _botRunner = new DotNetRunner(this);
                break;

            case BotMeta.BotTypes.Python2:
            case BotMeta.BotTypes.Python3:
                _botRunner = new PythonRunner(this);
                break;

            case BotMeta.BotTypes.Java:
                _botRunner = new JavaRunner(this);
                break;

            case BotMeta.BotTypes.JavaScript:
                _botRunner = new JavaScriptRunner(this);
                break;

            default:
                throw new ArgumentException("Invalid bot type " + meta.BotType);
            }
        }
Exemplo n.º 2
0
        public BotHarness(BotMeta meta, string botDir, string workDir, bool noTimeLimit, bool haltOnError, EnvironmentSettings environmentSettings)
            : base(meta.NickName ?? meta.Author ?? meta.Email)
        {
            BotMeta          = meta;
            BotDir           = botDir;
            WorkDir          = workDir;
            EnforceTimeLimit = !noTimeLimit;
            HaltOnError      = haltOnError;

            _inMemoryLogger = new InMemoryLogger();
            Logger          = _inMemoryLogger;

            switch (meta.BotType)
            {
            case BotMeta.BotTypes.CSharp:
            case BotMeta.BotTypes.CPlusPlus:
            case BotMeta.BotTypes.FSharp:
                _botRunner = new DotNetRunner(this, environmentSettings);
                break;

            case BotMeta.BotTypes.Python2:
            case BotMeta.BotTypes.Python3:
                _botRunner = new PythonRunner(this, environmentSettings);
                break;

            case BotMeta.BotTypes.Java:
            case BotMeta.BotTypes.Scala:
                _botRunner = new JavaRunner(this, environmentSettings);
                break;

            case BotMeta.BotTypes.Golang:
                _botRunner = new GolangRunner(this, environmentSettings);
                break;

            case BotMeta.BotTypes.JavaScript:
                _botRunner = new JavaScriptRunner(this, environmentSettings);
                break;

            case BotMeta.BotTypes.Julia:
                _botRunner = new JuliaRunner(this, environmentSettings);
                break;

            case BotMeta.BotTypes.Rust:
                _botRunner = new RustRunner(this, environmentSettings);
                break;

            default:
                throw new ArgumentException("Invalid bot type " + meta.BotType);
            }
        }