コード例 #1
0
ファイル: NpHost.cs プロジェクト: WuxiCodeMonkey/ServiceWire
 /// <summary>
 /// Constructs an instance of the host and starts listening for incoming connections.
 /// All listener threads are regular background threads.
 /// 
 /// NOTE: the instance is not automatically thread safe!
 /// </summary>
 /// <param name="pipeName">The pipe name for incoming requests</param>
 /// <param name="log"></param>
 /// <param name="stats"></param>
 public NpHost(string pipeName, ILog log = null, IStats stats = null)
 {
     base.Log = log;
     base.Stats = stats;
     _pipeName = pipeName;
     _listener = new NpListener(_pipeName, log: base.Log, stats: base.Stats);
     _listener.RequestReieved += ClientConnectionMade;
 }
コード例 #2
0
ファイル: Interactors.cs プロジェクト: ralfw/rsloccounter
 public Interactors(IFolderProvider folderProvider, 
                    ICsProvider csProvider, 
                    IKommentarschlucker kommentarSchlucker, 
                    IStats stats)
 {
     this.folderProvider = folderProvider;
     this.csProvider = csProvider;
     this.kommentarSchlucker = kommentarSchlucker;
     this.stats = stats;
 }
コード例 #3
0
 public NpListener(string pipeName, int maxConnections = 254, ILog log = null, IStats stats = null)
 {
     _log = log ?? _log;
     _stats = stats ?? _stats;
     if (maxConnections > 254) maxConnections = 254;
     _maxConnections = maxConnections;
     this.PipeName = pipeName;
     _pipeSecurity = new PipeSecurity();
     _pipeSecurity.AddAccessRule(new PipeAccessRule(@"Everyone", PipeAccessRights.ReadWrite, AccessControlType.Allow));
     _pipeSecurity.AddAccessRule(new PipeAccessRule(WindowsIdentity.GetCurrent().User, PipeAccessRights.FullControl, AccessControlType.Allow));
     _pipeSecurity.AddAccessRule(new PipeAccessRule(@"SYSTEM", PipeAccessRights.FullControl, AccessControlType.Allow));
 }
コード例 #4
0
ファイル: RiotClient.cs プロジェクト: Khalyss/RiotApi.NET
 /// <summary>
 /// Constructs a Riot Client with given implemented service for each Riot service group.
 /// </summary>
 /// <param name="champion">The champion.</param>
 /// <param name="currentGame">The current game.</param>
 /// <param name="featuredGames">The featured games.</param>
 /// <param name="game">The game.</param>
 /// <param name="league">The league.</param>
 /// <param name="lolStaticData">The lol static data.</param>
 /// <param name="lolStatus">The lol status.</param>
 /// <param name="match">The match.</param>
 /// <param name="matchHistory">The match history.</param>
 /// <param name="matchList">The match list.</param>
 /// <param name="stats">The stats.</param>
 /// <param name="summoner">The summoner.</param>
 /// <param name="team">The team.</param>
 public RiotClient(IChampion champion, ICurrentGame currentGame, IFeaturedGames featuredGames, IGame game, ILeague league, ILolStaticData lolStaticData,
     ILolStatus lolStatus, IMatch match, IMatchHistory matchHistory, IMatchList matchList, IStats stats, ISummoner summoner, ITeam team)
 {
     this.Champion = champion;
     this.CurrentGame = currentGame;
     this.FeaturedGames = featuredGames;
     this.Game = game;
     this.League = league;
     this.LolStaticData = lolStaticData;
     this.LolStatus = lolStatus;
     this.Match = match;
     this.MatchHistory = matchHistory;
     this.MatchList = matchList;
     this.Stats = stats;
     this.Summoner = summoner;
     this.Team = team;
 }
