示例#1
0
        /// <summary>
        /// Runs a simulation and prints results on the console.
        /// </summary>
        /// <param name="nbrPoints">The number of points for each path to be generated.</param>
        /// <param name="nbrPaths">The number of paths to be generated.</param>
        /// <param name="simulationName">The name of the simulation</param>
        /// <param name="creator">The function used to create the <seealso cref="StockPath"/> from a given index.</param>
        /// <param name="mode">The <see cref="Program.ExecutionMode"/></param>
        public static void RunSimulation(int nbrPoints, int nbrPaths, string simulationName, Func<int,StockPath> creator, ExecutionMode mode)
        {
            Stopwatch stopWatch = new Stopwatch();
            StockPath[] paths = new StockPath[nbrPaths];
            IEnumerable<int> indices = Enumerable.Range(0, nbrPaths - 1);
            Console.WriteLine("Starting " + simulationName + " simulation.");
            stopWatch.Start();

            switch (mode)
            {
                case ExecutionMode.CLASSIC:
                    paths = indices.Select(creator).ToArray();
                    break;
                case ExecutionMode.PARALLEL:
                    paths = indices.AsParallel().Select(creator).ToArray();
                    break;
                default:
                    throw new ArgumentException("Unknown execution mode", "mode");
            }

            stopWatch.Stop();
            Console.WriteLine("End of " + simulationName + " simulation.");
            var lastPrices = paths.Select(x => x.LastPrice);
            Console.WriteLine("Min price: " + lastPrices.Min().ToString("N2"));
            Console.WriteLine("Max price: " + lastPrices.Max().ToString("N2"));
            Console.WriteLine("Computation time: " + stopWatch.Elapsed.TotalSeconds.ToString("N2") + " sec");
        }
 /// <summary>
 /// Writes a set of project invocation rules to a worksheet.
 /// </summary>
 /// <param name="ws">The worksheet to which the rules are to be written.</param>
 /// <param name="mode">The ExecutionMode to be written.</param>
 /// <param name="rules">The project invocation rules to be written.</param>
 public void Save(Excel.Worksheet ws, ExecutionMode mode, ProjectInvocationRule[] rules)
 {
     ws.Cells.ClearContents();
     Helper.WriteCell(ws, 1, 1, mode.ToString());
     var writer = new ProjectRuleDataWriter();
     writer.Write(ws, rules, 2);
 }
 public PluginRegistrationAttribute(string keyName, MessageType messageType, string primaryEntityLogicalName = null,
     string secondaryEntityLogicalName = null, string[] filteringAttributes = null, string name = null,
     string userContext = null, int executionOrder = 1,
     PipelineStage pipelineStage = PipelineStage.Preoperation,
     ExecutionMode executionMode = ExecutionMode.Synchronous,
     SupportedDeployment supportedDeployment = SupportedDeployment.ServerOnly,
     bool deleteAsyncOpOnSuccess = false, string preImageName = null, string[] preImageAttributes = null,
     string postImageName = null, string[] postImageAttributes = null)
 {
     _messageType = messageType;
     _primaryEntityLogicalName = primaryEntityLogicalName;
     _secondaryEntityLogicalName = secondaryEntityLogicalName;
     _filteringAttributes = filteringAttributes;
     _name = name;
     _userContext = userContext;
     _executionOrder = executionOrder;
     _pipelineStage = pipelineStage;
     _executionMode = executionMode;
     _supportedDeployment = supportedDeployment;
     _deleteAsyncOpOnSuccess = deleteAsyncOpOnSuccess;
     _preImageName = preImageName;
     _preImageAttributes = preImageAttributes;
     _postImageName = postImageName;
     _postImageAttributes = postImageAttributes;
     _keyName = keyName;
 }
        public bool MatchesExecutingPlugin(MessageType messageType, string primaryEntityName, string secondaryEntityName,
            PipelineStage pipelineStage, ExecutionMode executionMode
            , bool isExecutingOffline, string preImageName, Entity preImage, string postImageName,
            Entity postImage)
        {
            if (_messageType != messageType) return false;

            if (!string.IsNullOrEmpty(_primaryEntityLogicalName) &&
                string.Equals(_primaryEntityLogicalName, primaryEntityName, StringComparison.InvariantCultureIgnoreCase))
                return false;
            if (secondaryEntityName != _secondaryEntityLogicalName) return false;

            if (_pipelineStage != pipelineStage) return false;
            if (_executionMode != executionMode) return false;
            if (_supportedDeployment == SupportedDeployment.MicrosoftDynamicsCrmClientForOutlookOnly &&
                !isExecutingOffline) return false;
            if (_supportedDeployment == SupportedDeployment.ServerOnly && isExecutingOffline) return false;

            if (!string.IsNullOrEmpty(_preImageName) && _preImageName != preImageName) return false;
            if (!string.IsNullOrEmpty(_postImageName) && _postImageName != preImageName) return false;

            if (_preImageAttributes != null && !ImageIncludes(_preImageAttributes, preImage)) return false;

            if (_postImageAttributes != null && !ImageIncludes(_postImageAttributes, postImage)) return false;

            return true;
        }
