Ejemplo n.º 1
0
        public static LegacyGameInfo FromSessionHostHeartbeatInfo(SessionHostHeartbeatInfo heartbeatInfo, string legacyTitleId)
        {
            LegacyGameInfo result = new LegacyGameInfo();

            result.NextBeatMilliseconds = heartbeatInfo.NextHeartbeatIntervalMs.ToString();
            result.Operation            = heartbeatInfo.Operation;
            if (heartbeatInfo.SessionConfig != null)
            {
                if (heartbeatInfo.SessionConfig.LegacyAllocationInfo != null)
                {
                    result.ClusterManifest = heartbeatInfo.SessionConfig.LegacyAllocationInfo.ClusterManifest;
                }
                else
                {
                    string sessionIdString = heartbeatInfo.SessionConfig.SessionId.ToString();
                    result.ClusterManifest["sessionId"]     = sessionIdString;
                    result.ClusterManifest["sessionUrl"]    = new Uri(SessionDirectoryBaseUrl, sessionIdString).AbsoluteUri;
                    result.ClusterManifest["sessionCookie"] = heartbeatInfo.SessionConfig?.SessionCookie;

                    if (ulong.TryParse(legacyTitleId, out ulong titleIdLong) &&
                        LegacyTitleHelper.LegacyTitleMappings.TryGetValue(VmConfiguration.GetGuidFromTitleId(titleIdLong), out LegacyTitleDetails titleDetails))
                    {
                        result.ClusterManifest["gameVariantId"] = titleDetails.VariantId.ToString();
                    }
                }
            }

            return(result);
        }
Ejemplo n.º 2
0
        public SessionHostsStartInfo ToSessionHostsStartInfo()
        {
            // Clear mount path in process based, otherwise, agent will kick into back-compat mode and try to strip the
            // mount path from the start game command before running
            AssetDetail[] assetDetails = AssetDetails?.Select(x => new AssetDetail()
            {
                MountPath     = RunContainer ? x.MountPath : null,
                LocalFilePath = x.LocalFilePath
            }).ToArray();

            var startInfo = new SessionHostsStartInfo
            {
                AssignmentId      = $"{VmConfiguration.GetGuidFromTitleId(TitleIdUlong)}:{BuildId}:{Region}",
                SessionHostType   = RunContainer ? SessionHostType.Container : SessionHostType.Process,
                PublicIpV4Address = "127.0.0.1",
                FQDN = "localhost",
                HostConfigOverrides = GetHostConfig(),
                ImageDetails        = ContainerStartParameters.ImageDetails,
                AssetDetails        = assetDetails,
                StartGameCommand    = RunContainer ? ContainerStartParameters.StartGameCommand : ProcessStartParameters.StartGameCommand,
                PortMappingsList    = PortMappingsList
            };

            return(startInfo);
        }
Ejemplo n.º 3
0
        private string CreateAssignmentId()
        {
            var titleIdGuid = VmConfiguration.GetGuidFromTitleId(ulong.Parse(PlayFabTitleId, NumberStyles.HexNumber));

            return($"{titleIdGuid}{VmConfiguration.AssignmentIdSeparator}{DeploymentId}{VmConfiguration.AssignmentIdSeparator}{Region}");
        }