コード例 #5
0
ファイル: RiotClient.cs プロジェクト: rogin/RiotApi.NET
 /// <summary>
 /// Constructs a Riot Client with given implemented service for each Riot service group.
 /// </summary>
 /// <param name="champion">The champion.</param>
 /// <param name="currentGame">The current game.</param>
 /// <param name="featuredGames">The featured games.</param>
 /// <param name="game">The game.</param>
 /// <param name="league">The league.</param>
 /// <param name="lolStaticData">The lol static data.</param>
 /// <param name="lolStatus">The lol status.</param>
 /// <param name="match">The match.</param>
 /// <param name="matchHistory">The match history.</param>
 /// <param name="matchList">The match list.</param>
 /// <param name="stats">The stats.</param>
 /// <param name="summoner">The summoner.</param>
 /// <param name="team">The team.</param>
 public RiotClient(IChampion champion, ICurrentGame currentGame, IFeaturedGames featuredGames, IGame game, ILeague league, ILolStaticData lolStaticData,
     ILolStatus lolStatus, IMatch match, IMatchHistory matchHistory, IMatchList matchList, IStats stats, ISummoner summoner, ITeam team)
 {
     //we need to let Ninject know which concrete type to use to satisfy the interface.
     this.Champion = champion;
     this.CurrentGame = currentGame;
     this.FeaturedGames = featuredGames;
     this.Game = game;
     this.League = league;
     this.LolStaticData = lolStaticData;
     this.LolStatus = lolStatus;
     this.Match = match;
     this.MatchHistory = matchHistory;
     this.MatchList = matchList;
     this.Stats = stats;
     this.Summoner = summoner;
     this.Team = team;
 }
コード例 #6
0
        internal StandardCommandMetrics(GroupKey key, IConfigurableValue<long> windowMillis, IConfigurableValue<long> snapshotTtlMillis, IClock clock, IStats stats)
        {
            if (key == null)
            {
                throw new ArgumentNullException("key");
            }

            _key = key;
            _clock = clock;
            _snapshotTtlMillis = snapshotTtlMillis;
            _resettingNumbersBucket = new ResettingNumbersBucket(_clock, windowMillis);

            if (stats == null)
            {
                throw new ArgumentNullException("stats");
            }
            _stats = stats;
        }
コード例 #7
0
        /// <summary>
        /// </summary>
        /// <param name="dynel">
        /// </param>
        /// <returns>
        /// </returns>
        public static uint CalculateHitPoints(IStats dynel)
        {
            int[,] tableProfessionHitPoints =
            {
                { 6, 6, 6, 6, 6, 6, 6, 6, 7, 6, 6, 6, 6, 6 },
                { 7, 7, 6, 7, 7, 7, 6, 7, 8, 6, 6, 6, 7, 7 },
                { 8, 7, 6, 7, 7, 8, 7, 7, 9, 6, 6, 6, 8, 8 },
                { 9, 8, 6, 8, 8, 8, 7, 7, 10, 6, 6, 6, 9, 9 },
                { 10, 9, 6, 9, 8, 9, 8, 8, 11, 6, 6, 6, 10, 9 },
                { 11, 12, 6, 10, 9, 9, 9, 9, 12, 6, 6, 6, 11, 10 },
                { 12, 13, 7, 11, 10, 10, 9, 9, 13, 6, 6, 6, 11, 10 },

                // TitleLevel 7
                // TitleLevel 6
                // TitleLevel 5
                // TitleLevel 4
                // TitleLevel 3
                // TitleLevel 2
                // TitleLevel 1
                // Sol| MA|ENG|FIX|AGE|ADV|TRA|CRA|ENF|DOC| NT| MP| KEP|SHA   // geprüfte Prof & TL = Soldier, Martial Artist, Engineer, Fixer
            };

            // Sol|Opi|Nan|Tro
            int[] breedBaseHitPoints = { 10, 15, 10, 25 };
            int[] breedMultiplicatorHitPoints = { 3, 3, 2, 4 };
            int[] breedModificatorHitPoints = { 0, -1, -1, 0 };

            uint breed = dynel.Stats[StatIds.breed].BaseValue;
            uint profession = dynel.Stats[StatIds.profession].BaseValue;
            uint titlelevel = dynel.Stats[StatIds.titlelevel].BaseValue;
            uint level = dynel.Stats[StatIds.level].BaseValue;

            // BreedBaseHP+(Level*(TableProfHP+BreedModiHP))+(BodyDevelopment*BreedMultiHP))
            return
                (uint)
                    (breedBaseHitPoints[breed - 1]
                     + (dynel.Stats[StatIds.level].Value
                        * (tableProfessionHitPoints[titlelevel - 1, profession - 1]
                           + breedModificatorHitPoints[breed - 1]))
                     + (dynel.Stats[StatIds.bodydevelopment].Value * breedMultiplicatorHitPoints[breed - 1]));
        }
