Пример #1
0
        public static QosResultPlayFabEvent CreateFrom(QosResult result)
        {
#if (NETSTANDARD && !NETSTANDARD1_1) || NETFRAMEWORK || NETCOREAPP
            return(new QosResultPlayFabEvent
            {
                RegionResults = result.RegionResults.ConvertAll(x => new QosRegionResultSummary()
                {
                    Region = x.Region,
                    ErrorCode = x.ErrorCode,
                    LatencyMs = x.LatencyMs
                }),
                ErrorCode = result.ErrorCode
            });
#else
            throw new NotSupportedException("QoS ping library is only supported on .net standard 2.0 and newer, .net core or full .net framework");
#endif
        }
Пример #2
0
#pragma warning disable 4014
        public async Task <QosResult> GetQosResultAsync(
            int timeoutMs           = DefaultTimeoutMs,
            int pingsPerRegion      = DefaultPingsPerRegion,
            int degreeOfParallelism = DefaultDegreeOfParallelism,
            bool listQosForTitle    = false,
            bool chinaVer           = false)
        {
            await new PlayFabUtil.SynchronizationContextRemover();

            QosResult result = await GetResultAsync(timeoutMs, pingsPerRegion, degreeOfParallelism, listQosForTitle, chinaVer);

            if (result.ErrorCode != (int)QosErrorCode.Success)
            {
                return(result);
            }

            if (_reportResults)
            {
                Task.Factory.StartNew(qosResultsReporter, result).Unwrap();
            }

            return(result);
        }