Exemplo n.º 1
0
        public override void Execute(SharedObjects shared)
        {
            string pointName = PopValueAssert(shared).ToString();

            AssertArgBottomAndConsume(shared);

            WaypointManager wpm = WaypointManager.Instance();

            if (wpm == null) // When zero waypoints exist, there might not even be a waypoint manager.
            {
                ReturnValue = null;
                // I don't like returning null here without the user being able to test for that, but
                // we don't have another way to communicate "no such waypoint".  We really need to address
                // that problem once and for all.
                return;
            }

            string   baseName;
            int      index;
            bool     hasGreek = WaypointValue.GreekToInteger(pointName, out index, out baseName);
            Waypoint point    = wpm.AllWaypoints().FirstOrDefault(
                p => String.Equals(p.name, baseName, StringComparison.CurrentCultureIgnoreCase) && (!hasGreek || p.index == index));

            ReturnValue = new WaypointValue(point, shared);
        }
Exemplo n.º 2
0
        public override void Execute(SharedObjects shared)
        {
            AssertArgBottomAndConsume(shared); // no args

            // ReSharper disable SuggestUseVarKeywordEvident
            ListValue <WaypointValue> returnList = new ListValue <WaypointValue>();
            // ReSharper enable SuggestUseVarKeywordEvident

            WaypointManager wpm = WaypointManager.Instance();

            if (wpm == null)
            {
                ReturnValue = returnList; // When no waypoints exist, there isn't even a waypoint manager at all.
                return;
            }

            List <Waypoint> points = wpm.Waypoints;

            // If the code below gets used in more places it may be worth moving into a factory method
            // akin to how PartValueFactory makes a ListValue<PartValue> from a List<Part>.
            // But for now, this is the only place it's done:

            foreach (Waypoint point in points)
            {
                WaypointValue wp = WaypointValue.CreateWaypointValueWithCheck(point, shared, true);
                if (wp != null)
                {
                    returnList.Add(wp);
                }
            }
            ReturnValue = returnList;
        }
Exemplo n.º 3
0
        public override void Execute(SharedObjects shared)
        {
            string pointName = PopValueAssert(shared).ToString();

            AssertArgBottomAndConsume(shared);

            WaypointManager wpm = WaypointManager.Instance();

            // If no contracts have been generated with waypoints in them,
            // then sometimes the stock game's waypoint manager doesn't even
            // exist yet either.  (The base game seems not to instance one until the
            // first time a contract with a waypoint is created).
            if (wpm == null)
            {
                throw new KOSInvalidArgumentException("waypoint", "\"" + pointName + "\"", "no waypoints exist");
            }

            // If this name has a greek letter in it's spelling like "alpha", "beta", etc, then it
            // is probably part of a waypoint cluster.
            // Waypoint clusters are actually 1 waypoint with an array of "children" by index number.
            // where the waypoint's name is just the base part with the "alpha", "beta", etc suffix removed.
            string baseName;
            int    index;
            bool   hasGreek = WaypointValue.GreekToInteger(pointName, out index, out baseName);

            Waypoint point = null;

            if (hasGreek) // Attempt to find it as part of a waypoint cluster.
            {
                point = wpm.Waypoints.FirstOrDefault(
                    p => string.Equals(p.name, baseName, StringComparison.CurrentCultureIgnoreCase) && (!hasGreek || p.index == index));
                if (point != null) // Will be null if this name is not really a waypoint cluster.
                {
                    pointName = baseName;
                }
            }
            if (point == null) // Either it had no greek letter, or it did but wasn't a waypoint cluster.  Try it as a vanilla waypoint:
            {
                point = wpm.Waypoints.FirstOrDefault(
                    p => string.Equals(p.name, pointName, StringComparison.CurrentCultureIgnoreCase) && (!hasGreek || p.index == index));
            }

            // If it's still null at this point then give up - we can't find such a waypoint name:
            if (point == null)
            {
                throw new KOSInvalidArgumentException("waypoint", "\"" + pointName + "\"", "no such waypoint");
            }

            ReturnValue = WaypointValue.CreateWaypointValueWithCheck(point, shared, false);
        }
