Ejemplo n.º 1
0
 private static void LogApplicationAccount(string prefix, Guid id, TmpApplicationAccount account, long elapsedMilliseconds)
 {
     log.DebugFormat(
         "{0} appID {1} - Result: {2} ({3}), CCUs: {4}, CCU Burst: {5}, Region: {6}, Cloud: {7}, Region/Cluster: {11}, Custom Auth Services: {8}, External APIs: {9}, (took {10} ms)",
         prefix,
         id,
         account.ReturnCode,
         account.Message,
         account.ApplicationCcu,
         account.ApplicationCcuBurst,
         account.ApplicationRegion,
         account.PrivateCloud,
         account.ClientAuthenticationServiceInfoList == null ? 0 : account.ClientAuthenticationServiceInfoList.TotalRecordCount,
         account.ExternalApiInfoList == null ? 0 : account.ExternalApiInfoList.TotalRecordCount,
         elapsedMilliseconds,
         account.RegionClusterInfo);
 }
        public ApplicationAccount(string aplicationId, AccountServiceResult authResult, TmpApplicationAccount tmpApplicationAccount)
        {
            this.ApplicationId        = aplicationId;
            this.AccountServiceResult = authResult;
            this.IsAuthenticated      = tmpApplicationAccount.ReturnCode == (int)AccountServiceReturnValue.Success; //TODO:
            this.MaxCcu                       = tmpApplicationAccount.ApplicationCcu;
            this.IsCcuBurstAllowed            = tmpApplicationAccount.ApplicationCcuBurst;
            this.PrivateCloud                 = tmpApplicationAccount.PrivateCloud?.ToLower();
            this.IsAnonymousAccessAllowed     = tmpApplicationAccount.ClientAuthenticationAllowAnonymous;
            this.ServiceType                  = tmpApplicationAccount.ServiceType;
            this.ExternalApiList              = tmpApplicationAccount.ExternalApiInfoList;
            this.DebugMessage                 = tmpApplicationAccount.Message;
            this.ClientAuthTokenLevel         = tmpApplicationAccount.ClientAuthTokenLevel;
            this.VirtualAppVersionsCountLimit = tmpApplicationAccount.VirtualAppVersionsCountLimit;

            this.GameListUseLegacyLobbies      = tmpApplicationAccount.GameListUseLegacyLobbies;
            this.GameListLimit                 = tmpApplicationAccount.GameListLimit;
            this.GameListLimitUpdates          = tmpApplicationAccount.GameListLimitUpdates;
            this.GameListLimitSqlFilterResults = tmpApplicationAccount.GameListLimitSqlFilterResults;

            this.ClientConnectionFlags = tmpApplicationAccount.ClientConnectionFlags;

            this.MatchmakingStoredProcedure = tmpApplicationAccount.MatchmakingStoredProcedure;

            if (this.HasExternalApi)
            {
                this.TrimExternalApiListStrings();
            }

            if (!string.IsNullOrEmpty(tmpApplicationAccount.GetRegionsFilter))
            {
                //always remove spaces, convert to lower case and add a semicolon at end
                this.GetRegionsFilter = tmpApplicationAccount.GetRegionsFilter.Replace(" ", "").ToLower() + ";";
            }

            if (!string.IsNullOrEmpty(tmpApplicationAccount.RegionClusterInfo))
            {
                // e.g.:  jp/cluster2;jp/cluster3;us/experimental
                this.RegionClusterInfos = new Dictionary <string, List <string> >();
                var regionClusterInfos = tmpApplicationAccount.RegionClusterInfo.ToLower().Split(',', ';');

                foreach (var info in regionClusterInfos)
                {
                    var regionCluster = info.Split('/');

                    if (regionCluster.Length != 2)
                    {
                        continue;
                    }

                    string region  = regionCluster[0];
                    string cluster = regionCluster[1];
                    if (RegionClusterInfos.ContainsKey(region))
                    {
                        var l = RegionClusterInfos[region];
                        if (!l.Contains(cluster))
                        {
                            l.Add(cluster);
                        }
                    }
                    else
                    {
                        RegionClusterInfos[region] = new List <string> {
                            cluster
                        };
                    }
                }
            }


            if (tmpApplicationAccount.ClientAuthenticationServiceInfoList != null && tmpApplicationAccount.ClientAuthenticationServiceInfoList.TotalRecordCount > 0)
            {
                this.IsClientAuthenticationEnabled = true;
                this.ClientAuthenticationServices  = tmpApplicationAccount.ClientAuthenticationServiceInfoList.Entries;
            }
        }