示例#5
0
        /// <summary>
        /// Constructs an instance of the CallSite object given its scope and 
        /// method information. This constructor optionally takes in a preloaded
        /// trace data information.
        /// </summary>
        /// <param name="classScope"></param>
        /// <param name="methodName"></param>
        /// <param name="globalFunctionTable"></param>
        /// <param name="execMode"></param>
        /// <param name="serializedTraceData">An optional Base64 encoded string
        /// representing the trace data that the callsite could use as part of 
        /// its re-construction.</param>
        /// 
        public CallSite(int classScope, string methodName,
            FunctionTable globalFunctionTable,
            ExecutionMode execMode, string serializedTraceData = null)
        {
            //Set the ID of internal test
            callsiteID = Guid.NewGuid();

            Validity.Assert(methodName != null);
            Validity.Assert(globalFunctionTable != null);

            runID = ProtoCore.DSASM.Constants.kInvalidIndex;
            executionMode = execMode;
            this.classScope = classScope;
            this.methodName = methodName;
            this.globalFunctionTable = globalFunctionTable;

            if (execMode == ExecutionMode.Parallel)
                throw new CompilerInternalException(
                    "Parrallel Mode is not yet implemented {46F83CBB-9D37-444F-BA43-5E662784B1B3}");

            // Found preloaded trace data, reconstruct the instances from there.
            if (!string.IsNullOrEmpty(serializedTraceData))
            {
                // TODO(Luke): Decode the (nested) serialized information
                // to reconstruct all immediate and nested trace data.
                //
                // this.traceData.Add(...);
                //
                throw new NotImplementedException();
            }
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="SingleTransactionCommand"/> class.
 /// </summary>
 /// <param name="connectionString">The connection string.</param>
 /// <param name="executionMode">The execution mode. </param>
 /// 
 public SingleTransactionCommand(string connectionString, ExecutionMode executionMode)
 {
     _connectionString = connectionString;
     _parachuteContext = new ParachuteContext(_connectionString);
     _transactionScope = new TransactionScope();
     _allTransactionsSuccess = false;
 }
        public static Uri GetBaseSearchUri(
            this TestEnvironment environment, 
            ExecutionMode executionMode, 
            string searchServiceName)
        {
            EnvironmentNames envName =
                environment.LookupEnvironmentFromBaseUri(executionMode, environment.BaseUri.AbsoluteUri);

            string domain;
            switch (envName)
            {
                case EnvironmentNames.Dogfood:
                    domain = "search-dogfood.windows-int.net";
                    break;

                case EnvironmentNames.Next:
                    domain = "search-next.windows-int.net";
                    break;

                case EnvironmentNames.Current:
                    domain = "search-current.windows-int.net";
                    break;

                case EnvironmentNames.Prod:
                default:
                    // Assume PROD if all else fails.
                    domain = "search.windows.net";
                    break;
            }

            string UriFormat = "https://{0}.{1}/";
            return new Uri(String.Format(UriFormat, searchServiceName, domain));
        }
示例#8
0
        /// <summary>
        /// Creates a new instance of the <see cref="CalculationEngine"/> class.
        /// </summary>
        /// <param name="cultureInfo">
        /// The <see cref="CultureInfo"/> required for correctly reading floating poin numbers.
        /// </param>
        /// <param name="executionMode">The execution mode that must be used for formula execution.</param>
        /// <param name="cacheEnabled">Enable or disable caching of mathematical formulas.</param>
        /// <param name="optimizerEnabled">Enable or disable optimizing of formulas.</param>
        public CalculationEngine(CultureInfo cultureInfo, ExecutionMode executionMode, bool cacheEnabled, bool optimizerEnabled)
        {
            this.executionFormulaCache = new MemoryCache<string, Func<Dictionary<string, double>, double>>();
            this.FunctionRegistry = new FunctionRegistry(false);
            this.ConstantRegistry = new ConstantRegistry(false);
            this.cultureInfo = cultureInfo;
            this.cacheEnabled = cacheEnabled;
            this.optimizerEnabled = optimizerEnabled;

            if (executionMode == ExecutionMode.Interpreted)
                executor = new Interpreter();
            else if (executionMode == ExecutionMode.Compiled)
                executor = new DynamicCompiler();
            else
                throw new ArgumentException(string.Format("Unsupported execution mode \"{0}\".", executionMode),
                    "executionMode");

            optimizer = new Optimizer(new Interpreter()); // We run the optimizer with the interpreter

            // Register the default constants of Jace.NET into the constant registry
            RegisterDefaultConstants();

            // Register the default functions of Jace.NET into the function registry
            RegisterDefaultFunctions();
        }
示例#9
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SceneInstance" /> class.
        /// </summary>
        /// <param name="services">The services.</param>
        /// <param name="sceneEntityRoot">The scene entity root.</param>
        /// <param name="enableScripting">if set to <c>true</c> [enable scripting].</param>
        /// <exception cref="System.ArgumentNullException">services
        /// or
        /// sceneEntityRoot</exception>
        public SceneInstance(IServiceRegistry services, Scene sceneEntityRoot, ExecutionMode executionMode = ExecutionMode.Runtime) : base(services)
        {
            if (services == null) throw new ArgumentNullException("services");

            ExecutionMode = executionMode;
            Scene = sceneEntityRoot;
            RendererTypes = new EntityComponentRendererTypeCollection();
            ComponentTypeAdded += EntitySystemOnComponentTypeAdded;
            Load();
        }
示例#10
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SceneInstance" /> class.
        /// </summary>
        /// <param name="services">The services.</param>
        /// <param name="sceneEntityRoot">The scene entity root.</param>
        /// <param name="enableScripting">if set to <c>true</c> [enable scripting].</param>
        /// <exception cref="System.ArgumentNullException">services
        /// or
        /// sceneEntityRoot</exception>
        public SceneInstance(IServiceRegistry services, Scene sceneEntityRoot, ExecutionMode executionMode = ExecutionMode.Runtime) : base(services)
        {
            if (services == null) throw new ArgumentNullException("services");

            ExecutionMode = executionMode;
            VisibilityGroups = new TrackingCollection<VisibilityGroup>();
            VisibilityGroups.CollectionChanged += VisibilityGroups_CollectionChanged;
            Scene = sceneEntityRoot;
            Load();
        }
示例#11
0
		/// <summary>
		/// Initializes a new instance of the <see cref="ScriptManagerFactory"/> class.
		/// </summary>
		/// <param name="config">The config.</param>
		/// <param name="compilerOutput">The compiler output.</param>
		/// <param name="executionMode">The execution mode.</param>
		public ScriptManagerFactory(Configuration config, string compilerOutput = null, ExecutionMode executionMode = ExecutionMode.Compiled)
		{
			_config = config;
			_compilerOutput = compilerOutput;
			_executionMode = executionMode;
			_managers = new Dictionary<string, IScriptManager>();

			if (!string.IsNullOrEmpty(compilerOutput) && !Directory.Exists(compilerOutput))
				Directory.CreateDirectory(compilerOutput);

			LoadManagers();
		}
 public ReplicateInBulkCommand(
     StorageDescriptor sourceStorageDescriptor,
     StorageDescriptor targetStorageDescriptor,
     DbManagementMode databaseManagementMode = DbManagementMode.DropAndRecreateConstraints | DbManagementMode.EnableIndexManagment | DbManagementMode.UpdateTableStatistics,
     ExecutionMode executionMode = ExecutionMode.Parallel,
     TimeSpan? bulkCopyTimeout = null)
 {
     SourceStorageDescriptor = sourceStorageDescriptor;
     TargetStorageDescriptor = targetStorageDescriptor;
     DbManagementMode = databaseManagementMode;
     ExecutionMode = executionMode;
     BulkCopyTimeout = bulkCopyTimeout ?? DefaultBulkCopyTimeout;
 }
示例#13
0
        public CallSite(int classScope, string methodName, FunctionTable globalFunctionTable, ExecutionMode execMode)
        {
            Debug.Assert(methodName != null);
            Debug.Assert(globalFunctionTable != null);

            executionMode = execMode;
            this.classScope = classScope;
            this.methodName = methodName;
            this.globalFunctionTable = globalFunctionTable;

            if (execMode == ExecutionMode.Parallel)
                throw new CompilerInternalException(
                    "Parrallel Mode is not yet implemented {46F83CBB-9D37-444F-BA43-5E662784B1B3}");
        }
示例#14
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ControlPanelServiceControl"/> class.
        /// </summary>
        /// <param name="mode">
        /// Which mode is the system running in?
        /// <list type="table">
        /// <item><term>Production</term><description>Drey will use its normal package detail information to load packages into the runtime for execution.</description></item>
        /// <item><term>Development</term><description>Drey will discover packages in the ~/Hoarde folder and load them for execution. This prevents the need to package your system for every build.</description></item>
        /// </list>
        /// </param>
        /// <param name="configureLogging">An action that gets run at the startup of every package which configures the logging provider for that package.</param>
        /// <param name="logVerbosity">How much logging should be captured?  Pass a compatible string here that works with your chosen framework, and parse it within the configureLogging method.</param>
        public ControlPanelServiceControl(ExecutionMode mode = ExecutionMode.Production, Action<INutConfiguration> configureLogging = null, string logVerbosity = "Info")
        {
            _configurationManager = new ApplicationHostNutConfiguration() { Mode = mode, LogVerbosity = logVerbosity };
            _executionMode = mode;

            if (configureLogging != null)
            {
                _configureLogging = configureLogging;
                _configureLogging.Invoke(_configurationManager);
            }

            _log = LogProvider.For<ControlPanelServiceControl>();
            _appFactory = new Sponsor<ShellFactory>(new ShellFactory());
        }
示例#15
0
        public CalculationEngine(CultureInfo cultureInfo, ExecutionMode executionMode, bool cacheEnabled, bool optimizerEnabled)
        {
            this.executionFormulaCache = new ConcurrentDictionary<string, Func<Dictionary<string, double>, double>>();
            this.cultureInfo = cultureInfo;
            this.cacheEnabled = cacheEnabled;
            this.optimizerEnabled = optimizerEnabled;

            if (executionMode == ExecutionMode.Interpreted)
                executor = new Interpreter();
            else if (executionMode == ExecutionMode.Compiled)
                executor = new DynamicCompiler();
            else
                throw new ArgumentException(string.Format("Unsupported execution mode \"\".", executionMode),
                    "executionMode");

            optimizer = new Optimizer(new Interpreter()); // We run the optimizer with the interpreter
        }
示例#16
0
 static void AnalizeCommandLine(string[] args)
 {
     SpecializerServices.MaximimOperations = 5000;
     foreach (string arg in args)
     {
         if (arg == "-c")
             Mode = ExecutionMode.Compile;
         else if (arg == "-i")
             Mode = ExecutionMode.Interpret;
         else if (arg == "-s")
             Mode = ExecutionMode.Specialize;
         else if (arg.Length > 5 && arg.Substring(0, 5) == "-out:")
         {
             OutFileName = arg.Substring(5);
             if (OutFileName.Contains("."))
                 AssemblyName = OutFileName.Substring(0, OutFileName.LastIndexOf("."));
             else
                 AssemblyName = OutFileName;
         }
         else if (File.Exists(arg))
         {
             InputFileName = arg;
         }
     }
     if (OutFileName == "program.exe" && InputFileName != "program.l1")
     {
         if (InputFileName.Contains("."))
         {
             OutFileName = InputFileName.Substring(0, InputFileName.LastIndexOf(".")) + ((Mode == Program.ExecutionMode.Specialize) ? ".spec.l1" : ".exe");
             AssemblyName = InputFileName.Substring(0, InputFileName.LastIndexOf("."));
         }
         else
         {
             OutFileName = InputFileName + ".exe";
             AssemblyName = InputFileName;
         }
     }
 }
		protected IEnumerator Run (ExecutionMode mode)
		{
			WaitForSeconds frameDelay = new WaitForSeconds (1.0f / Frequency);

			do
			{
				// Start running the tree root - grabbing its node data yielded on the init frame
				IEnumerator rootRoutine = Root ();
				rootRoutine.MoveNext ();
				m_RootData = rootRoutine.Current as NodeData;

				// Keep running until we're disabled
				while (Application.isPlaying && enabled)
				{
					// Break out if the root was reset
					if (m_RootData != null && m_RootData.ShouldReset)
					{
						break;
					}

					// Break out if the tree breaks or completes with success or failure
					if (!rootRoutine.MoveNext () || Success.Equals (rootRoutine.Current) || Failure.Equals (rootRoutine.Current))
					{
						break;
					}

					yield return frameDelay;
				}

				// Reset the root
				if (m_RootData != null)
				{
					m_RootData.Reset ();
					rootRoutine.MoveNext ();
				}
			}
			while (mode == ExecutionMode.Continuous && Application.isPlaying && enabled);
		}
示例#18
0
        protected AuthTest(
            BrowserFixture browserFixture,
            ToggleExecutionModeServerFixture <Program> serverFixture,
            ITestOutputHelper output,
            ExecutionMode executionMode)
            : base(browserFixture, serverFixture, output)
        {
            // Normally, the E2E tests use the Blazor dev server if they are testing
            // client-side execution. But for the auth tests, we always have to run
            // in "hosted on ASP.NET Core" mode, because we get the auth state from it.
            switch (executionMode)
            {
            case ExecutionMode.Client:
                serverFixture.UseAspNetHost(TestServer.Program.BuildWebHost <TestServer.AuthenticationStartup>);
                break;

            case ExecutionMode.Server:
                serverFixture.UseAspNetHost(TestServer.Program.BuildWebHost <TestServer.ServerAuthenticationStartup>);
                break;

            default:
                break;
            }
        }
示例#19
0
        public static void RunPass(ControlFlowGraph cfg, ExecutionMode mode)
        {
            // Compute local register inputs and outputs used inside blocks.
            RegisterMask[] localInputs  = new RegisterMask[cfg.Blocks.Count];
            RegisterMask[] localOutputs = new RegisterMask[cfg.Blocks.Count];

            for (BasicBlock block = cfg.Blocks.First; block != null; block = block.ListNext)
            {
                for (Operation node = block.Operations.First; node != default; node = node.ListNext)
                {
                    for (int index = 0; index < node.SourcesCount; index++)
                    {
                        Operand source = node.GetSource(index);

                        if (source.Kind == OperandKind.Register)
                        {
                            Register register = source.GetRegister();

                            localInputs[block.Index] |= GetMask(register) & ~localOutputs[block.Index];
                        }
                    }

                    if (node.Destination != default && node.Destination.Kind == OperandKind.Register)
                    {
                        localOutputs[block.Index] |= GetMask(node.Destination.GetRegister());
                    }
                }
            }

            // Compute global register inputs and outputs used across blocks.
            RegisterMask[] globalCmnOutputs = new RegisterMask[cfg.Blocks.Count];

            RegisterMask[] globalInputs  = new RegisterMask[cfg.Blocks.Count];
            RegisterMask[] globalOutputs = new RegisterMask[cfg.Blocks.Count];

            bool modified;
            bool firstPass = true;

            do
            {
                modified = false;

                // Compute register outputs.
                for (int index = cfg.PostOrderBlocks.Length - 1; index >= 0; index--)
                {
                    BasicBlock block = cfg.PostOrderBlocks[index];

                    if (block.Predecessors.Count != 0 && !HasContextLoad(block))
                    {
                        BasicBlock predecessor = block.Predecessors[0];

                        RegisterMask cmnOutputs = localOutputs[predecessor.Index] | globalCmnOutputs[predecessor.Index];
                        RegisterMask outputs    = globalOutputs[predecessor.Index];

                        for (int pIndex = 1; pIndex < block.Predecessors.Count; pIndex++)
                        {
                            predecessor = block.Predecessors[pIndex];

                            cmnOutputs &= localOutputs[predecessor.Index] | globalCmnOutputs[predecessor.Index];
                            outputs    |= globalOutputs[predecessor.Index];
                        }

                        globalInputs[block.Index] |= outputs & ~cmnOutputs;

                        if (!firstPass)
                        {
                            cmnOutputs &= globalCmnOutputs[block.Index];
                        }

                        modified |= Exchange(globalCmnOutputs, block.Index, cmnOutputs);
                        outputs  |= localOutputs[block.Index];
                        modified |= Exchange(globalOutputs, block.Index, globalOutputs[block.Index] | outputs);
                    }
                    else
                    {
                        modified |= Exchange(globalOutputs, block.Index, localOutputs[block.Index]);
                    }
                }

                // Compute register inputs.
                for (int index = 0; index < cfg.PostOrderBlocks.Length; index++)
                {
                    BasicBlock block = cfg.PostOrderBlocks[index];

                    RegisterMask inputs = localInputs[block.Index];

                    for (int i = 0; i < block.SuccessorsCount; i++)
                    {
                        inputs |= globalInputs[block.GetSuccessor(i).Index];
                    }

                    inputs &= ~globalCmnOutputs[block.Index];

                    modified |= Exchange(globalInputs, block.Index, globalInputs[block.Index] | inputs);
                }

                firstPass = false;
            }while (modified);

            // Insert load and store context instructions where needed.
            for (BasicBlock block = cfg.Blocks.First; block != null; block = block.ListNext)
            {
                bool hasContextLoad = HasContextLoad(block);

                if (hasContextLoad)
                {
                    block.Operations.Remove(block.Operations.First);
                }

                Operand arg = default;

                // The only block without any predecessor should be the entry block.
                // It always needs a context load as it is the first block to run.
                if (block.Predecessors.Count == 0 || hasContextLoad)
                {
                    arg = Local(OperandType.I64);

                    Operation loadArg = block.Operations.AddFirst(Operation(Instruction.LoadArgument, arg, Const(0)));

                    LoadLocals(block, globalInputs[block.Index].VecMask, RegisterType.Vector, mode, loadArg, arg);
                    LoadLocals(block, globalInputs[block.Index].IntMask, RegisterType.Integer, mode, loadArg, arg);
                }

                bool hasContextStore = HasContextStore(block);

                if (hasContextStore)
                {
                    block.Operations.Remove(block.Operations.Last);
                }

                if (EndsWithReturn(block) || hasContextStore)
                {
                    if (arg == default)
                    {
                        arg = Local(OperandType.I64);

                        block.Append(Operation(Instruction.LoadArgument, arg, Const(0)));
                    }

                    StoreLocals(block, globalOutputs[block.Index].IntMask, RegisterType.Integer, mode, arg);
                    StoreLocals(block, globalOutputs[block.Index].VecMask, RegisterType.Vector, mode, arg);
                }
            }
        }
示例#20
0
        /// <summary>
        /// Constructs an instance of the CallSite object given its scope and 
        /// method information. This constructor optionally takes in a preloaded
        /// trace data information.
        /// </summary>
        /// <param name="classScope"></param>
        /// <param name="methodName"></param>
        /// <param name="globalFunctionTable"></param>
        /// <param name="execMode"></param>
        /// <param name="serializedTraceData">An optional Base64 encoded string
        /// representing the trace data that the callsite could use as part of 
        /// its re-construction.</param>
        /// 
        public CallSite(int classScope, string methodName,
            FunctionTable globalFunctionTable,
            ExecutionMode execMode, string serializedTraceData = null)
        {
            //Set the ID of internal test
            callsiteID = Guid.NewGuid();

            Validity.Assert(methodName != null);
            Validity.Assert(globalFunctionTable != null);

            this.classScope = classScope;
            this.methodName = methodName;
            this.globalFunctionTable = globalFunctionTable;

            if (execMode == ExecutionMode.Parallel)
                throw new CompilerInternalException(
                    "Parrallel Mode is not yet implemented {46F83CBB-9D37-444F-BA43-5E662784B1B3}");

            // Found preloaded trace data, reconstruct the instances from there.
            if (!String.IsNullOrEmpty(serializedTraceData))
            {
                LoadSerializedDataIntoTraceCache(serializedTraceData);
                
            }
        }
示例#21
0
 protected void Publish([NotNull] object message, ExecutionMode mode = ExecutionMode.None)
 {
     ThreadManager.Invoke(mode, this, message, (@base, o) => @base.Publish(@base, o));
 }
 private void ExecuteCommandProxy(string command, ExecutionMode mode)
 {
     switch(mode)
     {
         case ExecutionMode.CommandLine: ExecuteCommand(command, 1, true);
             break;
         case ExecutionMode.GUID: Process.Start(command);
             break;
         case ExecutionMode.ProcessStart:Process.Start(command);
             break;
         default:
             break;
     }
 }
示例#23
0
 /// <summary>
 /// Called to intercept scripting operation
 /// </summary>
 /// <param name="executionInfo"></param>
 /// <param name="executionResult"></param>
 /// <returns>
 /// true if regular execution should take place, false the script
 /// has been created by this function
 /// </returns>
 protected virtual bool PreProcessScripting(PreProcessExecutionInfo executionInfo, out ExecutionMode executionResult)
 {
     //we don't do anything here, but we enable derived classes to do something...
     executionResult = ExecutionMode.Success;
     return(true);
 }
示例#24
0
        internal static TranslatedFunction Translate(IMemoryManager memory, JumpTable jumpTable, ulong address, ExecutionMode mode, bool highCq)
        {
            ArmEmitterContext context = new ArmEmitterContext(memory, jumpTable, address, highCq, Aarch32Mode.User);

            Logger.StartPass(PassName.Decoding);

            Block[] blocks = Decoder.Decode(memory, address, mode, highCq, singleBlock: false);

            Logger.EndPass(PassName.Decoding);

            PreparePool(highCq ? 1 : 0);

            Logger.StartPass(PassName.Translation);

            EmitSynchronization(context);

            if (blocks[0].Address != address)
            {
                context.Branch(context.GetLabel(address));
            }

            ControlFlowGraph cfg = EmitAndGetCFG(context, blocks, out Range funcRange);

            ulong funcSize = funcRange.End - funcRange.Start;

            Logger.EndPass(PassName.Translation);

            Logger.StartPass(PassName.RegisterUsage);

            RegisterUsage.RunPass(cfg, mode);

            Logger.EndPass(PassName.RegisterUsage);

            OperandType[] argTypes = new OperandType[] { OperandType.I64 };

            CompilerOptions options = highCq ? CompilerOptions.HighCq : CompilerOptions.None;

            GuestFunction func;

            if (Ptc.State == PtcState.Disabled)
            {
                func = Compiler.Compile <GuestFunction>(cfg, argTypes, OperandType.I64, options);

                ResetPool(highCq ? 1 : 0);
            }
            else
            {
                using PtcInfo ptcInfo = new PtcInfo();

                func = Compiler.Compile <GuestFunction>(cfg, argTypes, OperandType.I64, options, ptcInfo);

                ResetPool(highCq ? 1 : 0);

                Ptc.WriteInfoCodeRelocUnwindInfo(address, funcSize, highCq, ptcInfo);
            }

            return(new TranslatedFunction(func, funcSize, highCq));
        }
示例#25
0
 public StringStrNode(uint address, ExecutionMode mode, string str)
 {
     this.address = address;
     this.mode = mode;
     this.str = str;
 }
示例#26
0
 public QueryBase CreateQuery(string queryString, ExecutionMode mode, string outputTable)
 {
     return CreateQuery(queryString, mode, outputTable, null, null);
 }
示例#27
0
        public QueryBase CreateQuery(string queryString, ExecutionMode mode, string outputTable, DatasetBase mydbds, DatasetBase tempds)
        {
            var parser = CreateParser();
            var root = parser.Execute(queryString);

            QueryBase q = CreateQueryBase((Node)root);
            q.QueryFactoryTypeName = this.GetType().AssemblyQualifiedName;
            q.ExecutionMode = mode;

            switch (mode)
            {
                case ExecutionMode.Graywulf:
                    GetInitializedQuery_Graywulf(q, queryString, outputTable);
                    break;
                case ExecutionMode.SingleServer:
                    GetInitializedQuery_SingleServer(q, queryString, outputTable, (SqlServerDataset)mydbds, (SqlServerDataset)tempds);
                    break;
                default:
                    throw new NotImplementedException();
            }

            return q;
        }
示例#28
0
 /// <summary>
 /// Creates a new instance of the <see cref="CalculationEngine"/> class. The optimizer and
 /// cache are enabled.
 /// </summary>
 /// <param name="cultureInfo">
 /// The <see cref="CultureInfo"/> required for correctly reading floating poin numbers.
 /// </param>
 /// <param name="executionMode">The execution mode that must be used for formula execution.</param>
 public CalculationEngine(UnitsCore unitsCore, CultureInfo cultureInfo, ExecutionMode executionMode)
     : this(unitsCore, cultureInfo, executionMode, true, true)
 {
 }
示例#29
0
 /// <summary>
 /// Creates a new instance of the <see cref="CalculationEngine"/> class.
 /// </summary>
 /// <param name="cultureInfo">
 /// The <see cref="CultureInfo"/> required for correctly reading floating poin numbers.
 /// </param>
 /// <param name="executionMode">The execution mode that must be used for formula execution.</param>
 /// <param name="cacheEnabled">Enable or disable caching of mathematical formulas.</param>
 /// <param name="optimizerEnabled">Enable or disable optimizing of formulas.</param>
 public CalculationEngine(UnitsCore unitsCore, CultureInfo cultureInfo, ExecutionMode executionMode, bool cacheEnabled, bool optimizerEnabled)
     : this(unitsCore, cultureInfo, executionMode, cacheEnabled, optimizerEnabled, true, true)
 {
 }
示例#30
0
        /// <summary>
        /// Parses object model defined in RDFS/XML to DataModelModule object.
        /// </summary>
        /// <param name="baseResourceType">Instance of Base ResourceType.</param>
        /// <param name="rdfDocument">RDF/XML Document.</param>
        /// <param name="xsdDocument">XSD Documet.</param>
        /// <param name="namespaceName">User defined Namespace.</param>
        /// <param name="isStrictExecutionMode">Execution Mode (Strict/Loose).</param>
        /// <returns>Parsed object of DataModelModule class.</returns>
        /// <exception cref="Zentity.Rdf.Xml.RdfXmlParserException"/>
        /// <exception cref="Zentity.Core.RdfsException"/>
        /// <example> This example shows how to create a <see cref="Zentity.Core.DataModelModule"/>
        /// from an RDF Schema document. Though, the example uses reflection to show how to use the
        /// generated assembly, we recommend creating clients that are compiled with references to
        /// the extensions assembly to avoid the reflection based code.
        /// <br/>
        /// The listing below shows the contents of RDF Schema document. The example assumes that
        /// this document is saved as 'C:\Sample.rdf'.
        /// <code lang="xml">
        ///&lt;?xml version=&quot;1.0&quot;?&gt;
        ///&lt;!DOCTYPE rdf:RDF [
        ///  &lt;!ENTITY dt &quot;http://contoso.com/2008/&quot; &gt;
        ///]&gt;
        ///&lt;rdf:RDF
        ///   xmlns:rdf=&quot;http://www.w3.org/1999/02/22-rdf-syntax-ns#&quot;
        ///   xmlns:rdfs=&quot;http://www.w3.org/2000/01/rdf-schema#&quot;
        ///   xml:base=&quot;http://www.sample.org/&quot;&gt;
        ///
        ///  &lt;rdfs:Class rdf:about=&quot;Person&quot;&gt;
        ///  &lt;/rdfs:Class&gt;
        ///
        ///  &lt;rdfs:Class rdf:about=&quot;Employee&quot;&gt;
        ///    &lt;rdfs:subClassOf rdf:resource=&quot;Person&quot;/&gt;
        ///  &lt;/rdfs:Class&gt;
        ///
        ///  &lt;rdfs:Class rdf:about=&quot;Book&quot;&gt;
        ///  &lt;/rdfs:Class&gt;
        ///
        ///  &lt;rdf:Property rdf:about=&quot;AuthoredBy&quot;&gt;
        ///    &lt;rdfs:range rdf:resource=&quot;Person&quot;/&gt;
        ///    &lt;rdfs:domain rdf:resource=&quot;Book&quot;/&gt;
        ///  &lt;/rdf:Property&gt;
        ///
        ///  &lt;rdf:Property rdf:about=&quot;EditedBy&quot;&gt;
        ///    &lt;rdfs:range rdf:resource=&quot;Person&quot;/&gt;
        ///    &lt;rdfs:domain rdf:resource=&quot;Book&quot;/&gt;
        ///  &lt;/rdf:Property&gt;
        ///
        ///  &lt;rdf:Property rdf:about=&quot;Name&quot;&gt;
        ///    &lt;rdfs:range rdf:resource=&quot;&amp;dt;string128&quot;/&gt;
        ///    &lt;rdfs:domain rdf:resource=&quot;Person&quot;/&gt;
        ///  &lt;/rdf:Property&gt;
        ///
        ///  &lt;rdf:Property rdf:about=&quot;Designation&quot;&gt;
        ///    &lt;rdfs:range rdf:resource=&quot;&amp;dt;string256&quot;/&gt;
        ///    &lt;rdfs:domain rdf:resource=&quot;Employee&quot;/&gt;
        ///  &lt;/rdf:Property&gt;
        ///
        ///  &lt;rdf:Property rdf:about=&quot;//Book/Name&quot;&gt;
        ///    &lt;rdfs:range rdf:resource=&quot;&amp;dt;string128&quot;/&gt;
        ///    &lt;rdfs:domain rdf:resource=&quot;Book&quot;/&gt;
        ///  &lt;/rdf:Property&gt;
        ///
        ///&lt;/rdf:RDF&gt;
        /// </code>
        /// <br/>
        /// The listing below shows the contents of XSD that contains additional type definitions
        /// used in the example. The example assumes that this document is saved as 'C:\Sample.xsd'.
        /// <code lang="xml">
        ///&lt;xs:schema
        ///  targetNamespace=&quot;http://contoso.com/2008/&quot;
        ///  xmlns:xs=&quot;http://www.w3.org/2001/XMLSchema&quot;&gt;
        ///
        ///  &lt;xs:simpleType name=&quot;string128&quot; id=&quot;string128&quot;&gt;
        ///    &lt;xs:restriction base=&quot;xs:string&quot;&gt;
        ///      &lt;xs:maxLength value=&quot;128&quot;/&gt;
        ///    &lt;/xs:restriction&gt;
        ///  &lt;/xs:simpleType&gt;
        ///
        ///  &lt;xs:simpleType name=&quot;string256&quot; id=&quot;string256&quot;&gt;
        ///    &lt;xs:restriction base=&quot;xs:string&quot;&gt;
        ///      &lt;xs:maxLength value=&quot;256&quot;/&gt;
        ///    &lt;/xs:restriction&gt;
        ///  &lt;/xs:simpleType&gt;
        ///
        ///&lt;/xs:schema&gt;
        /// </code>
        /// <br/>
        /// Example:
        /// <code>
        ///using System;
        ///using System.Linq;
        ///using Zentity.Core;
        ///using System.Reflection;
        ///using System.Collections;
        ///using System.Xml.Linq;
        ///
        ///namespace ZentitySamples
        ///{
        ///    class Program
        ///    {
        ///        const string nameSpace = &quot;Zentity.Samples&quot;;
        ///        const string connectionStringFormat = @&quot;provider=System.Data.SqlClient;
        ///                metadata=res://{0}; provider connection string='Data Source=.;
        ///                Initial Catalog=Zentity;Integrated Security=True;MultipleActiveResultSets=True'&quot;;
        ///        const string rdfsPath = @&quot;C:\Sample.rdf&quot;;
        ///        const string dataTypesXsdPath = @&quot;C:\Sample.xsd&quot;;
        ///        const string extensionsAssemblyName = &quot;Extensions&quot;;
        ///        const string extensionsAssemblyFileName = &quot;Extensions.dll&quot;;
        ///
        ///        static void Main(string[] args)
        ///        {
        ///            Assembly extensions = SynchronizeAndGenerateAssembly();
        ///            CreateRepositoryItems(extensions);
        ///            FetchRepositoryItems(extensions);
        ///        }
        ///
        ///        private static void FetchRepositoryItems(Assembly extensionsAssembly)
        ///        {
        ///            using (ZentityContext context = new ZentityContext(
        ///                string.Format(connectionStringFormat, extensionsAssemblyName)))
        ///            {
        ///                Console.WriteLine(&quot;Getting books...&quot;);
        ///                Type resourceTypeBook = extensionsAssembly.GetType(&quot;Zentity.Samples.Book&quot;);
        ///                MethodInfo ofTypeMethod = context.Resources.GetType().GetMethod(&quot;OfType&quot;).
        ///                    MakeGenericMethod(resourceTypeBook);
        ///                var customTypeInstances = ofTypeMethod.Invoke(context.Resources, null);
        ///                foreach (Resource book in (IEnumerable)customTypeInstances)
        ///                    Console.WriteLine(book.Id);
        ///
        ///                Console.WriteLine(&quot;\nGetting persons...&quot;);
        ///                Type resourceTypePerson = extensionsAssembly.GetType(&quot;Zentity.Samples.Person&quot;);
        ///                ofTypeMethod = context.Resources.GetType().GetMethod(&quot;OfType&quot;).
        ///                    MakeGenericMethod(resourceTypePerson);
        ///                customTypeInstances = ofTypeMethod.Invoke(context.Resources, null);
        ///                foreach (Resource person in (IEnumerable)customTypeInstances)
        ///                    Console.WriteLine(person.Id);
        ///
        ///                Console.WriteLine(&quot;\nGetting AuthoredBy relationships...&quot;);
        ///                NavigationProperty authoredByProperty = context.DataModel.Modules[nameSpace].
        ///                    ResourceTypes[&quot;Book&quot;].NavigationProperties[&quot;AuthoredBy&quot;];
        ///                Predicate predicate = context.Predicates.
        ///                    Where(tuple =&gt; tuple.Id == authoredByProperty.Association.PredicateId).First();
        ///                predicate.Relationships.Load();
        ///                foreach (Relationship rel in predicate.Relationships)
        ///                    Console.WriteLine(&quot;[{0}] &lt;--{1}--&gt; [{2}]&quot;, rel.Subject.Id, predicate.Name,
        ///                        rel.Object.Id);
        ///            }
        ///        }
        ///
        ///        private static void CreateRepositoryItems(Assembly extensionsAssembly)
        ///        {
        ///            using (ZentityContext context = new ZentityContext(
        ///                string.Format(connectionStringFormat, extensionsAssemblyName)))
        ///            {
        ///                Type resourceTypeBook = extensionsAssembly.GetType(&quot;Zentity.Samples.Book&quot;);
        ///                PropertyInfo propertyAuthoredBy = resourceTypeBook.GetProperty(&quot;AuthoredBy&quot;);
        ///                Type resourceTypePerson = extensionsAssembly.GetType(&quot;Zentity.Samples.Person&quot;);
        ///
        ///                var aPerson = Activator.CreateInstance(resourceTypePerson);
        ///                var aBook = Activator.CreateInstance(resourceTypeBook);
        ///                var anotherBook = Activator.CreateInstance(resourceTypeBook);
        ///
        ///                // AuthoredBy is actually a an EntityCollection&lt;Person&gt;.
        ///                var instanceAuthoredBy = propertyAuthoredBy.GetValue(aBook, null);
        ///                Type entityCollectionOfPerson = instanceAuthoredBy.GetType();
        ///                // Get the &quot;Add&quot; method.
        ///                MethodInfo methodAdd = entityCollectionOfPerson.GetMethod(&quot;Add&quot;);
        ///                // Add author to book.
        ///                methodAdd.Invoke(instanceAuthoredBy, new object[] { aPerson });
        ///
        ///                instanceAuthoredBy = propertyAuthoredBy.GetValue(anotherBook, null);
        ///                methodAdd.Invoke(instanceAuthoredBy, new object[] { aPerson });
        ///
        ///                // Save the entities to repository.
        ///                context.AddToResources((Resource)aPerson);
        ///                context.SaveChanges();
        ///            }
        ///        }
        ///
        ///        private static Assembly SynchronizeAndGenerateAssembly()
        ///        {
        ///            using (ZentityContext context = new ZentityContext(
        ///            string.Format(connectionStringFormat, &quot;Zentity.Core&quot;)))
        ///            {
        ///                ResourceType defaultBaseResourceType = context.DataModel.
        ///                Modules[&quot;Zentity.Core&quot;].ResourceTypes[&quot;Resource&quot;];
        ///
        ///                XDocument rdfDocument = XDocument.Load(rdfsPath);
        ///                XDocument xsdDocument = XDocument.Load(dataTypesXsdPath);
        ///                DataModelModule module = DataModelModule.CreateFromRdfs(defaultBaseResourceType,
        ///                rdfDocument, xsdDocument, nameSpace, false);
        ///
        ///                context.DataModel.Modules.Add(module);
        ///
        ///                // Synchronize to alter the database schema.
        ///                // This method sometimes takes a few minutes to complete depending on the actions
        ///                // taken by other modules (such as change history logging) in response to schema
        ///                // changes. Everything happens in a single transaction. Make sure that the timeout
        ///                // values are set correct for the command and transaction. Transaction timeout is
        ///                // controlled from App.Config, Web.Config and machine.config configuration files.
        ///                context.CommandTimeout = 300;
        ///                context.DataModel.Synchronize();
        ///
        ///                // Generate the module assembly to use.
        ///                byte[] rawAssembly = context.DataModel.GenerateExtensionsAssembly(
        ///                extensionsAssemblyName, true, new string[] { nameSpace },
        ///                new string[] { nameSpace }, null);
        ///
        ///                return Assembly.Load(rawAssembly);
        ///            }
        ///        }
        ///    }
        ///}
        /// </code>
        /// </example>
        public static DataModelModule CreateFromRdfs(ResourceType baseResourceType, XDocument rdfDocument,
                                                     XDocument xsdDocument, string namespaceName, bool isStrictExecutionMode)
        {
            //Validate parameters.
            if (baseResourceType == null)
            {
                throw new ArgumentNullException("baseResourceType", RdfsResources.ExceptionArgumentIsNull);
            }
            if (rdfDocument == null)
            {
                throw new ArgumentNullException("rdfDocument", RdfsResources.ExceptionArgumentIsNull);
            }
            if (string.IsNullOrEmpty(namespaceName))
            {
                throw new ArgumentNullException("namespaceName", RdfsResources.ExceptionArgumentIsNull);
            }


            ExecutionMode executionMode = isStrictExecutionMode ?
                                          ExecutionMode.Strict : ExecutionMode.Loose;

            //Parse Rdf/Xml to Graph.
            RdfXmlParser rdfParser = new RdfXmlParser(rdfDocument);
            Graph        rdfGraph  = rdfParser.Parse(true);

            //Create collection of xsd datatypes.
            XsdDataTypeCollection dataTypeCollection = null;

            if (xsdDocument != null)
            {
                dataTypeCollection = new XsdDataTypeCollection(xsdDocument);
            }
            else
            {
                dataTypeCollection = new XsdDataTypeCollection();
            }

            //Create context for current execution.
            Context context = new Context
            {
                Graph = rdfGraph,
                XsdDataTypeCollection = dataTypeCollection,
                ExecutionMode         = executionMode,
                BaseResourceType      = baseResourceType
            };

            //Create list of interpreters.
            List <RdfsInterpreter> interpreters = new List <RdfsInterpreter>();

            interpreters.Add(new PredicateInterpreter(context));
            interpreters.Add(new TypeInterpreter(context));
            interpreters.Add(new SubClassOfInterpreter(context));
            interpreters.Add(new DomainRangeInterpreter(context));

            //Create data model module object.
            DataModelModule dataModelModule = new DataModelModule
            {
                NameSpace = namespaceName,
                Uri       = rdfDocument.BaseUri
            };

            //Execute interpreters.
            foreach (RdfsInterpreter interpreter in interpreters)
            {
                interpreter.Interpret(dataModelModule);
            }

            return(dataModelModule);
        }
示例#31
0
 /// <summary>
 /// Creates a new instance of the <see cref="SystemTestAttribute" /> class.
 /// </summary>
 /// <param name="expectedExecutionTime">Expected execution time</param>
 /// <param name="executionMode">Execution mode</param>
 public SystemTestAttribute(ExpectedExecutionTime expectedExecutionTime, ExecutionMode executionMode)
     : base(expectedExecutionTime, executionMode)
 {
 }
示例#32
0
 /// <summary>
 /// Creates a new instance of the <see cref="SystemTestAttribute" /> class.
 /// </summary>
 /// <param name="executionMode">Execution mode</param>
 public SystemTestAttribute(ExecutionMode executionMode)
     : base(executionMode)
 {
 }
        public ExecutableRcvPipeline(ReceivePipeline source)
        {
            XmlDocument conf = new XmlDocument();

            conf.LoadXml(source.XmlContent);

            foreach (XmlNode stageConf in conf.SelectNodes("/*[local-name()='Document']/*[local-name()='Stages']/*[local-name()='Stage']"))
            {
                XmlNode       fileStageConf = stageConf.SelectSingleNode("*[local-name()='PolicyFileStage']");
                ExecutionMode mode          = ExecutionMode.allRecognized;
                switch (fileStageConf.Attributes["execMethod"].Value.ToLower())
                {
                case "all":
                    mode = ExecutionMode.all;
                    break;

                case "firstmatch":
                    mode = ExecutionMode.firstRecognized;
                    break;

                default:
                    mode = ExecutionMode.allRecognized;
                    break;
                }


                CustomStage tempStage = new CustomStage
                {
                    StageID    = Guid.Parse(fileStageConf.Attributes["stageId"].Value),
                    StageLevel = Int32.Parse(fileStageConf.Attributes["_locID"].Value),
                    Mode       = mode
                };
                this.Stages.Add(tempStage);


                foreach (XmlNode componentConf in stageConf.SelectNodes("*[local-name()='Components']/*[local-name()='Component']"))
                {
                    IBaseComponent realComponent = (IBaseComponent)Activator.CreateInstance(Type.GetType(componentConf.SelectSingleNode("*[local-name()='Name']").InnerText));
                    MethodInfo     initNewInfo   = realComponent.GetType().GetMethod("InitNew");
                    if (initNewInfo != null)
                    {
                        initNewInfo.Invoke(realComponent, new object[] { });
                    }

                    IPropertyBag componentProps = new CustomPropertyBag();

                    List <string> hiddenProps = new List <string>();
                    XmlNode       hiddenNode  = componentConf.SelectSingleNode("*[local-name()='Properties']/*[local-name()='Property' and @Name='HiddenProperties']");
                    if (hiddenNode != null)
                    {
                        hiddenProps.AddRange(hiddenNode.InnerText.Split(','));
                    }
                    hiddenProps.Add("HiddenProperties");

                    foreach (XmlNode propConf in componentConf.SelectNodes("*[local-name()='Properties']/*[local-name()='Property']"))
                    {
                        if (!String.IsNullOrEmpty(propConf.SelectSingleNode("*[local-name()='Value']").InnerText) && !hiddenProps.Contains(propConf.Attributes["Name"].Value))
                        {
                            componentProps.Write(
                                propConf.Attributes["Name"].Value,
                                this.TryConvertToSchemaList(propConf.SelectSingleNode("*[local-name()='Value']").InnerText,
                                                            propConf.SelectSingleNode("*[local-name()='Value']").Attributes["xsi:type"].Value));
                            //switch (propConf.Attributes["Name"].Value)
                            //{
                            //    case "Microsoft.BizTalk.Component.Utilities.SchemaList":
                            //        componentProps.Write(
                            //                            propConf.Attributes["Name"].Value,
                            //                            this.ConvertToSchemaList(propConf.SelectSingleNode("*[local-name()='Value']").InnerText));
                            //        break;
                            //    default:
                            //        componentProps.Write(
                            //                            propConf.Attributes["Name"].Value,
                            //                            Convert.ChangeType(propConf.SelectSingleNode("*[local-name()='Value']").InnerText, propertyInfo.PropertyType));
                            //        break;
                            //}
                        }
                    }

                    if (realComponent.GetType().GetInterfaces().Contains(typeof(IPersistPropertyBag)))
                    {
                        MethodInfo loadInfo = realComponent.GetType().GetMethod("Load");
                        if (loadInfo != null)
                        {
                            loadInfo.Invoke(realComponent, new object[] { componentProps, null });
                        }
                    }

                    tempStage.Components.Add(realComponent);
                }
            }
        }
示例#34
0
            void IExecuteOperation.Execute(IEntity entity, params object[] args)
            {
                using (HeavyProfiler.Log("Execute", () => Symbol.Symbol.Key))
                {
                    OperationLogic.AssertOperationAllowed(Symbol.Symbol, inUserInterface: false);

                    string error = OnCanExecute((T)entity);
                    if (error != null)
                    {
                        throw new ApplicationException(error);
                    }

                    OperationLogEntity log = new OperationLogEntity
                    {
                        Operation = Symbol.Symbol,
                        Start     = TimeZoneManager.Now,
                        User      = UserHolder.Current?.ToLite()
                    };

                    try
                    {
                        using (Transaction tr = new Transaction())
                        {
                            using (OperationLogic.AllowSave(entity.GetType()))
                                OperationLogic.OnSuroundOperation(this, log, entity, args).EndUsing(_ =>
                                {
                                    Execute((T)entity, args);

                                    AssertEntity((T)entity);

                                    entity.Save(); //Nothing happens if already saved

                                    log.SetTarget(entity);
                                    log.End = TimeZoneManager.Now;
                                });

                            using (ExecutionMode.Global())
                                log.Save();

                            tr.Commit();
                        }
                    }
                    catch (Exception ex)
                    {
                        OperationLogic.SetExceptionData(ex, Symbol.Symbol, (Entity)entity, args);

                        if (Transaction.InTestTransaction)
                        {
                            throw;
                        }

                        var exLog = ex.LogException();

                        using (Transaction tr2 = Transaction.ForceNew())
                        {
                            OperationLogEntity newLog = new OperationLogEntity //Transaction chould have been rollbacked just before commiting
                            {
                                Operation = log.Operation,
                                Start     = log.Start,
                                User      = log.User,
                                Target    = entity.IsNew ? null : entity.ToLite(),
                                Exception = exLog.ToLite(),
                            };

                            using (ExecutionMode.Global())
                                newLog.Save();

                            tr2.Commit();
                        }

                        throw;
                    }
                }
            }
示例#35
0
 public Options(string[] targetAssemblies, string outputPath, string formatFilePath, string templateOutputPath, ExecutionMode mode)
 {
     TargetAssemblies   = targetAssemblies;
     OutputPath         = outputPath;
     FormatFilePath     = formatFilePath;
     TemplateOutputPath = templateOutputPath;
     Mode = mode;
 }
示例#36
0
		/// <summary>
		/// Initializes the specified config.
		/// </summary>
		/// <param name="config">The config.</param>
		/// <param name="compilerOutput">The compiler output.</param>
		/// <param name="executionMode">The execution mode.</param>
		public static void Initialize(Configuration config, string compilerOutput= null, ExecutionMode executionMode = ExecutionMode.Compiled)
		{
			_instance = new ScriptManagerFactory(config, compilerOutput, executionMode);
		}
示例#37
0
 public void SetExecutionMode(ExecutionMode mode)
 {
     _sourceEditor.SetExecutionMode(mode);
     _targetEditor.SetExecutionMode(mode);
 }
示例#38
0
        public static Block[] DecodeFunction(MemoryManager memory, ulong address, ExecutionMode mode, bool highCq)
        {
            List <Block> blocks = new List <Block>();

            Queue <Block> workQueue = new Queue <Block>();

            Dictionary <ulong, Block> visited = new Dictionary <ulong, Block>();

            int opsCount = 0;

            int instructionLimit = highCq ? MaxInstsPerFunction : MaxInstsPerFunctionLowCq;

            Block GetBlock(ulong blkAddress)
            {
                if (!visited.TryGetValue(blkAddress, out Block block))
                {
                    if (opsCount > instructionLimit || !memory.IsMapped((long)blkAddress))
                    {
                        return(null);
                    }

                    block = new Block(blkAddress);

                    workQueue.Enqueue(block);

                    visited.Add(blkAddress, block);
                }

                return(block);
            }

            GetBlock(address);

            while (workQueue.TryDequeue(out Block currBlock))
            {
                // Check if the current block is inside another block.
                if (BinarySearch(blocks, currBlock.Address, out int nBlkIndex))
                {
                    Block nBlock = blocks[nBlkIndex];

                    if (nBlock.Address == currBlock.Address)
                    {
                        throw new InvalidOperationException("Found duplicate block address on the list.");
                    }

                    nBlock.Split(currBlock);

                    blocks.Insert(nBlkIndex + 1, currBlock);

                    continue;
                }

                // If we have a block after the current one, set the limit address.
                ulong limitAddress = ulong.MaxValue;

                if (nBlkIndex != blocks.Count)
                {
                    Block nBlock = blocks[nBlkIndex];

                    int nextIndex = nBlkIndex + 1;

                    if (nBlock.Address < currBlock.Address && nextIndex < blocks.Count)
                    {
                        limitAddress = blocks[nextIndex].Address;
                    }
                    else if (nBlock.Address > currBlock.Address)
                    {
                        limitAddress = blocks[nBlkIndex].Address;
                    }
                }

                FillBlock(memory, mode, currBlock, limitAddress);

                opsCount += currBlock.OpCodes.Count;

                if (currBlock.OpCodes.Count != 0)
                {
                    // Set child blocks. "Branch" is the block the branch instruction
                    // points to (when taken), "Next" is the block at the next address,
                    // executed when the branch is not taken. For Unconditional Branches
                    // (except BL/BLR that are sub calls) or end of executable, Next is null.
                    OpCode lastOp = currBlock.GetLastOp();

                    bool isCall = IsCall(lastOp);

                    if (lastOp is IOpCodeBImm op && !isCall)
                    {
                        currBlock.Branch = GetBlock((ulong)op.Immediate);
                    }

                    if (!IsUnconditionalBranch(lastOp) || isCall)
                    {
                        currBlock.Next = GetBlock(currBlock.EndAddress);
                    }
                }

                // Insert the new block on the list (sorted by address).
                if (blocks.Count != 0)
                {
                    Block nBlock = blocks[nBlkIndex];

                    blocks.Insert(nBlkIndex + (nBlock.Address < currBlock.Address ? 1 : 0), currBlock);
                }
                else
                {
                    blocks.Add(currBlock);
                }
            }

            TailCallRemover.RunPass(address, blocks);

            return(blocks.ToArray());
        }
 public StringFileAppenderBuilder(ExecutionMode executionMode, FileConfigurationBuilder fileConfiguration)
 {
     m_executionMode = executionMode;
     m_fileConfiguration = fileConfiguration;
     m_filterBuilder = new FilterBuilder<StringFileAppenderBuilder>(this);
 }
 public ExecutionModeEventArgs(ExecutionMode mode)
 {
     Mode = mode;
 }
示例#41
0
 public void SetExecutionMode(ExecutionMode mode)
 {
     this.testExecutionMode = mode;
 }
示例#42
0
 protected override SynchronizedNotifiableCollection <T> CreateNotifiableCollection <T>(ExecutionMode executionMode,
                                                                                        IThreadManager threadManager)
 {
     return(new FilterableNotifiableCollection <T>
     {
         ExecutionMode = executionMode,
         ThreadManager = threadManager,
         Filter = item => true
     });
 }
示例#43
0
        /// <summary>
        /// called when we need to script a Sql server dlg.
        /// </summary>
        /// <param name="executionInfo"></param>
        /// <param name="executionResult"></param>
        private void ExecuteForSql(PreProcessExecutionInfo executionInfo, out ExecutionMode executionResult)
        {
            Microsoft.SqlServer.Management.Smo.Server oldServer = null;
            if (NeedToSwitchServer)
            {
                // We use a new instance of the SMO Server object every time we script
                // so that any changes that are made to the SMO server while scripting are
                // not kept when the script operation is completed.
                oldServer = DataContainer.Server;

                //BUGBUG - see if we can use copy ctor instead
                DataContainer.Server = new Microsoft.SqlServer.Management.Smo.Server(DataContainer.ServerConnection);
            }

            String szScript              = null;
            bool   isScripting           = IsScripting(executionInfo.RunType);
            var    executionModeOriginal = GetServerConnectionForScript().SqlExecutionModes;
            //For Azure the ExecutionManager is different depending on which ExecutionManager
            //used - one at the Server level and one at the Database level. So to ensure we
            //don't use the wrong execution mode we need to set the mode for both (for on-prem
            //this will essentially be a no-op)
            SqlExecutionModes subjectExecutionModeOriginal = executionModeOriginal;
            SqlSmoObject      sqlDialogSubject             = null;

            try
            {
                sqlDialogSubject = this.DataContainer.SqlDialogSubject;
            }
            catch (System.Exception)
            {
                //We may not have a valid dialog subject here (such as if the object hasn't been created yet)
                //so in that case we'll just ignore it as that's a normal scenario.
            }

            if (sqlDialogSubject != null)
            {
                subjectExecutionModeOriginal = sqlDialogSubject.ExecutionManager.ConnectionContext.SqlExecutionModes;
            }
            try
            {
                SqlExecutionModes newMode = isScripting
                    ? SqlExecutionModes.CaptureSql
                    : SqlExecutionModes.ExecuteSql;
                //now, do the execution itself
                GetServerConnectionForScript().SqlExecutionModes = newMode;
                if (sqlDialogSubject != null)
                {
                    sqlDialogSubject.ExecutionManager.ConnectionContext.SqlExecutionModes = newMode;
                }

                executionResult = DoPreProcessExecutionAndRunViews(executionInfo.RunType);

                if (isScripting)
                {
                    if (executionResult == ExecutionMode.Success)
                    {
                        szScript = BuildSqlScript();
                    }
                }
            }
            finally
            {
                GetServerConnectionForScript().SqlExecutionModes = executionModeOriginal;

                if (isScripting)
                {
                    GetServerConnectionForScript().CapturedSql.Clear();
                }

                if (sqlDialogSubject != null)
                {
                    sqlDialogSubject.ExecutionManager.ConnectionContext.SqlExecutionModes = subjectExecutionModeOriginal;
                    if (isScripting)
                    {
                        sqlDialogSubject.ExecutionManager.ConnectionContext.CapturedSql.Clear();
                    }
                }

                //see if we need to restore the server
                if (oldServer != null)
                {
                    DataContainer.Server = oldServer;
                }
            }

            if (isScripting)
            {
                executionInfo.Script = szScript;
            }
        }
示例#44
0
 protected override SynchronizedNotifiableCollection <T> CreateNotifiableCollection <T>(ExecutionMode executionMode, IThreadManager threadManager)
 {
     return(new FilterableNotifiableCollection <T>(threadManager));
 }
示例#45
0
 internal StageCategory(string name, Guid id, ExecutionMode executionMode)
 {
     ExecutionMode = executionMode;
     Id            = id;
     Name          = name;
 }
示例#46
0
 public ExecutionModeEventArgs(ExecutionMode mode)
 {
     Mode = mode;
 }
示例#47
0
 /// <summary>
 /// Asynchronously starts a new search <see cref="Job"/>.
 /// </summary>
 /// <param name="search">
 /// The search language string to execute.
 /// </param>
 /// <param name="mode">
 /// The search <see cref="ExecutionMode"/>. A value of <see cref=
 /// "ExecutionMode.Normal"/> or <see cref="ExecutionMode.Blocking"/> is
 /// required. The default value is <see cref="ExecutionMode.Normal"/>.
 /// <param name="mode">
 /// </param>
 /// <returns>
 /// An object representing the search job that was started.
 /// </returns>
 /// <remarks>
 /// This method uses the <a href="http://goo.gl/JZcPEb">POST 
 /// search/jobs</a> endpoint to start a job to execute the specified
 /// <see cref="search"/> language string in <see cref="mode"/>.
 /// </remarks>
 public async Task<Job> CreateJobAsync(string search, ExecutionMode mode = ExecutionMode.Normal)
 {
     return await this.CreateJobAsync(new JobArgs(search) { ExecutionMode = mode });
 }
示例#48
0
        public Transition(Predicate <T> _Function, Predicate <T> _SolvePredicate, Action <T> _DecreaseAction, Action <T> _IncreaseAction, ExecutionMode _mode, int _key, int _TimePeriod = 0)
        {
            Function       = _Function;
            SolvePredicate = _SolvePredicate;
            DecreaseAction = _DecreaseAction;
            IncreaseAction = _IncreaseAction;
            mode           = _mode;
            key            = _key;

            TimePeriod = _TimePeriod;
        }
示例#49
0
        public static async Task <SmallBasicEngine> VerifyExecutionState(this SmallBasicCompilation compilation, ExecutionState executionState, ExecutionMode mode = ExecutionMode.RunToEnd)
        {
            compilation.VerifyDiagnostics();

            SmallBasicEngine engine = new SmallBasicEngine(compilation, new LibrariesCollection());

            engine.Mode = mode;
            await engine.Execute().ConfigureAwait(false);

            engine.State.Should().Be(executionState);

            return(engine);
        }
示例#50
0
 public Task<Job> SearchAsync(string search, int count = 0, 
     ExecutionMode mode = ExecutionMode.Normal, JobArgs args = null,
     CustomJobArgs customArgs = null)
 {
     Contract.Requires<ArgumentNullException>(search != null);
     return default(Task<Job>);
 }
示例#51
0
 internal static ExecutionMode GetMoreUncertain(this ExecutionMode @this, ExecutionMode other)
 {
     return((ExecutionMode)Math.Max((int)other, (int)@this));
 }
 public void SetExecutionMode(ExecutionMode mode)
 {
     _properties.SetExecutionMode(mode);
 }
示例#53
0
 protected virtual SynchronizedNotifiableCollection <T> CreateNotifiableCollection <T>(ExecutionMode executionMode,
                                                                                       IThreadManager threadManager)
 {
     return(new SynchronizedNotifiableCollection <T>
     {
         ThreadManager = threadManager
     });
 }
示例#54
0
 /// <summary>
 /// Creates a new instance of the <see cref="CalculationEngine"/> class. The optimizer and 
 /// cache are enabled.
 /// </summary>
 /// <param name="cultureInfo">
 /// The <see cref="CultureInfo"/> required for correctly reading floating poin numbers.
 /// </param>
 /// <param name="executionMode">The execution mode that must be used for formula execution.</param>
 public CalculationEngine(CultureInfo cultureInfo, ExecutionMode executionMode)
     : this(cultureInfo, executionMode, true, true)
 {
 }
示例#55
0
            IEntity IConstructOperation.Construct(params object[] args)
            {
                using (HeavyProfiler.Log("Construct", () => Symbol.Symbol.Key))
                {
                    OperationLogic.AssertOperationAllowed(Symbol.Symbol, inUserInterface: false);

                    OperationLogEntity log = new OperationLogEntity
                    {
                        Operation = Symbol.Symbol,
                        Start     = TimeZoneManager.Now,
                        User      = UserHolder.Current?.ToLite()
                    };

                    try
                    {
                        using (Transaction tr = new Transaction())
                        {
                            T result = null;
                            using (OperationLogic.AllowSave <T>())
                                OperationLogic.OnSuroundOperation(this, null, log, args).EndUsing(_ =>
                                {
                                    result = Construct(args);

                                    AssertEntity(result);

                                    if ((result != null && !result.IsNew) || LogAlsoIfNotSaved)
                                    {
                                        log.SetTarget(result);
                                        log.End = TimeZoneManager.Now;
                                    }
                                    else
                                    {
                                        log = null;
                                    }
                                });

                            if (log != null)
                            {
                                using (ExecutionMode.Global())
                                    log.Save();
                            }

                            return(tr.Commit(result));
                        }
                    }
                    catch (Exception ex)
                    {
                        OperationLogic.SetExceptionData(ex, Symbol.Symbol, null, args);

                        if (LogAlsoIfNotSaved)
                        {
                            if (Transaction.InTestTransaction)
                            {
                                throw;
                            }

                            var exLog = ex.LogException();

                            using (Transaction tr2 = Transaction.ForceNew())
                            {
                                log.Exception = exLog.ToLite();

                                using (ExecutionMode.Global())
                                    log.Save();

                                tr2.Commit();
                            }
                        }

                        throw;
                    }
                }
            }
示例#56
0
        public HostArguments(string[] args)
        {
            commands = new List <Type> {
                typeof(RemoveDeprecatedOveridesCommand), typeof(RunCommand)
            };
            startMode      = StartMode.Automatic;
            url            = "http://*****:*****@"Configures ServicePulse to listen on the specified url."
                    , s => { url = s; }
                }
            };

            extractOptions = new CaseLessOptionSet
            {
                {
                    "?|h|help", "Help about the command line options.", key => { Help = true; }
                },
                {
                    "e|extract",
                    @"Extract files to be installed in a Web Server."
                    , s =>
                    {
                        commands = new List <Type> {
                            typeof(ExtractCommand), typeof(ExtractAndUpdateConstantsCommand)
                        };
                        executionMode = ExecutionMode.Extract;
                    }
                },
                {
                    "servicecontrolurl=",
                    @"Configures the service control url."
                    , s => { serviceControlUrl = s; }
                },
                {
                    "servicecontrolmonitoringurl=",
                    @"Configures the service control monitoring url."
                    , s => { serviceControlMonitoringUrl = s; }
                },
                {
                    "outpath=",
                    @"The output path to extract files to. By default it extracts to the current directory."
                    , s => { OutputPath = s; }
                }
            };

            uninstallOptions = new CaseLessOptionSet
            {
                {
                    "?|h|help", "Help about the command line options.", key => { Help = true; }
                },
                {
                    "u|uninstall",
                    @"Uninstall the endpoint as a Windows service."
                    , s =>
                    {
                        commands = new List <Type> {
                            typeof(UninstallCommand)
                        };
                        executionMode = ExecutionMode.Uninstall;
                    }
                },
                {
                    "servicename=",
                    @"Specify the service name for the installed service."
                    , s => { ServiceName = s; }
                }
            };

            installOptions = new CaseLessOptionSet
            {
                {
                    "?|h|help",
                    "Help about the command line options.",
                    key => { Help = true; }
                },
                {
                    "i|install",
                    @"Install the endpoint as a Windows service."
                    , s =>
                    {
                        commands = new List <Type> {
                            typeof(RemoveDeprecatedOveridesCommand), typeof(ExtractAndUpdateConstantsCommand), typeof(InstallCommand)
                        };
                        executionMode = ExecutionMode.Install;
                    }
                },
                {
                    "servicename=",
                    @"Specify the service name for the installed service."
                    , s => { ServiceName = s; }
                },
                {
                    "displayname=",
                    @"Friendly name for the installed service."
                    , s => { DisplayName = s; }
                },
                {
                    "description=",
                    @"Description for the service."
                    , s => { Description = s; }
                },
                {
                    "username="******"Username for the account the service should run under."
                    , s => { Username = s; }
                },
                {
                    "password="******"Password for the service account."
                    , s => { Password = s; }
                },
                {
                    "localservice",
                    @"Run the service with the local service account."
                    , s => { ServiceAccount = ServiceAccount.LocalService; }
                },
                {
                    "networkservice",
                    @"Run the service with the network service permission."
                    , s => { ServiceAccount = ServiceAccount.NetworkService; }
                },
                {
                    "user",
                    @"Run the service with the specified username and password. Alternative the system will prompt for a valid username and password if values for both the username and password are not specified."
                    , s => { ServiceAccount = ServiceAccount.User; }
                },
                {
                    "delayed",
                    @"The service should start automatically (delayed)."
                    , s => { startMode = StartMode.Delay; }
                },
                {
                    "autostart",
                    @"The service should start automatically (default)."
                    , s => { startMode = StartMode.Automatic; }
                },
                {
                    "disabled",
                    @"The service should be set to disabled."
                    , s => { startMode = StartMode.Disabled; }
                },
                {
                    "manual",
                    @"The service should be started manually."
                    , s => { startMode = StartMode.Manual; }
                },
                {
                    "servicecontrolurl=",
                    @"Configures the service control url."
                    , s => { serviceControlUrl = s; }
                },
                {
                    "servicecontrolmonitoringurl=",
                    @"Configures the service control monitoring url."
                    , s => { serviceControlMonitoringUrl = s; }
                },
                {
                    "url=",
                    @"Configures ServicePulse to listen on the specified url."
                    , s => { url = s; }
                }
            };

            try
            {
                List <string> unknownArgsList;

                unknownArgsList = installOptions.Parse(args);
                if (executionMode == ExecutionMode.Install)
                {
                    ThrowIfUnknownArgs(unknownArgsList);
                    ValidateArgs();
                    return;
                }

                unknownArgsList = uninstallOptions.Parse(args);
                if (executionMode == ExecutionMode.Uninstall)
                {
                    ThrowIfUnknownArgs(unknownArgsList);
                    return;
                }

                unknownArgsList = extractOptions.Parse(args);
                if (executionMode == ExecutionMode.Extract)
                {
                    ThrowIfUnknownArgs(unknownArgsList);
                    ValidateArgs();
                    return;
                }

                unknownArgsList = runOptions.Parse(args);
                ThrowIfUnknownArgs(unknownArgsList);
                ValidateArgs();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                Help = true;
            }
        }