コード例 #8
0
        // ReSharper restore NotAccessedField.Local

        internal SemaphoreSlimIsolationSemaphore(GroupKey key, IConfigurableValue<int> maxConcurrent, IStats stats, IConfigurableValue<long> gaugeIntervalMillisOverride = null)
        {
            _key = key;

            if (stats == null)
            {
                throw new ArgumentNullException("stats");
            }

            _stats = stats;

            // Note: Changing the semaphore maximum at runtime is not currently supported.
            _maxConcurrent = maxConcurrent.Value;
            _semaphore = new SemaphoreSlim(_maxConcurrent);

            _timer = new GaugeTimer((source, args) =>
            {
                var count = _semaphore.CurrentCount;
                _stats.Gauge(StatsPrefix + " available", (count == 0 ? "Full" : "Available"), count);
            }, gaugeIntervalMillisOverride);
        }
コード例 #9
0
        internal FailurePercentageCircuitBreaker(GroupKey key, IClock clock, ICommandMetrics metrics, IStats stats, IMetricEvents metricEvents, FailurePercentageCircuitBreakerProperties properties, IConfigurableValue<long> gaugeIntervalMillisOverride = null)
        {
            _key = key;
            _clock = clock;
            _metrics = metrics;

            if (stats == null)
            {
                throw new ArgumentNullException("stats");
            }

            if (metricEvents == null)
            {
                throw new ArgumentNullException("metricEvents");
            }

            _stats = stats;
            _metricEvents = metricEvents;

            Properties = properties;
            _state = State.Fixed; // Start off assuming everything's fixed.
            _lastTrippedTimestamp = 0; // 0 is fine since it'll be far less than the first compared value.

            // Old gauge, will be phased out in v3.0 when IStats are removed.
            _statsTimer = new GaugeTimer((source, args) =>
            {
                var snapshot = _metrics.GetSnapshot();
                _stats.Gauge(StatsPrefix + " total", snapshot.Total >= properties.MinimumOperations.Value ? "Above" : "Below", snapshot.Total);
                _stats.Gauge(StatsPrefix + " error", snapshot.ErrorPercentage >= properties.ThresholdPercentage.Value ? "Above" : "Below", snapshot.ErrorPercentage);
            }, gaugeIntervalMillisOverride);

            _metricsTimer = new GaugeTimer((source, args) =>
            {
                _metricEvents.BreakerConfigGauge(
                    Name,
                    Properties.MinimumOperations.Value,
                    Properties.ThresholdPercentage.Value,
                    Properties.TrippedDurationMillis.Value);
            }, ConfigGaugeIntervalMillis);
        }
コード例 #10
0
ファイル: Architect.cs プロジェクト: rjankovic/Webmin
 public Architect(ISystemDriver system, IStats stats)
 {
     this.stats = stats;
     this.systemDriver = system;
 }
