/// <summary> /// Logs into the Steam network as an anonymous game server /// </summary> /// <param name="appId"></param> /// <returns></returns> public async Task LoginGameServerAnonymousAsync(int appId) { CMsgClientLogon logon = new CMsgClientLogon() { protocol_version = _currentProtocolVer, obfustucated_private_ip = (uint)(GetConfig <SteamNetworkConfig>().LoginId < 0 ? LocalIp.ToUInt32() ^ _obfuscationMask : GetConfig <SteamNetworkConfig>().LoginId), client_os_type = (uint)HardwareUtils.GetCurrentOsType(), game_server_app_id = appId, machine_id = await HardwareUtils.GetMachineId().ConfigureAwait(false), }; NetworkMessage message = NetworkMessage .CreateProtobufMessage(MessageType.ClientLogon, logon) .WithClientInfo(SteamId.CreateAnonymousGameServer(GetConfig <SteamNetworkConfig>().DefaultUniverse), 0); await SendAsync(message.Serialize()).ConfigureAwait(false); }
public void Factories() { Assert.Equal(new SteamId(0, AccountType.AnonUser, Universe.Invalid, 0), SteamId.CreateAnonymousUser(Universe.Invalid)); Assert.Equal(new SteamId(0, AccountType.AnonUser, Universe.Dev, 0), SteamId.CreateAnonymousUser(Universe.Dev)); Assert.Equal(new SteamId(0, AccountType.AnonGameServer, Universe.Invalid, 0), SteamId.CreateAnonymousGameServer(Universe.Invalid)); Assert.Equal(new SteamId(0, AccountType.AnonGameServer, Universe.Dev, 0), SteamId.CreateAnonymousGameServer(Universe.Dev)); Assert.Equal(new SteamId(0, AccountType.Individual, Universe.Invalid, 0), SteamId.CreateIndividualAccount(0, Universe.Invalid, Instance.All)); Assert.Equal(new SteamId(uint.MaxValue, AccountType.Individual, Universe.Dev, 7), SteamId.CreateIndividualAccount(uint.MaxValue, Universe.Dev, Instance.Desktop | Instance.Console | Instance.Web)); }