protected override ProcessParameters ExecutionProcess(IEnumerable <string> modules, IEnumerable <string> folders, bool noEtw) { ProcessParameters processParameters = base.ExecutionProcess(modules, folders, noEtw); processParameters.EnvironmentOverrides["COMPLUS_ReadyToRun"] = "1"; return(processParameters); }
public override ProcessResultsCollection ProcessComponent(IBusinessComponent component, ProcessInvocationPoint point, int pluginId, ProcessParameters processParameters) { ProcessResultsCollection processResults = new ProcessResultsCollection(); Header header = (Header)component; // Get the header status code that matches Policy Verified from the Application Configuration string verifiedHeaderStatus = UWBusinessLogicHelper.ResolveMandatoryConfig<string>("PolicyVerifiedHeaderStatus"); // If the header status code has been changed and now matches the verified header status code retried, process if (header.HeaderStatusCode == verifiedHeaderStatus && header.HeaderStatusCode != header.OriginalTransitionStatus) { // Retrieve the Policy Verify Permission Token and the Submitted for verification Event codes from the Application Configuration string policyVerifyPermissionToken = UWBusinessLogicHelper.ResolveMandatoryConfig<string>("PolicyVerificationPermissionToken"); string submittedForVerificationEventTypeCode = UWBusinessLogicHelper.ResolveMandatoryConfig<string>("SubmittedForVerificationEventTypeCode"); // Check if this user has Policy Verify in their permission tokens. This method throws a SecurityException if this fails XiapSecurity.Assert(policyVerifyPermissionToken); // Check in tasks for a 'submitted for verification' task and make sure it wasn't entered by the user who is now trying to // verify the policy. Throw an error if so. var eventType = header.UwEvents.Where(e => e.EventTypeCode == submittedForVerificationEventTypeCode).OrderByDescending(e => e.EventDate).FirstOrDefault(); if (eventType != null && eventType.CreatedByUserID == XiapSecurity.GetUser().UserID) { UWBusinessLogicHelper.AddError(processResults, UwMessageConstants.POLICY_CANNOT_BE_VERIFIED_BY_PERSON_SUBMITTED, ProcessInvocationPoint.Virtual, component); } } return processResults; }
protected virtual ProcessParameters ExecutionProcess(IEnumerable <string> modules, IEnumerable <string> folders, bool noEtw) { ProcessParameters processParameters = new ProcessParameters(); if (!string.IsNullOrEmpty(_options.GCStress)) { processParameters.EnvironmentOverrides["COMPlus_GCStress"] = _options.GCStress; } if (_options.ExecutionTimeoutMinutes != 0) { processParameters.TimeoutMilliseconds = _options.ExecutionTimeoutMinutes * 60 * 1000; } else if (string.IsNullOrEmpty(Environment.GetEnvironmentVariable("__GCSTRESSLEVEL"))) { processParameters.TimeoutMilliseconds = ProcessParameters.DefaultExeTimeout; } else { processParameters.TimeoutMilliseconds = ProcessParameters.DefaultExeTimeoutGCStress; } // TODO: support for tier jitting - for now we just turn it off as it may distort the JIT statistics processParameters.EnvironmentOverrides["COMPLUS_TieredCompilation"] = "0"; processParameters.CollectJittedMethods = !noEtw; if (!noEtw) { processParameters.MonitorModules = modules; processParameters.MonitorFolders = folders; } return(processParameters); }
public virtual ProcessParameters ScriptExecutionProcess(string outputRoot, string scriptPath, IEnumerable <string> modules, IEnumerable <string> folders) { string scriptToRun = GetOutputFileName(outputRoot, scriptPath); ProcessParameters processParameters = ExecutionProcess(modules, folders, _options.NoEtw); if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { processParameters.ProcessPath = scriptToRun; processParameters.Arguments = null; } else { Linux.MakeExecutable(scriptToRun); processParameters.ProcessPath = "bash"; processParameters.Arguments = "-c " + scriptToRun; } string coreRootDir; if (_options.Composite && !(_options.Framework || _options.UseFramework)) { coreRootDir = GetOutputPath(outputRoot); } else { coreRootDir = _options.CoreRootOutputPath(Index, isFramework: false); } processParameters.InputFileNames = new string[] { scriptToRun }; processParameters.OutputFileName = scriptToRun; processParameters.LogPath = scriptToRun + ".log"; processParameters.EnvironmentOverrides["CORE_ROOT"] = coreRootDir; return(processParameters); }
public override ProcessParameters CompilationProcess(string outputFileName, IEnumerable <string> inputAssemblyFileNames) { ProcessParameters processParameters = base.CompilationProcess(outputFileName, inputAssemblyFileNames); processParameters.Arguments = $"{Crossgen2Path} {processParameters.Arguments}"; return(processParameters); }
public virtual ProcessParameters CompilationProcess(string outputFileName, IEnumerable <string> inputAssemblyFileNames) { Directory.CreateDirectory(Path.GetDirectoryName(outputFileName)); string responseFile = outputFileName + ".rsp"; var commandLineArgs = BuildCommandLineArguments(inputAssemblyFileNames, outputFileName); CreateResponseFile(responseFile, commandLineArgs); ProcessParameters processParameters = new ProcessParameters(); processParameters.ProcessPath = CompilerPath; processParameters.Arguments = $"@{responseFile}"; if (_options.CompilationTimeoutMinutes != 0) { processParameters.TimeoutMilliseconds = _options.CompilationTimeoutMinutes * 60 * 1000; } else { processParameters.TimeoutMilliseconds = (_options.Composite ? ProcessParameters.DefaultIlcCompositeTimeout : ProcessParameters.DefaultIlcTimeout); } processParameters.LogPath = outputFileName + ".ilc.log"; processParameters.InputFileNames = inputAssemblyFileNames; processParameters.OutputFileName = outputFileName; foreach (string inputAssembly in inputAssemblyFileNames) { processParameters.CompilationCostHeuristic += new FileInfo(inputAssembly).Length; } return(processParameters); }
/// <summary> /// Set the Task Initial User and Due Date on the event as appliccable. /// </summary> /// <param name="component">Claim Event</param> /// <param name="point">Process Invocation Point</param> /// <param name="pluginId">unique plugin id</param> /// <param name="processParameters">Process parameters</param> /// <returns>collection of process results</returns> public override ProcessResultsCollection ProcessComponent(IBusinessComponent component, ProcessInvocationPoint point, int pluginId, ProcessParameters processParameters) { PluginHelper<IBusinessComponent> pluginHelper = new PluginHelper<IBusinessComponent>(point, (ClaimEvent)component, new ProcessResultsCollection()); switch (pluginHelper.InvocationPoint) { case ProcessInvocationPoint.Created: case ProcessInvocationPoint.Virtual: { this.UpdateTaskInitialUser(pluginHelper); break; } case ProcessInvocationPoint.PreValidationDefaulting: { // if a new event is added. ClaimEvent clmEvent = (ClaimEvent)pluginHelper.Component; if (clmEvent.IsNew) { this.SetTaskInitialUserForEvents(pluginHelper, clmEvent); } break; } } return pluginHelper.ProcessResults; }
public virtual ProcessParameters CompilationProcess(string outputRoot, string assemblyFileName) { CreateOutputFolder(outputRoot); string outputFileName = GetOutputFileName(outputRoot, assemblyFileName); string responseFile = GetResponseFileName(outputRoot, assemblyFileName); var commandLineArgs = BuildCommandLineArguments(assemblyFileName, outputFileName); CreateResponseFile(responseFile, commandLineArgs); ProcessParameters processParameters = new ProcessParameters(); processParameters.ProcessPath = Path.Combine(_options.CoreRootDirectory.FullName, CompilerRelativePath, CompilerFileName); processParameters.Arguments = $"@{responseFile}"; if (_options.CompilationTimeoutMinutes != 0) { processParameters.TimeoutMilliseconds = _options.CompilationTimeoutMinutes * 60 * 1000; } else { processParameters.TimeoutMilliseconds = ProcessParameters.DefaultIlcTimeout; } processParameters.LogPath = outputFileName + ".ilc.log"; processParameters.InputFileName = assemblyFileName; processParameters.OutputFileName = outputFileName; processParameters.CompilationCostHeuristic = new FileInfo(assemblyFileName).Length; return(processParameters); }
/// <summary> /// This will validate correct combination of TypeOfLoss and CoverageType through decision table. /// </summary> /// <param name="component">Claim Header Component</param> /// <param name="point">Process Invocation Point Virtual</param> /// <param name="pluginId">plugin Id</param> /// <param name="processParameters">List of processParameters</param> /// <returns>Process Results Collection</returns> public override ProcessResultsCollection ProcessComponent(IBusinessComponent component, ProcessInvocationPoint point, int pluginId, ProcessParameters processParameters) { StaticValues.PolicyLinkLevel policyLinkLevel; PluginHelper<ClaimHeader> pluginHelper = new PluginHelper<ClaimHeader>(point, component as ClaimHeader, new ProcessResultsCollection()); switch (point) { case ProcessInvocationPoint.Virtual: this.ValidateTypeOfLossAndCoverageTypeCombination(pluginHelper, (string)processParameters.Parameters[2]); if (Enum.TryParse(processParameters.Parameters[1].ToString(), out policyLinkLevel)) { this.IsExternalPolicyChildComponentExists(pluginHelper, (string)processParameters.Parameters[0], policyLinkLevel); } else { string messageTitle = string.Empty; string messageBody = string.Empty; MessageServiceFactory.GetMessageService().GetMessage(MessageConstants.InvalidValue, out messageTitle, out messageBody, ClaimConstants.POLICY_LINK_LEVEL); throw new ArgumentException(messageBody); } break; } return pluginHelper.ProcessResults; }
protected override bool CheckForCompletion() { /* * if (Duration < TimeSpan.FromMinutes(1.0)) * return false; * else * return true; */ ProcessParameters par = ((App)App.Current).ParametersModel; if (Battery.ActualVoltage >= par.HighBatteryVoltageLimit) { try { if (checkCurrentStability()) { Log.Info("{0} => Stage was interrupted with current stabilization : I={1:F3} A dI={2:F5}A", Battery.TypeOfBattery, Battery.ActualCurrent, DeltaCurrent); return(true); } } catch (Exception e) { Log.Error("{0} => Check current stability failed : {1}", Battery.TypeOfBattery, e.Message); return(false); } } return(false); }
public void GetParametersAlta(bool CopiarDatos) { if (CopiarDatos) { string idVariable = string.Empty; string descripcion = string.Empty; string valor = string.Empty; string tipo = string.Empty; if (SeleccionGeneral) { idVariable = IdVariableSeleccionada; _parametros = ProcessParameters.ConvertToHash("ABMVariables", "IdVariableAlta", idVariable); Hashtable valores = (Hashtable)_parametros["ABMVariables"]; valores.Add("SearchObjectListener", _brClass); } else { idVariable = (string)VariableSeleccionada["IdVariable"]; descripcion = (string)VariableSeleccionada["Descripcion"]; valor = (string)VariableSeleccionada["ValorDefault"]; tipo = (string)VariableSeleccionada["Tipo"]; _parametros = ProcessParameters.ConvertToHash("ABMVariables", "IdVariableAlta", idVariable); Hashtable valores = (Hashtable)_parametros["ABMVariables"]; valores.Add("DescripcionAlta", descripcion); valores.Add("ValorAlta", valor); valores.Add("TipoAlta", tipo); valores.Add("SearchObjectListener", _brClass); } } else { _parametros = ProcessParameters.ConvertToHash("ABMVariables", "SearchObjectListener", _brClass); } }
public void GetParameters() { string idVariable = string.Empty; if (SeleccionGeneral) { idVariable = IdVariableSeleccionada; _parametros = ProcessParameters.ConvertToHash("ABMVariables", "IdVariable", idVariable); ArrayList variablesSeleccionadas = new ArrayList(); foreach (DataRow row in DataTableResult.Rows) { if (idVariable.Equals((string)row["IdVariable"])) { Variable var = new Variable(row); variablesSeleccionadas.Add(var); } } Hashtable valores = (Hashtable)_parametros["ABMVariables"]; valores.Add("VariablesSeleccionadas", variablesSeleccionadas); valores.Add("ModificacionSimple", false); valores.Add("SearchObjectListener", _brClass); } else { idVariable = (string)VariableSeleccionada["IdVariable"]; _parametros = ProcessParameters.ConvertToHash("ABMVariables", "IdVariable", idVariable); ArrayList variablesSeleccionadas = new ArrayList(); Variable var = new Variable(VariableSeleccionada); variablesSeleccionadas.Add(var); Hashtable valores = (Hashtable)_parametros["ABMVariables"]; valores.Add("VariablesSeleccionadas", variablesSeleccionadas); valores.Add("ModificacionSimple", true); valores.Add("SearchObjectListener", _brClass); } }
/// <summary> /// Virtual plugin called by coverage verification to validate the external policy. Used by UK motor policies to check there is an existing Xuber policy for the /// Genius policy and that the policy is verified /// </summary> /// <param name="component">Claim Header</param> /// <param name="point">Points Create,ComponentChange</param> /// <param name="pluginId">PlugIN ID</param> /// <param name="processParameters">The parameters for the virtual process. This should contain a UwHeaderData for the external policy</param> /// <returns>return ProcessResultCollection which have Error msg If any validation failed.</returns> public override ProcessResultsCollection ProcessComponent(IBusinessComponent component, ProcessInvocationPoint point, int pluginId, ProcessParameters processParameters) { PluginHelper<IBusinessComponent> pluginHelper = new PluginHelper<IBusinessComponent>(point, (ClaimHeader)component, new ProcessResultsCollection()); if (pluginHelper.InvocationPoint == ProcessInvocationPoint.Virtual) { UWHeaderData policyHeaderData = processParameters.Parameters != null && processParameters.Parameters.Any() ? processParameters.Parameters[0] as UWHeaderData : null; if (policyHeaderData == null || string.IsNullOrEmpty(policyHeaderData.HeaderReference)) { ClaimsBusinessLogicHelper.AddError(pluginHelper.ProcessResults, ClaimConstants.ATTACHMENT_NOT_ALLOWED, ProcessInvocationPoint.Virtual, pluginHelper.Component); } else { // Get the verified policy header status from the application configuration var verifiedHeaderStatus = ClaimsBusinessLogicHelper.ResolveMandatoryConfig<string>(ConfigSetting_PolicyVerifiedHeaderStatus); // check the header status matches the verified status if (policyHeaderData.HeaderStatusCode != verifiedHeaderStatus) { ClaimsBusinessLogicHelper.AddError(pluginHelper.ProcessResults, ClaimConstants.POLICYNOTVERIFIED_COVERAGEVERIFICATION_NOTALLOWED, ProcessInvocationPoint.Virtual, pluginHelper.Component, policyHeaderData.HeaderReference); } } } return pluginHelper.ProcessResults; }
private void InitializeServerProcess(int listeningPort) { //InitSDK will establish a local connection with GameLift's agent to enable further communication. var initSDKOutcome = GameLiftServerAPI.InitSDK(); if (initSDKOutcome.Success) { ProcessParameters processParameters = new ProcessParameters( (gameSession) => { //When a game session is created, GameLift sends an activation request to the game server and passes along the game session object containing game properties and other settings. //Here is where a game server should take action based on the game session object. //Once the game server is ready to receive incoming player connections, it should invoke GameLiftServerAPI.ActivateGameSession() GameLiftServerAPI.ActivateGameSession(); }, (updateGameSession) => { //When a game session is updated (e.g. by FlexMatch backfill), GameLiftsends a request to the game //server containing the updated game session object. The game server can then examine the provided //matchmakerData and handle new incoming players appropriately. //updateReason is the reason this update is being supplied. }, () => { //OnProcessTerminate callback. GameLift will invoke this callback before shutting down an instance hosting this game server. //It gives this game server a chance to save its state, communicate with services, etc., before being shut down. //In this case, we simply tell GameLift we are indeed going to shutdown. GameLiftServerAPI.ProcessEnding(); }, () => { //This is the HealthCheck callback. //GameLift will invoke this callback every 60 seconds or so. //Here, a game server might want to check the health of dependencies and such. //Simply return true if healthy, false otherwise. //The game server has 60 seconds to respond with its health status. GameLift will default to 'false' if the game server doesn't respond in time. //In this case, we're always healthy! return(true); }, listeningPort, //This game server tells GameLift that it will listen on port 7777 for incoming player connections. new LogParameters(new List <string>() { //Here, the game server tells GameLift what set of files to upload when the game session ends. //GameLift will upload everything specified here for the developers to fetch later. "/local/game/logs/myserver.log" })); //Calling ProcessReady tells GameLift this game server is ready to receive incoming game sessions! var processReadyOutcome = GameLiftServerAPI.ProcessReady(processParameters); if (processReadyOutcome.Success) { print("ProcessReady success."); } else { print("ProcessReady failure : " + processReadyOutcome.Error.ToString()); } } else { print("InitSDK failure : " + initSDKOutcome.Error.ToString()); } }
void Start() { LogOutcome("init", GameLiftServerAPI.InitSDK()); var logParams = new LogParameters(new List <string>()); var parameters = new ProcessParameters(OnStartGameSession, OnUpdateGameSession, OnProcessTerminated, OnHealthCheck, 1900, logParams); LogOutcome("ready", GameLiftServerAPI.ProcessReady(parameters)); }
public void TestCmd() { var cmd = new ProcessParameters("cmd /c dir", "c:\\"); Assert.AreEqual("c:\\windows\\system32\\cmd.exe", cmd.Executable.ToLower()); Assert.AreEqual("c:\\", cmd.Directory); Assert.AreEqual("/c dir", cmd.Parameters); }
public ProcessParameters CompilationR2RDumpProcess(string compiledExecutable, bool naked) { if (_options.R2RDumpPath == null) { return(null); } StringBuilder commonBuilder = new StringBuilder(); commonBuilder.Append($@"""{_options.R2RDumpPath.FullName}"""); commonBuilder.Append(" --normalize"); commonBuilder.Append(" --sc"); commonBuilder.Append(" --disasm"); foreach (string referencePath in _options.ReferencePaths()) { commonBuilder.Append($@" --rp ""{referencePath}"""); } if (_options.CoreRootDirectory != null) { commonBuilder.Append($@" --rp ""{_options.CoreRootDirectory.FullName}"""); } commonBuilder.Append($@" --in ""{compiledExecutable}"""); StringBuilder builder = new StringBuilder(commonBuilder.ToString()); if (naked) { builder.Append(" --naked"); } string outputFileName = compiledExecutable + (naked ? ".naked.r2r" : ".raw.r2r"); builder.Append($@" --out ""{outputFileName}"""); ProcessParameters param = new ProcessParameters(); param.ProcessPath = "dotnet"; param.Arguments = builder.ToString(); param.TimeoutMilliseconds = R2RDumpTimeoutMilliseconds; param.LogPath = compiledExecutable + (naked ? ".naked.r2r.log" : ".raw.r2r.log"); param.InputFileNames = new string[] { compiledExecutable }; param.OutputFileName = outputFileName; try { param.CompilationCostHeuristic = new FileInfo(compiledExecutable).Length; } catch (Exception ex) { Console.Error.WriteLine("File not found: {0}: {1}", compiledExecutable, ex); param.CompilationCostHeuristic = 0; } return(param); }
private void SetupServerAndGamelift() { // start the unet server networkPort = LISTEN_PORT; StartServer(); print($"Server listening on port {networkPort}"); // initialize GameLift print("Starting GameLift initialization."); var initSDKOutcome = GameLiftServerAPI.InitSDK(); if (initSDKOutcome.Success) { isGameliftServer = true; var processParams = new ProcessParameters( (gameSession) => { // onStartGameSession callback GameLiftServerAPI.ActivateGameSession(); // quit if no player joined within two minutes timer.Elapsed += this.CheckPlayersJoined; timer.AutoReset = false; timer.Start(); }, (updateGameSession) => { }, () => { // onProcessTerminate callback TerminateSession(); }, () => { // healthCheck callback return(true); }, LISTEN_PORT, new LogParameters(new List <string>() { "/local/game/logs/myserver.log" }) ); var processReadyOutcome = GameLiftServerAPI.ProcessReady(processParams); if (processReadyOutcome.Success) { print("GameLift process ready."); } else { print($"GameLift: Process ready failure - {processReadyOutcome.Error.ToString()}."); } } else { print($"GameLift: InitSDK failure - {initSDKOutcome.Error.ToString()}."); } }
public bool GameLiftStart(int listenPort) { //Debug.Log("GameLift Start with Port:" + listenPort); LogModule.WriteToLogFile("[GameLift] GameLift Start with Port:" + listenPort); var initSDKOutcome = GameLiftServerAPI.InitSDK(); if (initSDKOutcome.Success) { ProcessParameters processParameters = new ProcessParameters( (gameSession) => { //OnStartGameSession Callback LogModule.WriteToLogFile("[GameLift] OnStartGameSession with Parameter=" + gameSession); GameLiftServerAPI.ActivateGameSession(); }, (gameSession) => { //OnUpdateGameSession Callback //You can implement custom Match update logics using Backfill Ticket, UpdateReason, GameSession data. LogModule.WriteToLogFile("[GameLift] OnUpdateGameSession with Backfill Ticket=" + gameSession.BackfillTicketId + ", UpdateReason=" + gameSession.UpdateReason); }, () => { //OnProcessTerminate Callback LogModule.WriteToLogFile("[GameLift] ProcessEnding"); GameLiftServerAPI.ProcessEnding(); }, () => { //OnHealthCheck Callback return(true); }, listenPort, new LogParameters(new List <string>() { "./local/game/logs/myserver.log" //"C:\\game\\myserver.log" } )); var processReadyOutcome = GameLiftServerAPI.ProcessReady(processParameters); if (processReadyOutcome.Success) { LogModule.WriteToLogFile("[GameLift] ProcessReady Success"); return(true); } else { LogModule.WriteToLogFile("[GameLift] ProcessReady Failure : " + processReadyOutcome.Error.ToString()); return(false); } } else { LogModule.WriteToLogFile("[GameLift] InitSDK failure : " + initSDKOutcome.Error.ToString()); return(false); } }
public ArmaProcess( Process process, ProcessParameters processParameters, ILogger <ArmaProcess> logger) : this(processParameters, logger) { _serverProcess = process; _serverProcess.EnableRaisingEvents = true; _serverProcess.Exited += (sender, args) => InvokeOnProcessShutdown(); }
public void VerifyExecutableExists() { var process = new ProcessParameters(Command, Settings.Home); if (!File.Exists(process.Executable)) { Logger.Warning($"File {process.Executable} does not seem to exist"); } }
//public class ProcessInfo : IDisposable //{ // public readonly uint Id = default; // public IntPtr StdIn { get; internal set; } = default; // public IntPtr StdOut { get; internal set; } = default; // public IntPtr StdErr { get; internal set; } = default; // public readonly Process Process; // internal ProcessInfo(uint id) // { // Id = id; // try // { // Process = Process.GetProcessById((int)Id); // } // catch (System.ArgumentException e)//throws an exception if the process is not running // { } // } // public bool WriteIn(byte[] buffer, int offset, int count) // { // lock (this) // { // if (fileStreamIn == null) // { // if (StdIn == default) // throw new Exception("StdIn is not redirected."); // SafeFileHandle h = new SafeFileHandle(StdIn, true); // fileStreamIn = new FileStream(h, FileAccess.Write, BufferLength); // } // if (!fileStreamIn.CanWrite) // return false; // fileStreamIn.Write(buffer, offset, count); // fileStreamIn.Flush(); // return true; // } // } // FileStream fileStreamIn = null; // public int BufferLength = 4096; // public bool WriteIn2(string m) // { // byte[] buffer = System.Text.Encoding.ASCII.GetBytes(m); // uint dwWritten; // System.Threading.NativeOverlapped o = new System.Threading.NativeOverlapped(); // bool r = Kernel32.WriteFile(new SafeFileHandle(StdIn, true), buffer, (uint)buffer.Length, out dwWritten, ref o); // WinApi.Kernel32.CloseHandle(StdIn); // return r; // } // public bool WriteIn(string m) // { // //byte[] bs = Process.StandardInput.Encoding.GetBytes(m);!!! does not work // byte[] bs = System.Text.Encoding.ASCII.GetBytes(m); // return WriteIn(bs, 0, bs.Length); // } // public int ReadOut(byte[] buffer, int offset, int count) // { // lock (this) // { // if (fileStreamOut == null) // { // if (StdOut == default) // throw new Exception("StdOut is not redirected."); // SafeFileHandle h = new SafeFileHandle(StdOut, true); // fileStreamOut = new FileStream(h, FileAccess.Read, BufferLength, false); // } // if (!fileStreamOut.CanRead) // return -1; // return fileStreamOut.Read(buffer, offset, count); // } // } // FileStream fileStreamOut = null; // System.Text.Encoding encoding // { // get // { // if (_encoding == null) // _encoding = System.Text.Encoding.GetEncoding(Kernel32.GetConsoleOutputCP()); // return _encoding; // } // } // System.Text.Encoding _encoding = null; // public string ReadOut(int count) // { // byte[] bs = new byte[count]; // int r = ReadOut(bs, 0, count); // return encoding.GetString(bs, 0, r); // } // //public string ReadOut(int count) // //{ // // byte[] bs = new byte[count]; // // uint r; // // System.Threading.NativeOverlapped o = new System.Threading.NativeOverlapped(); // // //Kernel32.ReadFile(new SafeFileHandle(StdOut, true), bs, 100, out r, ref o); // // bool c = Kernel32.ReadFile(StdOut, bs, (uint)count, out r, ref o); // // return System.Text.Encoding.ASCII.GetString(bs, 0, (int)r); // //} // public int ReadErr(byte[] buffer, int offset, int count) // { // lock (this) // { // if (fileStreamErr == null) // fileStreamErr = new FileStream(new SafeFileHandle(StdErr, true), FileAccess.Read); // if (!fileStreamErr.CanRead) // return -1; // return fileStreamErr.Read(buffer, offset, count); // } // } // FileStream fileStreamErr = null; // public string ReadErr(int count) // { // byte[] bs = new byte[count]; // int r = ReadErr(bs, 0, count); // return encoding.GetString(bs, 0, r); // } // ~ProcessInfo() // { // Dispose(); // } // public void Dispose() // { // lock (this) // { // if (StdIn != default) // { // Kernel32.CloseHandle(StdIn); // if (fileStreamIn != null) // { // fileStreamIn.Close(); // fileStreamIn = null; // } // } // if (StdOut != default) // { // Kernel32.CloseHandle(StdOut); // if (fileStreamOut != null) // { // fileStreamOut.Close(); // fileStreamOut = null; // } // } // if (StdErr != default) // { // Kernel32.CloseHandle(StdErr); // if (fileStreamErr != null) // { // fileStreamErr.Close(); // fileStreamErr = null; // } // } // } // } //} public static int CreateProcess(ProcessParameters processParameters) { try { Advapi32.STARTUPINFO si = new Advapi32.STARTUPINFO(); si.hStdInput = processParameters.StdIn != null ? processParameters.StdIn : new SafeFileHandle(Kernel32.GetStdHandle(Kernel32.StdHandles.STD_INPUT_HANDLE), true); si.hStdOutput = processParameters.StdOut != null ? processParameters.StdOut : new SafeFileHandle(Kernel32.GetStdHandle(Kernel32.StdHandles.STD_OUTPUT_HANDLE), true); si.hStdError = processParameters.StdErr != null ? processParameters.StdErr : new SafeFileHandle(Kernel32.GetStdHandle(Kernel32.StdHandles.STD_ERROR_HANDLE), true); if (processParameters.StdIn != null || processParameters.StdOut != null || processParameters.StdErr != null) { si.dwFlags |= Advapi32.dwFlags.STARTF_USESTDHANDLES; } si.dwFlags |= Advapi32.dwFlags.STARTF_USESHOWWINDOW; //it is needed if hiding the window when CREATE_NEW_CONSOLE si.wShowWindow = (short)(!processParameters.ShowWindow ? User32.SW.SW_HIDE : User32.SW.SW_SHOW); //what does it do??? //si.lpDesktop = "winsta0\\default"; SECURITY_ATTRIBUTES sa = new SECURITY_ATTRIBUTES(); if (processParameters.StdIn != null || processParameters.StdOut != null || processParameters.StdErr != null) { sa.bInheritHandle = true; } Advapi32.CreationFlags creationFlags = 0; //|=Advapi32.CreationFlags.CREATE_UNICODE_ENVIRONMENT if (processParameters.NewConsole) { creationFlags |= Advapi32.CreationFlags.CREATE_NEW_CONSOLE; } if (!processParameters.ShowWindow) { creationFlags |= Advapi32.CreationFlags.CREATE_NO_WINDOW; } Advapi32.PROCESS_INFORMATION pi = new Advapi32.PROCESS_INFORMATION(); if (!Advapi32.CreateProcess( processParameters.Executable, // file to execute processParameters.Arguments, // command line null, // pointer to process SECURITY_ATTRIBUTES null, // pointer to thread SECURITY_ATTRIBUTES true, // handles are inheritable creationFlags, // creation flags IntPtr.Zero, // pointer to new environment block; NULL = use parent's environment Environment.CurrentDirectory, // name of current directory; NULL = use parent's current directory si, // pointer to STARTUPINFO structure pi // receives information about new process )) { throw new LastErrorException("!CreateProcess()"); } return(pi.dwProcessId); } finally { } }
// This is an example of a simple integration with GameLift server SDK that will make game server processes go active on GameLift! public void Start() { //InitSDK will establish a local connection with GameLift's agent to enable further communication. var initSDKOutcome = GameLiftServerAPI.InitSDK(); _tcpServerPort = UnityEngine.Random.Range(7000, 8000); Debug.Log("TCP Port: " + _tcpServerPort); if (initSDKOutcome.Success) { ProcessParameters processParameters = new ProcessParameters( this.OnGameSession, this.OnGameSessionUpdate, this.OnProcessTerminate, this.OnHealthCheck, _tcpServerPort, // This game server tells GameLift the port it will listen on for incoming player connections. new LogParameters(new List <string>() { // Here, the game server tells GameLift what set of files to upload when the game session ends. // GameLift will upload everything specified here for the developers to fetch later. // When -isProd is NOT set, use a path relevant for local testing Startup.IsArgFlagPresent("-isProd") ? "/local/game/logs/server.log" : "~/Library/Logs/Unity/server.log" } )); // Calling ProcessReady tells GameLift this game server is ready to receive incoming game sessions! var processReadyOutcome = GameLiftServerAPI.ProcessReady(processParameters); if (processReadyOutcome.Success) { print("ProcessReady success."); _server = GetComponent <BADNetworkServer>(); if (_server != null) { Debug.Log("BADNetworkServer is good."); _server.StartTCPServer(_tcpServerPort); } else { Debug.Log("BADNetworkServer is null."); } } else { print("ProcessReady failure : " + processReadyOutcome.Error.ToString()); } } else { print("InitSDK failure : " + initSDKOutcome.Error.ToString()); } }
public override ProcessParameters CompilationProcess(string outputFileName, IEnumerable <string> inputAssemblyFileNames) { ProcessParameters processParameters = base.CompilationProcess(outputFileName, inputAssemblyFileNames); processParameters.Arguments = $"{Crossgen2Path} {processParameters.Arguments}"; processParameters.EnvironmentOverrides["COMPlus_GCStress"] = ""; processParameters.EnvironmentOverrides["COMPlus_HeapVerify"] = ""; processParameters.EnvironmentOverrides["COMPlus_ReadyToRun"] = ""; processParameters.EnvironmentOverrides["COMPlus_GCName"] = ""; return(processParameters); }
public virtual ProcessParameters AppExecutionProcess(string outputRoot, string appPath, IEnumerable <string> modules, IEnumerable <string> folders) { string exeToRun = GetOutputFileName(outputRoot, appPath); ProcessParameters processParameters = ExecutionProcess(modules, folders, _options.NoEtw); processParameters.ProcessPath = _options.CoreRunPath(Index, isFramework: false); processParameters.Arguments = exeToRun; processParameters.InputFileName = exeToRun; processParameters.LogPath = exeToRun + ".log"; processParameters.ExpectedExitCode = 100; return(processParameters); }
protected override bool CheckForTimeout() { ProcessParameters par = ((App)App.Current).ParametersModel; if (Duration >= par.ChargeTimeout) { Log.Error("{0} => {1} stage timeout : {2}", Battery.TypeOfBattery, Name, Duration.ToString()); return(true); } return(false); }
private static Program GetProgramBasedOnSettings() { var cred = CredentialManager.ReadCreds(SettingsManager.Settings.CredentialsName); var parameters = new ProcessParameters() { Date = SettingsManager.Settings.ChosedDate, Username = cred.UserName, Password = cred.SecurePassword }; var program = new Program(parameters, SettingsManager.Settings.IntervalSec * 1000, _nextRun, _processProgress); return(program); }
/// <summary> /// This will validate whether VehicleType and Class3Code of section detail of selected coverage are equal. /// </summary> /// <param name="component">Claim Header</param> /// <param name="point">Process Invocation Point</param> /// <param name="pluginId">plugin Id</param> /// <param name="processParameters">Process Parameters</param> /// <returns>ProcessResults Collection</returns> public override ProcessResultsCollection ProcessComponent(IBusinessComponent component, ProcessInvocationPoint point, int pluginId, ProcessParameters processParameters) { PluginHelper<ClaimHeader> pluginHelper = new PluginHelper<ClaimHeader>(point, component as ClaimHeader, new ProcessResultsCollection()); switch (point) { case ProcessInvocationPoint.Virtual: this.AreVehicleTypeAndGeniusVehicleCategoryEqual(pluginHelper, processParameters.Parameters[3].ToString(), processParameters.Parameters[4].ToString()); break; } return pluginHelper.ProcessResults; }
private void Log_Click(object sender, EventArgs e) { string LogFile = Environment.CurrentDirectory + "\\Logs\\" + ConfigurationSettings.AppSettings["ErrorLog"]; StartProcess LogProcess = new StartProcess(); ProcessParameters ProcParam = new ProcessParameters(); ProcParam.ProcessName = LogFile; LogProcess.ProcessParameters = ProcParam; IResult ExecResult = LogProcess.ExecuteCommand(); if (ExecResult.Result == ExecutionResultType.Failed) { MessageBox.Show("Failed to open log file", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public IStitchAdaptor Create(PackageFile packageFile, StitchInstance stitchInstance) { switch (packageFile.Adaptor.Type) { //case InstanceRunModeType.AppDomain: // return new AppDomainAppAdaptor(instance, _network); case AdaptorType.ProcessV1: var pv1args = new ProcessParameters(_configuration, _fileSystem, stitchInstance, packageFile); return(new ProcessStitchAdaptor(_core, _configuration, stitchInstance, _observer, pv1args, _log)); case AdaptorType.BuildInClassV1: return(new BuiltInClassV1StitchAdaptor(packageFile, stitchInstance, _observer, _log)); } throw new Exception("Run mode not supported"); }
private IResult StartProgram(string ProgramPath) { StartProcess ProcStart = new StartProcess(); ProcessParameters ProcParam = new ProcessParameters(); NetworkParameters NetParams = new NetworkParameters(); NetParams.RemoteSystemName = RemoteMachineName; ProcParam.ProcessName = ProgramPath; ProcStart.ProcessParameters = ProcParam; RemoteExecutionManager RemoteExec = new RemoteExecutionManager(); RemoteExec.Command = ProcStart; RemoteExec.NetParams = NetParams; IResult ExecResult = RemoteExec.Execute(); return(ExecResult); }
protected override bool CheckForCompletion() { /*if (Duration < TimeSpan.FromMinutes(1.0)) * return false; * else * return true; */ ProcessParameters par = ((App)App.Current).ParametersModel; if (Battery.ActualVoltage <= par.LowBatteryVoltageLimit) { Log.Info("{0} => {1} stage was interrupted with voltage limit : U={2:F2}V Umin={3:F2}V ", Battery.TypeOfBattery, Name, Battery.ActualVoltage, par.LowBatteryVoltageLimit); return(true); } return(false); }
public App() { Log = App.PrepareLogger("app"); ArtWPFHelpers.Localization.ResxLocalizationProvider rlp = new ArtWPFHelpers.Localization.ResxLocalizationProvider(Strings.ResourceManager); ArtWPFHelpers.Localization.LocalizationManager.Instance.LocalizationProvider = rlp; rlp.AddCulture("ru-RU"); rlp.AddCulture("en-US"); ArtWPFHelpers.Localization.LocalizationManager.Instance.CultureChanged += OnCultureChanged; Telerik.Windows.Controls.StyleManager.ApplicationTheme = new Telerik.Windows.Controls.Office2016TouchTheme(); MainModel = new MainViewModel(); ParametersModel = new ProcessParameters(); TestBanch = new BanchModel(); }
protected override bool CheckForCompletion() { /* * if (Duration < TimeSpan.FromMinutes(1.0)) * return false; * else * return true; */ ProcessParameters par = ((App)App.Current).ParametersModel; if (Duration >= par.AfterChargeRelaxation) { return(true); } return(false); }
private void StartDeskConnectButton_Click(object sender, EventArgs e) { string DeskConnectPath = Environment.CurrentDirectory; DeskConnectPath = DeskConnectPath + "\\" + ConfigurationSettings.AppSettings["DeskConnectApplication"] + ".exe"; StartProcess DeskConnectProcess = new StartProcess(); ProcessParameters ProcParam = new ProcessParameters(); ProcParam.ProcessName = DeskConnectPath; DeskConnectProcess.ProcessParameters = ProcParam; IResult ExecResult = DeskConnectProcess.ExecuteCommand(); if (ExecResult.Result == ExecutionResultType.Failed) { MessageBox.Show("Failed to start Desk Connect", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } RefreshStatus(); }
public override ProcessResultsCollection ProcessComponent(IBusinessComponent component, ProcessInvocationPoint point, int pluginId, ProcessParameters processParameters) { if (_Logger.IsInfoEnabled) { _Logger.Info(string.Format("ClaimReviewTaskProcessHandler - ProcessComponent Called")); } ClaimHeader header = null; PluginHelper<IBusinessComponent> pluginHelper = null; if (component.GetType() == typeof(ClaimHeader)) { header = (ClaimHeader)component; pluginHelper = new PluginHelper<IBusinessComponent>(point, header, new ProcessResultsCollection()); this.ProcessClaimForReopen(header, pluginHelper); } return pluginHelper.ProcessResults; }
/// <summary> /// This plugin is mapping DocumentReference,DocumentGroupReference and CustomCode08 claim Event CustomReference01, CustomReference02 and CustomCode08 respectivelly /// </summary> /// <param name="component">Claim Document</param> /// <param name="point">Process Invocation Point</param> /// <param name="pluginId">plugin Id</param> /// <param name="processParameters">process Parameters</param> /// <returns>Process Results</returns> public override ProcessResultsCollection ProcessComponent(IBusinessComponent component, ProcessInvocationPoint point, int pluginId, ProcessParameters processParameters) { var document = (ClaimDocument)component; var claimEvent = (ClaimEvent)processParameters.Parameters[0]; PluginHelper<IBusinessComponent> pluginHelper = new PluginHelper<IBusinessComponent>(point, (ClaimDocument)component, new ProcessResultsCollection()); switch (point) { case ProcessInvocationPoint.Virtual: { propAccessorSet.SetProperty(claimEvent, ConfigurationManager.AppSettings[ClaimEventDocumentReferenceCustomReferenceField], document.DocumentReference); propAccessorSet.SetProperty(claimEvent, ConfigurationManager.AppSettings[ClaimEventDocumentGroupReferenceCustomReferenceField], document.DocumentGroupReference); var generateTask = propAccessorGet.GetProperty(document, ConfigurationManager.AppSettings[ClaimDocumentGenerateTaskCustomCodeField]); if (generateTask != null) { propAccessorSet.SetProperty(claimEvent, ConfigurationManager.AppSettings[ClaimEventGenerateTaskCustomCodeField], Convert.ToString(generateTask)); } break; } } return pluginHelper.ProcessResults; }
/// <summary> /// start the process on Virtual invocation point. /// </summary> /// <param name="component">ClaimEvent component or ClaimHeader component</param> /// <param name="point">invocation point</param> /// <param name="pluginId">plugin id</param> /// <param name="processParameters">process parameters</param> /// <returns>collection of process results</returns> public override ProcessResultsCollection ProcessComponent(IBusinessComponent component, ProcessInvocationPoint point, int pluginId, ProcessParameters processParameters) { ClaimEvent claimEvent = null; ClaimHeader header = null; PluginHelper<IBusinessComponent> pluginHelper = null; // Get the ClaimHeader, depending on whether we have a ClaimEvent or a ClaimHeader Component // The pluginHelper will reflect the Business Component passed in. if (component.GetType() == typeof(ClaimEvent)) { claimEvent = (ClaimEvent)component; // Get the Claim Header from the ClaimEvent, depending on where it's attached. if (claimEvent.Parent is ClaimDetail) { header = (ClaimHeader)claimEvent.Parent.Parent; } else { header = (ClaimHeader)claimEvent.Parent; } pluginHelper = new PluginHelper<IBusinessComponent>(point, claimEvent, new ProcessResultsCollection()); } else { header = (ClaimHeader)component; pluginHelper = new PluginHelper<IBusinessComponent>(point, header, new ProcessResultsCollection()); } try { // We are only processing on the Virtual invocation point. if (point == ProcessInvocationPoint.Virtual) { switch (processParameters.Alias) { case AXA_CLOSE_FINALIZE_CLAIM_PROCESS_HANDLER: // Close all tasks on Finalise. ClaimsProcessHelper.CloseAllTasks(header); break; case AXA_REVIEW_COMPLETED_PROCESS_HANDLER: if (processParameters.TransactionInvocationPoint == TransactionInvocationPoint.PreComplete) { // On pre-complete of a transaction only, process for the auto-review event. this.CheckAndCreateAutoReviewEvent(header, pluginHelper, processParameters.Alias); } break; case AXA_PHONE_LOG_PROCESS_HANDLER: // If the claim event "Task To Do" is set to '1' we have a PhoneLog and should process. if (!string.IsNullOrWhiteSpace(claimEvent.CustomCode03) && claimEvent.CustomCode03 == "1") { this.StartClaimProcess(header, pluginHelper, processParameters.Alias); } break; // ClaimWakeUp Processing (2) case AXA_MANUAL_REVIEW_START_CLAIM_PROCESS_HANDLER: // On opening a review task on a closed migrated claim, we must be doing this to reopen that claim // so we process the reopening using the ClaimReviewTaskProcessHandler, that calls out to the ClaimWakeUpService. if (ClaimsBusinessLogicHelper.CheckMigratedCloseClaim(header)) { ProcessHelper.HandleVirtualProcess(header, new ProcessParameters { Alias = "AXAClaimsReviewTaskProcessHandler" }); } // We also need to run the default processing but leaving out the 'break;' comment to drop through // is confusing for reading the code. this.StartClaimProcess(header, pluginHelper, processParameters.Alias); break; case AXAFileUploadNotificationProcessHandler: // CustomCode08 is based on Document.CustomCode08 "Generate task?" field string generateTask = Convert.ToString(propAccessor.GetProperty(claimEvent, ConfigurationManager.AppSettings[ClaimEventGenerateTaskCustomCodeField])); if (generateTask == "1") { this.StartClaimProcess(header, pluginHelper, processParameters.Alias); } break; default: this.StartClaimProcess(header, pluginHelper, processParameters.Alias); break; } } } catch (Exception e) { logger.Error(e); logger.Error(e.InnerException); pluginHelper.AddError(MessageConstants.CLAIM_PROCESS_ERROR); } return pluginHelper.ProcessResults; }
/// <summary> /// Invoke the AXADefaultClaimEventValues virtual process against this event, via a plugin call. /// </summary> /// <param name="ev"> Event type object </param> /// <param name="eventContainer">Event Container</param> /// <param name="point">Points PostComplete,Precomplete</param> private void InvokeVirtualProcess(IEvent ev, IEventContainer eventContainer, Xiap.Framework.TransactionInvocationPoint point) { ProductXML.ProductEvent pdevent = ev.GetProduct(); if (pdevent != null) { IBusinessComponent eventComponent = (IBusinessComponent)ev; string alias = "AXADefaultClaimEventValues"; // invoke the 'process handler' plugin if (_Logger.IsInfoEnabled) { _Logger.Info("Invoked Virtual plugin " + alias + point.ToString() + "for " + eventComponent.GetType().Name); } ProcessParameters processParameters = new ProcessParameters() { Alias = alias, TransactionInvocationPoint = point }; ProcessHelper.HandleVirtualProcess(eventComponent, processParameters); } }
public override ProcessResultsCollection ProcessComponent(IBusinessComponent component, ProcessInvocationPoint point, int pluginId, ProcessParameters processParameters) { return null; }