public KubeMqTransportSender(ILogger <KubeMqTransportSender> logger)
 {
     _logger    = logger;
     _sender    = new Sender(logger);
     _initiator = new Initiator(logger);
     _id        = $"{Environment.MachineName}_{Guid.NewGuid()}";
 }
Ejemplo n.º 2
0
        private static void BufferUsageExample(Initiator initiator, Service service, QualityOfService qualityOfService, ClientServerMessageBus bus, List <Key> newKeys)
        {
            bus.Send(initiator, new MoreBitsArrived(newKeys));
            bus.Send(service, new MoreBitsArrived(newKeys));

            bus.Send(initiator, new Initiate());

            bus.Send(initiator, new CreateKeyBuffer("app1.in", qualityOfService));
            bus.Send(initiator, new CreateKeyBuffer("app1.out", qualityOfService));

            bus.Send(service, new CreateKeyBuffer("app1.in", qualityOfService));
            bus.Send(service, new CreateKeyBuffer("app1.out", qualityOfService));

            bus.Send(initiator, new MoreBitsArrived(newKeys));
            bus.Send(service, new MoreBitsArrived(newKeys));

            bus.Send(initiator, new Initiate());

            bus.Send(initiator, new CloseKeyBuffer("app1.in"));
            bus.Send(service, new CloseKeyBuffer("app1.in"));

            bus.Send(initiator, new GetOutBufferKey("app1.out", 128));


            bus.Send(service, new GetOutBufferKey("app1.out", 128));
        }
Ejemplo n.º 3
0
        private void SendLowLevelRequest()
        {
            initiator = new Initiator(logger);
            Response response = initiator.SendRequest(CreateLowLevelRequest(RequestType.Query));

            initiator.SendRequest(CreateLowLevelRequest(RequestType.Command));
        }
Ejemplo n.º 4
0
        static async Task Main(string[] args)
        {
            // Import parameters for the elliptic curve prime256v1
            var ecParameters = CustomNamedCurves.GetByOid(X9ObjectIdentifiers.Prime256v1);

            var publicKeyStore = new InMemoryPublicKeyStore();
            var publicKey      = await publicKeyStore.GetAsync();

            _initiator = new Initiator();

            // 1. Initiate communication with a masked point P = r*T = r*Hash(t)
            var init = _initiator.Initiate(ecParameters.Curve);
            var t    = init.t;
            var r    = init.r;
            var P    = init.P;

            // 2. Generate token Q = k*P and proof (c,z) of correctness
            var(Q, proofC, proofZ) = await _tokenApiClient.GenerateTokenAsync(ecParameters.Curve, P);

            // 3. Randomise the token Q, by removing the mask r: W = (1/r)*Q = k*T. Also checks that proof (c,z) is correct.
            var W = _initiator.RandomiseToken(ecParameters, publicKey.Q, P, Q, proofC, proofZ, r);

            // 4. Verify that the token (t,W) is correct.
            var isVerified = await _tokenApiClient.VerifyTokenAsync(t, W);

            if (isVerified)
            {
                Console.WriteLine("Token is valid.");
            }
            else
            {
                Console.WriteLine("Token is invalid.");
                Debug.Fail("Token is invalid.");
            }
        }
Ejemplo n.º 5
0
    public void SetUp()
    {
        application = new ApplicationImpl();
        SessionSettings     settings            = new SessionSettings("c:\\development\\quickfix\\test\\cfg\\at_client.cfg");
        MessageStoreFactory messageStoreFactory =
            new MemoryStoreFactory();

        QuickFix42.MessageFactory messageFactory = new QuickFix42.MessageFactory();

        initiator = new SocketInitiator
                        (application, messageStoreFactory, settings, messageFactory);

        server = new Process();
        server.StartInfo.FileName  = "c:\\development\\quickfix\\test\\debug\\at\\at";
        server.StartInfo.Arguments = "-f c:\\development\\quickfix\\test\\cfg\\at.cfg";
        server.Start();

        Thread quickFixThread = new Thread(RunThread);

        quickFixThread.Start();

        for (int i = 0; i < 50; ++i)
        {
            if (application.isLoggedOn())
            {
                break;
            }
            Thread.Sleep(1000);
        }
        if (!application.isLoggedOn())
        {
            throw new Exception();
        }
    }
