static async Task Examples() { // Get details for SteamApp with ID 443790 SteamApp steamApp1 = await AppDetails.GetAsync(460810); // Get details for SteamApp with ID 443790 for region US SteamApp steamApp2 = await AppDetails.GetAsync(322330, "US"); // Get details for SteamApp with ID 443790 for region US with strings localized in german SteamApp steamApp3 = await AppDetails.GetAsync(322330, "US", "german"); // Get details for Package with ID 68179 for region PackageInfo package1 = await PackageDetails.GetAsync(68179); // Get details for Package with ID 68179 for region JP PackageInfo package2 = await PackageDetails.GetAsync(68179, "JP"); // Get a list of featured games FeaturedApps featured = await Featured.GetAsync(); // Get a list of featured games for region DE FeaturedApps featured2 = await Featured.GetAsync("DE"); // Get a list of featured games for region DE localized in english FeaturedApps featured3 = await Featured.GetAsync("DE", "english"); // Get a list of featured games grouped by category List <FeaturedCategory> featuredCategories = (await FeaturedCategories.GetAsync()).ToList(); // Get a list of featured games grouped by category for region US List <FeaturedCategory> featuredCategories2 = (await FeaturedCategories.GetAsync("DE")).ToList(); }
private void AddGamePlayer(SteamApp game, SteamProfile player) { //record the player if (!players.ContainsKey(player.SteamID)) { players.Add(player.SteamID, player); } //record the game if (!games.ContainsKey(game.ID)) { games.Add(game.ID, game); } //record the players in the games if (!gamePlayers.ContainsKey(game.ID)) { gamePlayers.Add(game.ID, new HashSet <long>()); } //add player to game if (!gamePlayers[game.ID].Contains(player.SteamID)) { gamePlayers[game.ID].Add(player.SteamID); } }
static bool RetrieveMVInstallDir() { try { SteamAppsManager sam = new SteamAppsManager(); SteamApp sapp = sam.SteamApps.FindAppByID(Vars.STEAM_MV_APPID, false); if (sapp != null) { PMFileSystem.MV_Installation_Directory = sapp.InstallDir; } else { return(GetStandAloneInstallFolder()); } if (string.IsNullOrWhiteSpace(PMFileSystem.MV_Installation_Directory)) { return(GetStandAloneInstallFolder()); } else { return(true); } } catch (Exception ex) { Logger.CreateIssueLogForLowLevelException(ex, MethodBase.GetCurrentMethod().ToLogFormatFullName()); return(GetStandAloneInstallFolder()); } }
public Server(int id, SteamApp app) { ID = id; App = app; ExecutablePath = Path.Combine(WorkingDirectory, app.RelativeExecutablePath); int nextPort = app.Port; while (PreAPIHelper.Servers.Exists(x => x.Port == nextPort)) { nextPort += 10; } Variables.Add(new Variable("Hostname", $"My New {app.Name} Server | Powered By ServerNode", true)); Variables.Add(new Variable("IPAddress", "0.0.0.0", true)); Variables.Add(new Variable("Port", nextPort, true)); Variables.Add(new Variable("Slots", app.DefaultSlots, true)); Variables.Add(new Variable("RconPort", nextPort + 1, true)); Variables.Add(new Variable("Password", "", true)); Variables.Add(new Variable("RconPassword", "Password123!", true)); foreach (Variable variable in app.CustomVariables) { this.Variables.Add(variable); } }
/// <summary> /// Starts a Steam app /// </summary> /// <param name="app">The app to start</param> /// <param name="arguments">Optional arguments</param> public Process StartApp(SteamApp app, string arguments) { ProcessStartInfo startInfo; if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { startInfo = new ProcessStartInfo(Path.Combine(_path, "Steam.exe")); } else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) { startInfo = new ProcessStartInfo("steam"); } else { throw new PlatformNotSupportedException(); } var builder = new ArgumentBuilder(); builder.AppendArgument("-applaunch"); builder.AppendArgument(((long)app).ToString()); builder.AppendExisting(arguments); startInfo.Arguments = builder.ToString(); return(Process.Start(startInfo)); }
private void tooltipTimer_Tick(object sender, EventArgs e) { if (!cellTooltipVisible) { // Stop the timer. cellTooltipTimer.Stop(); // Acknowledge the displaying. cellTooltipVisible = true; // Determine tooltip params. SteamApp app = gridViewItems[cellTooltipRow].App; string tooltipText = app.Name + "\r\n" + app.OriginalLibrary.Name; int tooltipX = dataGrid.PointToClient(Cursor.Position).X; int tooltipY = dataGrid.GetRowDisplayRectangle(cellTooltipRow, false).Top; // Fake the tooltip display and measure size. cellTooltip.Popup += cellTooltip_FakePopup; cellTooltip.Show(tooltipText, dataGrid, tooltipX, tooltipY); cellTooltip.Popup -= cellTooltip_FakePopup; // Actually display the tooltip in the corrected position. cellTooltip.Show(tooltipText, dataGrid, tooltipX, tooltipY - cellTooltipSize.Height); } }
public override bool Predicate(SteamApp app) { if (string.IsNullOrEmpty(Text)) { return(true); } if (!string.IsNullOrEmpty(Text)) { if (app.Name.IndexOf(this.Text, StringComparison.OrdinalIgnoreCase) > -1 || app.AppId.ToString().IndexOf(this.Text, StringComparison.OrdinalIgnoreCase) > -1) { return(true); } //var num = 0; //foreach (var i in Text) //{ // if (app.Name.IndexOf(i.ToString(), StringComparison.OrdinalIgnoreCase) > -1) // { // num++; // } //} //if (num == Text.Length) // return true; } return(false); }
/// <summary> /// Asynchronously runs the patcher. /// </summary> public async Task RunAsync() { Steam steam = Steam.GetSteamInstallation(); if (steam.IsInstalled) { bool isHaloInstalled = await steam.IsAppInstalledAsync(HaloAppId) .ConfigureAwait(false); if (isHaloInstalled) { SteamApp haloApp = await steam.GetAppAsync(HaloAppId).ConfigureAwait(false); await this.PatchSteamVersionAsync(haloApp).ConfigureAwait(false); } else { MsgBoxHelpers.Error(Resources.HaloNotInstalledViaSteam); await this.ConfirmManualPatchAsync().ConfigureAwait(false); } } else { MsgBoxHelpers.Error(Resources.SteamNotInstalled); await this.ConfirmManualPatchAsync().ConfigureAwait(false); } }
/// <summary> /// Starts a Steam app. /// </summary> /// <param name="app">The app to start.</param> /// <param name="args">Optional arguments.</param> public void StartApp(SteamApp app, params string[] args) { #if NETFULL var startInfo = new ProcessStartInfo(Path.Combine(_path, "Steam.exe")); #elif NETCORE ProcessStartInfo startInfo; var os = Environment.OSVersion; if (os.Platform == PlatformID.Win32NT) { startInfo = new ProcessStartInfo(Path.Combine(_path, "Steam.exe")); } else if (os.Platform == PlatformID.Unix) { startInfo = new ProcessStartInfo("steam"); } else { throw new PlatformException(); } #endif string argString = $"-applaunch {((long)app).ToString()}"; if (!(args is null) && (args.Length != 0)) { argString += " " + string.Join(" ", args); } startInfo.Arguments = argString; Process.Start(startInfo); }
public static SteamApp CreateApp(string name, string shortName, int port, int slots, string relativeWindowsExecutablePath, string relativeLinuxExecutablePath, int steamID, bool requirePurchase, string[] defaultCommandLine, Variable[] customVariables = null) { SteamApp app = new SteamApp(name, shortName, port, slots, relativeWindowsExecutablePath, relativeLinuxExecutablePath, steamID, requirePurchase, defaultCommandLine, customVariables); Apps.Add(shortName, app); return(app); }
public static string GetSteamGameDescription(Listing game, SteamApp appdata) { var launchurl = BaseSteamRunUrl + appdata.SteamAppId; var storeurl = BaseSteamStoreUrl + appdata.SteamAppId; var fulldesc = appdata.AboutTheGame; string desc; if (fulldesc.Contains("<br")) { var clean = fulldesc.Replace("<br /> ", "").Replace("<br/> ", "").Replace("<br />", "").Replace("<br/>", "").Replace("<br> ", "\n").Replace("<br>", "\n"); var split = clean.Split('\n'); int count = 0; while (count < split.Length) { if (count == split.Length - 1) { count = -1; break; } if (string.IsNullOrEmpty(split[count])) { count++; } else { break; } } desc = split[count].StripHtml(); } else { desc = string.Join(" ", fulldesc.Split(' ').Take(250)); } string returnstring = ""; //Description returnstring += desc; //seperator returnstring += "\n\n"; //Cost if (!appdata.IsFree) { returnstring += "Price (USD): $" + game.PriceUSD; } else { returnstring += "Price (USD): Free"; } //seperator returnstring += "\n\n"; //LaunchURL returnstring += $"[Launch]({launchurl}) | [Store]({storeurl})"; return(returnstring); }
private void dataGrid_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e) { SteamApp app = gridViewItems[e.RowIndex].App; if (app.TargetLibrary != app.OriginalLibrary) { e.CellStyle.ForeColor = Color.Blue; } }
internal static SteamAppEntity ToDataObject(this SteamApp serviceModel) { SteamAppEntity dataObject = new SteamAppEntity(); dataObject.Id = serviceModel.Id; dataObject.Name = serviceModel.Name; return(dataObject); }
internal static SteamApp ToServiceModel(this SteamAppEntity dataObject) { SteamApp serviceModel = new SteamApp(); serviceModel.Id = dataObject.Id; serviceModel.Name = dataObject.Name; return(serviceModel); }
public override bool Predicate(SteamApp app) { if (Application && app.Type == SteamAppTypeEnum.Application) { return(true); } if (Config && app.Type == SteamAppTypeEnum.Config) { return(true); } if (Demo && app.Type == SteamAppTypeEnum.Demo) { return(true); } if (DLC && app.Type == SteamAppTypeEnum.DLC) { return(true); } if (Game && app.Type == SteamAppTypeEnum.Game) { return(true); } if (Media && app.Type == SteamAppTypeEnum.Media) { return(true); } if (Music && app.Type == SteamAppTypeEnum.Music) { return(true); } if (Tool && app.Type == SteamAppTypeEnum.Tool) { return(true); } if (Video && app.Type == SteamAppTypeEnum.Video) { return(true); } if (Driver && app.Type == SteamAppTypeEnum.Driver) { return(true); } if (Guide && app.Type == SteamAppTypeEnum.Guide) { return(true); } if (Hardware && app.Type == SteamAppTypeEnum.Hardware) { return(true); } if (Unknown && app.Type == SteamAppTypeEnum.Unknown) { return(true); } return(false); }
public EditAppInfoWindowViewModel(SteamApp app) { if (app == null) { this.Close(); return; } App = app; Title = App.GetIdAndName(); }
private static bool FindApp(string shortName, out SteamApp steamApp) { if (PreAPIHelper.Apps.ContainsKey(shortName)) { steamApp = PreAPIHelper.Apps[shortName]; return(true); } steamApp = null; return(false); }
/// <summary> /// Asynchronously patches the game found in the Steam library. /// </summary> /// <param name="app">The <see cref="SteamApp"/> instance.</param> private async Task PatchSteamVersionAsync(SteamApp app) { if (!app.InstallDirectory.Exists) { MsgBoxHelpers.Error(String.Format(Resources.ManifestButNoInstall, app.Name)); await this.ConfirmManualPatchAsync().ConfigureAwait(false); return; } await this.PatchAsync(new HaloInstallation(app.InstallDirectory)).ConfigureAwait(false); }
static DateTime GetAppDate(SteamApp steamApp) { try { return(GetAppReleaseDate.GetAppReleaseDates(steamApp.AppId)); } catch (ToManyAPIRequestsException) { WriteLine("To many Steam Requests!", 1); Thread.Sleep(5000); return(GetAppDate(steamApp)); } }
private static void ShowApp(SteamApp app) { Console.Out.WriteLine(app.Title); foreach (var package in app.Packages) { Console.Out.WriteLine("Package:"); Console.Out.WriteLine($"\t{package.Title}"); Console.Out.WriteLine($"\t${package.CurrentPrice}"); Console.Out.WriteLine("------------"); } Console.Out.WriteLine("-------------------------------------------------------------"); }
private static async Task Examples() { var steamApiClient = new SteamApiClient(); // Get full list of SteamApps. SteamAppBriefInfoList steamAppList = await steamApiClient.GetAppListAsync(); Console.WriteLine($"Got {steamAppList.Apps.Length.ToString()} items."); // Get details for SteamApp with ID 292030 (The Witcher 3: Wild Hunt). SteamApp steamApp1 = await steamApiClient.GetSteamAppAsync(292030); Console.WriteLine($"Got response for {steamApp1.Name}."); // Get details for SteamApp with same ID for region US. SteamApp steamApp2 = await steamApiClient.GetSteamAppAsync(292030, CountryCode.USA); Console.WriteLine($"Got response for {steamApp2.Name}."); // Get details for Package with ID 68179 (Don't Starve Together). PackageInfo package1 = await steamApiClient.GetPackageInfoAsync(68179); Console.WriteLine($"Got response for {package1.Name}."); // Get details for Package with same ID for region JP. PackageInfo package2 = await steamApiClient.GetPackageInfoAsync(68179, CountryCode.Japan); Console.WriteLine($"Got response for {package2.Name}."); // Get a list of featured games. FeaturedApps featured1 = await steamApiClient.GetFeaturedAppsAsync(); Console.WriteLine($"Got {featured1.FeaturedWin.Length.ToString()} items for Windows."); // Get a list of featured games for region DE. FeaturedApps featured2 = await steamApiClient.GetFeaturedAppsAsync(CountryCode.Germany); Console.WriteLine($"Got {featured2.FeaturedWin.Length.ToString()} items for Windows."); // Get a list of featured games grouped by category. FeaturedCategories featuredCategories1 = await steamApiClient.GetFeaturedCategoriesAsync(); Console.WriteLine($"Got {featuredCategories1.TopSellers.Items.Length.ToString()} top sellers items."); // Get a list of featured games grouped by category for region US. FeaturedCategories featuredCategories2 = await steamApiClient.GetFeaturedCategoriesAsync(CountryCode.USA); Console.WriteLine($"Got {featuredCategories2.TopSellers.Items.Length.ToString()} top sellers items."); }
public static string FindNeosDir(SteamAppsManager sam) { SteamApp NeosApp = null; foreach (SteamApp app in sam.SteamApps) { if (app.AppID == 740250) { NeosApp = app; } } if (NeosApp == null) { throw new Exception("Neos was not found! Is it installed?"); } return(NeosApp.InstallDir); }
public void UnlockAchievement_Click(SteamApp app) { switch (app.Type) { case SteamAppTypeEnum.Application: case SteamAppTypeEnum.Game: //var nApp = app.Clone(); //nApp.Process = Process.Start($"{ProductInfo.Title}.exe", app.AppId.ToString(CultureInfo.InvariantCulture)); app.Process = Process.Start(Path.Combine(AppContext.BaseDirectory, App.Instance.ProgramName), "-app " + app.AppId.ToString(CultureInfo.InvariantCulture)); SteamConnectService.Current.RuningSteamApps.Add(app); break; default: StatusService.Current.Notify(Resources.Unsupported_Operation); break; } }
public void PerfectMatchesTest() { List <SteamProfile> Friends = new List <SteamProfile>(); SteamApp app1 = MockTinySteamWrapper.CreateSteamApp(); MockTinySteamWrapper.SetValue(app1, "Name", "Game1"); MockTinySteamWrapper.SetValue(app1, "ID", 101); SteamApp app2 = MockTinySteamWrapper.CreateSteamApp(); MockTinySteamWrapper.SetValue(app2, "Name", "Game2"); MockTinySteamWrapper.SetValue(app2, "ID", 102); SteamApp app3 = MockTinySteamWrapper.CreateSteamApp(); MockTinySteamWrapper.SetValue(app3, "Name", "Game3"); MockTinySteamWrapper.SetValue(app3, "ID", 103); SteamProfileGame game1 = new SteamProfileGame(app1, TimeSpan.FromHours(1)); SteamProfileGame game2 = new SteamProfileGame(app2, TimeSpan.FromHours(1)); SteamProfileGame gameCommon = new SteamProfileGame(app3, TimeSpan.FromHours(1)); SteamProfile friend1 = new SteamProfile() { SteamID = 1, Avatar = "AvatarUrl1", PersonaState = TinySteamWrapper.Steam.PersonaState.Online }; friend1.Games.Add(game1); friend1.Games.Add(gameCommon); Friends.Add(friend1); SteamProfile friend2 = new SteamProfile() { SteamID = 2, Avatar = "AvatarUrl2", PersonaState = TinySteamWrapper.Steam.PersonaState.Online }; friend2.Games.Add(game2); friend2.Games.Add(gameCommon); Friends.Add(friend2); GamesAndPlayers gamesAndPlayers = new GamesAndPlayers(Friends); var match = gamesAndPlayers.GetPerfectMatches(); Assert.AreEqual(1, match.Count); Assert.AreEqual(gameCommon.App, match[0].SteamApp); }
public void UnlockAchievement_Click(SteamApp app) { switch (app.Type) { case SteamAppTypeEnum.Application: case SteamAppTypeEnum.Game: if (WindowService.Current.MainWindow.Dialog("【风险提示】解锁成就可能会被游戏开发者视为作弊,并且会被成就统计网站封锁。若决定继续使用,请自行承担解锁成就带来的风险和后果。")) { app.Process = Process.Start(Path.Combine(AppContext.BaseDirectory, App.Instance.ProgramName), "-app " + app.AppId.ToString(CultureInfo.InvariantCulture)); SteamConnectService.Current.RuningSteamApps.Add(app); } break; default: StatusService.Current.Notify(Resources.Unsupported_Operation); break; } }
public void InstallSteamApp_Click(SteamApp app) { switch (app.Type) { case SteamAppTypeEnum.Media: Process.Start(string.Format(Const.STEAM_MEDIA_URL, app.AppId.ToString())); break; default: if (app.IsInstalled) { TaskbarService.Current.Notify($"正在启动《{app.Name}》", Resources.CurrentAppInstalled); Process.Start(string.Format(Const.STEAM_RUNGAME_URL, app.AppId.ToString())); return; } Process.Start(string.Format(Const.STEAM_INSTALL_URL, app.AppId.ToString())); break; } }
public void UnlockAchievement_Click(SteamApp app) { switch (app.Type) { case SteamAppTypeEnum.Application: case SteamAppTypeEnum.Game: //var achievement = new AchievementWindowViewModel(); //WindowService.Current.MainWindow.Transition(achievement, typeof(AchievementWindow)); var nApp = app.Clone(); //nApp.Process = Process.Start($"{ProductInfo.Title}.exe", app.AppId.ToString(CultureInfo.InvariantCulture)); nApp.Process = Process.Start(Environment.GetCommandLineArgs()[0], "-app " + app.AppId.ToString(CultureInfo.InvariantCulture)); SteamConnectService.Current.RuningSteamApps.Add(nApp); break; default: StatusService.Current.Notify(Resources.Unsupported_Operation); break; } }
public static Server CreateServer(SteamApp app, int?forcedID = null) { int nextID = 0; if (forcedID == null) { while (Servers.Exists(x => x.ID == nextID)) { nextID++; } } Server server = new Server(forcedID ?? nextID, app) { CommandLine = app.DefaultCommandLine }; Servers.Add(server); Directory.CreateDirectory(server.WorkingDirectory); Log.Success($"Server Created - ID: {server.ID} | App: {app.Name}"); return(server); }
public async Task <SteamGameInfo?> TryGetSteamAppAsync(int appId, SteamCountryCode countryCode, SteamResponseLanguage language, CancellationToken token = default) { _logger.Info($"Getting Steam game by app ID: \"{appId.ToString()}\" [countryCode: " + $"{countryCode.ToString()}, language: {language.ToString()}]."); try { SteamApp response = await _steamApiClient.GetSteamAppAsync( appId, (CountryCode)countryCode, (Language)language, token ); return(_dataMapper.Transform(response)); } catch (Exception ex) { _logger.Warn(ex, "Exception occurred during processing response for " + $"\"{appId.ToString()}\"."); return(null); } }
static void Main(string[] args) { List <GetAppListApp> apiApps = GetAppList.GetAllApps(); List <SteamApp> dbApps = SteamGameListData.Models.SteamApp.GetAllSteamApps(); int counter = 0; foreach (GetAppListApp steamApp in apiApps) { // Attempt to get from database SteamApp existingApp = dbApps.Where(x => x.AppId == steamApp.AppId).FirstOrDefault(); if (existingApp == null) { // Add WriteLine(string.Format("Missing {0}: {1}", steamApp.AppId, steamApp.Name), 0); SteamApp newSteamApp = SteamApp.CreateSteamApp(steamApp.AppId, steamApp.Name); SteamApp.UpdateSteamAppReleaseDate(newSteamApp.AppId, GetAppDate(newSteamApp)); } else if (existingApp.ReleaseDate == null) { WriteLine(string.Format("No Release Date {0}: {1}", steamApp.AppId, steamApp.Name), 0); // Get the release date SteamApp.UpdateSteamAppReleaseDate(existingApp.SteamAppId, GetAppDate(existingApp)); } else { WriteLine(string.Format("Found {0}: {1}", steamApp.AppId, steamApp.Name), 0); } counter++; WriteLine(counter + " / " + apiApps.Count, 2); } }
public static AppPackage NewAppPackage(SteamApp associatedSteamApp) => new AppPackage(associatedSteamApp);
private AppPackage(SteamApp associatedSteamApp) { AssociatedSteamApp = associatedSteamApp; }