public ApplicationAccount(string applicationId, AccountServiceResult authResult, bool isAuthenticated, string debugMessage)
        {
            this.ApplicationId        = applicationId;
            this.AccountServiceResult = authResult;
            this.IsAuthenticated      = isAuthenticated;
            this.DebugMessage         = debugMessage;

            // if the CCU is not set explicitly, assume that we have "unlimited" access.  CCU = 0 does not mean "unlimited" any longer.
            this.MaxCcu = int.MaxValue;
        }
 public ApplicationAccount(string applicationId, AccountServiceResult authResult, bool isAuthenticated, string debugMessage, int maxCcu, bool isCcuBurstAllowed,
                           string privateCloud, bool isAnonymousAccessAllowed, ServiceType serviceType)
 {
     this.ApplicationId        = applicationId;
     this.AccountServiceResult = authResult;
     this.IsAuthenticated      = isAuthenticated;
     this.MaxCcu                   = maxCcu;
     this.IsCcuBurstAllowed        = isCcuBurstAllowed;
     this.PrivateCloud             = privateCloud.ToLower();
     this.IsAnonymousAccessAllowed = isAnonymousAccessAllowed;
     this.ServiceType              = serviceType;
     this.ExternalApiList          = new ExternalApiInfoList();
     this.DebugMessage             = debugMessage;
 }
        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;
            }
        }