Ejemplo n.º 6
0
 /// <summary>
 /// Validate the object.
 /// </summary>
 /// <exception cref="ValidationException">
 /// Thrown if validation fails
 /// </exception>
 public override void Validate()
 {
     base.Validate();
     if (Sender == null)
     {
         throw new ValidationException(ValidationRules.CannotBeNull, "Sender");
     }
     if (Recipient == null)
     {
         throw new ValidationException(ValidationRules.CannotBeNull, "Recipient");
     }
     if (Initiator != null)
     {
         Initiator.Validate();
     }
     if (Sender != null)
     {
         Sender.Validate();
     }
     if (Recipient != null)
     {
         Recipient.Validate();
     }
     if (RejectionReason != null)
     {
         if (RejectionReason.Length > 140)
         {
             throw new ValidationException(ValidationRules.MaxLength, "RejectionReason", 140);
         }
     }
 }
Ejemplo n.º 7
0
 public static string GetAnswer(string command, long chatid)
 {
     if (accounts.ContainsKey(chatid) && command.Split(' ')[0] != "login")
     {
         string[]  arguments = command.Split(" ");
         Initiator initiator = new Initiator();
         return(initiator.Build(arguments, accounts[chatid]));
     }
     else if (command.Split(' ')[0] == "login")
     {
         string answer = "";
         try
         {
             Login(chatid, command.Split(' ')[1], command.Split(' ')[2]);
             answer = "Залогинился \nИспользуй команду dialog count, где count от 1 до 200";
         } catch (Exception e)
         {
             answer = "Хуй знает даун не может залогинится";
         }
         return(answer);
     }
     else
     {
         return("Залогинься петух");
     }
 }
        public async Task <bool> UpdateAsync(long oid,
                                             DateTime?effectiveSince,
                                             PauseState state,
                                             DateTime?cancelledAt,
                                             DateTime?cancellationEffectiveSince,
                                             Initiator cancellationInitiator,
                                             PauseCancellationSource?cancellationSource)
        {
            var updated = await _decoratee.UpdateAsync(oid,
                                                       effectiveSince,
                                                       state,
                                                       cancelledAt,
                                                       cancellationEffectiveSince,
                                                       cancellationInitiator,
                                                       cancellationSource);

            if (updated)
            {
                await _log.WriteInfoAsync(nameof(RfqExecutionPauseRepositoryDecorator),
                                          nameof(UpdateAsync),
                                          new { Oid = oid }.ToJson(),
                                          $"RFQ pause has been updated therefore {nameof(RfqEvent)} is about to be published");

                var pause = await _decoratee.FindAsync(oid);

                if (pause != null)
                {
                    var rfq = await GetRfqByIdAsync(pause.OperationId);

                    await _notifyService.Rfq(rfq.ToEventContract(RfqEventTypeContract.Update, _brokerId));
                }
            }

            return(updated);
        }
Ejemplo n.º 9
0
 private Pause(long?oid,
               string operationId,
               string operationName,
               DateTime createdAt,
               DateTime?effectiveSince,
               PauseState state,
               PauseSource source,
               Initiator initiator,
               DateTime?cancelledAt,
               DateTime?cancellationEffectiveSince,
               [CanBeNull] Initiator cancellationInitiator,
               PauseCancellationSource?cancellationSource)
 {
     Oid                        = oid;
     OperationId                = operationId;
     OperationName              = operationName;
     CreatedAt                  = createdAt;
     EffectiveSince             = effectiveSince;
     State                      = state;
     Source                     = source;
     Initiator                  = initiator;
     CancelledAt                = cancelledAt;
     CancellationEffectiveSince = cancellationEffectiveSince;
     CancellationInitiator      = cancellationInitiator;
     CancellationSource         = cancellationSource;
 }
 private void setInstances()
 {
     initiator     = new Initiator(this);
     picCompressor = new PicCompressor(this);
     cleaner       = new XMLCleaner(this);
     backupHandler = new BackupHandler();
 }
