public void Execute(ExecutingOptions options) { var host = new RhinoServiceBusHost(); host.SetArguments(options); host.InitialDeployment(options.Account); }
public void Execute(ExecutingOptions options) { var installer = new ProjectInstaller { DisplayName = options.Name, Description = options.Name, Context = new InstallContext() }; if (!string.IsNullOrEmpty(options.Account)) { if (string.IsNullOrEmpty(options.Password)) { throw new InvalidOperationException("When /Action is Install and /Account is set /Password is required."); } installer.SetUserAccount(options.Account, options.Password); } installer.Context.Parameters.Add("assemblypath", GetType().Assembly.Location); installer.Install(new Hashtable()); using (var system = Registry.LocalMachine.OpenSubKey("System")) using (var currentControlSet = system.OpenSubKey("CurrentControlSet")) using (var services = currentControlSet.OpenSubKey("Services")) using (var service = services.OpenSubKey(installer.ServiceName, true)) { var path = (string)service.GetValue("ImagePath"); options.Action = Action.Server; service.SetValue("ImagePath", path + options); } }
public void Execute(ExecutingOptions options) { var installer = new ProjectInstaller { DisplayName = options.Name, Description = options.Name, Context = new InstallContext() }; installer.Context.Parameters.Add("assemblypath", GetType().Assembly.Location); installer.Install(new Hashtable()); using (var system = Registry.LocalMachine.OpenSubKey("System")) using (var currentControlSet = system.OpenSubKey("CurrentControlSet")) using (var services = currentControlSet.OpenSubKey("Services")) using (var service = services.OpenSubKey(installer.ServiceName, true)) { var path = (string)service.GetValue("ImagePath"); options.Action = Action.Server; service.SetValue("ImagePath", path + options); } }
public void Execute(ExecutingOptions options) { var host = new RhinoServiceBusHost(); host.SetArguments(options); try { host.DebugStart(new string[0]); bool keepGoing = true; while (keepGoing) { Console.WriteLine("Enter 'cls' to clear the screen, 'q' to exit"); var op = Console.ReadLine() ?? ""; switch (op.ToLowerInvariant()) { case "q": keepGoing = false; break; case "cls": Console.Clear(); break; } } host.Stop(); } catch (Exception e) { Console.WriteLine(e); Console.ReadKey(); } }
public void Execute(ExecutingOptions options) { var host = new RhinoServiceBusHost(); host.SetArguments(options); try { host.DebugStart(new string[0]); bool keepGoing = true; while (keepGoing) { Console.WriteLine("Enter 'cls' to clear the screen, 'q' to exit"); var op = Console.ReadLine() ?? ""; switch (op.ToLowerInvariant()) { case "q": keepGoing = false; break; case "cls": Console.Clear(); break; } } host.Stop(); } catch (Exception e) { Log.Fatal("Host has crashed", e); Console.WriteLine(e); Console.ReadKey(); } }
public void Execute(ExecutingOptions options) { var host = new RhinoServiceBusHost(); host.SetArguments(options); ServiceBase.Run(host); }
public Judger(FileFactory factory, Problem problem, Submit submit) { _factory = factory; _problem = problem; _options = problem.Options; _submit = submit; _checker = JudgeProcess.ApprKernel.Get <IChecker>(); }
/// <summary> /// Executes the specified options. /// </summary> /// <param name="options">The options.</param> public void Execute(ExecutingOptions options) { var installer = new ProjectInstaller { DisplayName = options.Name, Description = options.Name, Context = new InstallContext() }; installer.Uninstall(null); }
public void Execute(ExecutingOptions options) { var installer = new ProjectInstaller { DisplayName = options.Name, Description = options.Name, Context = new InstallContext() }; installer.Uninstall(null); }
public TestVerdict CheckMemory(ExecutionOutput executionOutput, ExecutingOptions executingOptions) { TypeVerdicts verdict = TypeVerdicts.OK; if (executionOutput.Memory.TotalKilobytes > executingOptions.MemoryLimit.TotalKilobytes) { verdict = TypeVerdicts.MemoryLimit; } return(new TestVerdict(executionOutput.Memory, executionOutput.Time, executionOutput.ExitCode, verdict)); }
public TestVerdict CheckTime(ExecutionOutput executionOutput, ExecutingOptions executingOptions) { TypeVerdicts verdict = TypeVerdicts.OK; if (executionOutput.Time.TotalMilliseconds < executingOptions.TimeLimit.TotalMilliseconds) { verdict = TypeVerdicts.TimeLimit; } return(new TestVerdict(executionOutput.Memory, executionOutput.Time, executionOutput.ExitCode, verdict)); }
public void Execute(ExecutingOptions options) { var host = new RhinoServiceBusHost(); host.SetArguments(options); try { host.DebugStart(new string[0]); Console.WriteLine("Press any key to continue..."); Console.ReadKey(); host.Stop(); } catch (Exception e) { Console.WriteLine(e); Console.ReadKey(); } }
public ExecutionOutput Execute(string path, string input, ExecutingOptions options, string startArguments) { throw new NotImplementedException(); }
public Problem(ExecutingOptions options) { Options = options; }
public ExecutionOutput Execute(string path, string input, ExecutingOptions option, string startArguments) { var watch = System.Diagnostics.Stopwatch.StartNew(); CancellationTokenSource cancelTokenSource = new CancellationTokenSource(); CancellationToken token = cancelTokenSource.Token; long memory = 0; Process solve = new Process(); Task executing = new Task(() => { //Init solve.StartInfo = new ProcessStartInfo(path); solve.StartInfo.CreateNoWindow = true; solve.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; solve.StartInfo.RedirectStandardInput = true; solve.StartInfo.RedirectStandardOutput = true; solve.StartInfo.UseShellExecute = false; if (startArguments != "") { solve.StartInfo.Arguments = startArguments + ".txt"; } solve.Start(); //Memory Task memoryCheck = new Task(() => { while (!token.IsCancellationRequested) { memory = Math.Max(solve.WorkingSet64, memory); Thread.Sleep(25); } }); memoryCheck.Start(); // Math.Max(0.5, TL*1.5)+0.5 // Input solve.StandardInput.WriteLine(input); //byte //ToDo: new memory thread 5oms //Output string result = solve.StandardOutput.ReadToEnd(); solve.WaitForExit(); int exitCode = solve.ExitCode; //Time TimeSpan execitionTime = TimeSpan.FromMilliseconds((int)watch.Elapsed.TotalMilliseconds); executionOutput = new ExecutionOutput(execitionTime, new MemorySpan(memory), result, exitCode); cancelTokenSource.Cancel(); }, token); executing.Start(); for (int i = 0; i < option.TimeLimit.Seconds; i++) { Thread.Sleep(100); } if (!token.IsCancellationRequested) { cancelTokenSource.Cancel(); solve.Kill(); executionOutput = new ExecutionOutput(TimeSpan.FromMilliseconds((int)watch.Elapsed.TotalMilliseconds), new MemorySpan(-1), "TL", -1); } return(executionOutput); }