コード例 #11
0
    void ShowStats(IStats stats, Transform background)
    {
        statParent.gameObject.SetActive(true);

        Transform offsetter = background.Find("Offsetter");

        Text[] currentTextFields = offsetter.GetComponentsInChildren <Text> ();

        KeyValuePair <string, string>[] kvs = stats.Stats.ToArray();

        int i;

        for (i = 0; i < kvs.Length; i++)
        {
            if (i >= currentTextFields.Length)
            {
                GameObject statField = Instantiate(statFieldPrefab, offsetter);
                statField.name = "Contestant UI Stat Field";

                statField.GetComponent <RectTransform> ().sizeDelta = new Vector2(background.GetComponent <RectTransform>().rect.width, statFieldPrefab.GetComponent <RectTransform>().rect.height);
                //ScreenManager.ScaleUIElement(statField, 10f, 7.5f);

                statField.transform.localPosition = new Vector3(0f, statField.GetComponent <RectTransform> ().rect.height *(i + 0.5f));
            }
        }

        while (i < currentTextFields.Length)
        {
            currentTextFields [i].text = "";
            currentTextFields [i].GetComponentInChildren <Image> ().sprite = new Sprite();
            currentTextFields [i].GetComponentInChildren <Image> ().color  = Color.clear;
            i++;
        }

        //Rescale background
        //ScreenManager.ScaleUIElement(background, 10f, 7.5f * kvs.Length);

        Text[] newTextFields   = offsetter.GetComponentsInChildren <Text> ();
        int    maxStringLength = 0;

        for (int j = kvs.Length - 1; j >= 0; j--)
        {
            Text  currentTextField = newTextFields [kvs.Length - j - 1];
            Image imageField       = currentTextField.GetComponentInChildren <Image> ();

            int imageForStat = -1;
            for (int s = 0; s < statSpriteNames.Length; s++)
            {
                if (statSpriteNames[s] == kvs [j].Key)
                {
                    imageForStat = s;
                    break;
                }
            }

            if (imageForStat >= 0 && imageForStat < statSprites.Length)
            {
                imageField.sprite          = statSprites[imageForStat];
                imageField.color           = new Color(1f, 1f, 1f, 1f);
                currentTextField.alignment = TextAnchor.MiddleRight;
                currentTextField.text      = string.Format("{0}\t", kvs [j].Value);
            }
            else if (kvs[j].Key == "Title")
            {
                imageField.color           = new Color(1f, 1f, 1f, 0f);
                currentTextField.text      = string.Format("{0}", kvs [j].Value);
                currentTextField.fontStyle = FontStyle.Bold;
                currentTextField.alignment = TextAnchor.MiddleCenter;
            }
            else
            {
                imageField.color           = new Color(1f, 1f, 1f, 0f);
                currentTextField.alignment = TextAnchor.MiddleCenter;
                currentTextField.text      = string.Format("{0}: {1}", kvs [j].Key, kvs [j].Value);
            }

            if (currentTextField.text.ToString().Length > maxStringLength)
            {
                maxStringLength = currentTextField.text.ToString().Length;
            }
        }

        background.GetComponent <RectTransform>().sizeDelta = new Vector2(background.GetComponent <RectTransform>().rect.width, (statFieldPrefab.GetComponent <RectTransform>().rect.height *kvs.Length));

        offsetter.GetComponent <RectTransform>().localPosition = new Vector2(offsetter.GetComponent <RectTransform>().localPosition.x, 0f);
    }
コード例 #12
0
 /// <summary>
 /// Constructs a Riot Client with given implemented service for each Riot service group.
 /// </summary>
 /// <param name="champion">The champion.</param>
 /// <param name="currentGame">The current game.</param>
 /// <param name="featuredGames">The featured games.</param>
 /// <param name="game">The game.</param>
 /// <param name="league">The league.</param>
 /// <param name="lolStaticData">The lol static data.</param>
 /// <param name="lolStatus">The lol status.</param>
 /// <param name="match">The match.</param>
 /// <param name="matchHistory">The match history.</param>
 /// <param name="matchList">The match list.</param>
 /// <param name="stats">The stats.</param>
 /// <param name="summoner">The summoner.</param>
 /// <param name="team">The team.</param>
 public RiotClient(IChampion champion, ICurrentGame currentGame, IFeaturedGames featuredGames, IGame game, ILeague league, ILolStaticData lolStaticData,
                   ILolStatus lolStatus, IMatch match, IMatchHistory matchHistory, IMatchList matchList, IStats stats, ISummoner summoner, ITeam team)
 {
     this.Champion      = champion;
     this.CurrentGame   = currentGame;
     this.FeaturedGames = featuredGames;
     this.Game          = game;
     this.League        = league;
     this.LolStaticData = lolStaticData;
     this.LolStatus     = lolStatus;
     this.Match         = match;
     this.MatchHistory  = matchHistory;
     this.MatchList     = matchList;
     this.Stats         = stats;
     this.Summoner      = summoner;
     this.Team          = team;
 }