Ejemplo n.º 11
0
        public static Pause Initialize(long?oid,
                                       string operationId,
                                       string operationName,
                                       DateTime createdAt,
                                       DateTime?effectiveSince,
                                       PauseState state,
                                       PauseSource source,
                                       Initiator initiator,
                                       DateTime?cancelledAt,
                                       DateTime?cancellationEffectiveSince,
                                       Initiator cancellationInitiator,
                                       PauseCancellationSource?cancellationSource)
        {
            if (!oid.HasValue)
            {
                throw new InvalidOperationException("Pause initialization can be done for persisted object only");
            }

            return(new Pause(
                       oid,
                       operationId,
                       operationName,
                       createdAt,
                       effectiveSince,
                       state,
                       source,
                       initiator,
                       cancelledAt,
                       cancellationEffectiveSince,
                       cancellationInitiator,
                       cancellationSource));
        }
Ejemplo n.º 12
0
        private Initiator CreateInitiator(ICustomPrincipal principal)
        {
            Initiator initiator = new Initiator();

            if (principal != null && principal.Identity != null)
            {
                initiator.Account = new Account()
                {
                    Name   = principal.Identity.Name,
                    Domain = principal.Identity.Domain
                };
                initiator.Assertions = new List <object>()
                {
                    new
                    {
                        principal.Identity.Name,
                        principal.Identity.Domain,
                        principal.Identity.Username,
                        principal.IpAddress
                    }
                };
            }

            return(initiator);
        }
Ejemplo n.º 13
0
        public Script ToScript()
        {
            if (Initiator == null || Receiver == null || LockTime == default(LockTime))
            {
                throw new InvalidOperationException("Parameters are incomplete");
            }
            EscrowScriptPubKeyParameters parameters = new EscrowScriptPubKeyParameters();
            List <Op> ops = new List <Op>();

            ops.Add(Op.GetPushOp(Initiator.ToBytes()));
            ops.Add(OpcodeType.OP_DEPTH);
            ops.Add(OpcodeType.OP_3);
            ops.Add(OpcodeType.OP_EQUAL);
            ops.Add(OpcodeType.OP_IF);
            {
                ops.Add(OpcodeType.OP_SWAP);
                ops.Add(Op.GetPushOp(Receiver.ToBytes()));
                ops.Add(OpcodeType.OP_CHECKSIGVERIFY);
                ops.Add(OpcodeType.OP_CODESEPARATOR);
            }
            ops.Add(OpcodeType.OP_ELSE);
            {
                ops.Add(Op.GetPushOp(LockTime));
                ops.Add(OpcodeType.OP_DROP);
            }
            ops.Add(OpcodeType.OP_ENDIF);
            ops.Add(OpcodeType.OP_CHECKSIG);
            return(new Script(ops.ToArray()));
        }
Ejemplo n.º 14
0
        static void Main(string[] args)
        {
            //initialize the Unity IoC Container and Dependency Injection
            Bootstrap.Init();
            Initiator init = DependencyInjector.Retrieve <Initiator>();

            //Instantiate the apireader and console writer objects
            _reader = init.GetReader();
            _writer = init.GetWriter();
            _reader.SetClient(uriAddress);

            //attempt to read from the Web API
            try
            {
                //Write out to the console Message 1 and 2 from the API
                _writer.Write(_reader.GetMessage(1).Result);
                _writer.Write("<Press any key to exit>");
                Console.ReadLine();
                _writer.Write(_reader.GetMessage(2).Result);

                //pause for 1 second and exit
                System.Threading.Thread.Sleep(1000);
            }
            //If an error occurs, print out teh error message and exit.
            catch (Exception ex)
            {
                _writer.Write(ex.InnerException.Message);
                _writer.Write("Please ensure the target API application is running, and the server is accessable");
                _writer.Write("<Press any key to exit>");
                Console.ReadLine();
            }
        }
