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); }
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); }
private string CreateAssignmentId() { var titleIdGuid = VmConfiguration.GetGuidFromTitleId(ulong.Parse(PlayFabTitleId, NumberStyles.HexNumber)); return($"{titleIdGuid}{VmConfiguration.AssignmentIdSeparator}{DeploymentId}{VmConfiguration.AssignmentIdSeparator}{Region}"); }