コード例 #13
0
 public MetricsObserver(string observerName, string diagnosticName, IMetricsOptions options, IStats censusStats, ITags censusTags, ILogger logger = null)
     : base(observerName, diagnosticName, logger)
 {
     ViewManager   = censusStats.ViewManager;
     StatsRecorder = censusStats.StatsRecorder;
     Tagger        = censusTags.Tagger;
     Options       = options;
 }
コード例 #14
0
ファイル: CPHelper.cs プロジェクト: dahlia/lib9c
        public static decimal GetStatsCP(IStats stats, int characterLevel = 1)
        {
            var statTuples = stats.GetStats(true);

            return(statTuples.Sum(tuple => GetStatCP(tuple.statType, tuple.value, characterLevel)));
        }
コード例 #15
0
 public BreakerBuilder WithStats(IStats stats)
 {
     _stats = stats;
     return this;
 }
コード例 #16
0
 public TestObserver(IMetricsObserverOptions options, IStats stats, ILogger logger)
     : base("TestObserver", DIAGNOSTIC_NAME, options, stats, logger)
 {
 }
コード例 #17
0
 /// <summary>
 /// Gets the total number of various entities registered in Orchestrator
 /// </summary>
 /// <remarks>
 /// Requires authentication.
 ///
 /// Returns the name and the total number of entities registered in
 /// Orchestrator for a set of entities.
 /// All the counted entity types can be seen in the result below.
 /// [
 /// {
 /// "title": "Processes",
 /// "count": 1
 /// },
 /// {
 /// "title": "Assets",
 /// "count": 0
 /// },
 /// {
 /// "title": "Queues",
 /// "count": 0
 /// },
 /// {
 /// "title": "Schedules",
 /// "count": 0
 /// }
 /// ]
 /// </remarks>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 public static IList <CountStats> GetCountStats(this IStats operations)
 {
     return(operations.GetCountStatsAsync().GetAwaiter().GetResult());
 }
コード例 #18
0
 public SpringBootMetricWriter(CloudFoundryForwarderOptions options, IStats stats, ILogger logger = null)
     : base(options, stats, logger)
 {
 }
コード例 #19
0
 public StatsVisitorResult Visit(IStats stats)
 {
     return(stats.Visit(this));
 }
コード例 #20
0
 /// <summary>
 /// Gets the licensing usage statistics
 /// </summary>
 /// <remarks>
 /// Required permissions: License.View.
 /// </remarks>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='tenantId'>
 /// The Tenant's Id - can be used when authenticated as Host
 /// </param>
 /// <param name='days'>
 /// Number of reported license usage days
 /// </param>
 public static IList <LicenseStatsModel> GetLicenseStats(this IStats operations, int tenantId, int days)
 {
     return(operations.GetLicenseStatsAsync(tenantId, days).GetAwaiter().GetResult());
 }
コード例 #21
0
ファイル: NpListener.cs プロジェクト: wouterroos/ServiceWire
        public NpListener(string pipeName, int maxConnections = 254, ILog log = null, IStats stats = null)
        {
            _log   = log ?? _log;
            _stats = stats ?? _stats;
            if (maxConnections > 254)
            {
                maxConnections = 254;
            }
            _maxConnections = maxConnections;
            this.PipeName   = pipeName;
#if NET462
            _pipeSecurity = new PipeSecurity();
            SecurityIdentifier everyone = new SecurityIdentifier(WellKnownSidType.WorldSid, null);
            _pipeSecurity.AddAccessRule(new PipeAccessRule(everyone, PipeAccessRights.ReadWrite, AccessControlType.Allow));
            _pipeSecurity.AddAccessRule(new PipeAccessRule(WindowsIdentity.GetCurrent().User, PipeAccessRights.FullControl, AccessControlType.Allow));
            _pipeSecurity.AddAccessRule(new PipeAccessRule(@"SYSTEM", PipeAccessRights.FullControl, AccessControlType.Allow));
#endif
        }
コード例 #22
0
 public MicrometerMetricWriter(CloudFoundryForwarderOptions options, IStats stats, ILogger logger = null)
     : base(options, stats, logger)
 {
 }