示例#57
0
 internal void SetAbortState(ExecutionMode abortReason, JSValue abortInfo)
 {
     _executionMode = abortReason;
     _executionInfo = abortInfo;
 }
示例#58
0
            void IDeleteOperation.Delete(IEntity entity, params object[] args)
            {
                using (HeavyProfiler.Log("Delete", () => Symbol.Symbol.Key))
                {
                    OperationLogic.AssertOperationAllowed(Symbol.Symbol, inUserInterface: false);

                    string error = OnCanDelete((T)entity);
                    if (error != null)
                    {
                        throw new ApplicationException(error);
                    }

                    OperationLogEntity log = new OperationLogEntity
                    {
                        Operation = Symbol.Symbol,
                        Start     = TimeZoneManager.Now,
                        User      = UserHolder.Current?.ToLite()
                    };

                    using (OperationLogic.AllowSave(entity.GetType()))
                        OperationLogic.OnSuroundOperation(this, log, entity, args).EndUsing(_ =>
                        {
                            try
                            {
                                using (Transaction tr = new Transaction())
                                {
                                    OnDelete((T)entity, args);

                                    log.SetTarget(entity);
                                    log.End = TimeZoneManager.Now;

                                    using (ExecutionMode.Global())
                                        log.Save();

                                    tr.Commit();
                                }
                            }
                            catch (Exception ex)
                            {
                                OperationLogic.SetExceptionData(ex, Symbol.Symbol, (Entity)entity, args);

                                if (Transaction.InTestTransaction)
                                {
                                    throw;
                                }

                                var exLog = ex.LogException();

                                using (Transaction tr2 = Transaction.ForceNew())
                                {
                                    log.Target    = entity.ToLite();
                                    log.Exception = exLog.ToLite();

                                    using (ExecutionMode.Global())
                                        log.Save();

                                    tr2.Commit();
                                }

                                throw;
                            }
                        });
                }
            }
 /// <summary>
 /// Invokes those of the supplied project invocation rules that are valid and enabled.
 /// </summary>
 /// <param name="mode">The ExecutionMode to be used.</param>
 /// <param name="rules">The project invocation rules that are to be invoked.</param>
 public void Run(ExecutionMode mode, ProjectInvocationRule[] rules)
 {
     lock (m_runLock) {
         var d = new ProjectExecutionDialogue();
         if (m_bounds.HasValue) {
             d.Bounds = m_bounds.Value;
             d.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
         }
         PerformActiveAdapterAction(a => a.Run(mode, rules, m_manager, d));
         m_bounds = d.Bounds;
     }
 }
        /// <summary>
        /// Initializes TCP channel and starts remoting server. Should only be called once!
        /// </summary>
        private void CreateInterProcessCommunicationServer(int maximumRetries)
        {
            ThreadExceptionEventHandler terminator = new ThreadExceptionEventHandler(Application_FatalError);

            Application.ThreadException += terminator;

            if (Mode == ExecutionMode.Client)
            {
                throw new InvalidOperationException("Server cannot be created in this AppDomain because a client has been created");
            }
            else if (Mode == ExecutionMode.Server)
            {
                return;
            }

            int retryCount = 0;

            try
            {
                Configuration config = Configuration.GetNewInstance();
                while (true)
                {
                    try
                    {
                        IDictionary properties = new Hashtable(3);
                        properties.Add("bindTo", "127.0.0.1");
                        properties.Add("port", config.Settings.FrameworkTcpPort);
                        TcpChannel tcpChannel = new TcpChannel(properties, null, null);
                        ChannelServices.RegisterChannel(tcpChannel, false);
                        //chnl.GetUrlsForUri(RemotingUri)[0];
                        RemotingServices.Marshal(this, GetUniqueRemotingUri(config.ConfigFilePath));

                        // exit retry while loop
                        break;
                    }
                    catch (Exception ex)
                    {
                        System.Diagnostics.Debug.WriteLine(ex.Message);

                        SocketException sex = ex as SocketException;
                        if (sex != null)
                        {
                            // port already in use
                            if (sex.ErrorCode == 10048)
                            {
                                // increment port number and for retry
                                config.Settings.FrameworkTcpPort += 1;
                                Configuration.Save(config);
                            }
                        }

                        if (++retryCount > maximumRetries)
                        {
                            throw;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw new GeneralException("Framework interprocess communication initalization failed. Please restart and try again.", ex);
            }

            Mode = ExecutionMode.Server;
            Application.ThreadException -= terminator;


            // the unhandled exception handler is disabled in debug builds
            AttachExceptionHandler();
        }