Ejemplo n.º 15
0
        public void TestForError()
        {
            Task.Run(async() =>
            {
                //create tree
                Initiator root = new Initiator();
                root.NextStep  = new OperationForcedError()
                {
                    NextStep = new Terminator()
                };

                //create data
                TestData data = new TestData()
                {
                    A = 5,
                    B = 10
                };

                FlowManager man = new FlowManager();
                bool result     = await man.Execute(root, data);

                Assert.IsFalse(result);
                Assert.AreEqual(man.CurrentStep.Errors.Count, 1);
            }).GetAwaiter().GetResult();
        }
Ejemplo n.º 16
0
    public void SetUp()
    {
        application = new ApplicationImpl();
        SessionSettings settings = new SessionSettings( "c:\\development\\quickfix\\test\\cfg\\at_client.cfg" );
        MessageStoreFactory messageStoreFactory =
            new MemoryStoreFactory();
        QuickFix42.MessageFactory messageFactory = new QuickFix42.MessageFactory();

        initiator = new SocketInitiator
            (application, messageStoreFactory, settings, messageFactory);

        server = new Process();
        server.StartInfo.FileName = "c:\\development\\quickfix\\test\\debug\\at\\at";
        server.StartInfo.Arguments = "-f c:\\development\\quickfix\\test\\cfg\\at.cfg";
        server.Start();

        Thread quickFixThread = new Thread(RunThread);
        quickFixThread.Start();

        for(int i = 0;i < 50;++i)
        {
            if(application.isLoggedOn())
            {
                break;
            }
            Thread.Sleep(1000);
        }
        if(!application.isLoggedOn())
        {
            throw new Exception();
        }
    }
Ejemplo n.º 17
0
        public void OperationMultiplierTest()
        {
            Task.Run(async() =>
            {
                //create tree
                Initiator root = new Initiator();
                root.NextStep  = new OperationMultiplier()
                {
                    NextStep = new Terminator()
                };

                //create data
                TestData data = new TestData()
                {
                    A = 5,
                    B = 10
                };

                FlowManager man = new FlowManager();
                bool result     = await man.Execute(root, data);

                Assert.IsTrue(result);
                Assert.AreEqual(50, data.Result);
                Assert.AreEqual(3, man.ProcessedCounter);
            }).GetAwaiter().GetResult();
        }
Ejemplo n.º 18
0
        public async void SendRequestAsync()
        {
            // init
            string    serverAddress = "localhost:50000";
            Initiator initiator     = new Initiator(serverAddress);

            // Send Request Async and await for response
            Request request = CreateSimpleRequest();

            try
            {
                Response response = await initiator.SendRequestAsync(request);

                LogResponse(response);
            }
            catch (Exception ex)
            {
                logger.LogError(ex, "Exception in SendRequest");
            }


            // Send Request with delegate to handle the responses
            try
            {
                for (int i = 0; i < 4; i++)
                {
                    Request request2 = CreateRequestWithObjects(i);
                    initiator.SendRequest(HandleResponse, request2);
                }
            }
            catch (Exception ex)
            {
                logger.LogError(ex, "Exception in SendRequest");
            }
        }