Exemplo n.º 4
0
        public override void Execute(SharedObjects shared)
        {
            string pointName = PopValueAssert(shared).ToString();

            AssertArgBottomAndConsume(shared);

            WaypointManager wpm = WaypointManager.Instance();

            // If no contracts have been generated with waypoints in them,
            // then sometimes the stock game's waypoint manager doesn't even
            // exist yet either.  (The base game seems not to instance one until the
            // first time a contract with a waypoint is created).
            if (wpm == null)
            {
                throw new KOSInvalidArgumentException("waypoint", "\"" + pointName + "\"", "no waypoints exist");
            }

            string baseName;
            int    index;
            bool   hasGreek = WaypointValue.GreekToInteger(pointName, out index, out baseName);

            if (hasGreek)
            {
                pointName = baseName;
            }
            Waypoint point = wpm.Waypoints.FirstOrDefault(
                p => string.Equals(p.name, pointName, StringComparison.CurrentCultureIgnoreCase) && (!hasGreek || p.index == index));

            // We can't communicate the concept of a lookup fail to the script in a way it can catch (can't do
            // nulls), so bomb out here:
            if (point == null)
            {
                throw new KOSInvalidArgumentException("waypoint", "\"" + pointName + "\"", "no such waypoint");
            }

            ReturnValue = new WaypointValue(point, shared);
        }
        public void Run()
        {
            _logger.Log("Begin");

            var complexContext = TstEngineContextHelper.CreateAndInitContext();

            var context      = complexContext.EngineContext;
            var worldContext = complexContext.WorldContext;

            //var dictionary = context.Dictionary;

            var platformListener = new TstPlatformHostListener();

            var npcSettings = new HumanoidNPCSettings();

            npcSettings.Id = "#020ED339-6313-459A-900D-92F809CEBDC5";
            //npcSettings.HostFile = Path.Combine(Directory.GetCurrentDirectory(), @"Source\Hosts\PeaceKeeper\PeaceKeeper.host");
            npcSettings.LogicFile       = Path.Combine(Directory.GetCurrentDirectory(), @"Source\Apps\PeaceKeeper\PeaceKeeper.sobj");
            npcSettings.HostListener    = platformListener;
            npcSettings.PlatformSupport = new PlatformSupportCLIStub();

            _logger.Log($"npcSettings = {npcSettings}");

            var tstBaseManualControllingGameComponent = new TstBaseManualControllingGameComponent(npcSettings, worldContext);

            var methodName = NameHelper.CreateName("go");

            var command = new Command();

            command.Name       = methodName;
            command.ParamsDict = new Dictionary <StrongIdentifierValue, Value>();

            var param1Value = new WaypointValue(25, 36, context);
            var param1Name  = NameHelper.CreateName("to");

            command.ParamsDict[param1Name] = param1Value;

            var param2Value = new NumberValue(12.4);
            var param2Name  = NameHelper.CreateName("speed");

            command.ParamsDict[param2Name] = param2Value;

            _logger.Log($"command = {command}");

            //ExecuteCommand(tstBaseManualControllingGameComponent, command);

            methodName = NameHelper.CreateName("shoot");

            command      = new Command();
            command.Name = methodName;

            ExecuteCommand(tstBaseManualControllingGameComponent, command);

            var gameObjectSettings = new GameObjectSettings();

            gameObjectSettings.Id = "#120ED339-6313-459A-900D-92F809CEBDC5";

            var gunPlatformHostListener = new TstGunPlatformHostListener();

            gameObjectSettings.HostListener = gunPlatformHostListener;

            _logger.Log($"gameObjectSettings = {gameObjectSettings}");

            var gameObject = new GameObjectImplementation(gameObjectSettings, worldContext);

            tstBaseManualControllingGameComponent.AddToManualControl(gameObject, 12);

            methodName = NameHelper.CreateName("shoot");

            command      = new Command();
            command.Name = methodName;

            ExecuteCommand(tstBaseManualControllingGameComponent, command);

            var manualControlledObjectsList = tstBaseManualControllingGameComponent.GetManualControlledObjects();

            //_logger.Log($"manualControlledObjectsList = {manualControlledObjectsList.WriteListToString()}");
            _logger.Log($"manualControlledObjectsList.Count = {manualControlledObjectsList.Count}");

            tstBaseManualControllingGameComponent.RemoveFromManualControl(gameObject);

            manualControlledObjectsList = tstBaseManualControllingGameComponent.GetManualControlledObjects();

            _logger.Log($"manualControlledObjectsList.Count = {manualControlledObjectsList.Count}");

            _logger.Log("End");
        }
