public DotNetCompiler(BotMeta botMeta, string botDir, ILogger compileLogger, EnvironmentSettings environmentSettings) { _botMeta = botMeta; _botDir = botDir; _compileLogger = compileLogger; _environmentSettings = environmentSettings; }
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); } }
public BotCompiler(BotMeta botMeta, string botDir, ILogger compileLogger) { _botMeta = botMeta; _botDir = botDir; this._compileLogger = compileLogger; switch (botMeta.BotType) { case BotMeta.BotTypes.JavaScript: _compiler = new JavaScriptCompiler(botMeta, botDir, compileLogger); break; case BotMeta.BotTypes.Java: _compiler = new JavaCompiler(botMeta, botDir, compileLogger); break; case BotMeta.BotTypes.Python2: case BotMeta.BotTypes.Python3: _compiler = new PythonCompiler(botMeta, botDir, compileLogger); break; default: _compiler = new DotNetCompiler(botMeta, botDir, compileLogger); break; } }
/// <summary> /// アセンブリから Bot クラスをスキャンする /// </summary> /// <param name="asm">捜査対象のアセンブリ(指定しない場合はプログラムエントリーのアセンブリ)</param> /// <returns>Bot IDと Bot クラスタイプ のマップ</returns> private static List <BotMeta> ScanBotsInternal(Assembly asm = null) { try { Debug.WriteLine("スキャン開始"); // アセンブリが指定されていない場合 if (asm == null) { // プログラムエントリーのアセンブリを検索する asm = Assembly.GetEntryAssembly(); } Debug.WriteLine($"Assembly : {asm.FullName}"); // 戻り値 var ret = new List <BotMeta>(); // 探す属性のタイプ Type attributeType = typeof(BotAttribute); // アセンブリの中から Robot を継承した Type を取得 var robotTypes = from type in asm.GetTypes() where type.IsSubclassOf(typeof(Bot)) select type; // 見つかった属性に対して繰り返し foreach (var type in robotTypes) { // Bot 属性 var robotAttr = type.GetCustomAttribute(attributeType) as BotAttribute; // Bot 属性が定義されていない場合、読み飛ばす if (robotAttr == null || robotAttr.BotId == null) { continue; } // Bot メタ情報 var meta = new BotMeta(robotAttr.BotId, robotAttr.Author, type); // 戻り値に追加 ret.Add(meta); Debug.WriteLine($"{robotAttr.BotId} : {type.FullName}"); } // Bot Id でソート ret.Sort((a, b) => a.BotId.CompareTo(b.BotId)); // 結果を返す return(ret); } catch (Exception ex) { throw new AppException("Bot クラスのスキャンに失敗しました", ex); } }
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); } }
public BotCompiler(BotMeta botMeta, string botDir, ILogger compileLogger, EnvironmentSettings environmentSettings) { _botMeta = botMeta; _botDir = botDir; this._compileLogger = compileLogger; switch (botMeta.BotType) { case BotMeta.BotTypes.JavaScript: _compiler = new JavaScriptCompiler(botMeta, botDir, compileLogger, environmentSettings); break; case BotMeta.BotTypes.Java: _compiler = new JavaCompiler(botMeta, botDir, compileLogger, environmentSettings); break; case BotMeta.BotTypes.Julia: _compiler = new JuliaCompiler(botMeta, botDir, compileLogger, environmentSettings); break; case BotMeta.BotTypes.Python2: case BotMeta.BotTypes.Python3: _compiler = new PythonCompiler(botMeta, botDir, compileLogger, environmentSettings); break; case BotMeta.BotTypes.Golang: _compiler = new GolangCompiler(botMeta, botDir, compileLogger, environmentSettings); break; case BotMeta.BotTypes.Rust: _compiler = new RustCompiler(botMeta, botDir, compileLogger, environmentSettings); break; case BotMeta.BotTypes.FSharp: throw new ArgumentException("F# is not supported (No sample bot submitted)"); case BotMeta.BotTypes.CPlusPlus: _compiler = new DotNetCompiler(botMeta, botDir, compileLogger, environmentSettings); break; default: _compiler = new DotNetCompiler(botMeta, botDir, compileLogger, environmentSettings); break; } }
public GolangCompiler(BotMeta botMeta, string botDir, ILogger compileLogger) { _botMeta = botMeta; _botDir = botDir; _compileLogger = compileLogger; }
public JavaScriptCompiler(BotMeta botMeta, string botDir, ILogger compileLogger) { _botMeta = botMeta; _botDir = botDir; _compileLogger = compileLogger; }
/// <summary> /// ComboBox のアイテムを生成する /// </summary> /// <param name="meta">Bot メタ情報</param> public ComboBoxItemBot(BotMeta meta) { Assert.IsNotNull(meta, nameof(meta)); this.meta = meta; }