public override void OnEnter() { AppId_t theAppId = (AppId_t)Convert.ToUInt32(appID.Value); buildID.Value = SteamAppList.GetAppBuildId(theAppId); string directory = ""; found = SteamAppList.GetAppInstallDir((AppId_t)Convert.ToUInt32(appID.Value), out directory, maxDirectoryLenght.Value); if (found != -1) { appDirectory.Value = directory; } else { Fsm.Event(notFound); } string name = ""; SteamAppList.GetAppName(theAppId, out name, maxNameLenght.Value); if (found != -1) { appName.Value = name; } else { Fsm.Event(notFound); } Finish(); }
public void RenderOnGUI() { GUILayout.BeginArea(new Rect(Screen.width - 200, 0, 200, Screen.height)); GUILayout.Label("Variables:"); GUILayout.Label("m_AppList: " + m_AppList); GUILayout.EndArea(); GUILayout.BeginVertical("box"); m_ScrollPos = GUILayout.BeginScrollView(m_ScrollPos, GUILayout.Width(Screen.width - 215), GUILayout.Height(Screen.height - 33)); GUILayout.Label("GetNumInstalledApps() : " + SteamAppList.GetNumInstalledApps()); GUILayout.Label("GetInstalledApps(m_AppList, (uint)m_AppList.Length) : " + SteamAppList.GetInstalledApps(m_AppList, (uint)m_AppList.Length)); { string Name; int ret = SteamAppList.GetAppName(m_AppList[0], out Name, 256); GUILayout.Label("GetAppName(m_AppList[0], out Name, 256) : " + ret + " -- " + Name); } { string Directory; int ret = SteamAppList.GetAppInstallDir(m_AppList[0], out Directory, 260); GUILayout.Label("GetAppInstallDir(m_AppList[0], out Directory, 260) : " + ret + " -- " + Directory); } GUILayout.Label("GetAppBuildId(m_AppList[0]) : " + SteamAppList.GetAppBuildId(m_AppList[0])); GUILayout.EndScrollView(); GUILayout.EndVertical(); }
public override void OnEnter() { Debug.Log(appIDs.Length); theAppIDList = new AppId_t[appIDs.Length]; for (int i = 0; i < theAppIDList.Length; i++) { theAppIDList[1] = (AppId_t)Convert.ToUInt32(appIDs.Get(i)); } uint theList = SteamAppList.GetInstalledApps(theAppIDList, (uint)MaxAppIDs.VariableType); Debug.Log(theList); Finish(); }
private static IFolder GetFolder() { if (Settings.Default.RunFactorioViaSteam) { if (SteamAPI.Init()) { LogManager.WriteLine("SteamAPI.Init() success."); SteamAppList.GetAppInstallDir(new AppId_t(427520), out var factorioInstallPath, 260); SteamAPI.Shutdown(); LogManager.WriteLine("SteamAPI.Shutdown()."); return(new FolderFromPath(factorioInstallPath)); } else { LogManager.WriteLine("SteamAPI.Init() failure."); switch (OperatingSystemInfo.GetOperatingSystemInfo().OperatingSystemType) { case OperatingSystemType.Windows: if (Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Steam App 427520", "InstallLocation", null) is string path) { return(new FolderFromPath(path)); } break; default: LogManager.WriteLine("Couldn't get Steam data."); break; } } } else { switch (OperatingSystemInfo.GetOperatingSystemInfo().OperatingSystemType) { case OperatingSystemType.Windows: if (Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Factorio_is1", "InstallLocation", null) is string path) { return(new FolderFromPath(path)); } break; } return(new FolderFromPath(Settings.Default.FactorioNonSteamFolderPath)); } return(new NonExistingFolder("")); }
public override void OnEnter() { ulong ID = ulong.Parse(this.steamID.Value); CSteamID IDsteam; IDsteam.m_SteamID = ID; isPlaying.Value = SteamFriends.GetFriendGamePlayed(IDsteam, out friendGameInfo); if (isPlaying.Value) { string gameID = Convert.ToString(friendGameInfo.m_gameID); if (appID != null) { appID.Value = gameID; } if (gameName != null && maxStringLenght.Value > 0) { string name; int ifNegative = SteamAppList.GetAppName((AppId_t)Convert.ToUInt32(gameID), out name, maxStringLenght.Value); if (ifNegative != -1) { gameName.Value = name; } else { gameName.Value = "No Name"; } } if (gameIP != null) { gameIP.Value = Convert.ToString(friendGameInfo.m_unGameIP); } if (gamePort != null) { gamePort.Value = (int)friendGameInfo.m_usGamePort; } if (queryPort != null) { queryPort.Value = (int)friendGameInfo.m_usGamePort; } if (steamIDLobby != null) { steamIDLobby.Value = Convert.ToString(friendGameInfo.m_steamIDLobby); } } Finish(); }
public string GetGameName(int appId) { if (appId == -1) { return(null); } string appName; try { if (SteamAppList.GetAppName(new AppId_t((uint)appId), out appName, 256) == -1 && (appName == null || appName == "")) { appName = "Unknown (App Id: " + appId.ToString() + ")"; } } catch (System.Exception e) { appName = "Unknown (App Id: " + appId.ToString() + ")"; } return(appName); }
public void RenderOnGUI() { GUILayout.Label("GetNumInstalledApps() : " + SteamAppList.GetNumInstalledApps()); { m_AppList = new AppId_t[1]; uint ret = SteamAppList.GetInstalledApps(m_AppList, 1); GUILayout.Label("GetInstalledApps(m_AppList, 1) : " + ret + " -- " + m_AppList[0]); } { string Name; int ret = SteamAppList.GetAppName(m_AppList[0], out Name, 256); GUILayout.Label("GetAppName(m_AppList[0], out Name, 256) : " + ret + " -- " + Name); } { string Directory; int ret = SteamAppList.GetAppInstallDir(m_AppList[0], out Directory, 260); GUILayout.Label("GetAppInstallDir(m_AppList[0], out Directory, 260) : " + ret + " -- " + Directory); } GUILayout.Label("GetAppBuildId() : " + SteamAppList.GetAppBuildId(m_AppList[0])); }
internal IEnumerator GetFriends() { if (_funGetFriends == null) { yield break; } _FriendsList.Clear(); AppId_t[] appList; appList = new AppId_t[1]; SteamAppList.GetInstalledApps(appList, 1); SteamAppList.GetNumInstalledApps(); _FriendsCount = SteamFriends.GetFriendCount(EFriendFlags.k_EFriendFlagImmediate | EFriendFlags.k_EFriendFlagIgnoredFriend); for (int i = 0; i < _FriendsCount; i++) { try { SteamFriendsData data = new SteamFriendsData(); //get steamid data._SteamID = SteamFriends.GetFriendByIndex(i, EFriendFlags.k_EFriendFlagImmediate | EFriendFlags.k_EFriendFlagIgnoredFriend); var fgi = new FriendGameInfo_t(); //get playing game name bool ret = SteamFriends.GetFriendGamePlayed(data._SteamID, out fgi); if (ret) { if (fgi.m_gameID.AppID() == SteamUtils.GetAppID()) { data._PlayedGameName = "Planet Explorers"; } else { data._PlayedGameName = "Another game"; } //SteamAppList.GetAppName(fgi.m_gameID.AppID(), out data._PlayedGameName, 256); } //get player state data._PlayerState = SteamFriends.GetFriendPersonaState(data._SteamID); //get player name data._PlayerName = SteamFriends.GetFriendPersonaName(data._SteamID); //get avatar int FriendAvatar = SteamFriends.GetSmallFriendAvatar(data._SteamID); uint ImageWidth; uint ImageHeight; ret = SteamUtils.GetImageSize(FriendAvatar, out ImageWidth, out ImageHeight); if (ret && ImageWidth > 0 && ImageHeight > 0) { ret = SteamUtils.GetImageRGBA(FriendAvatar, _imageData, SteamFriendsData._imageHeight * SteamFriendsData._imageWidth * 4); for (int n = 0; n < _imageData.Length; n += 4) { int x = (n / 4) % SteamFriendsData._imageWidth; int y = (n / 4) / SteamFriendsData._imageHeight; int tag = (SteamFriendsData._imageWidth * (SteamFriendsData._imageHeight - y - 1) + x) * 4; _imageTurnData[n] = _imageData[tag]; _imageTurnData[n + 1] = _imageData[tag + 1]; _imageTurnData[n + 2] = _imageData[tag + 2]; _imageTurnData[n + 3] = _imageData[tag + 3]; } data._avatar.LoadRawTextureData(_imageTurnData); data._avatar.Apply(); } _FriendsList[i] = data; } catch (Exception e) { Debug.Log("SteamGetFriendsProcess GetFriends " + e.ToString()); _funGetFriends(null, false); } yield return(0); } _funGetFriends(_FriendsList, true); }
public override void OnEnter() { installedAppsCount.Value = (int)SteamAppList.GetNumInstalledApps(); Finish(); }