Exemplo n.º 6
0
        public void Run()
        {
            _logger.Log("Begin");

            var complexContext = TstEngineContextHelper.CreateAndInitContext();

            var context      = complexContext.EngineContext;
            var worldContext = complexContext.WorldContext;

            //var dictionary = context.Dictionary;

            var platformTypesConvertorsRegistry = worldContext.PlatformTypesConvertorsRegistry;

            //var platformTypesConvertorsRegistry = new PlatformTypesConvertorsRegistry(context.Logger);

            //var convertor_1 = new Vector3AndWayPointValueConvertor();

            //platformTypesConvertorsRegistry.AddConvertor(convertor_1);

            //var convertor_2 = new FloatAndNumberValueConvertor();

            //platformTypesConvertorsRegistry.AddConvertor(convertor_2);

            var endpointsRegistries = new List <IEndpointsRegistry>();

            var endpointsRegistry = new EndpointsRegistry(context.Logger);

            endpointsRegistries.Add(endpointsRegistry);

            var endpointsRegistry_2 = new EndpointsRegistry(context.Logger);
            //endpointsRegistries.Add(endpointsRegistry_2);

            var endpointsProxyRegistryForDevices = new EndpointsProxyRegistryForDevices(context.Logger, endpointsRegistry_2, new List <int>()
            {
                1, 2, 3
            });

            endpointsRegistries.Add(endpointsProxyRegistryForDevices);

            var endPointsResolver = new EndPointsResolver(context.Logger, platformTypesConvertorsRegistry);

            var invokingInMainThread = DefaultInvokerInMainThreadFactory.Create();

            var endPointActivator = new EndPointActivator(context.Logger, platformTypesConvertorsRegistry, invokingInMainThread);

            var platformListener = new TstPlatformHostListener();

            var platformEndpointsList = EndpointDescriber.GetEndpointsInfoList(platformListener);

            endpointsRegistry.AddEndpointsRange(platformEndpointsList);

            var gunPlatformHostListener = new TstGunPlatformHostListener();

            platformEndpointsList = EndpointDescriber.GetEndpointsInfoList(gunPlatformHostListener);

            endpointsRegistry_2.AddEndpointsRange(platformEndpointsList);

            //----------------------------------

            var methodName = NameHelper.CreateName("go");

            //var listener = new TstCoreHostListener();

            var command = new Command();

            command.Name       = methodName;
            command.ParamsDict = new Dictionary <StrongIdentifierValue, Value>();

            var param1Value = new WaypointValue(25, 36, context);
            var param1Name  = NameHelper.CreateName("to");

            command.ParamsDict[param1Name] = param1Value;

            //var param2Value = new NumberValue(12.4);
            //var param2Name = NameHelper.CreateName("speed", dictionary);

            //command.ParamsDict[param2Name] = param2Value;

            _logger.Log($"command = {command}");

            //----------------------------------

            var endPointInfo = endPointsResolver.GetEndpointInfo(command, endpointsRegistries);

            _logger.Log($"endPointInfo = {endPointInfo}");

            if (endPointInfo != null)
            {
                var processInfo = endPointActivator.Activate(endPointInfo, command);

                _logger.Log($"processInfo = {processInfo}");

                processInfo.Start();

                Thread.Sleep(10000);

                _logger.Log("Cancel");

                processInfo.Cancel();

                Thread.Sleep(10000);
            }

            methodName = NameHelper.CreateName("shoot");

            command      = new Command();
            command.Name = methodName;

            endPointInfo = endPointsResolver.GetEndpointInfo(command, endpointsRegistries);

            _logger.Log($"endPointInfo = {endPointInfo}");

            if (endPointInfo != null)
            {
                var processInfo = endPointActivator.Activate(endPointInfo, command);

                _logger.Log($"processInfo = {processInfo}");

                processInfo.Start();

                Thread.Sleep(10000);

                _logger.Log("Cancel");

                processInfo.Cancel();

                Thread.Sleep(10000);
            }

            //----------------------------------
            //var platformListener = new TstPlatformHostListener();

            //var platformEndpointsList = EndpointDescriber.GetEndpointsInfoList(platformListener);

            //_logger.Log($"platformEndpointsList = {platformEndpointsList.WriteListToString()}");

            //var goEndpoint = platformEndpointsList.FirstOrDefault(p => p.Name == "go");

            //_logger.Log($"goEndpoint = {goEndpoint}");

            //var tokenSource = new CancellationTokenSource();
            //var token = tokenSource.Token;

            //var parameterList = new List<object>() { token, new Vector3(12, 15, 0), 25 }.ToArray();

            //var task = new Task(() =>
            //{
            //    try
            //    {
            //        goEndpoint.MethodInfo.Invoke(platformListener, parameterList);
            //    }
            //    catch(TargetInvocationException)
            //    {
            //    }
            //    catch(Exception e)
            //    {
            //        _logger.Log($"e = {e}");
            //    }

            //}, token);

            //var processInfo = new PlatformProcessInfo(task, tokenSource, goEndpoint.Devices);

            //_logger.Log($"processInfo = {processInfo}");

            //processInfo.Start();

            //Thread.Sleep(10000);

            //_logger.Log("Cancel");

            //processInfo.Cancel();

            //Thread.Sleep(10000);
            //-----------
            //var tokenSource = new CancellationTokenSource();
            //var token = tokenSource.Token;

            //var task = new Task(() => {
            //    platformListener.GoToImpl(token, new Vector3(12, 15, 0));
            //}, token);

            //task.Start();

            //Thread.Sleep(10000);

            //_logger.Log("Cancel");

            //tokenSource.Cancel();

            //Thread.Sleep(10000);

            //var process = listener.CreateProcess(command);

            //_logger.Log($"process = {process}");

            _logger.Log("End");
        }