コード例 #23
0
 public EventCounterListener(IStats stats, ILogger <EventCounterListener> logger = null)
 {
     _stats  = stats ?? throw new ArgumentNullException(nameof(stats));
     _logger = logger;
 }
コード例 #24
0
ファイル: TcpHost.cs プロジェクト: rdeago/ServiceWire
 private void Initialize(IPEndPoint endpoint, ILog log, IStats stats)
 {
     base.Log = log;
     base.Stats = stats;
     _endPoint = endpoint;
     _listener = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
     _listener.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.KeepAlive, true);
     _listener.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.DontLinger, true);
 }
コード例 #25
0
 internal StandardCommandMetrics(GroupKey key, IConfigurableValue<long> windowMillis, IConfigurableValue<long> snapshotTtlMillis, IStats stats)
     : this(key, windowMillis, snapshotTtlMillis, new SystemClock(), stats) {}
コード例 #26
0
 /// <summary>
 /// Do nothing
 /// </summary>
 /// <param name="attackerStats">No matter</param>
 public override void HandleAttack(IStats attackerStats)
 {
 }
コード例 #27
0
 public ExcelService(IStats stats, IExcelHelper excel, IDirectoryHelper directory)
 {
     _stats     = stats;
     _excel     = excel;
     _directory = directory;
 }
コード例 #28
0
ファイル: Channel.cs プロジェクト: wouterroos/ServiceWire
 public void InjectLoggerStats(ILog logger, IStats stats)
 {
     _logger = logger;
     _stats  = stats;
 }
コード例 #29
0
 public virtual void Apply(IStats stats)
 {
 }
コード例 #30
0
 public TestObserver(IMetricsOptions options, IStats censusStats, ITags censusTags, ILogger logger)
     : base("TestObserver", DIAGNOSTIC_NAME, options, censusStats, censusTags, logger)
 {
 }
コード例 #31
0
ファイル: TcpHost.cs プロジェクト: rdeago/ServiceWire
 /// <summary>
 /// Constructs an instance of the host and starts listening for incoming connections on designated endpoint.
 /// All listener threads are regular background threads.
 /// 
 /// NOTE: the instance created from the specified type is not automatically thread safe!
 /// </summary>
 /// <param name="endpoint"></param>
 /// <param name="log"></param>
 /// <param name="stats"></param>
 public TcpHost(IPEndPoint endpoint, ILog log = null, IStats stats = null)
 {
     Initialize(endpoint, log, stats);
 }
コード例 #32
0
 public ThreadpoolEventsListener(IStats stats, ILogger <EventSourceListener> logger = null)
     : base(stats)
 {
     _logger          = logger;
     availableThreads = Meter.CreateInt64Measure($"clr.threadpool.available");
 }
コード例 #33
0
ファイル: Program.cs プロジェクト: hamza77500/Chap2
 // affichage moyenne et écart-type d'un type IStats
 static void AfficheStats(IStats valeurs)
 {
     Console.WriteLine("{2}, Moyenne={0}, Ecart-type={1}", valeurs.Moyenne, valeurs.EcartType(), valeurs);
 }