Ejemplo n.º 19
0
        public async Task GetActiveSigningKeyPair_GivenRotationAndMasterKeyCert_ReturnsAKeyPairUsableForTokenSigning()
        {
            //Arrange
            var automocker = new AutoMocker();

            var masterKey = new byte[256];

            object cachedResult = null;

            automocker
            .SetupOptions(new AnonymousTokensConfig
            {
                KeyRotationEnabled  = true,
                CurveName           = "P-256",
                MasterKeyCertId     = "master-key-cert",
                KeyRotationInterval = TimeSpan.FromDays(3),
                KeyRotationRollover = TimeSpan.FromDays(4)
            });

            automocker
            .Setup <IMemoryCache, bool>(x => x.TryGetValue(It.IsAny <string>(), out cachedResult))
            .Returns(false);

            automocker
            .Setup <IMemoryCache, ICacheEntry>(x => x.CreateEntry(It.IsAny <string>()))
            .Returns(Mock.Of <ICacheEntry>());

            automocker
            .Setup <IAnonymousTokenMasterKeyLoader, Task <byte[]> >(x => x.LoadMasterKeyBytes())
            .ReturnsAsync(masterKey);

            var target = automocker.CreateInstance <AnonymousTokenKeyStore>();

            //Act
            var result = await target.GetActiveSigningKeyPair();

            //Assert
            var ecParameters = CustomNamedCurves.GetByOid(X9ObjectIdentifiers.Prime256v1);
            var initiator    = new Initiator();
            var init         = initiator.Initiate(ecParameters.Curve);
            var t            = init.t;
            var r            = init.r;
            var P            = init.P;

            var tokenGenerator = new TokenGenerator();

            var(Q, c, z) = tokenGenerator.GenerateToken(result.PrivateKey, result.PublicKey, ecParameters, P);

            var keyDto = result.AsValidationKey().AsKeyDto();

            var clientSideEcParameters   = CustomNamedCurves.GetByName(keyDto.Crv); // Matches keyDto.Crv == "P-256"
            var clientSidePublicKeyPoint = clientSideEcParameters.Curve.CreatePoint(new BigInteger(Convert.FromBase64String(keyDto.X)), new BigInteger(Convert.FromBase64String(keyDto.Y)));

            var W = initiator.RandomiseToken(clientSideEcParameters, clientSidePublicKeyPoint, P, Q, c, z, r);

            var tokenVerifier = new TokenVerifier(new InMemorySeedStore());
            var isVerified    = await tokenVerifier.VerifyTokenAsync(result.PrivateKey, ecParameters.Curve, t, W);

            isVerified.Should().BeTrue();
        }
        private async Task <TestRun> RunTests(TestRun testRun, Initiator initiator)
        {
            Task <bool>         doneWorker  = null;
            List <Task <bool> > testWorkers = null;

            CancellationTokenSource tokenSource = new CancellationTokenSource();
            CancellationToken       token       = tokenSource.Token;

            try
            {
                var header    = GetHeader(testRun, initiator);
                var isStarted = await _reporting.Start(testRun, _numberOfThreads, header);

                _logger.Debug($"TestRun of plan {testRun.TestPlanId} is about to run with {_numberOfThreads} threads with the following exclusion groups: {string.Join(", ", testRun.Tests.Select(t => t.ExclusionGroup).Where(g => g != null).Distinct())}");

                _testDoneQueue = new ConcurrentQueue <Test>();
                _testSchedule  = new TestExecutionSchedule(testRun.Tests);

                doneWorker = StartDoneWorker(testRun, token, header);

                var stopwatch = new Stopwatch();
                stopwatch.Start();

                testWorkers = StartTestWorkers(token, testRun.Tests.Count);

                if (await Timeout(testWorkers, _testRunTimeout, token))
                {
                    _logger.Error($"TestRun of plan {testRun.TestPlanId} timed out after {_testRunTimeout}");
                    CancelTestRun(tokenSource, testWorkers, doneWorker);
                }
                else
                {
                    stopwatch.Stop();
                    _logger.Info($"TestRun of plan {testRun.TestPlanId} finished succesfully after {stopwatch.Elapsed}");
                }

                _stop = true;
                await Task.WhenAll(doneWorker);

                await _reporting.Finished(_finished, _passed, _failed);


                return(_finished);
            }
            catch (Exception e)
            {
                try
                {
                    CancelTestRun(tokenSource, testWorkers, doneWorker);
                }
                finally
                {
                    _logger.Error($"Failed running test plan {testRun.TestPlanId}: {e}");
                    await _reporting.Stop(_finished, _passed, _failed, _finished.Tests.Count, testRun.Tests.Count);
                }

                throw;
            }
        }