Exemplo n.º 7
0
        private bool CommandLoop()
        {
            try
            {
                if (_currentCodeFrame == null)
                {
#if DEBUG
                    //Log("_currentCodeFrame == null return false;");
#endif

                    return(false);
                }

                var currentPosition = _currentCodeFrame.CurrentPosition;

#if DEBUG
                //Log($"currentPosition = {currentPosition}");
#endif

                var compiledFunctionBodyCommands = _currentCodeFrame.CompiledFunctionBody.Commands;

#if DEBUG
                //Log($"compiledFunctionBodyCommands.Count = {compiledFunctionBodyCommands.Count}");
#endif

                if (currentPosition >= compiledFunctionBodyCommands.Count)
                {
#if DEBUG
                    //Log("currentPosition >= compiledFunctionBodyCommands.Count return true;");
#endif
                    GoBackToPrevCodeFrame();
                    return(true);
                }

                var currentCommand = compiledFunctionBodyCommands[currentPosition];

#if DEBUG
                //Log($"currentCommand = {currentCommand}");
                //Log($"_currentCodeFrame = {_currentCodeFrame.ToDbgString()}");
#endif

                if (!CheckReturnedInfo())
                {
#if DEBUG
                    //Log("!CheckReturnedInfo()");
#endif

                    return(false);
                }

                switch (currentCommand.OperationCode)
                {
                case OperationCode.Nop:
                    _currentCodeFrame.CurrentPosition++;
                    break;

                case OperationCode.ClearStack:
                    _currentCodeFrame.ValuesStack.Clear();
                    _currentCodeFrame.CurrentPosition++;
                    break;

                case OperationCode.PushVal:
                    _currentCodeFrame.ValuesStack.Push(currentCommand.Value);
                    _currentCodeFrame.CurrentPosition++;
                    break;

                case OperationCode.PushValFromVar:
                {
                    var varName = currentCommand.Value.AsStrongIdentifierValue;

#if DEBUG
                    //Log($"varName = {varName}");
#endif

                    var targetValue = _varsResolver.GetVarValue(varName, _currentCodeFrame.LocalContext, ResolverOptions.GetDefaultOptions());

#if DEBUG
                    //Log($"targetValue = {targetValue}");
#endif

                    _currentCodeFrame.ValuesStack.Push(targetValue);

#if DEBUG
                    //Log($"_currentCodeFrame = {_currentCodeFrame.ToDbgString()}");
#endif

                    _currentCodeFrame.CurrentPosition++;
                }
                break;

                case OperationCode.PushValToVar:
                {
                    var varName = currentCommand.Value.AsStrongIdentifierValue;

#if DEBUG
                    //Log($"varName = {varName}");
#endif

                    if (varName.KindOfName != KindOfName.Var)
                    {
                        throw new NotImplementedException();
                    }

                    var currentValue = _currentCodeFrame.ValuesStack.Peek();

#if DEBUG
                    //Log($"currentValue = {currentValue}");
#endif

                    _currentVarStorage.SetValue(varName, currentValue);

#if DEBUG
                    //Log($"_currentCodeFrame = {_currentCodeFrame.ToDbgString()}");
#endif

                    _currentCodeFrame.CurrentPosition++;
                }
                break;

                case OperationCode.CallBinOp:
                {
                    var paramsList = TakePositionedParameters(3);

#if DEBUG
                    //Log($"paramsList = {paramsList.WriteListToString()}");
                    //Log($"_currentCodeFrame = {_currentCodeFrame.ToDbgString()}");
#endif

                    var kindOfOperator = currentCommand.KindOfOperator;

                    if (kindOfOperator == KindOfOperator.IsNot)
                    {
                        kindOfOperator = KindOfOperator.Is;
                    }

#if DEBUG
                    //Log($"kindOfOperator = {kindOfOperator}");
#endif

                    var operatorInfo = _operatorsResolver.GetOperator(kindOfOperator, _currentCodeFrame.LocalContext, ResolverOptions.GetDefaultOptions());

#if DEBUG
                    //Log($"operatorInfo (1) = {operatorInfo}");
#endif

                    CallOperator(operatorInfo, paramsList);

#if DEBUG
                    //Log($"_currentCodeFrame = {_currentCodeFrame.ToDbgString()}");
#endif

                    if (currentCommand.KindOfOperator == KindOfOperator.IsNot)
                    {
                        var result = _currentCodeFrame.ValuesStack.Pop();

#if DEBUG
                        //Log($"result = {result}");
#endif

                        result = result.AsLogicalValue.Inverse();

#if DEBUG
                        //Log($"result (2) = {result}");
#endif

                        _currentCodeFrame.ValuesStack.Push(result);

#if DEBUG
                        //Log($"_currentCodeFrame = {_currentCodeFrame.ToDbgString()}");
#endif
                    }

                    _currentCodeFrame.CurrentPosition++;
                }
                break;

                case OperationCode.CallUnOp:
                {
                    var paramsList = TakePositionedParameters(2);

#if DEBUG
                    //Log($"paramsList = {paramsList.WriteListToString()}");
                    //Log($"_currentCodeFrame = {_currentCodeFrame.ToDbgString()}");
#endif

                    var kindOfOperator = currentCommand.KindOfOperator;

                    var operatorInfo = _operatorsResolver.GetOperator(kindOfOperator, _currentCodeFrame.LocalContext, ResolverOptions.GetDefaultOptions());

#if DEBUG
                    //Log($"operatorInfo (2)= {operatorInfo}");
#endif

                    CallOperator(operatorInfo, paramsList);

#if DEBUG
                    //Log($"_currentCodeFrame = {_currentCodeFrame.ToDbgString()}");
#endif

                    _currentCodeFrame.CurrentPosition++;
                }
                break;

                case OperationCode.Call:
                    CallFunction(KindOfFunctionParameters.NoParameters, currentCommand.CountParams, true);
                    break;

                case OperationCode.Call_P:
                    CallFunction(KindOfFunctionParameters.PositionedParameters, currentCommand.CountParams, true);
                    break;

                case OperationCode.Call_N:
                    CallFunction(KindOfFunctionParameters.NamedParameters, currentCommand.CountParams, true);
                    break;

                case OperationCode.AsyncCall_N:
                    CallFunction(KindOfFunctionParameters.NamedParameters, currentCommand.CountParams, false);
                    break;

                case OperationCode.UseInheritance:
                    ProcessUseInheritance();
                    break;

                case OperationCode.UseNotInheritance:
                    ProcessUseNotInheritance();
                    break;

                case OperationCode.AllocateAnonymousWaypoint:
                {
                    if (currentCommand.CountParams == 0)
                    {
                        throw new NotImplementedException();
                        //break;
                    }

#if DEBUG
                    //Log($"currentCommand.CountParams = {currentCommand.CountParams}");
#endif

                    var paramsList = TakePositionedParameters(currentCommand.CountParams);

#if DEBUG
                    //Log($"paramsList = {paramsList.WriteListToString()}");
                    //Log($"_currentCodeFrame = {_currentCodeFrame.ToDbgString()}");
#endif

                    switch (currentCommand.CountParams)
                    {
                    case 2:
                    {
                        var firstParam = paramsList[0];

#if DEBUG
                        //Log($"firstParam = {firstParam}");
#endif

                        var resolvedFirstParam = _numberValueLinearResolver.Resolve(firstParam, _currentCodeFrame.LocalContext, ResolverOptions.GetDefaultOptions());

                        var annotationValue = paramsList[1].AsAnnotationValue;

                        var value = new WaypointValue((float)(double)resolvedFirstParam.GetSystemValue(), _context);

                        _currentCodeFrame.ValuesStack.Push(value);

                        _currentCodeFrame.CurrentPosition++;
                    }
                    break;

                    case 3:
                    {
                        var firstParam = paramsList[0];

#if DEBUG
                        //Log($"firstParam = {firstParam}");
#endif

                        var resolvedFirstParam = _numberValueLinearResolver.Resolve(firstParam, _currentCodeFrame.LocalContext, ResolverOptions.GetDefaultOptions());

                        var secondParam = paramsList[1];

#if DEBUG
                        //Log($"secondParam = {secondParam}");
#endif

                        var resolvedSecondParam = _numberValueLinearResolver.Resolve(secondParam, _currentCodeFrame.LocalContext, ResolverOptions.GetDefaultOptions());

                        var annotationValue = paramsList[2].AsAnnotationValue;

                        var value = new WaypointValue((float)(double)resolvedFirstParam.GetSystemValue(), (float)(double)resolvedSecondParam.GetSystemValue(), _context);

                        _currentCodeFrame.ValuesStack.Push(value);

                        _currentCodeFrame.CurrentPosition++;
                    }
                    break;

                    default:
                        throw new ArgumentOutOfRangeException(nameof(currentCommand.CountParams), currentCommand.CountParams, null);
                    }
                }
                break;

                case OperationCode.SetSEHGroup:
                {
#if DEBUG
                    //Log($"currentCommand = {currentCommand}");
#endif

                    var targetSEHGroup = _currentCodeFrame.CompiledFunctionBody.SEH[currentCommand.TargetPosition];

#if DEBUG
                    //Log($"targetSEHGroup = {targetSEHGroup}");
#endif

                    _currentCodeFrame.CurrentSEHGroup = targetSEHGroup;
                    _currentCodeFrame.SEHStack.Push(targetSEHGroup);

                    _currentCodeFrame.CurrentPosition++;
                }
                break;

                case OperationCode.RemoveSEHGroup:
                {
#if DEBUG
                    //Log($"currentCommand = {currentCommand}");
#endif

                    _currentCodeFrame.SEHStack.Pop();

                    if (_currentCodeFrame.SEHStack.Count == 0)
                    {
                        _currentCodeFrame.CurrentSEHGroup = null;
                    }
                    else
                    {
                        _currentCodeFrame.CurrentSEHGroup = _currentCodeFrame.SEHStack.Peek();
                    }

                    _currentCodeFrame.CurrentPosition++;
                }
                break;

                case OperationCode.JumpTo:
                {
#if DEBUG
                    //Log($"currentCommand = {currentCommand}");
#endif

                    _currentCodeFrame.CurrentPosition = currentCommand.TargetPosition;
                }
                break;

                case OperationCode.Error:
                {
#if DEBUG
                    //Log("Begin case OperationCode.Error");
#endif

#if DEBUG
                    //Log($"currentCommand = {currentCommand}");
                    //Log($"_currentCodeFrame = {_currentCodeFrame.ToDbgString()}");
#endif

                    var currentValue = _currentCodeFrame.ValuesStack.Peek();

#if DEBUG
                    //Log($"currentValue = {currentValue}");
#endif

                    var ruleInstance = currentValue.AsRuleInstanceValue.RuleInstance;

                    var errorValue = new ErrorValue(ruleInstance);
                    errorValue.CheckDirty();

#if DEBUG
                    //Log($"errorValue = {errorValue}");
#endif

                    _currentError = errorValue;



                    if (_currentCodeFrame.CurrentSEHGroup == null)
                    {
                        _currentCodeFrame.ProcessInfo.Status = ProcessStatus.Faulted;

                        GoBackToPrevCodeFrame();
                    }
                    else
                    {
#if DEBUG
                        //Log("_currentSEHGroup != null");
#endif

                        if (!CheckSEH())
                        {
                            _currentCodeFrame.ProcessInfo.Status = ProcessStatus.Faulted;

                            GoBackToPrevCodeFrame();
                        }
                    }

                    _globalLogicalStorage.Append(ruleInstance);

#if DEBUG
                    //Log("End case OperationCode.Error");
#endif
                }
                break;

                case OperationCode.Return:
                {
#if DEBUG
                    //Log("Begin case OperationCode.Return");
#endif

                    _currentCodeFrame.ProcessInfo.Status = ProcessStatus.Completed;

                    GoBackToPrevCodeFrame();

#if DEBUG
                    //_instancesStorage.PrintProcessesList();

                    //Log("End case OperationCode.Return");
#endif
                }
                break;

                default:
                    throw new ArgumentOutOfRangeException(nameof(currentCommand.OperationCode), currentCommand.OperationCode, null);
                }

                return(true);
            }
            catch (Exception e)
            {
#if DEBUG
                Error(e);
#endif

                throw;
            }
        }