コード例 #34
0
        /// <summary>
        /// </summary>
        /// <param name="aof">
        /// </param>
        /// <param name="checkAll">
        /// </param>
        /// <returns>
        /// </returns>
        public bool CheckRequirements(Functions aof, bool checkAll)
        {
            bool requirementsMet  = true;
            int  childOperator    = -1; // Starting value
            bool foundCharRelated = (aof.FunctionType == Constants.FunctiontypeHairMesh) ||
                                    (aof.FunctionType == Constants.FunctiontypeBackMesh) ||
                                    (aof.FunctionType == Constants.FunctiontypeTexture) ||
                                    (aof.FunctionType == Constants.FunctiontypeAttractorMesh) ||
                                    (aof.FunctionType == Constants.FunctiontypeCatMesh) ||
                                    (aof.FunctionType == Constants.FunctiontypeChangeBodyMesh) ||
                                    (aof.FunctionType == Constants.functiontype_shouldermesh) ||
                                    (aof.FunctionType == Constants.FunctiontypeHeadMesh);

            Identity RequirementTargetIdentity = new Identity();

            foreach (Requirements aor in aof.Requirements)
            {
                switch (aor.Target)
                {
                case Constants.ItemtargetUser:
                {
                    RequirementTargetIdentity = this.identity;
                    break;
                }

                case Constants.ItemtargetWearer:
                {
                    // TODO: Subject to change, not sure about this one
                    RequirementTargetIdentity = this.identity;
                    break;
                }

                case Constants.ItemtargetTarget:
                {
                    // TODO: pass on target
                    break;
                }

                case Constants.ItemtargetFightingtarget:
                {
                    var temp = this as ITargetingEntity;
                    if (temp != null)
                    {
                        RequirementTargetIdentity = temp.FightingTarget;
                    }

                    break;
                }

                case Constants.ItemtargetSelectedtarget:
                {
                    var temp = this as ITargetingEntity;
                    if (temp != null)
                    {
                        RequirementTargetIdentity = temp.SelectedTarget;
                    }

                    break;
                }

                case Constants.ItemtargetSelf:
                {
                    RequirementTargetIdentity = this.Identity;
                    break;
                }

                default:
                {
                    RequirementTargetIdentity = new Identity();
                    break;
                }
                }

                if (RequirementTargetIdentity.Type == IdentityType.None)
                {
                    return(false);

                    // Target not found, cant check reqs -> FALSE
                }

                IStats reqTargetStatholder = ((IInstancedEntity)this).Playfield.FindByIdentity(
                    RequirementTargetIdentity);
                int  statval   = reqTargetStatholder.Stats[aor.Statnumber].Value;
                bool reqresult = true;
                switch (aor.Operator)
                {
                case Constants.OperatorAnd:
                {
                    reqresult = (statval & aor.Value) != 0;
                    break;
                }

                case Constants.OperatorOr:
                {
                    reqresult = (statval | aor.Value) != 0;
                    break;
                }

                case Constants.OperatorEqualTo:
                {
                    reqresult = statval == aor.Value;
                    break;
                }

                case Constants.OperatorLessThan:
                {
                    reqresult = statval < aor.Value;
                    break;
                }

                case Constants.OperatorGreaterThan:
                {
                    reqresult = statval > aor.Value;
                    break;
                }

                case Constants.OperatorUnequal:
                {
                    reqresult = statval != aor.Value;
                    break;
                }

                case Constants.OperatorTrue:
                {
                    reqresult = true;
                    break;
                }

                case Constants.OperatorFalse:
                {
                    reqresult = false;
                    break;
                }

                case Constants.OperatorBitAnd:
                {
                    reqresult = (statval & aor.Value) != 0;
                    break;
                }

                case Constants.OperatorBitOr:
                {
                    reqresult = (statval | aor.Value) != 0;
                    break;
                }

                default:
                {
                    // TRUE for now
                    reqresult = true;
                    break;
                }
                }

                switch (childOperator)
                {
                case Constants.OperatorAnd:
                {
                    requirementsMet &= reqresult;
                    break;
                }

                case Constants.OperatorOr:
                {
                    requirementsMet &= reqresult;
                    break;
                }

                case -1:
                {
                    requirementsMet = reqresult;
                    break;
                }

                default:
                    break;
                }

                childOperator = aor.ChildOperator;
            }

            if (!checkAll)
            {
                if (foundCharRelated)
                {
                    requirementsMet &= foundCharRelated;
                }
                else
                {
                    requirementsMet = true;
                }
            }

            return(requirementsMet);
        }