Ejemplo n.º 21
0
 public GameEnding(GameObject ship, Initiator coroutineRunner,
                   GameObject gameOverObject, float endGameDelay)
 {
     this.ship            = ship;
     this.coroutineRunner = coroutineRunner;
     GameOverObject       = gameOverObject;
     this.endGameDelay    = endGameDelay;
 }
        /// <summary>
        /// Open an <b>IChannel</b> to the remote Service proxy.
        /// </summary>
        /// <seealso cref="RemoteService.OpenChannel"/>
        protected override IChannel OpenChannel()
        {
            IConnection connection = Initiator.EnsureConnection();

            return(connection.OpenChannel(NameServiceProtocol.Instance,
                                          "NameService",
                                          null,
                                          Thread.CurrentPrincipal));
        }
Ejemplo n.º 23
0
        public void WriteJsonToFile()
        {
            Task.Run(async() =>
            {
                //create tree
                Initiator root           = new Initiator();
                DecisionMultiplier child = new DecisionMultiplier()
                {
                    Paths = new List <DecisionPath>(),
                };
                child.Paths.Add(new DecisionPath()
                {
                    Value    = 25,
                    NextStep = new OperationMultiplier()
                    {
                        NextStep = new Terminator()
                    }
                });
                child.Paths.Add(new DecisionPath()
                {
                    Value    = 75,
                    NextStep = new OperationAdder()
                    {
                        NextStep = new Terminator()
                    }
                });
                root.NextStep = child;

                DefaultContractResolver contractResolver = new DefaultContractResolver
                {
                    NamingStrategy = new CamelCaseNamingStrategy()
                };
                string json = Newtonsoft.Json.JsonConvert.SerializeObject(root, new JsonSerializerSettings
                {
                    ContractResolver = contractResolver,
                    Formatting       = Formatting.Indented,
                    TypeNameHandling = Newtonsoft.Json.TypeNameHandling.Auto
                });

                File.WriteAllText(@"..\..\example.json", json);

                //create data
                TestData data = new TestData()
                {
                    A = 5,
                    B = 10
                };

                FlowManager man = new FlowManager();
                bool result     = await man.Execute(root, data);

                //should go through to id 3 and therefore result = A + B
                Assert.IsTrue(result);
                Assert.AreEqual(15, data.Result);
                Assert.AreEqual(4, man.ProcessedCounter);
            }).GetAwaiter().GetResult();
        }
Ejemplo n.º 24
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (Snapshot != null ? Snapshot.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Initiator != null ? Initiator.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ InstanceId;
         return(hashCode);
     }
 }
Ejemplo n.º 25
0
        static void Main(string[] args)
        {
            Bootstrapper.Init();
            Initiator initiator = DependencyInjector.Retrieve <Initiator>();

            var data = initiator.FetchData();

            Console.WriteLine(data);
            Console.ReadKey();
        }
Ejemplo n.º 26
0
 public void Add(char input)
 {
     switch (input)
     {
     case '1':
         _movieWriter.WriteToFile(Initiator.GetMovie(_movieWriter.GetNextId()));
         Console.WriteLine("Your movie has been added");
         break;
     }
 }
