private void Startup() { if (NativeHelpers.Services_GetSteamLoadStatus() == LoadStatus.NotLoaded) { // Only startup the native parts if they are not loaded yet if (!NativeMethods.Services_Startup(Constants.VersionInfo.InterfaceID)) { // Setup failed! Instance = null; ErrorCodes error = NativeHelpers.Services_GetErrorCode(); if (error == ErrorCodes.InvalidInterfaceVersion) { Error.ThrowError(ErrorCodes.InvalidInterfaceVersion, NativeMethods.Services_GetInterfaceVersion(), Constants.VersionInfo.InterfaceID); } else { Error.ThrowError(error); } } } AppID = new SteamTypes.AppID(NativeMethods.Services_GetAppID()); serviceJobs = new JobManager(); serviceJobs.AddJob(new DelegateJob(() => RegisterManagedCallback(), () => RemoveManagedCallback())); serviceJobs.AddJob(new DelegateJob(() => cloud = new Cloud(), () => cloud.ReleaseManagedResources())); serviceJobs.AddJob(new DelegateJob(() => stats = new Stats(), () => stats.ReleaseManagedResources())); serviceJobs.AddJob(new DelegateJob(() => user = new User(), () => user.ReleaseManagedResources())); serviceJobs.AddJob(new DelegateJob(() => friends = new Friends(), () => friends.ReleaseManagedResources())); serviceJobs.AddJob(new DelegateJob(() => matchmaking = new MatchMaking(), () => matchmaking.ReleaseManagedResources())); serviceJobs.AddJob(new DelegateJob(() => matchmakingServers = new MatchmakingServers(), () => matchmakingServers.ReleaseManagedResources())); serviceJobs.AddJob(new DelegateJob(() => networking = new Networking(), () => networking.ReleaseManagedResources())); serviceJobs.AddJob(new DelegateJob(() => utils = new Utils(), () => utils.ReleaseManagedResources())); serviceJobs.AddJob(new DelegateJob(() => apps = new Apps(), () => apps.ReleaseManagedResources())); serviceJobs.AddJob(new DelegateJob(() => http = new HTTP(), () => http.ReleaseManagedResources())); serviceJobs.AddJob(new DelegateJob(() => screenshots = new Screenshots(), () => screenshots.ReleaseManagedResources())); serviceJobs.AddJob(new DelegateJob(() => ugc = new UGC(), () => ugc.ReleaseManagedResources())); serviceJobs.AddJob(new DelegateJob(() => steamcontroller = new SteamController(), () => steamcontroller.ReleaseManagedResources())); hmd = new Hmd(); serviceJobs.RunCreateJobs(); }
private void Startup(uint ip, ushort steamPort, ushort gamePort, ushort queryPort, ServerMode serverMode, string versionString) { if (NativeHelpers.ServicesGameServer_GetSteamLoadStatus() == LoadStatus.NotLoaded) { // Only startup the native parts if they are not loaded yet if (!NativeMethods.ServicesGameServer_Startup(Constants.VersionInfo.InterfaceID, ip, steamPort, gamePort, queryPort, (int)serverMode, versionString)) { // Setup failed! Instance = null; ErrorCodes error = NativeHelpers.ServicesGameServer_GetErrorCode(); if (error == ErrorCodes.InvalidInterfaceVersion) { Error.ThrowError(ErrorCodes.InvalidInterfaceVersion, NativeMethods.ServicesGameServer_GetInterfaceVersion(), Constants.VersionInfo.InterfaceID); } else { Error.ThrowError(error); } } } serviceJobs = new JobManager(); serviceJobs.AddJob(new DelegateJob(() => RegisterManagedCallback(), () => RemoveManagedCallback())); serviceJobs.AddJob(new DelegateJob(() => gameServer = new GameServer(), () => gameServer.ReleaseManagedResources())); serviceJobs.AddJob(new DelegateJob(() => gameServerStats = new GameServerStats(), () => gameServerStats.ReleaseManagedResources())); serviceJobs.RunCreateJobs(); }