コード例 #35
0
 public static IStats Times(this IStats first, params IStats[] others) => Times(first, (IEnumerable <IStats>)others);
        /// <summary>
        /// Add Metrics actuator endpoint to OWIN Pipeline
        /// </summary>
        /// <param name="builder">OWIN <see cref="IAppBuilder" /></param>
        /// <param name="config"><see cref="IConfiguration"/> of application for configuring metrics endpoint</param>
        /// <param name="stats">Class for recording statistics - See also: <seealso cref="OpenCensusStats"/></param>
        /// <param name="tags">Class using for recording statistics</param>
        /// <param name="loggerFactory">For logging within the middleware</param>
        /// <returns>OWIN <see cref="IAppBuilder" /> with Metrics Endpoint added</returns>
        public static IAppBuilder UseMetricsActuator(this IAppBuilder builder, IConfiguration config, IStats stats, ITags tags, ILoggerFactory loggerFactory = null)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

            if (config == null)
            {
                throw new ArgumentNullException(nameof(config));
            }

            if (stats == null)
            {
                throw new ArgumentNullException(nameof(stats));
            }

            if (tags == null)
            {
                throw new ArgumentNullException(nameof(tags));
            }

            var options = new MetricsOptions(config);

            var hostObserver = new OwinHostingObserver(options, stats, tags, loggerFactory?.CreateLogger <OwinHostingObserver>());
            var clrObserver  = new CLRRuntimeObserver(options, stats, tags, loggerFactory?.CreateLogger <CLRRuntimeObserver>());

            DiagnosticsManager.Instance.Observers.Add(hostObserver);
            DiagnosticsManager.Instance.Observers.Add(clrObserver);

            var clrSource = new CLRRuntimeSource();

            DiagnosticsManager.Instance.Sources.Add(clrSource);

            var endpoint = new MetricsEndpoint(options, stats, loggerFactory?.CreateLogger <MetricsEndpoint>());
            var logger   = loggerFactory?.CreateLogger <MetricsEndpointOwinMiddleware>();

            return(builder.Use <MetricsEndpointOwinMiddleware>(endpoint, logger));
        }
コード例 #37
0
ファイル: LivingEntity.cs プロジェクト: benwoo1110/Ratventure
 public LivingEntity(EntityType type, char displayLetter, ILocation location, IStats stats)
     : base(type, displayLetter, location)
 {
     this.stats = stats;
 }
コード例 #38
0
 public void Load(IStats stats)
 {
     this.stats = stats;
 }
コード例 #39
0
 public FourBetCorrection(IStats playingStyle, int numberOfHandsToStartCorrection)
     : base(numberOfHandsToStartCorrection)
 {
     this.fourBet = playingStyle.FourBet;
 }
コード例 #40
0
 public static IStats Times(this IStats first, IEnumerable <IStats> others) => others.Aggregate(first, (current, other) => new MultipliedStats(current, other));
コード例 #41
0
ファイル: MetricsObserver.cs プロジェクト: winhu/Steeltoe
 public MetricsObserver(string observerName, string diagnosticName, IMetricsOptions options, IStats stats, ILogger logger = null)
     : base(observerName, diagnosticName, logger)
 {
     Meter   = stats.Meter;
     Options = options;
 }
コード例 #42
0
ファイル: TcpHost.cs プロジェクト: rdeago/ServiceWire
 /// <summary>
 /// Constructs an instance of the host and starts listening for incoming connections on any ip address.
 /// All listener threads are regular background threads.
 /// </summary>
 /// <param name="port">The port number for incoming requests</param>
 /// <param name="log"></param>
 /// <param name="stats"></param>
 public TcpHost(int port, ILog log = null, IStats stats = null)
 {
     Initialize(new IPEndPoint(IPAddress.Any, port), log, stats);
 }
コード例 #43
0
 public static void Provide(IStats stats)
 {
     _statsService = stats ?? new NullStats();
 }
コード例 #44
0
 public WorldDataService(IStats stats)
 {
     _stats = stats;
 }
コード例 #45
0
 public override void Apply(IStats stats)
 {
     stats.Speed /= 2;
 }
コード例 #46
0
 internal FailurePercentageCircuitBreaker(GroupKey key, ICommandMetrics metrics, IStats stats, FailurePercentageCircuitBreakerProperties properties)
     : this(key, new SystemClock(), metrics, stats, properties) {}
コード例 #47
0
        public SimpleChoice(TGame game, float time, TKind kind, double price, int level, IStats current, IStats next)
        {
            Game  = game;
            Time  = time;
            Kind  = kind;
            Price = price;
            Level = level;

            CurrentStats = current;
            NextStats    = next;
        }