Ejemplo n.º 27
0
        public static bool IsBackgroundTaskRunningStatusSet(Initiator InitiatedBy)
        {
            //Stop background
            var localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;

            int value = (int)localSettings.Values[Constants.BackgroundCommunicatieContinue];

            value &= (int)InitiatedBy;

            return(value != 0);
        }
        /// <summary>
        /// Open an <b>IChannel</b> to the remote ProxyService.
        /// </summary>
        protected override IChannel OpenChannel()
        {
            LookupProxyServiceAddress();

            IConnection connection = Initiator.EnsureConnection();

            return(connection.OpenChannel(InvocationServiceProtocol.Instance,
                                          "InvocationServiceProxy",
                                          null,
                                          Thread.CurrentPrincipal));
        }
Ejemplo n.º 29
0
 static void SendTestRequests()
 {
     for (long testRequestId = 1; testRequestId <= long.MaxValue; ++testRequestId)
     {
         var message = new Fix.Message {
             MsgType = Fix.Dictionary.Messages.TestRequest.MsgType
         };
         message.Fields.Set(Fix.Dictionary.Fields.TestReqID.Tag, testRequestId);
         Initiator.Send(message);
     }
 }
Ejemplo n.º 30
0
        public override void OnTrigger(RulebookEventContext context)
        {
            if (!Weapon.IsMelee)
            {
                return;
            }

            Result = Initiator.GetActiveCombatManeuverToggle();

            if (Result == CombatManeuver.Trip)
            {
                UnitState state = Target.Descriptor.State;
                // same checks as in UnitProneController, if this is true (and the unit is not in a cutscene), state.Prone.Active will be true on the next tick and we also don't want to trip again.
                if (state.Prone.Active || state.Prone.ShouldBeActive || !state.IsConscious || state.HasCondition(UnitCondition.Prone) || state.HasCondition(UnitCondition.Sleeping) || state.HasCondition(UnitCondition.Unconscious))
                {
                    Result = CombatManeuver.None;
                }
            }
            else if (Result == CombatManeuver.Disarm)
            {
                bool canBeDisarmed = false;
                // same checks as in RuleCombatManeuver. If the unit cannot be disarmed (further), don't attempt to disarm.
                ItemEntityWeapon maybeWeapon  = Target.Body.PrimaryHand.MaybeWeapon;
                ItemEntityWeapon maybeWeapon2 = Target.Body.SecondaryHand.MaybeWeapon;

                if (maybeWeapon != null && !maybeWeapon.Blueprint.IsUnarmed && !maybeWeapon.Blueprint.IsNatural && !Target.Descriptor.Buffs.HasFact(BlueprintRoot.Instance.SystemMechanics.DisarmMainHandBuff))
                {
                    canBeDisarmed = true;
                }
                else if (maybeWeapon2 != null && !maybeWeapon2.Blueprint.IsUnarmed && !maybeWeapon2.Blueprint.IsNatural && !Target.Descriptor.Buffs.HasFact(BlueprintRoot.Instance.SystemMechanics.DisarmOffHandBuff))
                {
                    canBeDisarmed = true;
                }

                if (!canBeDisarmed)
                {
                    Result = CombatManeuver.None;
                }
            }
            else if (Result == CombatManeuver.SunderArmor)
            {
                if (Target.Descriptor.Buffs.HasFact(BlueprintRoot.Instance.SystemMechanics.SunderArmorBuff))
                {
                    Result = CombatManeuver.None;
                }
            }

            if (ForceNormalAttack)
            {
                Result = CombatManeuver.None;
            }
        }
Ejemplo n.º 31
0
 public CommonMethods(ILogger <CommonMethods> logger, IConfiguration configuration) : base()
 {
     _logger   = logger;
     _config   = configuration;
     initiator = new Initiator(_config["KubeMQ:Address"]);
     clientID  = $"Client:{GetChannelName()}";
     if (!int.TryParse(_config["KubeMQ:Timeout"], out _timeout))
     {
         _timeout = 1000;
     }
     OpenPeekQueues    = new ConcurrentDictionary <string, System.Messaging.MessageQueue>();
     OpenRecieveQueues = new ConcurrentDictionary <string, System.Messaging.MessageQueue>();
 }