/// <summary> /// Runs the assembly with the specified arguments.xit /// </summary> /// <param name="workingDirectory">The working directory.</param> /// <param name="environmentVariables">The environment variables.</param> /// <param name="args">The main arguments.</param> /// <param name="shadowCache">If [true], use shadow cache.</param> /// <param name="logger">The logger.</param> /// <returns>System.Int32.</returns> public int Run(string workingDirectory, Dictionary<string, string> environmentVariables, string[] args, bool shadowCache, IServerLogger logger) { lock (disposingLock) { if (isDisposed) { logger.OnLog("Error, server is being shutdown, cannot run Compiler", ConsoleColor.Red); return 1; } } AppDomainShadow shadowDomain = null; try { shadowDomain = GetOrNew(shadowCache, IsCachingAppDomain); return shadowDomain.Run(workingDirectory, environmentVariables, args, logger); } finally { if (shadowDomain != null) { shadowDomain.EndRun(); if (!IsCachingAppDomain) { shadowDomain.Dispose(); } } } }
/// <summary> /// Adds a logger to this composite logger. This means this logger's methods will be invoked by the server to log /// its actions. /// </summary> public void AddLogger(IServerLogger logger) { if (logger == null) throw new ArgumentNullException("logger"); Loggers.AddLast(logger); }
public FosRequest(Socket sock, Fos.Logging.IServerLogger logger) : base(sock) { Logger = logger; CancellationSource = new CancellationTokenSource(); OwinContext = new OwinContext("1.0", CancellationSource.Token); // Streams stdout = new Fos.Streams.FosStdoutStream(sock); OwinContext.ResponseBody = Stdout; OwinContext.RequestBody = Stdin; }
public MediaClientValidator(IServerLogger logger = null, string validationURL = "") { if (logger != null) { m_Logger = logger; } else { m_Logger = new ConsoleLogger(); } m_ValidationURL = validationURL; }
public FosRequest(Socket sock, Fos.Logging.IServerLogger logger) : base(sock) { Logger = logger; CancellationSource = new CancellationTokenSource(); OwinContext = new OwinContext("1.0", CancellationSource.Token); OwinContext.Add("server.OnSendingHeaders", (Action <Action <object>, object>)RegisterOnSendingHeadersCallback); // Streams stdout = new Fos.Streams.FosStdoutStream(sock); OwinContext.ResponseBody = Stdout; OwinContext.RequestBody = Stdin; }
public void Init(IRequestHandlerFactory requestHandlerFactory, IServerLogger logger = null) { if (m_initialized) { throw new Exception("Already initialized."); } if (requestHandlerFactory == null) { throw new ArgumentNullException(nameof(requestHandlerFactory)); } GDInternalResources.Init(requestHandlerFactory, logger); m_initialized = true; }
public BaccaratGame(IServerNode node) { m_Node = node; m_Logger = m_Node.GetLogger(); m_GameState = GAME_STATUS.Unknown; m_WaitingForDealing = false; m_IsRunningGameLoop = false; PlayerPoints = -1; BankerPoints = -1; m_ShoeCode = ""; m_RoundIndex = 0; }
public ClientHolder(IServerNode node) { m_Node = node; m_Logger = m_Node.GetLogger(); m_ServerName = m_Node.GetName(); if (m_Clients != null) { m_Clients.Clear(); } else { m_Clients = new Dictionary <string, ClientInfo>(); } }
public WebSocketServer(IServerNode handler, IServerLogger logger = null, int flags = 0) { RequestHandler = handler; Logger = logger; if (Logger == null) { Logger = new ConsoleLogger(); } Flags = flags; if (WebMessage.JsonCodec == WebMessage.DefaultJsonCodec) { WebMessage.JsonCodec = new CommonJsonCodec(); } }
private static void RepeatIfFailed(Action action, IServerLogger serverLogger, int attempt = 0) { try { action(); } catch (Exception e) { var delay = AttemptDelay * Math.Pow(2, attempt); serverLogger.Log($"Internet is{(Internet.IsAvailable() ? null : " NOT")} available"); serverLogger.Log(e.GetFullDescription($"Attempt #{attempt} failed, next try in {delay}")); Thread.Sleep(delay); RepeatIfFailed(action, serverLogger, attempt + 1); } }
static void Main(string[] args) { //Controller.executeDeliveryBlocks("ES01"); string salesOrg = args[0]; IServerLogger log = Create.serverLogger(161); log.start(salesOrg); try { Controller.executeDeliveryBlocks(salesOrg); log.finish(salesOrg); } catch (Exception ex) { GlobalErrorHandler.handle(salesOrg, "Delivery Blocks", ex); log.finish(salesOrg + " Error"); } }
public static void Main(string[] args) { string salesOrg = args[0]; //string salesOrg = "FR01"; IServerLogger log = Create.serverLogger(157); log.start(); try { Controller.executeDistressReport(salesOrg); log.finish("success"); } catch (Exception ex) { GlobalErrorHandler.handle(salesOrg, "Distress", ex); log.finish("error"); } }
/// <summary> /// Runs the assembly with the specified arguments.xit /// </summary> /// <param name="args">The main arguments.</param> /// <param name="logger">The logger.</param> /// <returns>System.Int32.</returns> public int Run(string[] args, IServerLogger logger) { AppDomainShadow shadowDomain = null; try { shadowDomain = GetOrNew(IsCachingAppDomain); return shadowDomain.Run(args, logger); } finally { if (shadowDomain != null) { shadowDomain.EndRun(); if (!IsCachingAppDomain) { shadowDomain.Dispose(); } } } }
public HttpServer(IServerNode handler, IServerLogger logger = null, int flags = 0, string allowOrigin = "") { m_TaskSchedulerPair = new ConcurrentExclusiveSchedulerPair(TaskScheduler.Default, ListenerWorkerThreadCount); m_ListenerTaskFactory = new TaskFactory(m_TaskSchedulerPair.ConcurrentScheduler); RequestHandler = handler; Logger = logger; if (Logger == null) { Logger = new ConsoleLogger(); } Flags = flags; if ((Flags & RequestContext.FLAG_PUBLIC) != 0) { AllowOrigin = allowOrigin; // normally only public services need this } }
public static void Main(string[] args) { //TODO: Add ship to & sold to name for the email report //Controller.executeRejections("ZA01", true); string salesOrg = args[0]; bool isRelease = (args[1] == "Release"); IServerLogger log = Create.serverLogger(147); log.start(); try { Controller.executeRejections(salesOrg, isRelease); log.finish("success"); } catch (Exception ex) { GlobalErrorHandler.handle(salesOrg, isRelease ? "Release Rejections" : "After Release Rejections", ex); log.finish("error"); } }
/// <summary> /// Runs the assembly with the specified arguments.xit /// </summary> /// <param name="args">The main arguments.</param> /// <param name="logger">The logger.</param> /// <returns>System.Int32.</returns> public int Run(string[] args, IServerLogger logger) { AppDomainShadow shadowDomain = null; try { shadowDomain = GetOrNew(IsCachingAppDomain); return(shadowDomain.Run(args, logger)); } finally { if (shadowDomain != null) { shadowDomain.EndRun(); if (!IsCachingAppDomain) { shadowDomain.Dispose(); } } } }
public StreamnesiaHub( IHubContext <UpdateHub> hub, ICommandPoll poll, CommandQueue cmdQueue, IPayloadLoader payloadLoader, Bot bot, Random rng, PollState pollState, StreamnesiaConfig config, IServerLogger logger ) { _hub = hub; _poll = poll; _cmdQueue = cmdQueue; _payloadLoader = payloadLoader; _bot = bot; _rng = rng; _pollState = pollState; _logger = logger; _canQueryPoll = true; _bot.OnVoted = OnUserVoted; _bot.OnDeathSet = text => { if (config.AllowDeathMessages) { Amnesia.SetDeathHintTextAsync(text); } }; _bot.OnMessageSent = text => { if (config.AllowOnScreenMessages) { Amnesia.DisplayTextAsync(text); } }; _ = _cmdQueue.StartCommandProcessingAsync(CancellationToken.None); _ = StartLoop(); }
public ServiceWrapper(Type objectType, String serviceName, Boolean isPublic = true, IServerLogger logger = null) { IsPublic = isPublic; ServiceName = serviceName; m_Logger = logger; if (m_Logger == null) { m_Logger = new ConsoleLogger(); } ServiceObject = Activator.CreateInstance(objectType); var methods = ServiceObject.GetType().GetMethods(); foreach (var method in methods) { var attr = ServiceWrapper.GetAnnotation(method); if (attr != null) { string actionName = attr.Name; var actions = attr.IsLocal ? m_LocalActions : (attr.IsPublic ? m_PublicActions : m_InternalActions); if (!actions.ContainsKey(actionName)) { actions.Add(actionName, method); if (actionName == "validate-request") { m_ValidationAction = method; } else if (actionName == "get-task-factory") { m_TaskFactoryAction = method; } else if (actionName == "default-action") { m_DefaultAction = method; } } } } }
/// <summary> /// SOAR script runs reports as per args that are passed to save in the SOAR folder /// </summary> /// <param name="args"></param> public static void Main(string[] args) { IServerLogger log = Create.serverLogger(154); string soarReport = args[0]; //string soarReport = "WE05"; var SOs = new string[] { "FR01", "NL01", "DE01", "IT01", "GR01", "PL01", "CZ01", "PT01", "ES01", "RO01", "GB01", "TR01", "UA01", "RU01", "ZA01", "KE02", "NG01" }; log.start(); switch (soarReport) { case "WE05": { Controller.executeWE05(Strings.Left(args[1], 2)); log.finish(); break; } case "ZV04HN": { Controller.executeZV04HN(args[1]); log.finish(); break; } case "All": { runAll(SOs); log.finish(); break; } default: { throw new NotImplementedException("no report for " + soarReport); } } }
public override void SetLogger(IServerLogger logger) { if (logger == null) throw new ArgumentNullException("logger"); this.UserSetLogger = logger; }
/// <summary> /// Runs the assembly with the specified arguments.xit /// </summary> /// <param name="workingDirectory">The working directory.</param> /// <param name="environmentVariables">The environment variables.</param> /// <param name="args">The main arguments.</param> /// <param name="logger">The logger.</param> /// <returns>System.Int32.</returns> public int Run(string workingDirectory, Dictionary <string, string> environmentVariables, string[] args, IServerLogger logger) { lock (disposingLock) { if (isDisposed) { logger.OnLog("Error, server is being shutdown, cannot run Compiler", ConsoleColor.Red); return(1); } } AppDomainShadow shadowDomain = null; try { shadowDomain = GetOrNew(IsCachingAppDomain); return(shadowDomain.Run(workingDirectory, environmentVariables, args, logger)); } finally { if (shadowDomain != null) { shadowDomain.EndRun(); if (!IsCachingAppDomain) { shadowDomain.Dispose(); } } } }
public void Dispose() { logger = null; }
public AppDomainRedirectLogger(IServerLogger logger) { this.logger = logger; }
static CommonLog() { m_Logger = new ServerLogger(); }
public HttpSourceMediaServer(string serverName, MediaResourceManager resourceManager, IServerLogger logger = null, string inputIp = "", int inputPort = -1, string outputIp = "", int outputPort = -1, List <string> inputWhiteList = null, string certFile = "", string certKey = "") { InputQueueSize = DEFAULT_INPUT_QUEUE_SIZE; InputBufferSize = DEFAULT_INPUT_BUFFER_SIZE; OutputQueueSize = DEFAULT_OUTPUT_QUEUE_SIZE; OutputBufferSize = DEFAULT_OUTPUT_BUFFER_SIZE; OutputSocketBufferSize = 0; // use default value m_ServerName = serverName; m_CertFile = certFile; m_CertKey = certKey; if (logger != null) { m_Logger = logger; } else { m_Logger = new ConsoleLogger(); } m_ResourceManager = resourceManager; m_ResourceManager.AddServer(this); if (inputIp.Length > 0) { m_InputIp = inputIp; } if (outputIp.Length > 0) { m_OutputIp = outputIp; } if (inputPort >= 0) { m_InputPort = inputPort; } if (outputPort >= 0) { m_OutputPort = outputPort; } if (inputWhiteList != null) { m_InputWhiteList.AddRange(inputWhiteList); } if (m_InputWhiteList.Count <= 0) { m_InputWhiteList.Add("127.0.0.1"); } }
private static void UnhandledExceptionTrapper(UnhandledExceptionEventArgs e, IServerLogger serverLogger) { serverLogger.Log(e.ExceptionObject.ToString()); }
/// <summary> /// Runs the main entry point method passing arguments to it /// </summary> /// <param name="workingDirectory"></param> /// <param name="environmentVariables">The environment variables.</param> /// <param name="args">The arguments.</param> /// <param name="logger">The logger.</param> /// <returns>System.Int32.</returns> /// <exception cref="System.InvalidOperationException">Must call TryLock before calling this method</exception> public int Run(string workingDirectory, Dictionary <string, string> environmentVariables, string[] args, IServerLogger logger) { if (!isRunning) { throw new InvalidOperationException("Must call TryLock before calling this method"); } try { lastRunTime = DateTime.Now; using (var appDomainRedirectLogger = new AppDomainRedirectLogger(logger)) { appDomainCallback.Logger = appDomainRedirectLogger; appDomainCallback.CurrentDirectory = workingDirectory; appDomainCallback.EnvironmentVariables = environmentVariables; appDomainCallback.Arguments = args; appDomain.DoCallBack(appDomainCallback.Run); var result = appDomain.GetData("Result") as int?; //var result = appDomain.ExecuteAssembly(mainAssemblyPath, args); Console.WriteLine("Return result: {0}", result); return(result ?? -1); } } catch (Exception exception) { logger.OnLog(string.Format("Unexpected exception: {0}", exception), ConsoleColor.Red); return(1); } finally { lastRunTime = DateTime.Now; } }
public DBConnector(IServerLogger logger) { this.Logger = logger; }
public FosRequest(Socket sock, Fos.Logging.IServerLogger logger) : base(sock) { Logger = logger; CancellationSource = new CancellationTokenSource(); OwinContext = new OwinContext("1.0", CancellationSource.Token); // Streams stdout = new Fos.Streams.FosStdoutStream(sock); OwinContext.ResponseBody = Stdout; OwinContext.RequestBody = Stdin; }
public TelegramClientAndServerLogger(ITelegramBotClient botClient, IServerLogger serverLogger, Message message) { this.botClient = botClient; this.serverLogger = serverLogger; this.message = message; }
public BetResultUpdater(IServerNode node) { m_Node = node; m_Logger = m_Node.GetLogger(); }
internal static void Init(IRequestHandlerFactory requestHandlerFactory, IServerLogger logger = null) { m_requestHandlerFactory = requestHandlerFactory; m_logger = logger; }
public AppDomainRedirectLogger(IServerLogger logger) { this.logger = logger; }
public void Dispose() { logger = null; }
//private Dictionary<string, List<long>> m_BetRecordLists = new Dictionary<string, List<long>>(); public BetCollector(IServerNode node) { m_Node = node; m_Logger = m_Node.GetLogger(); }
//private Dictionary<string, List<long>> m_BetRecordLists = new Dictionary<string, List<long>>(); public BetWinlossChecker(IServerNode node) { m_Node = node; m_Logger = m_Node.GetLogger(); }
public ExecServerRemoteClient(IServerLogger logger, Binding binding, EndpointAddress remoteAddress) : base(logger, binding, remoteAddress) { }
/// <summary> /// Set this to an <see cref="Fos.Logging.IServerLogger"/> to log server information. /// </summary> public virtual void SetLogger(IServerLogger logger) { if (logger == null) throw new ArgumentNullException("logger"); this.Logger = logger; }
/// <summary> /// Runs the main entry point method passing arguments to it /// </summary> /// <param name="workingDirectory"></param> /// <param name="environmentVariables">The environment variables.</param> /// <param name="args">The arguments.</param> /// <param name="logger">The logger.</param> /// <returns>System.Int32.</returns> /// <exception cref="System.InvalidOperationException">Must call TryLock before calling this method</exception> public int Run(string workingDirectory, Dictionary<string, string> environmentVariables, string[] args, IServerLogger logger) { if (!isRunning) { throw new InvalidOperationException("Must call TryLock before calling this method"); } try { lastRunTime = DateTime.Now; using (var appDomainRedirectLogger = new AppDomainRedirectLogger(logger)) { appDomainCallback.Logger = appDomainRedirectLogger; appDomainCallback.CurrentDirectory = workingDirectory; appDomainCallback.EnvironmentVariables = environmentVariables; appDomainCallback.Arguments = args; appDomain.DoCallBack(appDomainCallback.Run); var result = appDomain.GetData("Result") as int?; //var result = appDomain.ExecuteAssembly(mainAssemblyPath, args); Console.WriteLine("Return result: {0}", result); return result ?? -1; } } catch (Exception exception) { logger.OnLog(string.Format("Unexpected exception: {0}", exception), ConsoleColor.Red); return 1; } finally { lastRunTime = DateTime.Now; } }