Compare commits

...

1195 Commits
v0.1 ... master

Author SHA1 Message Date
Rohan Singh
aa87fe557f Get rid of ICustomMarshaler (strings to native, possible IL2CPP bug workaround) and remaining Encoding.UTF8 usages 2025-03-20 17:44:19 -04:00
Rohan Singh
0595c9c796 Explicitly turn off BOM when marshaling strings to/from Steamworks, just to be safe 2025-02-03 22:13:32 -05:00
André Straubmeier
b4d3a65f86 PackageVersion / FileVersion 2.4.1 2025-01-16 09:39:49 +01:00
André Straubmeier
a0aac6a82a Update README.md (build badge fix) 2025-01-16 09:38:39 +01:00
Rohan Singh
6d1b9b9602 Merge branch 'steamworks161' 2025-01-15 11:28:57 -05:00
Rohan Singh
e4455258ac Add SteamTimeline 2024-12-16 11:49:31 -05:00
Rohan Singh
5783d89634 Manually marshal server list filters to fix crashing 2024-12-13 19:44:08 -05:00
Rohan Singh
3b58a3dc92 Upgrade to Steamworks 1.61
WIP due to server list crashing for some reason
2024-12-13 18:15:39 -05:00
Rohan Singh
de10d5ced4
Update actions 2024-12-12 13:00:34 -05:00
Rohan Singh
520ac1ca51 Add Friend.Nickname to get Steam nicknames for players
Expose FriendGameInfo.GameID so you can see what appID friends are playing
2024-12-10 15:03:47 -05:00
Rohan Singh
ee6572a380
Merge pull request #742 from height229/master
Fixed typo in SteamClient.cs
2024-12-09 16:21:18 -05:00
Rohan Singh
963729bf64
Merge pull request #709 from Zyhlon/master
Fixes #553 OnNewLaunchParameters never getting called
2024-12-09 16:20:37 -05:00
Jake Rich
eec3c05ecd Merge from fix_serverlist_query_allocations -> master 2024-08-14 12:46:27 -04:00
Jake Rich
62a1ae78e5 Merge from temp_browser_fix -> master
- make IPList disposable
- list Unresponsive vs Unqueried servers seperately)
2024-08-14 12:45:57 -04:00
Jake Rich
7f747b0468 Automatically get the field offset of gameserveritem_t.HasSuccessfulResponse instead of hardcoding it 2024-08-12 21:44:23 -04:00
Jake Rich
a80e8590d5 Add ISteamMatchmakingServers.HasServerResponded() to partial class instead 2024-08-12 21:30:28 -04:00
Jake Rich
09db39d9e3 Codegen 2024-08-12 21:30:05 -04:00
Jake Rich
6dd32eb5c4 Change codegen to make interface classes partial 2024-08-12 21:29:49 -04:00
Jake Rich
d18086a1b8 Fix serverlist query allocating a large amount of memory when a large amount of servers are pending 2024-08-12 20:46:16 -04:00
Rohan Singh
93223cb30a Fix IpList queries not cancelling when disposed 2024-07-16 22:07:37 -04:00
August
6deb4b64d2
Fixed typo in SteamClient.cs 2023-11-07 14:53:36 +01:00
Jake_Rich
f8960c8971 Put all servers that failed to respond to the query into a "Unqueried" list intead of "Unresponsive" 2023-09-06 21:46:41 -04:00
André Straubmeier
4463739be5
Update dotnetcore.yml 2023-06-09 09:49:07 +02:00
André Straubmeier
5475972ae7 InventoryTest.GetExchanges fix 2023-06-09 09:23:26 +02:00
André Straubmeier
a3419df3b9 GameServerTest.BeginAuthSession fix 2023-06-09 09:16:01 +02:00
André Straubmeier
c18a018c3f Forgot to update a few steam_api.dll and steam_api64.dll 2023-06-09 09:00:43 +02:00
André Straubmeier
e21c42e8a2 Add GetAuthTicketForWebApiAsync 2023-06-09 08:45:14 +02:00
André Straubmeier
8a5f229a2f Steamworks SDK 1.57 2023-05-15 14:37:19 +02:00
Frida Külper
10f3323318 Fix OnNewLaunchParameters never getting called 2023-03-17 16:32:18 +01:00
André Straubmeier
4e7e0ef8c4 Revert "Update packages, drop net46 support"
This reverts commit e81d1ac682cee74f84f4a4c967887dce35d18ecd.
2022-11-29 18:17:43 +01:00
André Straubmeier
9160882a9b Merge branch 'master' of https://github.com/Facepunch/Facepunch.Steamworks 2022-11-29 18:15:22 +01:00
André Straubmeier
4b12fa14dc Add SendRateMin, SendRateMax and NagleTime to SteamNetworkingUtils 2022-11-29 18:15:20 +01:00
dependabot[bot]
e81d1ac682
Update packages, drop net46 support 2022-10-12 06:57:41 +01:00
Rubat
814488652b
Handle Steam not running better (#566)
* Handle Steam not running better

* Make Steamworks.SteamClient.IsValid is correct without Steam

Make sure Steamworks.SteamClient.IsValid is correct without Steam running
2022-10-12 06:37:19 +01:00
Max Halldén
aab6d0d081
Check return value from FileRead (#663)
Co-authored-by: Max Halldén <me@maxhallden.com>
2022-10-12 06:34:22 +01:00
Michal Cichra
0fda7e39fe
update to steam sdk 1.55 (#675)
includes native apple M1 support
2022-10-12 06:33:34 +01:00
André Straubmeier
04b921b33d More detailed debug levels in SteamNetworkingUtils 2022-02-16 11:55:24 +01:00
Wesley Baartman
5cb1496e80
Fix strings in readme (#621) 2021-12-13 09:14:29 +00:00
André Straubmeier
2675b3201b Add net46 target framework back for Unity support 2021-11-25 18:36:49 +01:00
André Straubmeier
df99a3e1ac
Merge pull request #612 from Facepunch/steamworks152
Steamworks 1.53 with multi lane and fake IP support
2021-11-25 18:34:12 +01:00
André Straubmeier
a16c92d9c6 Update test case steamclient.dll et al 2021-11-24 15:37:40 +01:00
André Straubmeier
9ff422533f Do test case fake IP initialization before login 2021-11-24 10:19:55 +01:00
André Straubmeier
5d944374b2 RequestFakeIP / GetFakeIP comment fixes 2021-11-24 10:19:26 +01:00
André Straubmeier
36e3f3a58f Add NetAddress.IsFakeIPv4 2021-11-24 10:11:37 +01:00
André Straubmeier
86aa1439aa Generated 1.53 2021-11-24 10:01:12 +01:00
André Straubmeier
6a204680da Redist for 1.53 2021-11-24 09:56:55 +01:00
André Straubmeier
ed1c690d7b Headers for 1.53 2021-11-24 09:55:25 +01:00
André Straubmeier
30ff3a3d85 Add fake IP test cases 2021-11-23 15:46:07 +01:00
André Straubmeier
0455e7fc72 Add fake IP support to SteamNetworkingSockets 2021-11-23 15:44:22 +01:00
André Straubmeier
045a3963b0 Generated fake IP API 2021-11-23 15:39:18 +01:00
André Straubmeier
45df99416e Add missing fake IP API to steam_api.json 2021-11-23 15:38:14 +01:00
André Straubmeier
cf9744913c Redist update for test cases 2021-11-23 15:33:15 +01:00
André Straubmeier
214096e376 All SendMessage overloads have optional laneIndex 2021-11-22 17:53:48 +01:00
André Straubmeier
f3ee5bec4e Connection lanes implementation 2021-11-22 17:51:40 +01:00
André Straubmeier
2088f14c05 Generator comments out SteamInputActionEvent_t.AnalogAction_t types since the type declaration is missing from steam_api.json 2021-11-22 13:41:46 +01:00
André Straubmeier
26eb429654 Generated 1.52 2021-11-22 13:23:29 +01:00
André Straubmeier
70b2a301ca Generator changes to support 1.52 2021-11-22 13:23:07 +01:00
André Straubmeier
2f8c19a1d1 Headers for 1.52 2021-11-22 13:22:54 +01:00
André Straubmeier
59db8fac8a Redist for 1.52 2021-11-22 13:21:59 +01:00
Garry Newman
12663f0d81 Update redistributables 2021-10-24 09:11:09 +01:00
Thunder
c106d01fcb
Documentation Rework (#599) 2021-10-21 08:40:56 +01:00
BOTLANNER
132b1a579b
Fix for GetFloat on struct Steamworks.Data.Stat always returning 0 (#598)
Co-authored-by: B0TLANNER <b0tlanner.games@gmail.com>
2021-10-18 10:52:55 +01:00
Garry Newman
141dbfdaa1 These should be static 2021-09-24 15:47:41 +01:00
Garry Newman
f005600957 SteamPort isn't used anymore here 2021-09-24 14:46:37 +01:00
Garry Newman
480137a490 Added SteamUtils.SetGameLauncherMode 2021-09-24 14:36:48 +01:00
Garry Newman
3b0fa8106c Added SteamUtils.IsRunningOnSteamDeck 2021-09-24 14:29:58 +01:00
Garry Newman
38c2ffd796 Added SteamUGC.GetWorkshopEulaStatus() 2021-09-24 14:28:13 +01:00
Garry Newman
30f35c3aae Added SteamUGC.ShowWorkshopEula() 2021-09-24 14:26:15 +01:00
Garry Newman
1c98852d7c Update fixes 2021-09-24 14:24:00 +01:00
Garry Newman
40bcf2e95a Update to Steamworks 152 2021-09-24 14:06:32 +01:00
Garry Newman
bfa94d89fa Fix TextFilteringContext not getting exposed 2021-09-24 14:00:16 +01:00
Garry Newman
821975435c Merge branch 'master' of https://github.com/Facepunch/Facepunch.Steamworks 2021-09-24 13:55:08 +01:00
Garry Newman
959249d04a
Merge pull request #588 from rtsonneveld/master
Adjusted uploading progress bar so it doesn't jump back
2021-09-24 13:53:31 +01:00
Garry Newman
454c686368
Merge pull request #520 from PhyxionNL/master
Fix NuGet package generation
2021-09-24 13:52:47 +01:00
Garry Newman
b47e1e6f55
Merge pull request #514 from Noek1993/master
Added support for FilterText
2021-09-24 13:51:39 +01:00
Garry Newman
fa34bc76f9
Merge pull request #558 from bobbahbrown/we-hate-gc
Fix GC race condition in sending packets causing crash from steamworks
2021-09-24 13:50:24 +01:00
Garry Newman
ca77bd07bc
Merge pull request #560 from dozd/master
RemoteStoragePublishedFileSubscribed_t and RemoteStoragePublishedFile…
2021-09-24 13:45:53 +01:00
Garry Newman
997baf0a07
Merge pull request #592 from juanjp600/helpers-takememory-fix
Fixed race condition caused by too many tasks using Helpers.TakeMemory simultaneously
2021-09-24 13:44:29 +01:00
Garry Newman
b5dc75d062
Merge pull request #595 from Crytilis/master
Migrated .NET Framework and upgraded projects in anticipation of NET6
2021-09-24 13:40:58 +01:00
Garry Newman
a51ccbb69d Remove unused 2021-09-24 13:40:27 +01:00
Garry Newman
1c21400d3e Create .editorconfig 2021-09-24 13:36:22 +01:00
Jason Thompson
21fb722e3f
Update dotnetcore.yml 2021-09-09 19:48:00 -05:00
Jason Thompson
e96d97c5b5
Update dotnetcore.yml 2021-09-09 19:45:31 -05:00
Jason Thompson
dd613232d3
Update dotnetcore.yml 2021-09-09 19:42:30 -05:00
Jason Thompson
42c7755a58
Update dotnetcore.yml 2021-09-09 19:38:52 -05:00
Jason Thompson
1a1d023356
Update README.md 2021-09-09 19:31:21 -05:00
Jason Thompson
3eb302ac54 Migrated .Net Framework projects to .NET, retargeted projects for netstandard2.1 and/or net6.0 where appropriate, upgraded language level to latest for use with .NET 6 2021-09-09 18:59:58 -05:00
Juan Pablo Arce
9dd286eed4 Updated Generator to use disposable TakeMemory correctly 2021-08-30 22:13:31 -03:00
Juan Pablo Arce
ba0f4d3e10 Fixed native memory buffers allocated by Helpers.TakeMemory being overshared when more than 4 simultaneous tasks call it 2021-08-30 21:25:01 -03:00
Robin Sonneveld
8efc0414c4 Adjusted uploading progress bar so it doesn't jump back after finishing uploading content. 2021-08-06 17:32:45 +02:00
Garry Newman
2be5012647
Merge pull request #554 from chk1/patch-1
Fix typo in function documentation
2021-07-07 18:56:31 +01:00
Angel
b01e98e60c RemoteStoragePublishedFileSubscribed_t, RemoteStoragePublishedFileUnsubscribed_t, ItemInstalled_t callbacks 2021-05-05 13:41:00 +02:00
bobbahbrown
285e88b332 we HATE the garbage collector 2021-04-27 23:11:42 -03:00
Christoph Kisfeld
3eacc55b1e
Fix typo in function documentation 2021-04-22 19:43:40 +02:00
Garry Newman
1bae585602
Merge pull request #524 from HouraiTeahouse/public-lobby-chat
Implement #523: Make Lobby.SendChatBytes public.
2021-04-08 16:14:02 +01:00
Garry Newman
da34905e07
Merge pull request #527 from mlajtos/patch-1
ReadFile -> FileRead
2021-04-08 16:13:22 +01:00
Garry Newman
57d0e40ebb
Merge pull request #541 from morga4/master
Override connection's GetHashCode()
2021-04-08 16:13:04 +01:00
Garry Newman
f18fcb6aa8
Merge pull request #546 from sicklydove/master
Fixes typo in README Achievements code example
2021-04-08 16:12:51 +01:00
Garry Newman
d5b49fdeab
Merge pull request #548 from sschoener/patch-1
Expose message size in IsP2PPacketAvailable
2021-04-08 16:12:34 +01:00
Sebastian Schöner
1fe8f51915
Expose message size in IsP2PPacketAvailable 2021-04-06 22:47:04 +02:00
Laurie
55514d42ac Fixes typo in README Achievements code example 2021-04-02 16:58:09 +01:00
morga4
d2fbf89f99 Override connection's GetHashCode() 2021-03-13 18:48:47 +03:00
Rohan Singh
cca1b0305e Rename 2021-01-26 00:10:06 -05:00
Milan Lajtoš
f567313ea0
ReadFile -> FileRead 2021-01-25 00:00:43 +01:00
Rohan Singh
c7ec49abe0 Steamworks SDK 1.51 2021-01-20 10:25:43 -05:00
Rohan Singh
5c11508f41 Make SendMessage call SendMessages instead of SendMessageToConnection 2021-01-20 09:57:07 -05:00
Rohan Singh
28effd140b Pass results back, optionally 2021-01-19 17:04:48 -05:00
Rohan Singh
616571a3a9 Add ConnectionManager.Broadcast for sending the same message to
multiple clients
2021-01-19 14:23:49 -05:00
james7132
27a0048c0e Fix #523: Make Lobby.SendChatBytes public.
Also add a unsafe variant that would require zero copies to a managed
array.
2021-01-16 20:08:11 -08:00
Rohan Singh
47b9aca324 Crash fix in ConnectionManager.Receive due to bad pointer 2021-01-14 12:58:59 -05:00
PhyxionNL
e6df29654f
Update Facepunch.Steamworks.Win32.csproj 2021-01-14 11:41:38 +01:00
PhyxionNL
fa57c676e2
Update Facepunch.Steamworks.Win64.csproj 2021-01-14 11:41:32 +01:00
Rohan Singh
8057413ea3 Remove Marshal usage in ConnectionManager (removes allocations) 2021-01-13 10:03:41 -05:00
Koen Mulder
4a06c64ded Remove uint from InitFilterText call
FilterText now returns the filtered string instead of the number of filtered characters
2021-01-09 14:05:56 +01:00
Garry Newman
c5c31280c1
Merge pull request #494 from kamyker/k9-on-ws-item-created
UgcEditor.SubmitAsync, on item created callback
2021-01-09 11:46:32 +00:00
Garry Newman
8f579f6e55
Merge pull request #509 from ambid17/feature/game-managed-ugc
Add game managed UGC Items
2021-01-09 11:45:31 +00:00
Koen Mulder
bc6600736c Updated Generator to be in line with expected generated code 2021-01-09 12:13:30 +01:00
Koen Mulder
81c5ca7761 Added support for FilterText 2021-01-05 18:28:45 +01:00
Sabien
5be8940c83 Fix Typo 2020-12-09 23:01:41 -06:00
Sabien
f2ac10deb3 Updated comment 2020-12-09 22:38:21 -06:00
Sabien
088ba90f65 Add game managed UGC Items 2020-12-09 22:36:20 -06:00
Garry Newman
31ffaa3e6e
Merge pull request #504 from DeKon0650/add-suspend-downloads
SuspendDownloads added to public API
2020-11-27 07:35:41 +00:00
DeKon0650
110c0f2bad SuspendDownloads added to public API 2020-11-27 00:03:16 +03:00
André Straubmeier
5c30b6039a Merge branch 'master' of https://github.com/Facepunch/Facepunch.Steamworks 2020-11-23 12:47:51 +01:00
Garry Newman
68977092f3
Merge pull request #502 from benbristow/fix-violence-typo
Fix 'IsLowVoilence' Typo
2020-11-20 07:32:33 +00:00
Ben Bristow
aa6a780185 Fix 'IsLowVoilence' Typo 2020-11-19 21:05:32 +00:00
André Straubmeier
a10a5b40cd Added SteamNetworkingUtils.Unencrypted 2020-11-19 13:57:43 +01:00
André Straubmeier
ea3743bd73 Added optional receiveToEnd toggle to ConnectionManager.Receive and SocketManager.Receive (default true = old behaviour) 2020-11-19 13:44:51 +01:00
kamyker
8be43b4dde Ugc Editor, on item created callback 2020-10-29 17:26:32 +01:00
André Straubmeier
b4de0927f3 Fixed libsteam_api extension in UnityPlugin folder 2020-09-16 12:15:41 +02:00
Garry Newman
9fecd91bed StartPurchaseAsync: Should now be able to pass in multiple of the same item to purchase multiples 2020-09-04 10:42:25 +01:00
Garry Newman
ae70292e7b
Merge pull request #476 from stang-tgs/master
Allow caller to specify OverlayToStoreFlags when opening Store Overlay
2020-09-04 10:37:03 +01:00
Garry Newman
ad1cfca69f Expose OverlayToStoreFlag 2020-09-04 10:35:22 +01:00
Garry Newman
cb792b0f04 Expose ItemPreviewType 2020-09-04 10:34:33 +01:00
Garry Newman
b71c83ad13
Merge pull request #475 from kamyker/k7-addit-prevs
Added ugc addtional previews
2020-09-04 10:34:35 +01:00
Garry Newman
cf3e252d2e
Merge pull request #474 from kamyker/k6-clan-chat
Added clan chat
2020-09-04 10:33:03 +01:00
Garry Newman
8d25edf498
Merge pull request #472 from MadrMan/master
Fix race condition with async callresults
2020-09-04 10:22:50 +01:00
Garry Newman
fd6f7c8586
Merge pull request #466 from kamyker/k5-lobbymsg
Lobby.SendChatString() and OnChatMessage fix
2020-09-04 10:16:54 +01:00
Garry Newman
bd6693146c Re-adding BroadcastUploadStart_t and BroadcastUploadStop_t - because while they're no longer in the sdk, they are documented on the site 2020-09-04 10:05:37 +01:00
Garry Newman
fdbb97748b Removing Removed 2020-09-04 10:04:57 +01:00
Garry Newman
d8b6cf7c83 Make NetKeyValue partial to support the added functions 2020-09-04 10:01:39 +01:00
Garry Newman
6291c8f117 Replace int64_t with long, int32_t with int 2020-09-04 09:55:06 +01:00
Garry Newman
73b5c9ceb6 Manually create SteamNet delegates 2020-09-04 09:53:07 +01:00
Garry Newman
699b7c0850 Don't generate types starting with "FnSteam" 2020-09-04 09:46:12 +01:00
Garry Newman
e4a35ff64d Generated 1.50 2020-09-04 09:43:19 +01:00
Garry Newman
a627bf76c8 Headers 1.50 2020-09-04 09:42:26 +01:00
Garry Newman
7609e61a14 Redist for 1.50 2020-09-04 09:41:24 +01:00
André Straubmeier
5645a91e7f Added SteamNetworkingSockets.ConnectRelay overload that takes an IConnectionManager 2020-09-01 10:31:17 +02:00
André Straubmeier
74207eeaf3 Added SteamNetworkingSockets.Identity 2020-09-01 10:30:42 +02:00
Simon Tang
44af74e892 Allow caller to specify OverlayToStoreFlags when opening Store Overlay - fix 2020-08-31 18:03:45 -07:00
Simon Tang
d373077c9a Allow caller to specify OverlayToStoreFlags when opening Store Overlay 2020-08-31 17:58:12 -07:00
André Straubmeier
f739f9b588 Added SteamNetworkingUtils.AllowWithoutAuth 2020-08-31 18:19:16 +02:00
kamyker
0d9db585f5 Added ugc addtional previews 2020-08-28 13:10:57 +02:00
kamyker
11bc35f254 Merge branch 'k3-item-dependency' into k7-addit-prevs 2020-08-28 13:09:55 +02:00
kamyker
0eb3672674 Added clan chat 2020-08-28 13:07:27 +02:00
André Straubmeier
f887d8a9ba Connection.QuickStatus implementation 2020-08-20 15:46:08 +02:00
André Straubmeier
c4ffb5eac7 CompileFix.bat includes unit test projects 2020-08-20 11:02:07 +02:00
André Straubmeier
f84872b38c Fix for duplicate OnDisconnected callbacks when ConnectionState.ClosedByPeer or ConnectionState.ProblemDetectedLocally were followed by ConnectionState.None 2020-08-19 18:27:09 +02:00
André Straubmeier
4a2eb22ec7 Reverting ConnectionState.None handling to previous behaviour (for the callbacks) 2020-08-18 14:34:37 +02:00
André Straubmeier
ea1408392b TestSocketInterface fix 2020-08-18 13:50:16 +02:00
Garry Newman
5fd6de76d7 UnitTest DLL fixes 2020-08-18 11:47:24 +01:00
Garry Newman
91d03c957f Added SteamFriends.RegisterProtocolInOverlayBrowser 2020-08-18 11:36:57 +01:00
Garry Newman
6d0cfa1ec8 Added SteamFriends.OnOverlayBrowserProtocol 2020-08-18 11:36:50 +01:00
Garry Newman
88c742d415 Added SteamApps.IsTimedTrial 2020-08-18 11:33:31 +01:00
Garry Newman
68a1886283 Generate for new SDK 2020-08-18 11:30:47 +01:00
Garry Newman
ce3c395b49 Add missing BroadcastUploadStart_t and BroadcastUploadStop_t callbacks 2020-08-18 11:29:00 +01:00
Garry Newman
24431ca9db Delete ISteamTV (seems to be removed from the SDK now) 2020-08-18 11:28:45 +01:00
Garry Newman
a8794e6321 Steam SDK 1.49 libraries 2020-08-18 11:16:51 +01:00
Garry Newman
49f25b3936 Steam SDK 1.49 .h 2020-08-18 11:13:59 +01:00
André Straubmeier
6e67204ddc Don't try to remove the connection poll group in OnDisconnected (causes assert spam) 2020-08-18 12:06:27 +02:00
André Straubmeier
401f53b30d Removed SocketManager.Connecting and SocketManager.Connected lists (can be tracked in ISocketManager if needed) 2020-08-18 11:52:31 +02:00
André Straubmeier
943c4f9a30 Handle ConnectionState.None similar to the examples 2020-08-18 11:27:06 +02:00
André Straubmeier
498c1b9a32 ISocketManager.OnDisconnected is in charge of calling Connection.Close so custom parameters can be used 2020-08-17 13:49:22 +02:00
André Straubmeier
5fdffff5c4 ConnectionManager.Close takes the same optional parameters as Connection.Close 2020-08-17 13:31:15 +02:00
MadrMan
384cbf6b4c Fix race condition with async callresults 2020-08-16 11:55:43 +02:00
kamyker
c7ac4997ed Lobby.SendChatString() and OnChatMessage fix 2020-08-05 01:17:59 +02:00
Garry Newman
950b256c27
Merge pull request #449 from rhys-vdw/patch-1
Document SteamClient.IsValid
2020-07-05 10:58:27 +01:00
kamyker
75dc868064 getting dependencies/children 2020-06-19 10:02:36 +02:00
Rhys van der Waerden
c0c32e500a
Document SteamClient.IsValid
Copied wording from https://wiki.facepunch.com/steamworks/Setting_Up#using
2020-06-12 11:21:58 +10:00
Garry Newman
ec3012484a
Merge pull request #445 from kamyker/k1-summmary-typo
Summary typo
2020-06-09 07:15:37 +01:00
Garry Newman
8a1722053e
Merge pull request #446 from kamyker/k2-collection-item
Collection ws item editor
2020-06-09 07:15:19 +01:00
kamyker
6e2ab8b735 Add/Remove ws item dependency 2020-06-09 00:22:54 +02:00
kamyker
198b5555a2 collection item editor 2020-06-09 00:17:03 +02:00
kamyker
30d52cd541 typo 2020-06-09 00:15:33 +02:00
Garry Newman
de69dd228f
Merge pull request #441 from maxha651/master
Support return UGC metadata in query
2020-06-07 10:55:30 +01:00
Max Halldén
b0a64798cf
Add hint about WithMetadata 2020-06-04 21:02:23 +02:00
Max Halldén
af36007f5d Support return UGC metadata in query 2020-05-31 00:24:25 +02:00
Garry Newman
ed45805029
Merge pull request #437 from naomiEve/clans
Steam Clans support
2020-05-25 16:06:30 +01:00
unknown
53fc721ea9 Added a Clan struct. Implemented most primitive clan functions 2020-05-25 16:51:01 +02:00
Garry Newman
d4356b75dd
Merge pull request #434 from kamyker/leaderboards-users-ids
Added GetScoresForUsersAsync (DownloadLeaderboardEntriesForUsers)
2020-05-21 09:53:17 +01:00
Garry Newman
5c95620ee6
Merge pull request #435 from kamyker/getasync-disposed
Item.GetAsync ResultPage disposed
2020-05-21 09:53:00 +01:00
kamyker
a3bd199b11 fix for count == 0 2020-05-20 22:32:51 +02:00
kamyker
7e4f1400c3 brace fix 2020-05-20 22:26:25 +02:00
kamyker
f568958a39 Fixed Item.GetAsync() not disposed 2020-05-20 17:31:44 +02:00
kamyker
b8df8aff4a Added GetScoresForUsersAsync (DownloadLeaderboardEntriesForUsers) 2020-05-19 23:22:26 +02:00
Garry Newman
d080548c20
Merge pull request #431 from kamyker/leaderboards-count
DownloadLeaderboardEntries count more precise
2020-05-18 11:18:50 +01:00
Garry Newman
c25bc70d53
Merge pull request #432 from kamyker/faster-ugc-query
Ability to disable default stats loading to speed up ugc query
2020-05-18 11:18:12 +01:00
kamyker
a9391b72d5 Ability to disable default stats loading to speed up ugc query 2020-05-18 02:18:43 +02:00
kamyker
b522f5affa Last parameter for DownloadLeaderboardEntries is index inclusive 2020-05-18 02:11:15 +02:00
Garry Newman
9101b82450
Merge pull request #423 from kamyker/key-value-tags
Ugc item key value tags
2020-05-15 07:31:24 +01:00
Garry Newman
8ea013d69e
Merge pull request #418 from brian9206/master
Interface approach for CreateRelaySocket
2020-05-15 07:25:33 +01:00
Garry Newman
025cc9b3f0
Merge pull request #419 from Dimma/patch-1
Update README.md
2020-05-15 07:25:12 +01:00
kamyker
d58d95fe38 Removing/replacing ugc KeyValueTags 2020-05-14 20:11:59 +02:00
kamyker
9d8a9a1e9a comma 2020-05-08 01:41:47 +02:00
kamyker
392b57e18d Ugc item key value tags
(cherry picked from commit a5386b358fec87911d2c4cd221d53b90f470bcf4)
2020-05-08 01:40:39 +02:00
Garry Newman
9b487aae0e Added IntPtr version of DecompressVoice 2020-05-07 11:54:27 +01:00
Garry Newman
b813ee7a17 Don't use ThreadStatic in Helpers 2020-05-07 11:47:46 +01:00
Garry Newman
04d1c86954 Update OnGameWebCallback docs 2020-05-07 11:35:36 +01:00
Garry Newman
c10167bb91 Throw exception if ContentFolder doesn't exist or is empty 2020-05-07 11:05:37 +01:00
Dimma
1f5b5bea5f
Update README.md
Wrong properties in "Get Avatars"
2020-05-04 17:37:15 +03:00
Brian Choi
aa1751071d Add interface method for CreateRelayServer 2020-05-02 22:18:46 +08:00
Garry Newman
0beaeb2e9d ISteamUGC.RequestUGCDetails is deprecated 2020-03-31 08:34:51 +01:00
Garry Newman
abb4b7f6b6 Compile fix 2020-03-31 08:28:35 +01:00
Garry Newman
a0974e9ba3 Use Helper.TakeMemory instead of TakeBuffer where safe 2020-03-31 08:24:12 +01:00
Garry Newman
ecdf217d08 Make Helper calls threadsafe 2020-03-31 08:10:43 +01:00
Garry Newman
4c353264cb
Merge pull request #391 from KingofBeast/master
Add OnSteamNetAuthenticationStatus and SteamServer.SteamId
2020-03-13 18:39:13 +00:00
KingofBeast
6d4639376d Install OnSteamNetAuthenticationStatus listener, expose SteamServer.SteamId 2020-03-13 13:05:21 -05:00
Garry Newman
2f8acff629 Making SteamMatchmakingServers internal since it's not used 2020-03-04 12:40:31 +00:00
Garry Newman
cf1260983c FileVersion 2020-03-04 12:40:19 +00:00
Garry Newman
ead77b6567 Update Facepunch.Steamworks.targets 2020-03-03 09:09:47 +00:00
Garry Newman
f9b6448469 Version update 2020-03-02 10:04:13 +00:00
Garry Newman
36e5e50d85 Fixed ConnectionInfo.Identity returning wrong thing 2020-03-02 10:03:38 +00:00
Garry Newman
1797505960 Update FriendsTest.cs 2020-03-02 09:49:02 +00:00
Garry Newman
2287e5527b Added Friends.OpenWebOverlay test 2020-03-02 09:30:10 +00:00
Garry Newman
e48a0db798 Version Update 2020-03-01 11:38:29 +00:00
Garry Newman
d06054875a Add MonoPInvokeCallback to OnDebugMessage 2020-02-28 19:21:23 +00:00
Garry Newman
23129f3a83 Added SteamNetworkingUtils.SendBufferSize 2020-02-28 15:34:41 +00:00
Garry Newman
3a11b6f8b3 Update Facepunch.Steamworks.Win64.csproj 2020-02-28 14:28:04 +00:00
Garry Newman
d9bf9abeac Update Facepunch.Steamworks.Win64.csproj 2020-02-28 14:13:49 +00:00
Garry Newman
1a1809ba40 Fixed calling StreamServer.Shutdown clearing client interfaces too 2020-02-28 14:13:47 +00:00
Garry Newman
08a4136a3e Seems like struct packing only changes with CSteamId if it's not the first field 2020-02-28 13:53:22 +00:00
Garry Newman
53d86e7e3f Call OnDebugCallback on CallResults too 2020-02-28 13:31:08 +00:00
Garry Newman
e9978ec55b Fixed GlobalStatsReceived not added to debug list 2020-02-28 13:26:06 +00:00
Garry Newman
773ea24aa4 Update Facepunch.Steamworks.Win64.csproj 2020-02-28 12:20:20 +00:00
Garry Newman
b265084d18 Added Dispatch.OnException 2020-02-28 12:10:53 +00:00
Garry Newman
c24b247094 Removed SteamClient.OnCallbackException, SteamServer.OnCallbackException 2020-02-28 11:41:11 +00:00
Garry Newman
e6c0167c48 Some collection modified safety in Dispatch (seeing a few exceptions on Rust staging) 2020-02-28 11:05:27 +00:00
Garry Newman
5aeeaa0cd7
Update README.md 2020-02-27 20:03:23 +00:00
Garry Newman
e5b467ae35 SendMessage comments 2020-02-27 20:00:38 +00:00
Garry Newman
08d36b7ea1 Only try to copy to Rust folder if you're using my computer 2020-02-27 14:33:19 +00:00
Garry Newman
ebf77a8fde Added interface versions of Connection/SocketManagers 2020-02-27 14:01:27 +00:00
Garry Newman
66b221984f Fixed Sockets created using CreateRelaySocket not recieving messages 2020-02-27 13:45:42 +00:00
Garry Newman
09256aa4a3 Rename SocketInterface to SocketManager, ConnectionInterface to ConnectionManager 2020-02-27 12:54:23 +00:00
Garry Newman
2acbf964de Build a .win32 version for nuget too 2020-02-27 12:53:49 +00:00
Garry Newman
631969360c use Defines.k_SteamInventoryResultInvalid instead of default 2020-02-27 10:02:03 +00:00
Garry Newman
9db103cb2f Add Steamworks.Dispatch.OnDebugCallback 2020-02-27 10:01:43 +00:00
Garry Newman
8db2b46729 Hide structs starting with "PS3" 2020-02-27 09:49:58 +00:00
Garry Newman
93e21a5f79 Generate a dictionary of CallbackType's and the actual typeof the callback struct 2020-02-27 09:21:38 +00:00
Garry Newman
600c7dbcc4 Debug output for SocketInterface test 2020-02-26 15:29:12 +00:00
Garry Newman
f7d9acd05a Added NetAddressTest 2020-02-26 15:28:52 +00:00
Garry Newman
61b09add87 ConnectionInfo exposes NetAddress, NetIdentity 2020-02-26 15:28:40 +00:00
Garry Newman
57775e5d10 Added a bunch more functions to NetAddress 2020-02-26 15:28:25 +00:00
Garry Newman
d900b6e217 Added a bunch of functions/properties to NetIdentity 2020-02-26 15:28:16 +00:00
Garry Newman
13feee328d Renamed var ConnectionInfo from data to info 2020-02-26 14:55:13 +00:00
Garry Newman
49b55c74b8 Using shorter NetAddress.From 2020-02-26 13:49:46 +00:00
Garry Newman
8b2a888feb Cleaned up SteamClientClass/SteamServerClass 2020-02-26 13:49:31 +00:00
Garry Newman
b0d23eff22 Fixed dispatch double callbacks when server initialized 2020-02-26 12:42:20 +00:00
Garry Newman
bf60680d87 Renamed SteamNetworkingUtils.GetConfigInt to SetConfigInt 2020-02-26 12:41:45 +00:00
Garry Newman
a8f1ac3799 Added SteamNetworkingUtils.Timeout 2020-02-26 12:41:29 +00:00
Garry Newman
122c2b0a57 Added SteamNetworkingUtils.ConnectionTimeout 2020-02-26 12:41:20 +00:00
Garry Newman
a60281dc41 Fixed SteamServer events being hooked twice 2020-02-25 19:04:28 +00:00
Garry Newman
5d9e4b5c0b Fixed SteamFriends events not being hooked 2020-02-25 19:03:56 +00:00
Garry Newman
4d98ea3d51 Output data as proper hex 2020-02-25 16:26:18 +00:00
Garry Newman
263fb219a8 Nuget - include steam_api64.dll 2020-02-25 14:37:29 +00:00
Garry Newman
998c18764a Chnaged RequestEncryptedAppTicketAsync tests to keep in mind that it can only be called once every 60 seconds 2020-02-25 13:29:15 +00:00
Garry Newman
59eabc1302 Throw exception if trying to initialize multiple times 2020-02-25 12:42:09 +00:00
Garry Newman
b45ac59a21 Update SteamNetworkingTest.cs 2020-02-25 12:33:16 +00:00
Garry Newman
f191ee5e42 Shutdown dispatch on server/client close 2020-02-25 12:32:12 +00:00
Garry Newman
895e11e801 Nuget shit 2020-02-24 18:58:53 +00:00
Garry Newman
61a103919b Delete Jenkinsfile 2020-02-24 17:14:22 +00:00
Garry Newman
a043019f0a Update dotnetcore.yml 2020-02-24 17:08:37 +00:00
Garry Newman
546066d4cc Update dotnetcore.yml 2020-02-24 17:03:06 +00:00
Garry Newman
d526fa5e9f Update dotnetcore.yml 2020-02-24 17:02:01 +00:00
Garry Newman
bffa403e39 actions/checkout@v2 2020-02-24 16:59:19 +00:00
Garry Newman
a075810468
Update dotnetcore.yml 2020-02-24 16:57:07 +00:00
Garry Newman
f1e8664d28
Create dotnetcore.yml 2020-02-24 16:42:51 +00:00
Garry Newman
c9053b0a91 In ISteamNetworking everything is deprecated apart from the p2p stuff 2020-02-24 16:26:23 +00:00
Garry Newman
403488dfcb Fixed NetworkUtils.DebugOut on 32bit 2020-02-24 14:46:29 +00:00
Garry Newman
d990b537a3 Some code quality stuff 2020-02-24 14:11:27 +00:00
Garry Newman
b52a63bc8b Delete Facepunch.Steamworks.Posix64.csproj 2020-02-24 13:34:32 +00:00
Garry Newman
23b3304332 RequestUserStats to RequestUserStatsAsync 2020-02-24 13:28:27 +00:00
Garry Newman
52ecc0b594 Added SteamUgc.DownloadAsync 2020-02-24 13:24:18 +00:00
Garry Newman
2843749918 Hide FriendFlags 2020-02-24 13:07:50 +00:00
Garry Newman
faee6f6cf2 Rename RequestGlobalStats to RequestGlobalStatsAsync 2020-02-24 12:58:46 +00:00
Garry Newman
29f426baf0 Added Friend.GetAchievementUnlockTime 2020-02-24 12:00:57 +00:00
Garry Newman
ae900f84bc Added Friend.GetAchievement 2020-02-24 12:00:42 +00:00
Garry Newman
2928939c9f Added Friend.GetStatInt 2020-02-24 12:00:34 +00:00
Garry Newman
7c20b57957 Added Friend.GetStatFloat 2020-02-24 12:00:26 +00:00
Garry Newman
18fbabaf2c Added Friend.RequestUserStats() 2020-02-24 12:00:13 +00:00
Garry Newman
86a8f80584 Fixed SocketInterface duplicate connections, callbacks 2020-02-24 11:33:52 +00:00
Garry Newman
44196682c8 Added SteamNetworkUtils.OnDebugOutput, DebugLevel 2020-02-24 11:33:29 +00:00
Garry Newman
41c1d0da08 Ignore enums with "Force32Bit" in their names 2020-02-24 10:33:11 +00:00
Garry Newman
3c8a2f6cd1 NetMsg uses the flat function to release 2020-02-24 10:14:59 +00:00
Garry Newman
afd314627d Added StructFunctions 2020-02-24 10:14:31 +00:00
Garry Newman
e7a6a00675 Networking Cleanup 2020-02-24 08:58:09 +00:00
Garry Newman
4871c634fb Added IsSteamChinaLauncher 2020-02-23 19:14:27 +00:00
Garry Newman
fc74049123 Added Duration Control 2020-02-23 19:09:31 +00:00
Garry Newman
f495d18ece Added SteamRemotePlay 2020-02-23 18:58:50 +00:00
Garry Newman
8b2599be98 Try to define whether interfaces are shared/client/server only a bit better 2020-02-23 18:34:56 +00:00
Garry Newman
c80421e9a9 Update NetworkingSocketsTest.TestConnectionInterface.cs 2020-02-23 11:48:31 +00:00
Garry Newman
428c2425a0 CallResult takes an IsServer parameter 2020-02-23 11:44:14 +00:00
Garry Newman
aab047717b Merge branch 'master' of https://github.com/Facepunch/Facepunch.Steamworks 2020-02-23 11:26:02 +00:00
Garry Newman
bc9801c36a Prefer use client interface if both exist (this might need a big change at some point) 2020-02-23 11:25:56 +00:00
Garry Newman
f517587edc
Update README.md 2020-02-23 09:43:06 +00:00
Garry Newman
49252f49f5
Update README.md 2020-02-23 09:41:57 +00:00
Garry Newman
23a5964171
Wiki link 2020-02-23 09:41:45 +00:00
Garry Newman
dfa98564f7 Update issue templates 2020-02-23 09:22:54 +00:00
Garry Newman
4d2d15f3af Update issue templates 2020-02-23 09:22:27 +00:00
Garry Newman
16d4b4f6f8 Update issue templates 2020-02-23 09:21:07 +00:00
Garry Newman
8f36f0c939 Comment Fix 2020-02-23 09:14:16 +00:00
Garry Newman
ffa48fb03c Fixed server interfaces 2020-02-23 08:57:25 +00:00
Garry Newman
011c596cb1 Meta Files 2020-02-22 21:52:00 +00:00
Garry Newman
4108895749 Build server fix 2020-02-22 21:47:30 +00:00
Garry Newman
e3ac585144 No need for posix32/64 now - combined to just posix 2020-02-22 21:45:26 +00:00
Garry Newman
c2a980227d Wrong named meta file 2020-02-22 21:28:22 +00:00
Garry Newman
4b10d72d12 Callback fix 2020-02-22 21:13:47 +00:00
Garry Newman
abb749078b Removed debug Console.WriteLine 2020-02-22 21:11:14 +00:00
Garry Newman
c8cb180b78 Added SteamUserStats.RequestGlobalStats 2020-02-22 21:03:29 +00:00
Garry Newman
d58dfdf4d2
Merge pull request #326 from kamyker/kamyker-patch-2
Fix for InvetoryDef Properties
2020-02-22 20:54:30 +00:00
Garry Newman
a934498263
Merge pull request #368 from mkracik/master
Added bool parameter Active to event OnGameOverlayActivated
2020-02-22 20:49:56 +00:00
Garry Newman
1d3585fa6a
Merge branch 'master' into master 2020-02-22 20:49:47 +00:00
Garry Newman
b6c24ce04c
Merge pull request #373 from matt-bcs/master
Added EntryCount to Leaderboard
2020-02-22 20:48:13 +00:00
Garry Newman
ceb66b731e
32bit now supported again 2020-02-22 20:47:48 +00:00
Garry Newman
8ecd08fa50
Update README.md 2020-02-22 20:47:24 +00:00
Garry Newman
3a0e68c6e1 Unity dll updates 2020-02-22 20:46:24 +00:00
Garry Newman
a7954f9e21 Updated tests 2020-02-22 20:29:37 +00:00
Garry Newman
d8e5a48f65 Updated Implementation to use flat api 2020-02-22 20:23:19 +00:00
Garry Newman
92b45c7596 Latest Generated 2020-02-22 20:18:07 +00:00
Garry Newman
ed96cafbe4 Updated generator to use flat files 2020-02-22 20:16:04 +00:00
Garry Newman
85339a079a Steamworks 1.48 2020-02-22 20:14:01 +00:00
Matt Davis
6c84df0ef8 fixed indent for EntryCount 2020-02-16 12:15:27 -05:00
Matt Davis
2872bb92f7 added EntryCount to Leaderboard 2020-02-15 21:23:03 -05:00
Michal Kracik
841d665046 Updated OnGameOverlayActivated.
Updated to OnGameOverlayActivated?.Invoke( x.Active != 0 ) )
2020-02-10 14:49:55 -05:00
Michal Kracik
f60b54df33 Added bool parameter Active to event OnGameOverlayActivated to pass it from GameOverlayActivated_t. 2020-02-09 09:25:43 -05:00
Garry Newman
cfa77bc9e2
Merge pull request #366 from trdwll/connectionid
Make Id public only a getter
2020-02-05 10:17:33 +00:00
Garry Newman
2db3bb9bb3
Merge pull request #364 from trdwll/Lobby-ctor-public
Make Lobby ctor public
2020-02-05 10:17:17 +00:00
Russ Treadwell
427524abc9
Make Id public only a getter 2020-02-04 18:03:06 -05:00
Russ Treadwell
06d0059d87
Make Lobby ctor public 2020-02-04 13:47:57 -05:00
Garry Newman
f3443935b2
Merge pull request #356 from trdwll/ISteamFriends-add-methods
Expose IsFollowing, GetFollowerCount, and EnumerateFollowingList
2020-01-23 08:21:27 +00:00
Russ Treadwell
e4e3b0dbce
Fix EnumerateFollowingList and rename to GetFollowingList 2020-01-22 22:52:03 -05:00
Russ Treadwell
1a263c09cf
Expose IsFollowing, GetFollowerCount, and EnumerateFollowingList in SteamFriends 2020-01-21 17:35:04 -05:00
Garry Newman
6fbc1e80f3
Merge pull request #354 from trdwll/typo-fix
typo on AvailableLanguages
2020-01-21 22:30:39 +00:00
Garry Newman
7c82a9fc60
Merge pull request #355 from trdwll/shutdown-fix
shutdown server stats
2020-01-21 22:30:25 +00:00
Garry Newman
8dc011964f
Merge pull request #353 from kamyker/ugc-dl-validation
Fixed ugc validation/redownload
2020-01-21 22:30:09 +00:00
Garry Newman
6e896c2085
Merge pull request #350 from kurozael/ft/steam-input-glyph
Added a method to retrieve the glyph location for a provided controller and action
2020-01-21 22:26:35 +00:00
Russ Treadwell
1fd8ea89a9
shutdown server stats 2020-01-21 14:41:38 -05:00
Russ Treadwell
773605c841
typo on AvailableLanguages 2020-01-21 14:29:54 -05:00
kamyker
d42996142f Fixed ugc validation/redownload 2020-01-20 19:57:36 +01:00
kamyker
22e963250e Merge remote-tracking branch 'origin23/master' into masterFP 2020-01-20 19:54:13 +01:00
kurozael
d919a1e635 Added a method to retrieve the glyph location for a provided controller and action 2020-01-18 22:38:34 +00:00
Garry Newman
4e98ae5027
Merge pull request #338 from alexcodejammer/master
Exposed ConnectionInfo.EndReason
2019-12-16 10:24:55 +00:00
Alex Mein
19e64429c4 Merge remote-tracking branch 'upstream/master' 2019-12-16 09:49:24 +00:00
Rohan Singh
710c6a0ce7 Limit SourceServerQuery to one concurrent request per endpoint 2019-12-07 08:41:06 -05:00
Garry Newman
2e6db5fe37 fixed SourceServerQuery shared buffer errors 2019-12-06 14:27:38 +00:00
Garry Newman
127de84c8c
Merge pull request #335 from kamyker/subdl-fix
Fixed sometimes false returned from SubscribeDownloadAsync
2019-12-06 08:47:30 +00:00
kamyker
e9d130572a Fixed sometimes false returned from SubscribeDownloadAsync 2019-12-06 01:43:27 +01:00
Alex Mein
2fc5206b38 Exposed ConnectionInfo.EndReason 2019-12-05 16:49:52 +00:00
Garry Newman
04ad04f95d Added SteamServer.UserHasLicenseForApp 2019-12-04 11:15:58 +00:00
Garry Newman
32fbf63644
Merge pull request #333 from kamyker/ws-download-progress
SubscribeDownloadAsync for workshop item
2019-12-03 10:58:10 +00:00
kamyker
61f3809b4e SubscribeDownloadAsync has flag state fix 2019-12-03 01:13:27 +01:00
kamyker
c5f1033aeb Added SubscribeDownloadAsync for workshop item 2019-12-03 01:07:39 +01:00
Kamil Szurant
6587db5a9d
Fix for InvetoryDef Properties
Otherwise we get error in `_properties[name] = vl;` as name is null. GetProperty(null) is called to get list of keys as string. I guess separate method would be cleaner but I'm keeping this example to minimum (or im too lazy).
2019-11-19 20:50:41 +01:00
Garry Newman
f1fdf29124
Merge pull request #319 from LukasKastern/master
Added SteamFriends.GetFriendsWithFlag
2019-11-11 08:56:06 +00:00
Garry Newman
8ceecd7350
Merge pull request #321 from alexcodejammer/master
Added missing workshop features
2019-11-11 08:55:36 +00:00
Garry Newman
5832c3ea82
Merge pull request #323 from HouraiTeahouse/master
Add unsafe overloads for SteamNetworking P2P send and recieve functions
2019-11-11 08:54:50 +00:00
james7132
84063b674c Fix indentation 2019-11-10 17:03:21 -08:00
james7132
3e95d41692 Add unsafe overloads for SteamNetworking 2019-11-10 16:57:39 -08:00
Alex Mein
2f63117c32 Exposed the full result of the Vote method 2019-10-28 15:40:30 +00:00
Alex Mein
8b231bf4d6 Made SteamUGCDetails_t.Result available via a public method in UgcItem 2019-10-23 11:07:56 +01:00
Alex Mein
f549a69bc0 Added proper implementation of the various 'setreturn...' methods which previously did nothing 2019-10-18 10:07:18 +01:00
Alex Mein
4997a74d15 Added public methods for playtime tracking 2019-10-16 16:02:01 +01:00
Alex Mein
e3ce99bc12 Added missing newline 2019-10-16 14:47:23 +01:00
Alex Mein
455a9f8956 Added missing public methods for various functions in ISteamUGC. Fixed UGC Submit process reporting invalid progress value. 2019-10-16 14:41:57 +01:00
Lukas Kastern
83aa37ce4f Added SteamFriends.GetFriendsWithFlag
Added SteamFriends.GetFriendsWithFlag.
Reworked SteamFriends.GetFriends and SteamFriends.GetBlocked to work upon it.
I also had to expose the FriendFlags.
2019-10-11 16:44:27 +02:00
Garry Newman
06169693d0
Merge pull request #310 from laurirasanen/master
Add SteamFriends.GetFromSource
2019-09-19 14:41:12 +01:00
laurirasanen
796976cd47 Add SteamFriends.GetFromSource 2019-09-19 16:25:43 +03:00
Garry Newman
39952fe50e
Merge pull request #308 from TheCubicNoobik/SteamFriends-fix
Fix SteamFriends.GetRichPresence(key, value)
2019-09-16 10:02:20 +01:00
Andrii Vitiv
9ad3a57ad9
Fix SteamFriends.GetRichPresence(key, value)
Adds key/value to the dictionary only if the rich presence was set successfully. Also fixes #307
2019-09-15 00:48:49 +03:00
Garry Newman
5666bb432e Update package version 2019-08-29 15:58:56 +01:00
Garry Newman
3c2eeb7f2f Throw exceptions if trying to use client interfaces with no client 2019-08-17 11:52:56 +01:00
Garry Newman
a7666d7d51 Can disable automatic RunCallback calling by setting asyncCallbacks to false in Init 2019-08-17 11:40:52 +01:00
Garry Newman
71b977ef7e Don't catch and send exceptions to OnCallbackException in RunCallbacks (but do in RunCallbacksAsync) 2019-08-17 11:40:26 +01:00
aylaylay
a02d1e87a7 Revert "Revert "Fixed server not being listed on master server""
This reverts commit ac8983ee949501dec4a241e3494a57fa7cc61de3.
2019-08-17 08:08:10 +01:00
aylaylay
ac8983ee94 Revert "Fixed server not being listed on master server"
This reverts commit c69b817d62fe90e17e748e190d055b7ee511ff20.
2019-08-17 08:07:25 +01:00
Garry Newman
5c36a5c338 Removed usages of StringBuffer
Il2CPP fucks over StringBuffer by changing its Capacity
We can properly UTF8 convert these strings now
2019-08-14 14:39:04 +01:00
Garry Newman
58eae03ae4 Added UGCItem download stats 2019-08-14 12:01:39 +01:00
Garry Newman
4f6e8bf8d1 Trying PreserveAttribute instead 2019-08-08 11:00:34 +01:00
Garry Newman
1a02a9c363 Prevent Utf8StringToNative.GetInstance getting optimized out 2019-08-07 19:43:44 +01:00
Garry Newman
1e5dc7b2ea Added CompileFix.bat whcih calls dotnet restore on every project (wtf) 2019-08-07 19:15:51 +01:00
Garry Newman
4fafe33a93
Merge pull request #286 from LukasKastern/master
Fixed GetFriends returning blocked friends
2019-07-04 09:18:08 +01:00
Lukas Kastern
717ec3942f
Add files via upload 2019-07-03 20:59:03 +02:00
Garry Newman
c6c73a36e9 Handle steam shutdown nicer 2019-07-02 14:12:55 +01:00
Garry Newman
38b1ed5f88 Il2Cpp didn't like CustomMarshaler on returns, so string returns are Utf8StringPointer instead, which implicit converts to string 2019-07-02 13:52:04 +01:00
Garry Newman
2fb1426479 win64 doesn't care about calling convention - but apprently il2cpp does, so we use CallingConvention.Cdecl on everthing 2019-07-02 13:37:34 +01:00
Garry Newman
7a4f0c029a Fix MatchMakingKeyValuePair issues 2019-07-02 12:08:02 +01:00
Garry Newman
968e658913
Merge pull request #281 from thesupersoup/master
Lobby game server methods, OnLobbyCreated and OnLobbyGameCreated, Achievement progress
2019-07-01 10:08:54 +01:00
Garry Newman
1273b5985f
Merge pull request #283 from Agoxandr/fixtypo
Fix typo SteamNetworkingUtils.LocalTimestamp
2019-07-01 10:07:55 +01:00
thesupersoup
d2e4417ef2 Added OnLobbyCreated
Added OnLobbyCreated action and handler for associated LobbyCreated_t event
2019-06-30 03:23:08 -07:00
Alexander Filippov
fc42dca5bf Fix LocalTimestamp 2019-06-29 14:17:49 +02:00
thesupersoup
17434b2910 Updated summary for SetGameServer, IndicateAchProg exception 2019-06-26 20:36:17 -07:00
thesupersoup
7c1a218553 Lobby game server methods, OnLobbyGameCreated event, Achievement progress notification
Added SetGameServer and GetGameServer for lobby, added OnLobbyGameCreated event in SteamMatchmaking, added SteamId.IsValid check against default ulong value, added SteamUserStats.IndicateAchievementProgress for progress notification.
2019-06-26 20:31:54 -07:00
Garry Newman
6f5bde4f79
Merge pull request #278 from thesupersoup/master
LobbyQuery Numerical and NearVal Filters, SteamClient and Friend OwnsLobby
2019-06-26 10:04:25 +01:00
Garry Newman
3b4d4bf3d8 Cleanup proper 2019-06-25 15:03:21 +01:00
Garry Newman
689ada6eca Clean workspace up 2019-06-25 13:39:18 +01:00
Garry Newman
b60fa061ed Only copy dlls to debug locations if we're compiling on my PC 2019-06-25 13:26:18 +01:00
Garry Newman
e7deae2ae3 Update Jenkinsfile 2019-06-25 13:12:17 +01:00
Garry Newman
caea5ccb9b Fixed pointer size in ConnectionInterface 2019-06-25 13:01:41 +01:00
Garry Newman
39bc7b5c1b StructPlatformPackSize is 8 on win32 2019-06-25 12:58:25 +01:00
Garry Newman
11cc473a6e PLATFORM_32/64 defines 2019-06-25 12:47:31 +01:00
Garry Newman
7f4e0567a6 Swap overloaded function address on both win32 and win64 2019-06-25 12:47:22 +01:00
Garry Newman
7fbc333547 Handle struct returns differently on 32bit windows too 2019-06-25 12:42:17 +01:00
Garry Newman
a24ae4bac5 Translate memory offsets for 32bit 2019-06-25 12:40:23 +01:00
Garry Newman
a53a0f537c Allow 32bit processes 2019-06-25 12:36:57 +01:00
Garry Newman
71af8c0e9b Copy steam_api in tests 2019-06-25 12:36:46 +01:00
Garry Newman
74ec75b708 32bit test projects 2019-06-25 12:36:27 +01:00
Garry Newman
617275db3f 32bit test libs 2019-06-25 12:36:16 +01:00
Garry Newman
69e2e9bd39 POSIX32 2019-06-25 12:21:29 +01:00
Garry Newman
016b86ce8e Config no longer needed 2019-06-25 12:14:15 +01:00
Garry Newman
4cef345d95 Callback vtable uses #ifdef 2019-06-25 12:13:30 +01:00
Garry Newman
f53e1aaba0 Global function cleanup 2019-06-25 12:13:04 +01:00
Garry Newman
d5abb32aeb Neater generated vtable code 2019-06-25 12:04:43 +01:00
Garry Newman
810cb3623f Code formatting 2019-06-25 12:01:00 +01:00
Garry Newman
1df586305d No need to use Config.Os for vtable address swapping 2019-06-25 12:00:04 +01:00
Garry Newman
690db722eb No need for _Windows function alternatives 2019-06-25 11:39:17 +01:00
Garry Newman
6dbed6a91d StructPlatformPackSize instead of runtime Pack8 shit 2019-06-25 11:20:39 +01:00
thesupersoup
f42fa5942f Update NumericalFilter.cs
Removed unnecessary using statements
2019-06-25 03:09:40 -07:00
thesupersoup
12c26384e7 Update LobbyQuery.cs 2019-06-25 03:04:35 -07:00
Garry Newman
02e9063db8 New projects in solution 2019-06-25 11:01:49 +01:00
thesupersoup
9442689b02 NumericalFilter struct and suggested changes
Added NumericalFilter struct, changed the dictionary for numerical filters into a list of the struct, removed IsOwner from Friend and SteamClient and added IsOwnedBy( SteamId ) to Lobby
2019-06-25 03:01:13 -07:00
Garry Newman
040291ed22 Platform specific dlls 2019-06-25 10:03:38 +01:00
thesupersoup
db41c0f407 Update LobbyQuery.cs 2019-06-24 21:47:19 -07:00
thesupersoup
4b8e1e33af LobbyQuery Numerical Filters, NearValFilter, SteamClient and Friend OwnsLobby methods
Added LobbyQuery numerical filters for WithLower, WithHigher, WithEqual, and WithNotEqual; added OrderByNear for near value filters. Added OwnsLobby method to SteamClient and Friend to test for ownership.
2019-06-24 20:13:48 -07:00
Garry Newman
0300b46ed3 Sting Filter fixes 2019-06-24 15:09:29 +01:00
Garry Newman
57f3b334b5
Merge pull request #277 from thesupersoup/master
LobbyQuery FilterStringKeyValue method
2019-06-24 13:35:59 +01:00
thesupersoup
efd2fa2291 Changed exception check in FilterStringKeyValue
To check for invalid argument conditions
2019-06-24 01:45:10 -07:00
thesupersoup
fdc5b49587 Exceptions and expression body definition
Added exception throwing for FilterStringKeyValue, changed MaxLobbyKeyLength to internal and expression body definition
2019-06-24 01:35:33 -07:00
thesupersoup
645e7bd91e Removed second FilterStringKeyValue method and improved first
Second method was non-functional due to access modifier inconsistency, added IsNullOrEmpty and MaxLobbyKeyLength check to first method, added MaxLobbyKeyLength (and backing field) to SteamMAtchmaking, taken from https://partner.steamgames.com/doc/api/ISteamMatchmaking#constants
2019-06-23 22:12:21 -07:00
Mitch
6a0a46f495 Method summary for FilterStringKeyValue( MatchMakingKeyValuePair_t kv )
Added summary to method
2019-06-23 18:32:27 -07:00
Mitch
caf52e4c4b Update LobbyQuery.cs 2019-06-23 14:54:12 -07:00
Mitch
78761d9fd7 LobbyQuery FilterStringKeyValue diff param
Added MatchMakingKeyValuePair_t veriant of FilterStringKeyValue
2019-06-23 14:52:36 -07:00
thesupersoup
56efc9f48b LobbyQuery String Filter
Added LobbyList FilterStringKeyValue method, fixed spacing on SteamMatchmaking.LobbyEnter_t.Install() parameter
2019-06-23 14:19:16 -07:00
Garry Newman
08405459bd
Merge pull request #276 from JannikNickel/master
Added missing functionality to UgcQuery and UgcItem
2019-06-23 19:27:46 +01:00
Jannik Nickel
97b85172e2 Update UgcItem.cs 2019-06-23 20:22:37 +02:00
Jannik Nickel
c4eff7f61a Added missing methods to UgcItem and UgcQuery
Added Steamworks.Ugc.Query.WhereSearchText
Added Steamworks.Ugc.Item.VotesUp
Added Steamworks.Ugc.Item.VotesDown
Added Steamworks.Ugc.Item.Subscribe
Added Steamworks.Ugc.Item.Unsubscribe
2019-06-23 20:22:28 +02:00
Garry Newman
fd50e3ba71 Added SteamClient.RestartAppIfNecessary 2019-06-21 11:59:11 +01:00
Garry Newman
15dc2782cc Nicer return string marshalling 2019-06-20 13:26:11 +01:00
Garry Newman
1d242fbc98 Added CreateChineseFile test 2019-06-20 13:10:38 +01:00
Garry Newman
a0478a6040 Store struct strings as byte and encode as utf8 on demand 2019-06-20 13:10:28 +01:00
Garry Newman
615645a30e Utf8String marshaller 2019-06-20 12:19:21 +01:00
Garry Newman
552d5251f8 Merge branch 'master' of https://github.com/Facepunch/Facepunch.Steamworks 2019-06-20 11:39:17 +01:00
Garry Newman
bddac0ccc9 Cleanup, crash fixes 2019-06-20 11:39:13 +01:00
Garry Newman
fa48a1ce33 Controller progress 2019-06-20 10:41:57 +01:00
Garry Newman
bce40a3c3a
Merge pull request #274 from thesupersoup/master
Pull req - OnLobbyEntered Action and JoinLobbyAsync
2019-06-20 09:23:50 +01:00
thesupersoup
ade772d195 Pull req - OnLobbyEntered Action and JoinLobbyAsync
Added an OnLobbyEntered action with associated LobbyEnter_t event install, and added a JoinLobbyAsync method which returns the joined lobby if successful
2019-06-19 21:17:53 -07:00
thesupersoup
cb06574820 Pull req - OnLobbyEntered Action and JoinLobbyAsync
Added an OnLobbyEntered action with associated LobbyEnter_t event install, and added a JoinLobbyAsync method which returns the joined lobby if successful
2019-06-19 21:14:35 -07:00
Garry Newman
1c5cdd2d39 Controller tests 2019-06-19 16:18:12 +01:00
Garry Newman
ae1f648fa6 SteamInput, Controller boilerplate 2019-06-19 13:08:49 +01:00
Garry Newman
1ac22e1407 ISteamInput.GetConnectedControllers is an array 2019-06-19 13:05:09 +01:00
Garry Newman
77f3e09e98 Convert steam struct bools to bytes (to make them marshallable) 2019-06-19 13:04:18 +01:00
Garry Newman
985aefc2de SteamInput Base 2019-06-19 11:35:35 +01:00
Garry Newman
41a0b31644 ISteamInput generation 2019-06-19 11:33:16 +01:00
Garry Newman
ef071d3d71 OnP2PConnectionFailed passes error enum 2019-06-19 11:25:16 +01:00
Garry Newman
7c50db6997 Merge branch 'master' of https://github.com/Facepunch/Facepunch.Steamworks 2019-06-03 11:10:00 +01:00
Garry Newman
5b32943aa8 Increase max string length 2019-06-03 11:09:57 +01:00
Garry Newman
d64ef909c6
Merge pull request #269 from laurirasanen/master
Install SteamNetworkingSockets events when initializing SteamServer
2019-06-02 17:05:17 +01:00
laurirasanen
52381d4af8 Install SteamNetworkingSockets events when initializing SteamServer 2019-06-02 13:44:04 +03:00
Garry Newman
33703be387 nuget version 2019-05-30 15:11:13 +01:00
Garry Newman
adf39138a4 Add IntPtr version of HandleIncomingPacket 2019-05-30 08:15:01 +01:00
Garry Newman
253c206f71 Added OnSteamServerConnectFailure 2019-05-27 15:24:43 +01:00
Garry Newman
33830e274e Added SteamServer.ClearKeys() 2019-05-27 15:24:28 +01:00
Garry Newman
c93fe0ca11 Added SteamServer.LogOff() 2019-05-27 15:24:19 +01:00
Garry Newman
c69b817d62 Fixed server not being listed on master server 2019-05-27 15:23:56 +01:00
Garry Newman
2ad31e1375 Append Async to some async method names 2019-05-27 10:54:30 +01:00
Garry Newman
c60612b8b0 Some currency fix ups 2019-05-26 21:33:18 +01:00
Garry Newman
e4c9e9d034 Added SteamInventory.StartPurchaseAsync 2019-05-25 14:34:59 +01:00
Garry Newman
cad7edcec0 Added SteamMatchmaking.GetHistoryServers() 2019-05-24 15:19:04 +01:00
Garry Newman
5c973b0092 Fixed history servers being returned in favourites 2019-05-24 15:18:55 +01:00
Garry Newman
ffb0c7a830 Changed FriendGameInfo GamePort to ConnectionPort to match ServerInfo 2019-05-23 15:10:07 +01:00
Garry Newman
91e9e162f3 Added SteamMatchmaking.GetFavoriteServers() 2019-05-23 14:59:42 +01:00
Garry Newman
711bc7cb3d ServerInfo (AddTo|RemoveFrom)(History|Favorites) works 2019-05-23 14:46:26 +01:00
Garry Newman
761ff33663 Added GetAuthSessionTicketAsync, which waits on GetAuthSessionTicketResponse_t before returning 2019-05-21 20:39:56 +01:00
Garry Newman
2c4fc82ae2 Filled out FriendGameInfo 2019-05-20 14:52:31 +01:00
Garry Newman
6b9b7da34b Fixed SteamInventory not getting events on server 2019-05-18 12:04:43 +01:00
Garry Newman
7c53fc580d
Merge pull request #255 from FromZeus/master
Add ServersConnected and ServerConnectFailure callbacks to SteamServer
2019-05-17 09:10:02 +01:00
Daniil Trishkin
5f7bd08320 Add SteamServersConnected_t and SteamServerConnectFailure_t callbacks to SteamServer 2019-05-17 01:08:35 +02:00
Garry Newman
f06b4b431b InventoryItem.Flags uses SteamItemFlags 2019-05-16 15:02:16 +01:00
Garry Newman
a5bd78a597 SteamItemDetails_t should read flags properly on windows 2019-05-16 15:02:00 +01:00
Garry Newman
778b1081cb Windows specific on overloaded functions in ISteamGameServerStats 2019-05-15 13:25:50 +01:00
Garry Newman
a1599e3226 Added InventoryResult.BelongsTo( <steamid> ) 2019-05-15 13:11:00 +01:00
Garry Newman
cf2bc51c54 InventoryDef and Recpie IEquatable 2019-05-14 20:17:15 +01:00
Garry Newman
208af219d2 Added Acquired and Origin properties to InventoryItem 2019-05-14 20:17:01 +01:00
Garry Newman
17d7263973 Added InventoryDef.GetRecipesContainingThis() 2019-05-14 16:05:28 +01:00
Garry Newman
fed6ccdefa Should fix inventory definitions updating on server 2019-05-14 15:47:25 +01:00
Garry Newman
98915f0950 Fallback to FindOrCreateUserInterface if CreateInterface returns null 2019-05-14 13:29:09 +01:00
Garry Newman
a2942bd098 Use CreateInterface instead of FindOrCreateUserInterface 2019-05-14 10:23:43 +01:00
Garry Newman
d671c1ddc8 Test warning fixes 2019-05-14 10:23:21 +01:00
Garry Newman
fff2fc6098 Cleaning up inventory deserialize 2019-05-13 20:05:10 +01:00
Garry Newman
f629b1c663 Fixed NRE in OnAchievementIconFetched 2019-05-13 19:51:20 +01:00
Garry Newman
7a30b76a26 Don't release inventoryg result in InventoryUpdated callback 2019-05-13 15:51:55 +01:00
Garry Newman
69ec868227 Added Async to some async calls 2019-05-13 15:50:31 +01:00
Garry Newman
6981eb4a73 FindDefinition return null if _defMap is null 2019-05-13 14:50:47 +01:00
Garry Newman
fdee0bfc1e Cancel async waits if steam becomes invalid during wait 2019-05-13 13:13:12 +01:00
Garry Newman
b6cecf0082 If SteamInternal.GameServer_Init returns false, print the parameters in the error 2019-05-13 10:37:36 +01:00
Garry Newman
6a2db11c5d AppId.ToString 2019-05-13 10:37:07 +01:00
Garry Newman
326d27e98e Fixed UGC User Queries 2019-05-13 09:21:20 +01:00
Garry Newman
44dfa45337 Fixed server not setting appid properly 2019-05-13 09:13:19 +01:00
Garry Newman
99dcc83ab0 Comment fix 2019-05-13 09:01:21 +01:00
Garry Newman
f014681cc4 Clear interfaces and dangling pointers on steam shutdown 2019-05-10 14:08:17 +01:00
Garry Newman
69773bb033 Squeeze all the UGC Queries into one struct 2019-05-10 13:38:04 +01:00
Garry Newman
8a6bbb9a91 SteamTypes implement IComparable 2019-05-10 12:22:28 +01:00
Garry Newman
d290c26db1 Shutdown ISteamMatchmakingServers properly 2019-05-10 12:13:30 +01:00
Garry Newman
43f09dc2ed Update InventoryTest.cs 2019-05-10 10:50:47 +01:00
Garry Newman
586f4ee6f2 Added Ugc.Item.Edit() 2019-05-10 10:43:03 +01:00
Garry Newman
1980a2106a Update Base.cs 2019-05-10 10:10:20 +01:00
Garry Newman
d0b4ce0451 Fixed OnActiveBeaconsUpdated not getting called 2019-05-10 10:10:03 +01:00
Garry Newman
075e5460a4 InventoryItem IEquatable 2019-05-10 10:09:52 +01:00
Garry Newman
eae18553da Types now impl,ement IEquatable 2019-05-10 10:08:47 +01:00
Garry Newman
10c099d910 Added Steamworks.ServerList.IpList for querying an array of Ips 2019-05-10 09:33:58 +01:00
Garry Newman
b85fe5ffd8 nGameLobbyJoinRequested now passes a lobby object 2019-05-09 16:18:34 +01:00
Garry Newman
000358aae8 SteamServerStats 2019-05-09 11:29:50 +01:00
Garry Newman
8c986113de ISteamGameServerStats 2019-05-09 11:17:19 +01:00
Garry Newman
360645962f Equality compare InventoryItem (probably need to do this to every struct) 2019-05-08 21:15:20 +01:00
Garry Newman
f65cfecc64 Changed TransferItemQuantity to Add 2019-05-08 21:14:58 +01:00
Garry Newman
85c55a5bb1 SteamServer.Update becomes RunCallbacks, has OnCallbackException 2019-05-08 20:49:33 +01:00
Garry Newman
9339477c89 SteamInventory.AddPromoItemAsync 2019-05-08 14:52:47 +01:00
Garry Newman
8ea4231778 SteamInventory.TriggerItemDropAsync 2019-05-08 14:52:39 +01:00
Garry Newman
39c1e8da1e SteamInventory.GrantPromoItemsAsync 2019-05-08 14:52:32 +01:00
Garry Newman
60377c9c5b SteamUser.DecompressVoice with byte 2019-05-08 14:52:16 +01:00
Garry Newman
0342f8a712 SteamUserStats.ResetAll 2019-05-08 14:52:05 +01:00
Garry Newman
3212f39be5 SteamUserStats - direct Get/Setters 2019-05-08 14:51:58 +01:00
Garry Newman
05e12c32e1 OnInventoryUpdated passes the InventoryResult 2019-05-08 13:01:28 +01:00
Garry Newman
49bb3644bd Added Stat.Add 2019-05-08 12:38:09 +01:00
Garry Newman
f8798f2f4e Added Server.Tags 2019-05-08 12:28:47 +01:00
Garry Newman
cf458a515a OnAchievementProgress returns a Achievement instead of a string 2019-05-08 12:07:57 +01:00
Garry Newman
6c0e3df84c FetchItem to QueryFileAsync 2019-05-08 11:18:56 +01:00
Garry Newman
c6ac47c0c3 Use pack8 structs for windows where appropriate 2019-05-08 11:13:23 +01:00
Garry Newman
1dd679c391 Test fixes 2019-05-08 11:12:39 +01:00
Garry Newman
ad21e90e90 Added IsPack4OnWindows to codegen struct 2019-05-08 09:49:32 +01:00
Garry Newman
c625bbaef9 Added QuerySpecificFile test 2019-05-08 09:40:42 +01:00
Garry Newman
966ad90630 Added SteamUGC.FetchItem 2019-05-08 09:40:28 +01:00
Garry Newman
eceeb2cb8f Added Steamworks.Ugc.FileQuery 2019-05-08 09:40:19 +01:00
Garry Newman
18f81573f5 Added CraftItemAsync with Amounts 2019-05-07 21:25:41 +01:00
Garry Newman
d40efa8612 InventoryDef properties cache 2019-05-07 21:11:55 +01:00
Garry Newman
b6fa05afa2 InventoryDef.IsGenerator 2019-05-07 21:11:45 +01:00
Garry Newman
060af634d7 SteamInventory.Items (because it's nice and noob friendly) 2019-05-07 21:01:42 +01:00
Garry Newman
a020474856 Added RequestEncryptedAppTicketAsync 2019-05-07 20:21:06 +01:00
Garry Newman
503d8964ea NormalEndtoEnd test, fixed lockups 2019-05-07 17:42:03 +01:00
Garry Newman
d811afc741 Added "Connecting" bool to ConnectionInterface 2019-05-07 17:41:53 +01:00
Garry Newman
45471330d4 Regions in SteamNetworkingSockets 2019-05-07 17:41:36 +01:00
Garry Newman
82fe950bbf Can define Ip in NetAddress 2019-05-07 17:41:24 +01:00
Garry Newman
89e93d6c2a Added Async to some async method names 2019-05-07 16:59:52 +01:00
Garry Newman
6ecc68e5d7 Fixed some SteamInventory methods not being public 2019-05-07 16:52:39 +01:00
Garry Newman
1dc804c7ac Added UgcEditor.WithChangeLog 2019-05-07 16:44:01 +01:00
Garry Newman
8560d94a18 Ugc.Editor visibility 2019-05-07 16:41:18 +01:00
Garry Newman
43c3aa35f5 Ugc.Editor.WithTag 2019-05-07 16:38:54 +01:00
Garry Newman
a82a56bd4c SteamParamStringArray 2019-05-07 16:38:36 +01:00
Garry Newman
3516422c3f UgcEditor.WithPreviewFile 2019-05-07 16:28:48 +01:00
Garry Newman
fd320e2848 Steamworks.Ugc.Item.GetAsync 2019-05-07 16:28:35 +01:00
Garry Newman
f42fdfd09a Rename Ugc.Item.PreviewImageUrl 2019-05-07 15:50:37 +01:00
Garry Newman
a4a1b32bc7 Made SteamInventory.FindDefinition public 2019-05-07 15:49:35 +01:00
Garry Newman
2a74b309dd Added ServerInfo.QueryRulesAsync 2019-05-07 15:33:44 +01:00
Garry Newman
78c69b15a8 InventoryRecipe 2019-05-07 14:27:11 +01:00
Garry Newman
0ae14db7f8 Fixes 2019-05-06 21:41:48 +01:00
Garry Newman
63b3cae096 Cleaning up 2019-05-06 21:19:00 +01:00
Garry Newman
ea97de9c02 Tons of extra UGCItem fields 2019-05-06 20:46:11 +01:00
Garry Newman
dda27d2c61 Delete SteamServerInventory.cs 2019-05-06 15:45:43 +01:00
Garry Newman
2a55d7a8e8 Added Ugc.Item.Directory 2019-05-06 15:45:25 +01:00
Garry Newman
a0d9fdeab1 Added Steamworks.Realm 2019-05-06 15:45:01 +01:00
Garry Newman
d1cc0da526 Adding SteamFriends.RequestUserInformation 2019-05-06 15:44:51 +01:00
Garry Newman
533b6ad28d Network Enum cleanup 2019-05-06 13:38:37 +01:00
Garry Newman
9bb5b5178e Struct name consistency 2019-05-06 13:34:41 +01:00
Garry Newman
b171e22861 SteamNetworkingMicroseconds => long 2019-05-06 13:26:37 +01:00
Garry Newman
16851f1228 Added NetConnection.DetailedStatus 2019-05-06 13:02:39 +01:00
Garry Newman
cdeccc5afe Message send/recv tests 2019-05-06 12:33:29 +01:00
Garry Newman
f77332a41f ConnectionInterface MessageReading 2019-05-06 12:02:36 +01:00
Garry Newman
14d947c7ba NetMsg with Release 2019-05-06 12:02:09 +01:00
Garry Newman
12ab3f1248 NetworkIdentity ToString 2019-05-06 12:00:37 +01:00
Garry Newman
71d8226e28 Force ppOutMessages to IntPtr 2019-05-06 12:00:24 +01:00
Garry Newman
ebfecfe25c Added ReadVoiceDataBytes 2019-05-06 10:31:28 +01:00
Garry Newman
3b2c7a5a16 Adding Receive (it's crashing because it needs to be an array of intptr) 2019-05-03 16:47:29 +01:00
Garry Newman
91083d5d16 Updated Socket Tests 2019-05-03 15:08:48 +01:00
Garry Newman
9d363de6b8 Creating a Socket/Connection means you need to create an interface 2019-05-03 15:07:48 +01:00
Garry Newman
91f8f3ed29 Added SendType 2019-05-03 15:07:10 +01:00
Garry Newman
ab23781a5d SocketInterface/ConnectionInterface 2019-05-03 15:07:01 +01:00
Garry Newman
00bdc717c6 added ConnectionState.cs 2019-05-03 15:06:50 +01:00
Garry Newman
14c5bace46 ConnectionInfo.SteamId 2019-05-03 15:06:18 +01:00
Garry Newman
0265eda9f0 Connection SendMessage 2019-05-03 15:05:55 +01:00
Garry Newman
5fdbf02b29 Added SteamClient.OnCallbackException 2019-05-03 14:11:05 +01:00
Garry Newman
4ed8a4250b SteamNetworkingConnectionState => ConnectionState 2019-05-03 10:44:48 +01:00
Garry Newman
ea0f19ff8e Network struct packing fixes 2019-05-03 10:16:52 +01:00
Garry Newman
6be5826f31 ConnectionInfo 2019-05-02 21:40:39 +01:00
Garry Newman
ce3525bf1d Struct cleanups and testing 2019-05-02 20:41:45 +01:00
Garry Newman
270b3f0300 SteamNetConnectionStatusChangedCallback_t callback 2019-05-02 19:43:01 +01:00
Garry Newman
6c41ef2e51 Connection basics 2019-05-02 17:45:10 +01:00
Garry Newman
1c5eeedf40 SteamNetworking boilerplate 2019-05-02 16:58:44 +01:00
Garry Newman
9b2ad8e49a ISteamNetworkingSockets generating 2019-05-02 16:55:50 +01:00
Garry Newman
3eae3314b6 SteamNetworkUtil global config basics 2019-05-02 15:57:57 +01:00
Garry Newman
16ce5f4d63 NetworkingUtils (Ping stuff) 2019-05-02 15:23:47 +01:00
Garry Newman
1c1925bae9 Update how interfaces are initialized so we can initialize userless 2019-05-02 13:27:46 +01:00
Garry Newman
87ff387ca6 SteamNetworking enum/structs 2019-05-02 13:05:56 +01:00
Garry Newman
239273a715 ISteamNetworkingUtils 2019-05-02 13:05:38 +01:00
Garry Newman
068beddc04 95% bound SteamParties, even though I am doubting its usefulness 2019-05-01 22:29:42 +01:00
Garry Newman
93c4de7eda Added missing structs 2019-05-01 21:46:05 +01:00
Garry Newman
c5ec70447b ISteamParties 2019-05-01 21:33:10 +01:00
Garry Newman
5f9ad75741 OnLobbyMemberLeft becomes OnLobbyMemberLeave 2019-05-01 16:40:46 +01:00
Garry Newman
362ba26729 Chat test 2019-05-01 16:34:46 +01:00
Garry Newman
fbad8b8d6e Lobby Events 2019-05-01 16:30:28 +01:00
Garry Newman
e3840a9a3a LobbyQuery, Lobby Joining, Lobby Creating 2019-05-01 15:55:22 +01:00
Garry Newman
5a68e15676 ISteamMatchmaking 2019-05-01 14:28:42 +01:00
Garry Newman
994cdee49e Round off some edges with ItemDefinitions 2019-05-01 14:03:37 +01:00
Garry Newman
157d0d676e Compile fix 2019-05-01 13:24:05 +01:00
Garry Newman
96eeea1662 GetPlayedWith test RequestInfo on each user first 2019-05-01 13:23:13 +01:00
Garry Newman
cf0e3417de Fixed GetPlayedWith 2019-05-01 13:22:50 +01:00
Garry Newman
8d5f140e09 GetImage returns null on -1 2019-05-01 13:22:06 +01:00
Garry Newman
fb97dbee2e Added Friend.RequestInfoAsync 2019-05-01 13:21:52 +01:00
Garry Newman
ab535d367d Added Achivement.GetIconAsync() (waits for load if not loaded) 2019-05-01 11:47:50 +01:00
Garry Newman
38a29c6059 Safeguards and tests regarding #248 in GetScoresAroundUserAsync 2019-05-01 08:45:11 +01:00
Garry Newman
51ab76893a SteamNetworkingTest 2019-04-30 22:51:01 +01:00
Garry Newman
5938bf59d4 SteamNetworking 2019-04-30 22:45:37 +01:00
Garry Newman
6eae474e6e Parse/Generate ISteamNetworking 2019-04-30 22:01:02 +01:00
Garry Newman
b2cfbe23c5 Fixed not parsing function names containing numbers 2019-04-30 21:58:19 +01:00
Garry Newman
a80ee82e53
Update README.md 2019-04-30 21:19:13 +01:00
Garry Newman
26b79db7e4 Merge branch 'steamworks144' 2019-04-30 17:27:25 +01:00
Garry Newman
850c37e77d Update Jenkinsfile 2019-04-30 17:11:45 +01:00
Garry Newman
32850da719 Update Jenkinsfile 2019-04-30 17:10:06 +01:00
Garry Newman
8916161464 Update Jenkinsfile 2019-04-30 17:07:33 +01:00
Garry Newman
4160e72141 Update Jenkinsfile 2019-04-30 17:03:14 +01:00
Garry Newman
d16db7c13c just do a normal copy 2019-04-30 17:00:57 +01:00
Garry Newman
868c5672b9 Copy using xcopy 2019-04-30 16:58:14 +01:00
Garry Newman
0042a63db1 Artifact test 2019-04-30 16:55:46 +01:00
Garry Newman
1f7e78be09 UnityPlugin base 2019-04-30 16:52:47 +01:00
Garry Newman
93d20de83b ISteamCallback was a nice idea but IL2CPP support makes it unfeasible 2019-04-30 16:43:27 +01:00
Garry Newman
4237204f45
Merge pull request #229 from igniuss/patch-1
Fixed Lobby.Joinable
2019-04-30 16:39:02 +01:00
Garry Newman
86e4576baf IL2CPP works again 2019-04-30 15:42:10 +01:00
Garry Newman
ff48493ceb Structs with a CSteamID don't need the pack8 alternative 2019-04-30 14:56:59 +01:00
Garry Newman
84627fe69f Struct is the pack4 version 2019-04-30 14:51:56 +01:00
Garry Newman
eb51e359d4 Merge branch 'steamworks144' of https://github.com/Facepunch/Facepunch.Steamworks into steamworks144 2019-04-30 14:27:56 +01:00
Garry Newman
87cd93bfde CheckFileSignature => CheckFileSignatureAsync 2019-04-30 14:27:54 +01:00
Garry Newman
10a82adca9 Event cleanup 2019-04-30 14:27:45 +01:00
Garry Newman
cbc154da66 We can treat mac and linux as the same os 2019-04-30 13:01:30 +01:00
Garry Newman
8b78f8a1a7
Update README.md 2019-04-30 12:58:47 +01:00
Garry Newman
8da5ab2cd0 Overloaded functions swap locations only on windows 2019-04-30 11:53:12 +01:00
Garry Newman
a32ab732d1 Unregister events 2019-04-30 11:38:30 +01:00
Garry Newman
3bf1950068 Changd SteamClient.Update to SteamClient.RunCallbacks 2019-04-30 11:10:46 +01:00
Garry Newman
c609d7bb87 Request the stats on startup, harmless enough but useful 2019-04-30 10:40:59 +01:00
Garry Newman
d67bd7d8ef GetGlobals are in bytes, not array size 2019-04-30 10:40:41 +01:00
Garry Newman
f129ff7cac Usaboility tweaks 2019-04-29 16:34:35 +01:00
Garry Newman
b39ee80ecd Special path for Windows call convention when returning a SteamId 2019-04-29 15:47:56 +01:00
Garry Newman
74ef28b9fc MacOs loading 2019-04-29 15:47:23 +01:00
Garry Newman
e68dc15454 Try to dynamically determine the OS 2019-04-29 15:46:56 +01:00
Garry Newman
10e228f765 Api Generate global funcs 2019-04-29 13:28:20 +01:00
Garry Newman
bb2ede3870 Clear pointers on shutdown 2019-04-29 12:55:38 +01:00
Garry Newman
0c19a87813 DeserializeAsync 2019-04-29 11:59:00 +01:00
Garry Newman
2260b222f5 CraftItem 2019-04-29 11:51:06 +01:00
Garry Newman
f91b01d195 GenerateItem 2019-04-29 11:42:58 +01:00
Garry Newman
683925430d Consume, Split, Transfer 2019-04-29 11:33:08 +01:00
Garry Newman
b74d45814a Inventory item def 2019-04-29 11:21:59 +01:00
Garry Newman
1625268f5d InventoryResult.Serialize 2019-04-29 11:13:17 +01:00
Garry Newman
0d509bf126 GetItems, InventoryResult etc 2019-04-29 11:05:55 +01:00
Garry Newman
67de9c8e96 Expose ItemId, DefId types 2019-04-29 10:41:40 +01:00
Garry Newman
d2ce2fe13b GetDefinitions 2019-04-27 21:52:47 +01:00
Garry Newman
37f6192213 LocalPriceFormatted 2019-04-27 21:52:30 +01:00
Garry Newman
aa666a3149 Item Prices 2019-04-27 17:07:39 +01:00
Garry Newman
5a25d750f2 Stats fixes 2019-04-27 16:12:16 +01:00
Garry Newman
194ca8d8b3 Test using Rust instead of Gmod (uses more features) 2019-04-27 15:59:33 +01:00
Garry Newman
11b7fde17d InstalledDepots, AppInstallDir appd param default to current app 2019-04-27 15:58:51 +01:00
Garry Newman
396be12edd Create InventoryTest.cs 2019-04-27 15:56:11 +01:00
Garry Newman
67170a2da4 SteamInventory 2019-04-27 15:55:21 +01:00
Garry Newman
a59e8f9134 ISteamInventory interface 2019-04-27 15:49:33 +01:00
Garry Newman
764b6246e8 Igmore more STEAM_OUT_BUFFER_COUNT etc 2019-04-27 15:46:20 +01:00
Garry Newman
da64466b72 Comment fixes 2019-04-27 15:46:05 +01:00
Garry Newman
053f04bc2f SteamRemoteStorage 2019-04-27 15:04:19 +01:00
Garry Newman
1137076fa7 Parsing fixes 2019-04-27 14:25:54 +01:00
Garry Newman
dd06f22cee ISteamRemoteStorage codegen 2019-04-27 14:10:40 +01:00
Garry Newman
3b89a53da3 Merge branch 'steamworks144' of https://github.com/Facepunch/Facepunch.Steamworks into steamworks144 2019-04-26 18:22:44 +01:00
Garry Newman
4625e22a55 Ugc.Item change 2019-04-26 16:42:46 +01:00
Garry Newman
39705d5a2a Progress - will do for now 2019-04-26 15:40:27 +01:00
Garry Newman
e275b209b3 UgcEditor ContentFolder 2019-04-26 15:23:05 +01:00
Garry Newman
f2ae791e15 UgcEditor 2019-04-26 14:54:47 +01:00
Garry Newman
e4663ecc68 AppId_t => AppId 2019-04-26 14:29:36 +01:00
Garry Newman
bab5664568 Renamed Ugc.Details to Ugc.Result 2019-04-26 14:08:26 +01:00
Garry Newman
30a96ccae7 <LangVersion> 2019-04-26 13:54:17 +01:00
Garry Newman
e2e2554e88 Ugc Queries 2019-04-26 13:46:12 +01:00
Garry Newman
0e4946e550 Query tags 2019-04-26 12:22:27 +01:00
Garry Newman
e9f5898b6c Basic Ugc Querying 2019-04-17 16:41:06 +01:00
Garry Newman
6dd5164f34 ISteamUGC 2019-04-17 14:07:58 +01:00
Garry Newman
9af8935f47 Overloaded function vtable order 2019-04-17 13:53:54 +01:00
Garry Newman
6c1dd241ba Delegate name refactor 2019-04-17 13:36:11 +01:00
Garry Newman
eb16bebae9 Nice name deduplucate 2019-04-17 13:33:38 +01:00
Garry Newman
99e85e9a98 Stats 2019-04-17 13:20:32 +01:00
Garry Newman
934bd2154a AttachUgc 2019-04-17 10:39:58 +01:00
Garry Newman
ddd5cc03f3 Leaderboard, more entries and submit scores 2019-04-17 10:34:47 +01:00
Garry Newman
ebcd96326a Leaderboard.GetGlobalEntriesAsync 2019-04-17 09:31:28 +01:00
Garry Newman
e5a89b0550 Create/Get leaderboard 2019-04-17 08:40:58 +01:00
Garry Newman
d2a3e0b1da Stats callbacks 2019-04-17 08:26:31 +01:00
Garry Newman
5a780c4bc0 GetFileDetailsAsync tweak 2019-04-16 21:57:55 +01:00
Garry Newman
573bf39789 Create FriendsTest.cs 2019-04-16 21:57:42 +01:00
Garry Newman
bc658d0a31
Update README.md 2019-04-16 21:56:29 +01:00
Garry Newman
d4843adcab
Update README.md 2019-04-16 21:51:54 +01:00
Garry Newman
f18de016b1 PlayerCountAsync 2019-04-16 21:22:46 +01:00
Garry Newman
650fb08522 GlobalUnlockedPercentage to GlobalUnlocked 2019-04-16 21:16:43 +01:00
Garry Newman
79ed6a299a Parser fixes 2019-04-16 21:13:55 +01:00
Garry Newman
ebc1336da3 Achievement.Name/Description 2019-04-16 20:57:17 +01:00
Garry Newman
7e02ad736d UserStats (known bug in GlobalUnlockedPercentage) 2019-04-16 17:22:56 +01:00
Garry Newman
f4e2efaca1 ISteamUserStats interface 2019-04-16 16:55:08 +01:00
Garry Newman
b6f651b45c Deduplicate function names 2019-04-16 16:50:05 +01:00
Garry Newman
5782160623 Added SteamScreenshots 2019-04-16 16:37:49 +01:00
Garry Newman
6c5c94e834 Fixed struct packing regression 2019-04-16 15:25:35 +01:00
Garry Newman
ea85ddbb6f CodeWriter remove unused 2019-04-16 15:08:22 +01:00
Garry Newman
1abc9bf973 Constants, Types to data 2019-04-16 15:05:19 +01:00
Garry Newman
a1c64cfeda Generated structs into Data 2019-04-16 15:00:22 +01:00
Garry Newman
da17648ade BaseSteamInterface becomes SteamInterface 2019-04-16 14:54:05 +01:00
Garry Newman
6e350f4d08 Utility cleanup 2019-04-16 14:52:32 +01:00
Garry Newman
28e8f261e2 BaseSteamInterface open interfaces as server if no client 2019-04-16 14:52:19 +01:00
Garry Newman
a4f446d009 DepotId into Data 2019-04-16 14:51:47 +01:00
Garry Newman
59c0550cfc ServerList namespace 2019-04-16 14:51:37 +01:00
Garry Newman
603bd95c38 Epoch 2019-04-16 14:40:59 +01:00
Garry Newman
8e97489def Steamworks.Data 2019-04-16 14:38:10 +01:00
Garry Newman
51b2b7dee2 Moved Name, SteamId to SteamClient 2019-04-16 14:26:42 +01:00
Garry Newman
50ddedfd6e Renaiming top tier to Steam* 2019-04-16 14:21:48 +01:00
Garry Newman
353ddc5a8d Fixes 2019-04-16 14:04:28 +01:00
Garry Newman
ede5320069 Cleaning 2019-04-16 13:42:51 +01:00
Garry Newman
8ceecaf1b0 Cleaning up publics 2019-04-16 12:17:24 +01:00
Garry Newman
bf6883deb9 Big clean 2019-04-16 11:45:44 +01:00
Garry Newman
a634f80790 Real world use part 1 2019-04-16 09:30:17 +01:00
Garry Newman
c19982f3b1 Remove unused Auth 2019-04-15 22:11:14 +01:00
Garry Newman
8107297262 BeginAuthSession test 2019-04-15 21:39:13 +01:00
Garry Newman
c1d611dae7 Test fixes 2019-04-15 21:18:03 +01:00
Garry Newman
3255135df1 GameServer baseline 2019-04-15 20:54:50 +01:00
Garry Newman
90d9ae8c4c Friends Swap 2019-04-15 17:11:01 +01:00
Garry Newman
b134c8708f RichPresence 2019-04-15 16:47:21 +01:00
Garry Newman
e4ddd1fe6c Async avatars 2019-04-15 16:43:55 +01:00
Garry Newman
ca20e5a75a Overlays 2019-04-15 15:54:10 +01:00
Garry Newman
088e9918e0 Friends base 2019-04-15 15:41:01 +01:00
Garry Newman
6fa147141a Pass ** as ref 2019-04-15 15:37:50 +01:00
Garry Newman
ee7e4e076a Fixed parse error 2019-04-15 15:26:52 +01:00
Garry Newman
c5e507fb15 ServerList timeout option 2019-04-15 15:19:41 +01:00
Garry Newman
920ea6ce6b Fixed IsReturnedWeird ordering 2019-04-15 15:19:33 +01:00
Garry Newman
f7e09ec7bf ISteamFriends interface 2019-04-15 14:19:40 +01:00
Garry Newman
41dfaeb2f7 ServerList 2019-04-15 14:07:31 +01:00
Garry Newman
1f0e34cf40 ISteamMatchmakingServers Parser 2019-04-15 11:41:19 +01:00
Garry Newman
e096ba5c6c Removed Voice class (is all in User now) 2019-04-15 11:07:55 +01:00
Garry Newman
2ea8585c48 User Test 2019-04-15 11:06:32 +01:00
Garry Newman
d211dd40e1 User events 2019-04-15 10:39:54 +01:00
Garry Newman
dcd1ea8503 Steamworks.User functions 2019-04-15 10:24:44 +01:00
Garry Newman
e7aa122c1f Refactor 2019-04-14 22:05:51 +01:00
Garry Newman
ca96362a5f Video 2019-04-14 22:04:46 +01:00
Garry Newman
9cf553a786 Music 2019-04-14 21:57:09 +01:00
Garry Newman
db1cfde383 Refactor 2019-04-14 21:48:26 +01:00
Garry Newman
2d2be118d3 Parental settings 2019-04-14 21:48:11 +01:00
Garry Newman
a2cd4b099c Remove old app 2019-04-14 21:39:44 +01:00
Garry Newman
c2a9c7b226 nullsafe invokes 2019-04-14 21:38:36 +01:00
Garry Newman
3b9f6592ef UtilsTest.cs 2019-04-14 21:32:48 +01:00
Garry Newman
7a2fc78105 Utils complete 2019-04-14 21:21:47 +01:00
Garry Newman
8935311b03 GetImageRGBA 2019-04-14 20:52:51 +01:00
Garry Newman
cd30b85444 SteamApps events 2019-04-14 20:48:14 +01:00
Garry Newman
027a110c61 Update Utils.cs 2019-04-13 23:04:03 +01:00
Garry Newman
6b26323bf8 Struct callback cleanup 2019-04-13 22:56:06 +01:00
Garry Newman
173a132d6e SteamApiCallback to result 2019-04-13 22:02:52 +01:00
Garry Newman
76c82bff25 ISteamApps Methods Complete 2019-04-13 21:26:10 +01:00
Garry Newman
fe0d934bfc FileDetails SHA1 2019-04-13 21:20:25 +01:00
Garry Newman
d9da40c0e8 Internal interfaces do the await callback automatically 2019-04-13 21:20:07 +01:00
Garry Newman
cce25e6f77 Exception on 32bit 2019-04-13 18:49:35 +01:00
Garry Newman
d6eb2c8041 Test updates 2019-04-13 18:47:36 +01:00
Garry Newman
429d1937f9 Apps.GetFileDetails propert async working example 2019-04-13 18:47:23 +01:00
Garry Newman
fac123324d Added Utils.GetResult( call ) (generic) 2019-04-13 18:46:57 +01:00
Garry Newman
39a63f6906 Parse and use STEAM_CALL_RESULT to pass result type back 2019-04-13 18:46:39 +01:00
Garry Newman
db7c8d66a4 Use new structs properly 2019-04-13 18:45:40 +01:00
Garry Newman
cf8aa9501c Callback structs implement Steamworks.ISteamCallback 2019-04-13 18:45:09 +01:00
Garry Newman
ede67d51cd SteamApiCallback 2019-04-13 18:44:37 +01:00
Garry Newman
06446a8bc0 ISteamUtils generation 2019-04-12 22:53:46 +01:00
Garry Newman
afb2e286f4 Interface string 2019-04-12 22:52:55 +01:00
Garry Newman
34d6b15fb8 More functions 2019-04-12 21:47:02 +01:00
Garry Newman
199ad77406 Better vector marshalling 2019-04-12 21:30:13 +01:00
Garry Newman
ebea536334 Test fix 2019-04-12 20:26:04 +01:00
Garry Newman
f69710cc15 Filling 2019-04-12 16:02:20 +01:00
Garry Newman
4296e4e748 Easymode/Singleton redux 2019-04-12 15:43:24 +01:00
Garry Newman
96df72c291 Start fumbling the actual vtable instead of the flat functions 2019-04-12 15:43:11 +01:00
Garry Newman
d7a546d913 Parse from source (it's more reliable) 2019-04-12 15:41:40 +01:00
Garry Newman
6719c6d0a4 Steam controller input fixes 2019-04-12 08:29:19 +01:00
Garry Newman
7e09c9d56f Marshal bool properly 2019-04-11 21:49:46 +01:00
Garry Newman
b6266a7386 Codegen 2019-04-11 21:38:19 +01:00
Garry Newman
d91ba6d84a Throw error if interface_pointer is null 2019-04-11 21:38:06 +01:00
Garry Newman
feec8f6842 SteamClient018 2019-04-11 21:37:20 +01:00
Garry Newman
2b43b9b992 Don't bother copying steam_api.dll 2019-04-11 21:37:07 +01:00
Garry Newman
11ad696f7c Throw warning if trying to use in 32bit process 2019-04-11 21:36:57 +01:00
Garry Newman
1eb16f34b8 Don't need steam_api.dll in tests 2019-04-11 21:36:42 +01:00
Garry Newman
63aff6582f Unit test dlls 2019-04-11 21:36:16 +01:00
Garry Newman
d5f762fa32 Update steam_api64.dll 2019-04-11 21:35:18 +01:00
Garry Newman
177ca2b9e7 Remove steam_api.dll 2019-04-11 21:35:12 +01:00
Garry Newman
00bd53f0ec libsteam_api64.so to libsteam_api.so 2019-04-11 21:34:52 +01:00
Garry Newman
9d086dbcf6 Parse newer style STEAM_CALLBACK_BEGIN 2019-04-11 17:00:44 +01:00
Garry Newman
21ff07288d ActivateGameOverlayToWebPage new modal param 2019-04-11 16:46:22 +01:00
Garry Newman
51d0d21674 Fixed RetrieveConnectionDetails char* type 2019-04-11 16:45:00 +01:00
Garry Newman
18262fd4f2 Fixed early outing with enum for no reason 2019-04-11 16:39:59 +01:00
Garry Newman
1e1eb00e04 Fixes, Codegen 2019-04-11 16:37:51 +01:00
Garry Newman
0bf379a41b Steamworks 144 2019-04-11 16:19:09 +01:00
Garry Newman
15b04eec2a 64bit only 2019-04-11 16:18:08 +01:00
Garry Newman
4b9eba285a Dropped net35 supoport 2019-04-11 16:05:18 +01:00
André Straubmeier
26a64f64e7 Added Inventory.Definition.GetCachedStringProperty 2019-03-15 13:58:20 +01:00
André Straubmeier
879a284de3 Added Client.CurrentCountry 2019-03-04 15:55:42 +01:00
James King
0b55f13306 Update leaderboard counts when fetching entries 2019-02-08 23:10:19 +00:00
Sean L
07f9f00cb4
Fixed Lobby.Joinable
GetData("joinable") returns "True" or "False", (note upercase), so the Joinable would always return false.

Fixed by setting to LowerInvariant, since I'm not sure if it returns it uppercase on other platforms as well, or if this ever gets changed.
2019-01-11 14:19:34 +01:00
Rohan Singh
12e26e3f5d Add Inventory.EnableItemProperties to turn off per-item properties (not all games need it and it's a bit slow)
There could be a whitelist Func or something added later for more control if anyone wants to do that
2018-12-06 15:20:30 -05:00
Garry Newman
6c4a83800a
Merge pull request #197 from clansfear/master
Resolved #174  - removed redundant check in InitClient to allow wrapper initialization in offline mode
2018-12-05 10:06:02 +00:00
Garry Newman
fba1986812
Merge pull request #223 from YLahin/master
Fixed Windows x86 build crash on startup
2018-12-05 10:05:04 +00:00
Yaroslav Lahin
c0a6a80089 Fixed Windows x86 build crash 2018-12-05 11:17:34 +03:00
Rohan Singh
80a383730b Add Overlay.IsOpen 2018-12-04 13:39:47 -05:00
Rohan Singh
971751f89d Add Inventory.OnInventoryResultReady so you can check that as well as the generic OnUpdate 2018-12-04 13:39:31 -05:00
Rohan Singh
96511dcc64 Make Inventory.OnUpdate an event, FormatPrice can be passed LocalPrice without needing to multiply it 2018-12-03 08:17:55 -05:00
Rohan Singh
e69e25a1f1 Formats for more currencies, and make that format function public 2018-12-02 13:57:09 -05:00
Garry Newman
6c6c8dc696
Merge pull request #199 from danoli3/macOS_fix
Fix macOS Runtime Platform determination failing
2018-11-30 11:10:43 +00:00
Rohan Singh
7d66fc9744 Fixed items not being removed when the player no longer has it
Fixed item quantity and properties not updating when changed
Fixed an error message getting into the items list
Also checking if an item is nul wont NRE anymore
2018-11-11 07:05:56 -05:00
Rohan Singh
13280cd57c Fix GetAvatar sometimes failing instead of waiting for the avatar to load 2018-11-01 08:35:49 -04:00
Dan Rosser
834bb451a7 Fix macOS Runtime Platform determination failing 2018-10-02 12:20:58 +10:00
Lukasz Taborski
5f3ed7467a Removed unnecessary check for InitClient allowing wrapper to initialize when in offline mode.
Exposed LoggedOn property to manually check the client if it's connected and logged on to the (online) Steam servers.
2018-09-27 13:03:15 +02:00
Garry Newman
438127288a
Merge pull request #94 from jhett12321/master
Add FileTimestamp property to RemoteStorage.File.
2018-07-24 10:14:36 +01:00
Garry Newman
8ebaa933e4
Merge pull request #144 from Phyxion/patch-3
Add NuGet package description
2018-07-24 10:13:53 +01:00
Garry Newman
24df7fb6ad
Merge pull request #151 from alevastor/master
Improvements for rich presence
2018-07-24 10:13:38 +01:00
Garry Newman
812a435031
Merge pull request #166 from Oxy949/master
Added Leaderboard.GetBoardId() to access boardID
2018-07-24 10:12:31 +01:00
Garry Newman
b86d7ff019
Merge pull request #170 from paperjack93/master
Added FetchUsersScores to Leaderboard.cs
2018-07-24 10:12:13 +01:00
Garry Newman
6286e43066 Added Workshop.Editor.KeyValues 2018-07-20 12:15:07 +01:00
Garry Newman
e792d3b3b5 Added Workshop.Editor.MetaData 2018-07-20 12:07:27 +01:00
Garry Newman
a2cbe8dd22 Fixed warning 2018-07-20 12:03:22 +01:00
Garry Newman
a1ca267d93 IsUnity not used 2018-07-20 12:03:12 +01:00
Garry Newman
2d1e529abf Copy the steam_api/steam_api64 dlls as part of the build 2018-07-20 12:02:56 +01:00
Garry Newman
22dda179a3 Complain if WorkshopUploadAppId not set 2018-07-20 12:02:18 +01:00
Garry Newman
dc6b9fa5f7 Set WorkshopUploadAppId when editing item 2018-07-20 12:02:03 +01:00
Garry Newman
55d3fd6b75 Default workshop items to ItemType.Community (most common) 2018-07-20 12:01:52 +01:00
James King
617183184d Added Workshop.GetSubscribedItemIds() 2018-07-16 16:35:15 +01:00
James King
2e8fe41040 Added Workshop.Editor.OnChangesSubmitted event 2018-07-16 16:35:01 +01:00
paperjack
83d71d78a4 Added FetchUsersScores to Leaderboard.cs 2018-05-24 00:41:14 +03:00
Oxy949
1e484a07ed Added Leaderboard.GetBoardId() to access boardID 2018-04-29 13:35:02 +03:00
Alexander Storozhuk
616fcc400d Spelling 2018-04-14 14:02:03 +03:00
Alexander Storozhuk
072ef291a0 Added documentation for rich presence. Changed SetRichPresence return type to bool. Updated rich presence test. 2018-04-14 13:42:15 +03:00
Phyxion
e8741adea5
Update Facepunch.Steamworks.csproj
This otherwise shows as 'Package description'.
2018-04-03 12:41:46 +02:00
Garry Newman
46f56c24f3 In SourceServerQuery, read strings as UTF8 2018-04-03 09:55:11 +01:00
Garry Newman
ff1d866374 Mac uses this call's too (waiting before I rip out older methods) 2018-03-29 10:14:53 +01:00
Garry Newman
227aeee904 Apparently Linux needs ThisCall's too now 2018-03-28 17:34:36 +01:00
Garry Newman
9270eaef07 Server Rules Query uses a custom UdpClient instead of doing it through Steam, avoiding all the nasty vtable building junk 2018-03-27 12:29:34 +01:00
Garry Newman
476321c026 Keep friend status up to date via PersonaStateChange_t 2018-03-27 10:21:11 +01:00
Garry Newman
80bf89c9e6 Fixed inventory.item reliance on definition 2018-03-21 14:41:59 +00:00
Garry Newman
835770772f IPAddress Cleanup 2018-03-21 13:11:25 +00:00
Garry Newman
e94866828a Fixed avatars sometimes not loading 2018-03-21 12:39:43 +00:00
Garry Newman
e8a59e3a10 Merge branch 'master' of https://github.com/Facepunch/Facepunch.Steamworks 2018-03-21 11:46:49 +00:00
Garry Newman
372052a7fb Nuget settings 2018-03-21 11:46:43 +00:00
Garry Newman
41ee808639
Merge pull request #139 from kscarlett/master
Fixed documentation comment for Lobby.Create()
2018-03-21 11:29:33 +00:00
Garry Newman
0a115edae9
Merge pull request #138 from erebuswolf/master
Correctly handle lobby refresh with null filter
2018-03-21 11:29:17 +00:00
Garry Newman
7b7cfa29c4 Added Inventory.OnDefinitionsUpdated 2018-03-21 11:27:18 +00:00
Garry Newman
144f401d2c Register callbacks before setting up interfaces 2018-03-21 11:17:46 +00:00
Garry Newman
a40334551b Added missing callbacks 2018-03-21 10:42:55 +00:00
André Straubmeier
99c77f1997 Inventory.FetchItemDefinitions is now public 2018-03-19 19:36:06 +01:00
kscarlett
ebef55c428
Fixed documentation comment for Lobby.Create() 2018-03-14 11:09:00 +00:00
Jesse Fish
2fb0df5ae3 Correctly handle lobby refresh with null filter
Currently if a null filter is given, more filters are added to the call
than expected. This change makes a lobby request after the appid filter
is added and returns immediately resolving the issue.
2018-03-13 20:11:58 -07:00
Garry Newman
aa3a6d4d24
Merge pull request #132 from dblstallion/master
Added ability to register to OnLobbyJoinRequested callback
2018-02-23 18:52:41 +00:00
Daniel Menard
2474c3de99 Added ability to register to OnLobbyJoinRequested callback 2018-02-23 13:31:50 -05:00
Garry Newman
c58fc3f217 Merge branch 'master' of https://github.com/Facepunch/Facepunch.Steamworks 2018-02-22 11:36:42 +00:00
Garry Newman
aec8f756e8
Merge pull request #129 from dblstallion/master
Added method to show friends invite overlay to Lobby class
2018-02-21 19:25:32 +00:00
Daniel Menard
6b5f8f7481 Added method to show friends invite overlay to Lobby class 2018-02-20 15:55:44 -05:00
Garry Newman
72ef9015b3
Merge pull request #125 from speedis/master
Added servers stats SetAchievement
2018-02-20 10:57:49 +00:00
André Straubmeier
63b31976c0 Workshop.Item.Download returns a boolean 2018-02-20 11:55:59 +01:00
Garry Newman
bf2a074547 Added finalizer, less chance of crashing with unity editor stop plays missing dispose 2018-02-19 14:36:07 +00:00
Garry Newman
6982d05042 Unity fixes 2018-02-19 10:59:57 +00:00
speedis
24c0edcbcb Added servers stats SetAchievement 2018-02-16 22:50:19 +01:00
Garry Newman
c4617c5884 Fixed NRE in inventory result dispose 2018-02-15 14:03:28 +00:00
Garry Newman
2ee5fa4a5d Lobby GameServer information 2018-02-15 13:59:36 +00:00
Garry Newman
71048f1041 Moved LobbyData to its own file 2018-02-15 13:47:21 +00:00
Garry Newman
42d47a14c7 Added Networking.CloseSession 2018-02-15 13:46:01 +00:00
Garry Newman
3895fd33aa Added servers stats ClearAchievement, GetAchievement 2018-02-15 13:43:07 +00:00
Garry Newman
727741b81a Added SteamFriend.SendMessage 2018-02-15 13:36:01 +00:00
Garry Newman
e71cce0817 Added Friends.OnChatMessage 2018-02-15 13:34:04 +00:00
Garry Newman
7abd06a806 Added Friends.ListenForFriendsMessages 2018-02-15 13:23:36 +00:00
Garry Newman
28df21a19b Added app.OnDlcInstalled callback 2018-02-15 13:19:14 +00:00
Garry Newman
c4343ee318 Added App.IsDlcInstalled 2018-02-15 13:15:39 +00:00
Garry Newman
1f121f508a Added Item.Consume 2018-02-15 13:14:23 +00:00
Garry Newman
dd31847990 Added Friends.OnInvitedToGame callback 2018-02-15 12:43:52 +00:00
Garry Newman
2587643b25 Moved SteamFriend to own file 2018-02-15 12:33:24 +00:00
Garry Newman
70c1513c19 Fixed avatar downloading 2018-02-15 12:32:01 +00:00
Garry Newman
8d410969c3 App.GetName + GetInstallFolder, GetBuildId 2018-02-15 11:53:49 +00:00
Garry Newman
ef8234b958 MonoPInvokeCallback doesn't really seem to need a Type 2018-02-15 11:15:26 +00:00
Garry Newman
68b409d163 Callbacks uses static methods (IL2CPP Compatible) 2018-02-14 17:40:16 +00:00
Garry Newman
04c7eb59dc CallResults are queried 2018-02-14 14:15:02 +00:00
Garry Newman
a82f6fc8ed Fixes OnChatStringRecieved returning previous message data 2018-02-14 11:35:16 +00:00
Garry Newman
c4f33a1d3d
Merge pull request #121 from MadDave666/master
added client.Overlay.Enabled property (tells you whether the overlay …
2018-02-13 19:10:29 +00:00
David Salz
e88535ac57 added client.Overlay.Enabled property (tells you whether the overlay is actually available) 2018-02-13 19:44:54 +01:00
Garry Newman
9a9a310b5f
Merge pull request #116 from BrinerLovo/patch-1
Update for can send invitations.
2018-02-09 09:07:40 +00:00
Lovatto
d015d00974
Update for can send invitations.
I have add a simple function for enable send invitations to friends start from line 143.
2018-02-09 00:21:25 -08:00
Garry Newman
09c4a4f63e Merge branch 'master' of https://github.com/Facepunch/Facepunch.Steamworks 2018-02-07 13:29:36 +00:00
Garry Newman
9e8bf53f42 TriggerPromoDrop, TriggerItemDrop, GrantAllPromoItems 2018-02-07 12:31:01 +00:00
Garry Newman
0beef36548 Fixed inventory NRE 2018-02-01 19:30:43 +00:00
Garry Newman
3a4bb29f7e Merge branch 'master' of https://github.com/Facepunch/Facepunch.Steamworks 2018-02-01 19:22:09 +00:00
Garry Newman
59d21a7efb
Merge pull request #108 from igniuss/patch-1
Added AddScreenshotToLibrary
2018-02-01 19:21:51 +00:00
Garry Newman
d134c5e6ff Cleanup 2018-02-01 19:16:44 +00:00
Garry Newman
f0e4c63267
Merge pull request #111 from your1987/lobbylistdata
Added Lobby data getters for LobbyList.Lobby (plus extra LobbyType)
2018-02-01 19:14:42 +00:00
Garry Newman
a2807dbbcf Use new DeleteItem for workshop delete 2018-01-31 13:34:30 +00:00
Garry Newman
44a6f42f8e Added item.SetProperty, item.SubmitProperties 2018-01-31 13:32:16 +00:00
Garry Newman
bda8b5b956 Added Item.Properties 2018-01-31 13:30:51 +00:00
Garry Newman
627fa4c825 Fixed duplicate method name values 2018-01-31 13:05:49 +00:00
Garry Newman
2ecf323ae0 Added tests for new inventory stuff 2018-01-31 12:53:23 +00:00
Garry Newman
796fd29e32 Added Inventory.StartPurchase 2018-01-31 12:53:13 +00:00
Garry Newman
2da780df7c Added Inventory.UpdatePrices (shouldn't need to call manually) 2018-01-31 12:53:01 +00:00
Garry Newman
6c434df638 Added Inventory.DefinitionsWithPrices 2018-01-31 12:52:02 +00:00
Garry Newman
6d78155ec6 Renamed PriceRaw to PriceCategory 2018-01-31 12:51:36 +00:00
Garry Newman
958d4675af Added ItemDefinition.LocalPrice + LocalPriceFormatted 2018-01-31 12:51:22 +00:00
Garry Newman
916d9afdc9 Added FormatPrice utility function 2018-01-31 12:50:25 +00:00
Garry Newman
c8e5c0ca5a fixed "Result Esult" 2018-01-31 12:50:13 +00:00
Garry Newman
ba6132715c Don't try to make callback with invalid SteamAPICall_t 2018-01-31 11:40:58 +00:00
Garry Newman
650d221baf added more test timeouts 2018-01-31 11:28:47 +00:00
AlexSSZ
e66a00d212 Added Dictionary<string, string> GetAllData();
Added string GetData(string k);
Added string LobbyType { get; private set; }

To LobbyList.Lobby

With this you can list extra lobby parameters when displaying the Lobby List, such as current played map or game mode.
2018-01-29 06:29:43 -05:00
Sean L
b7195adc89
Added AddScreenshotToLibrary
Added AddScreenshotToLibrary(filename, thumbnailFilename, width, height); 
and AddScreenshotToLibrary(filename, width, height); 

We use Application.TakeScreenshot(path, superSize) in some of our in-game tools (like the camera) to allow for higher-res screenshots, and this feels like a much faster way of doing it then loading the PNG back into a texture2D, converting it into a correct format, and using Write.
2018-01-26 03:05:10 +01:00
Garry Newman
5991839c27 Unit Test timeouts 2018-01-23 12:33:49 +00:00
Garry Newman
8d202b4645 Fixed uint32 arrays using the wrong size marshalling 2018-01-23 11:02:36 +00:00
Garry Newman
59f7e0ca0a Handle AppId_t arrays 2018-01-23 11:00:14 +00:00
Garry Newman
01e7d1d378 Removed SteamNative.SteamUnifiedMessages.cs 2018-01-23 10:59:58 +00:00
Garry Newman
8585dca101 Generated Code 2018-01-23 10:53:48 +00:00
Garry Newman
4a663f8c9f Updated SDK libraries 2018-01-23 10:51:59 +00:00
Garry Newman
0633bae582 Updated Steamworks SDK to 1.42 2018-01-23 10:48:36 +00:00
Garry Newman
d2331e68e2 Removed steam_appid.txt requirement 2018-01-22 17:19:48 +00:00
Jhett Black
3085ec266c Add FileTimestamp property to RemoteStorage.File. 2017-12-23 14:48:44 +10:00
Garry Newman
1ccea72a13 Warn if trying to init steam client AFTER steam server 2017-12-06 13:23:36 +00:00
Garry Newman
d60ebf5fdd Forcing BytesTotal/BytesUploaded to return sane information 2017-12-06 13:08:48 +00:00
Garry Newman
6ce4e637d9 Enhanced AddScore description 2017-12-06 12:34:21 +00:00
Garry Newman
d6b3966c9d Renamed Achievement.Percentage to GlobalUnlockedPercentage, fixed description 2017-12-06 12:27:50 +00:00
Garry Newman
63a12ff7c6 Fixed "Zero-length data clogs the P2P packet queue" 2017-12-06 12:13:36 +00:00
Garry Newman
d98f7fd1fe Added Leaderboard.OnBoardInformation callback 2017-12-06 12:11:37 +00:00
Garry Newman
6e807c8e4d Added Friend.GetAvatar( size ) 2017-12-06 11:58:36 +00:00
Garry Newman
6dc680cbab Friends.GetAvatar now takes a callback rather than returning an Image. Use GetCachedAvatar for legacy behaviour. Also added 2017-12-06 11:58:20 +00:00
Garry Newman
54dab0c2a4 Added OnChatStringRecieved, cleaned up OnLobbyChatMessageRecievedAPI 2017-12-06 11:25:30 +00:00
Garry Newman
d959dafae0 Revert "Pinned some more delegates"
This reverts commit 7913ccd17150d3a242052450d3dac9325b5a7bd4.
2017-12-06 11:14:40 +00:00
Garry Newman
75530c6bef Revert "Now pinning delegates in callbacks / callresults"
This reverts commit e2ef2b0bf7d35da9e452fe528105c3bfaabd8d3e.
2017-12-06 11:14:38 +00:00
Garry Newman
33393e8725 Validate Update in ClientTest 2017-12-06 11:14:29 +00:00
Garry Newman
3001f2a5c4 Fixed warnings etc 2017-12-06 10:50:11 +00:00
James King
7913ccd171 Pinned some more delegates 2017-11-28 11:22:43 +00:00
James King
e2ef2b0bf7 Now pinning delegates in callbacks / callresults 2017-11-28 10:37:40 +00:00
James King
47f153ffa6 Added RemoteFile.Forget() 2017-11-09 11:00:10 +00:00
James King
1d0fe2b814
Update README.md 2017-11-07 16:58:24 +00:00
James King
7d30ffc734 Replaced NETCORE defines with NET_CORE 2017-11-06 20:42:50 +00:00
Rohan Singh
60933de240 Don't require unsafe to use voice 2017-10-26 09:35:09 -04:00
Garry Newman
a3a4c87ede Merge pull request #70 from Phyxion/patch-1
Fixed InstallFolder exception
2017-10-11 19:21:40 +01:00
Garry Newman
616040da42 Merge pull request #75 from Leodau/patch-1
Update README.md
2017-10-11 19:21:23 +01:00
James King
2e65cfe9bb NormalizePath fix for non-windows 2017-09-18 10:36:51 +01:00
Leonardo D'Aubeterre
d7fd203c02 Update README.md
Change the Create Server example to reflect the latest version.
2017-09-14 17:18:52 +02:00
Phyxion
e8b6f31bb2 Update Client.cs 2017-09-05 13:53:29 +02:00
Garry Newman
0366c39690 Merge pull request #71 from Phyxion/patch-2
Added .NET 4.0
2017-09-05 12:36:54 +01:00
Phyxion
b6c7916684 Added .NET 4.0 2017-09-05 13:30:35 +02:00
Phyxion
72bae11073 Fixed InstallFolder exception
This folder does not always exist.
2017-09-05 13:29:07 +02:00
Garry Newman
1cf2130703 Compile fixes, netstandard2.0 2017-08-30 23:10:55 +01:00
Garry Newman
13c8b543cc Merge pull request #66 from MollerVictor/master
Added support for publishing workshop items to the main app from anot…
2017-08-30 22:45:46 +01:00
Victor Möller
2b4c62bd28 Added support for publishing workshop items to the main app from another app. 2017-08-30 23:35:47 +02:00
Garry Newman
cc4bdcea8d Use IPAddress 2017-08-17 14:45:58 +01:00
Garry Newman
c6bd69092a Added ServerRequest.OnServerResponded, OnFinished 2017-08-17 13:21:22 +01:00
Garry Newman
4ba430601a Console errors on init failure 2017-08-17 12:02:32 +01:00
Garry Newman
79f398da04 Throw exception if trying to initialize without destroying old instance 2017-08-17 12:00:29 +01:00
Garry Newman
a6b440324b Merge pull request #62 from kkukshtel/master 2017-08-17 07:53:11 +01:00
Kyle Kukshtel
d614b1544b Fixes issue where Lobby Owner was being imporperly cached and not updating with the Lobby state. 2017-08-16 22:26:37 -07:00
Kyle Kukshtel
fd14512e28 fixes bug where Lobby Owner was unable to be set 2017-08-16 19:45:35 -07:00
Garry Newman
c5af1f91cf Nicer shutdown, I think 2017-08-16 22:11:00 +01:00
Garry Newman
5dcfda6c15 Merge pull request #56 from kkukshtel/master
Adds in Lobby functionality to library
2017-08-08 09:27:42 +01:00
Kyle Kukshtel
9516d1ed7a Merge remote-tracking branch 'refs/remotes/Facepunch/master' 2017-08-07 09:24:49 -07:00
Kyle Kukshtel
5067c32eed Small README update and adjusts doc tags for Lobby functions. 2017-08-07 09:24:28 -07:00
James King
ba32817183 Added Screenshots.Write( rgbData, width, height ) 2017-08-07 12:13:16 +01:00
Kyle Kukshtel
bef249000a Simple comment update 2017-08-06 22:09:13 -07:00
Kyle Kukshtel
cc4fdd5324 Cleans up some comments 2017-08-04 01:56:14 -07:00
Kyle Kukshtel
abea08d046 Fixes bug where LobbyList wouldn't report finished if it returned 0 lobbies 2017-08-01 00:19:37 -07:00
Kyle Kukshtel
6aa5bcf1ac Updates Readme with basic Lobby Info 2017-07-31 23:54:32 -07:00
Kyle Kukshtel
a1f24c5f24 Implements ability for a user to set/get individual user metadata for the joined lobby 2017-07-31 23:42:29 -07:00
Kyle Kukshtel
bcd8495d6e Adds in ability to send Lobby messages
Also adds in some callbacks around being invited to a lobby, as well
callbacks for being requested to join a lobby.
2017-07-31 22:44:46 -07:00
Kyle Kukshtel
75484c1e00 Adds in test functions for Lobby functionality in Steamworks 2017-07-31 09:30:26 -07:00
Kyle Kukshtel
beccb5e5e9 Gives LobbyList the ability to be queried for if it is Finished or not.
A lobby refresh will finish when the number of cached lobbies equals the
number of requests.
2017-07-31 09:29:53 -07:00
Kyle Kukshtel
c40037784e Caches created LobbyType to be assigned as a LobbyData to be referenced by other members in the lobby.
Because there is no GetLobbyType, provides a layer in which all users
can get a LobbyType from LobbyData.
2017-07-31 09:28:09 -07:00
Garry Newman
72c5427be6 Changed Server.Stats.Set to SetInt/SetFloat 2017-07-31 12:56:54 +01:00
Garry Newman
b62f7f6b87 Server stats callback include client steamid 2017-07-31 12:56:15 +01:00
Garry Newman
7bd8aaa793 OnAchievementStateChanged nicer 2017-07-31 10:31:04 +01:00
Garry Newman
84954436f7 Check GameId on achievement callbacks 2017-07-28 17:04:29 +01:00
Garry Newman
61268b973e Added Achievments.OnAchievementStateChanged 2017-07-28 17:04:18 +01:00
Garry Newman
c6cb8a2f81 Refresh achievements on startup 2017-07-28 17:03:35 +01:00
Garry Newman
a26ae696c2 Don't StoreStats achievement on trigger if already unlocked 2017-07-28 17:03:12 +01:00
James King
1c04459cdb Calls on an unresolved leaderboard are deferred
Applies to:
* AddScore( bool onlyIfBeatsOldScore, int score, params int[] subscores )
* AddScore( bool onlyIfBeatsOldScore, int score, int[] subscores = null, AddScoreCallback onSuccess = null, FailureCallback onFailure = null )
* AttachRemoteFile( RemoteFile file, AttachRemoteFileCallback onSuccess = null, FailureCallback onFailure = null )
* FetchScores( RequestType RequestType, int start, int end, FetchScoresCallback onSuccess, FailureCallback onFailure = null )
2017-07-28 15:38:07 +01:00
Kyle Kukshtel
e1c738fc8b Updates Lobby to work for both Lobby members and Lobby Owners
Uses a more rigurous approach to LobbyData and uses it as a cache for
string-able values to be able to be retrieved by members and set only by
the owner.
2017-07-28 02:20:28 -07:00
Garry Newman
7eb4a88cee Merge pull request #44 from moldfield1995/master
Implemented Workshop Item Subscription
2017-07-26 17:13:19 +01:00
Garry Newman
6c4296a0fc Merge pull request #46 from richdog/master
Made changes surrounding OnItemInstalled and OnFileDownloaded events in Workshop.cs
2017-07-26 17:12:56 +01:00
Kyle Kukshtel
7e38750f2e changes lobby initialization and makes lobbylist filter easier 2017-07-25 10:09:41 -07:00
Kyle Kukshtel
e3f84eac32 Initial pass at getting coverage for Client functions in API 2017-07-19 19:07:59 -07:00
Matthew Oldfield
e6c395b2f6 Removed GetSubscribedItems, could not find a nice way to change to property 2017-07-12 23:21:33 +01:00
Rich
bf7ab5598b Modified summary for OnFileDownloaded to more accurately represent my experience with the event. 2017-07-12 17:19:55 -04:00
Rich
c9d36eb4ac Made OnItemInstalled event public so it can be used to handle workshop items being subscribed to in-game 2017-07-12 17:18:29 -04:00
Rich
a2972098d9 Added AppId check to Workshop.onItemInstalled, like with onDownloadResult 2017-07-12 17:17:26 -04:00
richdog
d53c59f09b Merge pull request #1 from Facepunch/master
Merge pull request #45 from richdog/master
2017-07-11 14:04:49 -04:00
Garry Newman
ed632baf38 Merge pull request #45 from richdog/master
Updated  Workshop.onDownloadResult to compare downloaded item's application to current application
2017-07-11 09:59:43 +01:00
Rich
3ecd7e4e4e updated Workshop.onDownloadResult method to ensure that the item's app ID matches the client app id, as described in the DownloadItemResult_t Steamworks documentation 2017-07-10 18:05:34 -04:00
Matthew Oldfield
27f640fd5a Updated from feedback given 2017-07-10 19:15:36 +01:00
Matthew Oldfield
2108dc3b76 Implemented Workshop Item Subscription
Added subscribing to items as well as the UGC interfaces
GetNumSubscribedItems and GetSubscribedItems. Edited SteamUGC Method
GetSubscribedItems to accept array instead of a ptr to allow c# calling
2017-07-10 15:15:53 +01:00
Garry Newman
bf21cb9df3 Fixed Workshop.Item wrong created/modified dates 2017-07-08 13:43:37 +01:00
Garry Newman
499b0d64c5 Added Stats.ResetAll 2017-07-08 13:40:01 +01:00
James King
598f44e9f8 Added RemoteStorage.OpenSharedFile(sharingId) 2017-07-07 15:43:12 +01:00
James King
d129f3757a Added an exception when attempting to write to a shared file 2017-07-07 15:42:54 +01:00
Garry Newman
ea4c6d72b5 Added Stats.Add 2017-07-06 10:45:03 +01:00
Garry Newman
b327ab70f1 Useful comment 2017-07-06 10:37:23 +01:00
Garry Newman
28766081b5 Added Client.RestartIfNecessary 2017-07-06 10:33:28 +01:00
Garry Newman
67fb987288 Made SteamNative.SteamApi less hacky to initialize 2017-07-06 10:33:13 +01:00
Garry Newman
5890fea9e6 Added SteamAPI_RestartAppIfNecessary to missing 2017-07-06 10:05:23 +01:00
Garry Newman
892edf371e Moved missing api descriptions to steam_api_missing.json (was defined in code) 2017-07-06 10:02:23 +01:00
Garry Newman
d944c6c7ae If initialize failed, set instance to null 2017-06-26 14:40:14 +01:00
Garry Newman
e5b6d99bef Added ServerInit class, changed how servers are initialized 2017-06-25 20:23:34 +01:00
Garry Newman
111495100f Get applist 2017-06-25 20:22:33 +01:00
Garry Newman
1a47b32458 Fixed Friend.IsOnline not working, added IsAway, IsBusy, IsSnoozing 2017-06-25 11:51:53 +01:00
Garry Newman
3002419af0 Added Stats.Set 2017-06-25 11:44:26 +01:00
James King
0a115f8ea4 Added optional onFailure callbacks to leaderboard and remote file methods that accept a callback (for #23) 2017-06-12 11:59:18 +01:00
Garry Newman
0a9f3f2281 Added common utility functions to RemoteStorage 2017-06-09 11:46:44 +01:00
Garry Newman
e3312d3387 Cleaned up RemoteStorage 2017-06-09 11:36:53 +01:00
Garry Newman
4390724cbe friend.GetRichPresence 2017-06-09 11:06:05 +01:00
Garry Newman
3752e75316 Setting Rich Presence 2017-06-09 11:00:01 +01:00
Garry Newman
b92fba15ec Added Inventory.GenerateItem 2017-06-09 10:40:04 +01:00
Garry Newman
38f3f6d9ea Oops 2017-06-09 10:32:34 +01:00
Garry Newman
303da3753d Microtransaction callback (requested, but untested) 2017-06-09 10:30:43 +01:00
Garry Newman
67fd7fe00a Singleton accessors for Client/Server 2017-06-09 10:18:39 +01:00
Garry Newman
d417f22336 Call StoreStats when triggering an achievement 2017-06-09 10:16:11 +01:00
Garry Newman
53709bf5d0 Merge pull request #21 from DaDummy/master
Add missing Stats.StoreStats() API-method
2017-06-08 09:40:31 +01:00
Christoffer Anselm
3ffe684726 Added missing Stats.StoreStats() API-method that one needs to call to make Steam Achievements show in Steam while the game is still running. 2017-06-08 01:14:19 +02:00
James King
7e3527799a Fixed downloading leaderboard file attachments 2017-05-16 16:35:37 +01:00
James King
836f6e285c Added documentation for the new Leaderboard and RemoteStorage members 2017-05-16 09:30:28 +01:00
James King
788145c265 Added Leaderboard.AttachRemoteFile 2017-05-16 09:13:52 +01:00
James King
6ea0e366f5 Working on a RemoteStorage interface 2017-05-15 17:11:17 +01:00
James King
549ceb0562 Fixed AddScoresCallback test 2017-05-15 14:13:28 +01:00
James King
906cff4416 Added Leaderboard.AddScore overload that accepts a callback 2017-05-15 14:05:36 +01:00
James King
d3ebe4e2f2 Added overload of Leaderboard.FetchScores that takes a callback 2017-05-15 13:23:19 +01:00
James King
8fa8da4939 Fixed comment of RequestType.GlobalAroundUser 2017-05-12 16:51:10 +01:00
Garry Newman
27c2b83bea Build on windows nodes 2017-05-09 20:43:46 +01:00
Garry Newman
9657f3b32e Icon loading 2017-05-09 20:41:16 +01:00
Garry Newman
2cff8ccea1 Added utility functions to trigger, find and reset 2017-05-09 20:30:29 +01:00
Garry Newman
d1ada9464d Updated bindings 2017-05-08 20:59:37 +01:00
Garry Newman
16d3b048af Updated to Steamworks 1.40 2017-05-08 20:56:31 +01:00
Garry Newman
2ebecd1548 Achievement Tests 2017-05-08 20:52:21 +01:00
Garry Newman
01cf0f4cec Achievement callback 2017-05-08 20:51:57 +01:00
Garry Newman
3a8ed89583 Achievement basics 2017-05-08 20:34:13 +01:00
Garry Newman
277ae79950 Added builds status, steamworks thread link 2017-04-28 13:36:09 +01:00
Garry Newman
bb846c28aa Increased ServerQuery buffer size 2017-04-12 13:07:42 +01:00
Garry Newman
f693bff938 use dotnet instead of msbuild 2017-04-05 19:09:49 +01:00
Garry Newman
fab24796ab Updated Jenkinsfile 2017-04-05 17:08:39 +01:00
Garry Newman
a956a1005c Voice buffer fix (netcore) 2017-04-05 16:55:40 +01:00
Garry Newman
fd82d26367 Fixed ms.GetBuffer() usage (for netcore) 2017-04-05 16:23:13 +01:00
Garry Newman
412d13cbbc Avoid using Array.ConvertAll (doesn't exist on netcore) 2017-04-05 16:17:30 +01:00
Garry Newman
1e0f7a835c Netcore fixes 2017-04-05 16:15:35 +01:00
Garry Newman
c43b4767dc VS2017 2017-04-05 16:06:12 +01:00
Garry Newman
2fbbd66c45 Fixed warnings 2017-04-05 16:05:45 +01:00
Garry Newman
66f771fee2 Removing unused file 2017-04-03 15:00:15 +01:00
Garry Newman
04d2a2aa5d Test fix 2017-04-02 11:29:06 +01:00
Garry Newman
5c320bab12 Changed AddScore to reflect the real functionality 2017-04-02 10:33:35 +01:00
Garry Newman
ca7107c8d3 Added Client.CurrentLanguage + AvailableLanguages 2017-04-02 10:05:48 +01:00
Garry Newman
f9f18eec74 Added unity section 2017-03-23 09:31:29 +00:00
Garry Newman
58b4b73800 probable archiveArtifacts fix 2017-03-16 13:17:02 +00:00
Garry Newman
8d2ccf0538 Jenkinsfile 2017-03-16 12:32:00 +00:00
Garry Newman
2c343d27b1 Build paths 2017-03-16 11:18:44 +00:00
Garry Newman
1369dc2a3f Update README.md 2017-03-13 20:08:03 +00:00
Garry Newman
e9c913beea App tests 2017-03-13 20:05:32 +00:00
Garry Newman
f10dd56ddd Client tests 2017-03-13 19:58:52 +00:00
Garry Newman
c38f45e630 Filled out Client.App 2017-03-13 19:54:13 +00:00
Garry Newman
df9b0d3114 Made server list filters optional 2017-02-09 09:52:51 +00:00
Garry Newman
45024c57f3 Added leaderboards 2017-02-08 13:33:37 +00:00
Garry Newman
5426339bd0 Item.Tags are now guarenteed to be all lower case 2017-02-03 15:31:47 +00:00
Garry Newman
b5767fd1b6 Fixed NRE when definitions are updating 2017-02-02 15:26:58 +00:00
Garry Newman
287744fd83 Added a Inventory.CraftItem version which allows you to specify stack amounts 2017-02-01 15:00:53 +00:00
Garry Newman
b06411c42c Merge branch 'master' of https://github.com/Facepunch/Facepunch.Steamworks 2017-02-01 12:44:04 +00:00
Garry Newman
b7727a10e1 Unity Win32 callback fixes 2017-02-01 12:44:00 +00:00
Garry Newman
d7808bf424 Easier unity config 2017-02-01 12:32:51 +00:00
Garry Newman
b7564630cd Null pointer check fix 2017-02-01 12:20:47 +00:00
Garry Newman
6e7afc1ac9 Moved callback functions to ThisCall subclass 2017-02-01 11:38:05 +00:00
Garry Newman
62efd08e7a Removed debug output 2017-01-31 19:44:59 +00:00
Garry Newman
5fdcf82eac Updated generated code, marked Inventory.PlaytimeHeartbeat as obsolete 2017-01-25 18:25:23 +00:00
Garry Newman
967f9307d3 Fixed server test Ip 2017-01-25 18:24:55 +00:00
Garry Newman
8256cca36c Fixed server tests not binding to a proper ip 2017-01-25 18:24:38 +00:00
Garry Newman
f95c320469 SteamSdk 139 2017-01-25 17:53:09 +00:00
Garry Newman
d06f662e6c Cleaning Workshop.Item 2017-01-18 15:15:41 +00:00
Garry Newman
24affc78d8 Exposed update functions, so they can be called manually by the host (profiling etc) 2017-01-17 16:23:48 +00:00
Garry Newman
c297033ef7 Inventory.Result.IsPending tries to fill the result if it's finished 2016-12-08 20:33:42 +00:00
Garry Newman
f64d0d15af Added Workshop.Query.RankedByTrendDays 2016-12-05 11:22:12 +00:00
Garry Newman
255e80b58d Inventory Items cleanup 2016-12-01 12:26:53 +00:00
Garry Newman
5ac65c9fb9 Splitting client tests 2016-12-01 11:17:03 +00:00
Garry Newman
15bfd887bd Added Query.OnResult callback 2016-12-01 11:07:47 +00:00
Garry Newman
9f3ecfd66e WebApi doesn't belong here (moving to different repo) 2016-12-01 11:01:00 +00:00
Garry Newman
74ef4d49ad Allow & ignore errors when parsing exchange string 2016-11-21 20:41:30 +00:00
Garry Newman
5cef85adb4 NRE 2016-11-17 23:22:08 +00:00
Garry Newman
a1d458de00 Tweaking how Inventory.Item's is updated 2016-11-17 16:43:29 +00:00
Garry Newman
88e2568e9f Item stacking, unstacking 2016-11-17 14:08:26 +00:00
Garry Newman
0f26139d38 Show removed and consumed items seperately in Inventory Result 2016-11-16 14:59:17 +00:00
Garry Newman
f011ff8d8b Added ItemDef.PriceDollars 2016-11-16 14:52:11 +00:00
Garry Newman
ef2fb26911 IWorkshopService.GetItemDailyRevenue 2016-11-11 16:00:10 +00:00
Garry Newman
9fe91b48b6 Enabled POST methods 2016-11-11 15:48:00 +00:00
Garry Newman
54fe75b2bc GetMarketPrices 2016-11-11 15:13:47 +00:00
Garry Newman
270595a540 Web Api boilerplate 2016-11-11 14:51:04 +00:00
Garry Newman
657c04b399 Added Friends.UpdateInformation( steamid ) 2016-11-11 11:45:30 +00:00
Garry Newman
01dbec678c Added ServerList favourites/history/LAN/friends 2016-11-11 11:09:28 +00:00
Garry Newman
aeec6f59ef Open matchmaking interface 2016-11-11 10:44:15 +00:00
Garry Newman
6a5603a121 Added Utility.Epoch 2016-11-11 10:44:02 +00:00
Garry Newman
b8e6614f67 Pass matchmaking flag as out 2016-11-11 10:43:49 +00:00
Garry Newman
0e63be99c0 Definition.Type and Definition.IsGenerator 2016-11-10 10:58:54 +00:00
Garry Newman
5c62314f96 PriceCategoryToFloat returns 0 if string empty, null 2016-11-10 10:06:10 +00:00
Garry Newman
dec523602d Updated AssemblyInfo.cs 2016-11-10 10:05:23 +00:00
Garry Newman
158a102060 Added Inventory.Definition.IconUrl 2016-11-10 10:05:07 +00:00
Garry Newman
8aed047784 Ignore .xml 2016-11-10 10:04:51 +00:00
Garry Newman
941ab6e797 Shouldn't be shipping these 2016-11-10 09:15:11 +00:00
Garry Newman
53c47d5a12 Fixed exchange parse error 2016-11-09 16:08:30 +00:00
Garry Newman
9da329bb7d Only update Items if successful 2016-11-09 14:30:48 +00:00
Garry Newman
600c4c53c0 Merge branch 'master' of https://github.com/Facepunch/Facepunch.Steamworks 2016-11-09 12:22:00 +00:00
Garry Newman
d56e380c72 Comments 2016-11-09 12:21:57 +00:00
Garry Newman
b2be137107 Delete applicationhost.config 2016-11-09 12:21:03 +00:00
Garry Newman
4e4fdd63ee Added Inventory.CraftItem 2016-11-08 14:40:22 +00:00
Garry Newman
eabf5b84e2 Marshal input arrays properly 2016-11-08 13:51:24 +00:00
Garry Newman
41400f56e6 Parse exchange field for Item Definitions, giving Recipe 2016-11-08 12:43:49 +00:00
Garry Newman
019d46580e reset capacity, length on depool 2016-11-08 11:13:04 +00:00
Garry Newman
d8a25afb46 Pool StringBuilder 2016-11-08 10:32:45 +00:00
Garry Newman
3490d05b40 On publish validate that folder exists, preview image is under 1mb 2016-11-08 10:14:49 +00:00
Garry Newman
9d8141475f Fixed NRE in request 2016-11-08 10:14:10 +00:00
Garry Newman
755b238e1d Merge branch 'master' of https://github.com/Facepunch/Facepunch.Steamworks 2016-11-06 10:32:43 +00:00
Garry Newman
26c1a0af85 Access fixes 2016-11-06 10:32:40 +00:00
Garry Newman
a53340ddea randomize steam port by default 2016-11-04 14:20:55 +00:00
Garry Newman
aa28a78d8c Use GetAvailableVoice 2016-11-04 14:20:13 +00:00
Garry Newman
f838cf6b98 Throttle Network + Voice updates 2016-11-03 15:26:56 +00:00
Garry Newman
8bf391a300 Added Server.PublicIp 2016-11-03 14:33:03 +00:00
Garry Newman
84e38601d6 Cleanup 2016-11-03 14:05:50 +00:00
Garry Newman
2fef034547 Cleaning 2016-11-03 13:53:06 +00:00
Garry Newman
c27df08194 More comments 2016-11-03 13:49:32 +00:00
Garry Newman
11733c48e7 Update optimization 2016-11-03 12:11:40 +00:00
Garry Newman
44dcf4d150 Optimized Networking 2016-11-03 12:09:35 +00:00
Garry Newman
480daeb673 Comments 2016-11-03 11:04:16 +00:00
Garry Newman
947fc190d2 Added UpdateWhile 2016-11-03 10:57:52 +00:00
Garry Newman
65dec9d809 Fixed RequestUserStats callback 2016-11-03 10:52:52 +00:00
Garry Newman
d5eca996cd Make SteamNative completely internal 2016-11-02 21:00:25 +00:00
Garry Newman
0b11025afe Internalise generated code 2016-11-02 20:22:11 +00:00
Garry Newman
1efdd690c2 Callback fix 2016-11-01 19:29:42 +00:00
Garry Newman
480c06f288 More posix compatibility 2016-11-01 13:37:47 +00:00
Garry Newman
39c5860041 Put callback functions in the right order on non windows 2016-11-01 11:05:26 +00:00
Garry Newman
c9443b75f2 Fixes 2016-10-31 12:44:37 +00:00
Garry Newman
bae105dbc9 CallResult implementation 2016-10-31 11:46:53 +00:00
Garry Newman
7ddc054890 steam_api.json moved 2016-10-31 09:04:51 +00:00
Garry Newman
916c0fb1da SDK in generator 2016-10-31 09:00:47 +00:00
Garry Newman
04c2118ed8 Generated callback registration 2016-10-30 20:52:42 +00:00
Garry Newman
17b84c4f58 Parse defines 2016-10-29 21:05:48 +01:00
Garry Newman
778faa1049 Use generated structs where possible 2016-10-29 20:50:40 +01:00
Garry Newman
94e661c6b0 CodeParser 2016-10-29 20:28:16 +01:00
Garry Newman
14ee1314de Cleanup 2016-10-29 13:13:25 +01:00
Garry Newman
a333bc3860 Platform Class 2016-10-29 13:02:57 +01:00
Garry Newman
9e14aff459 Cleaning 2016-10-29 13:02:36 +01:00
Garry Newman
ba06bce930 Types cleanup 2016-10-29 12:55:23 +01:00
Garry Newman
561f185551 Struct cleanup 2016-10-29 12:49:36 +01:00
Garry Newman
48cb001fb3 Enum cleanip 2016-10-29 12:38:27 +01:00
Garry Newman
5da0690c5c Callback update 2016-10-28 17:24:41 +01:00
Garry Newman
8d605e99fa Keep the pipes 2016-10-28 12:30:12 +01:00
Garry Newman
1aeeb6b932 Tweaked DownloadFile test 2016-10-28 11:57:56 +01:00
Garry Newman
f048730edd Shutdown server properly 2016-10-28 11:02:48 +01:00
Garry Newman
1b4f5b91aa Server init, throw error properly 2016-10-28 11:02:27 +01:00
Garry Newman
6ea60a980b Client fail to start if user not logged on 2016-10-28 10:41:13 +01:00
Garry Newman
3d9c1406f7 Removed debug 2016-10-27 21:03:49 +01:00
Garry Newman
5830ea7b82 Fixed caps 2016-10-27 21:03:34 +01:00
Garry Newman
cda59960b2 Added ItemDefinition.SetProperty 2016-10-27 21:03:27 +01:00
Garry Newman
2e9c077535 Test ItemDefintiion.GetStringProperty 2016-10-27 21:02:06 +01:00
Garry Newman
a9cbc1740a Fixed tags not setting 2016-10-26 17:27:17 +01:00
Garry Newman
dcca1b8737 Added workshop publish tag tests 2016-10-26 17:08:39 +01:00
Garry Newman
6bd0af6c5a Cleanup 2016-10-26 17:02:57 +01:00
Garry Newman
6ef86c3cb8 Fixes 2016-10-26 16:47:12 +01:00
Garry Newman
b91b22a983 Removed debug 2016-10-26 16:37:25 +01:00
Garry Newman
63fec3d627 Interface versions 2016-10-26 16:37:16 +01:00
Garry Newman
b50c20a5ed _ptr == IntPtr.Zero, not _ptr == null 2016-10-26 16:11:41 +01:00
Garry Newman
bb1980eb84 SteamAPI_Init returns bool 2016-10-26 16:10:52 +01:00
Garry Newman
9922de378a Generated for 138a 2016-10-26 16:10:20 +01:00
Garry Newman
1bb6889ba4 Updated to 138a 2016-10-26 15:31:16 +01:00
Garry Newman
9756d15468 Added Config.ForcePlatform 2016-10-26 15:28:33 +01:00
Garry Newman
79bc9ffe24 Generate source 2016-10-26 14:51:58 +01:00
Garry Newman
7b19866d1b Use SteamNative.UGCQueryHandle_t internally 2016-10-26 14:51:24 +01:00
Garry Newman
b549bdcec8 More voice debug output 2016-10-26 14:46:53 +01:00
Garry Newman
3c867a0252 Removed debug input 2016-10-26 11:09:11 +01:00
Garry Newman
71e6866701 use raw typedef values to Native 2016-10-26 11:08:32 +01:00
Garry Newman
28a781d511 More marshalling 2016-10-26 10:43:08 +01:00
Garry Newman
43705fed86 More marhsalling 2016-10-26 10:32:00 +01:00
Garry Newman
69b342c504 Avoid SteamAPICall_t errors 2016-10-26 10:20:36 +01:00
Garry Newman
ba0fa2e102 Bools as ref 2016-10-26 10:20:14 +01:00
Garry Newman
784a1a1c2b Merge fix 2016-10-26 09:54:40 +01:00
Garry Newman
f1dd4462f2 Added Workshop.itemHandle 2016-10-26 09:52:25 +01:00
Garry Newman
c37ea38107 Cleanup, native classes disposable 2016-10-25 16:37:48 +01:00
Garry Newman
4b4f405a79 Cleaning 2016-10-25 16:16:02 +01:00
Garry Newman
b1280eb65c Struct name fixes 2016-10-25 16:11:29 +01:00
Garry Newman
0b02bf2331 Struct member name clean 2016-10-25 15:57:46 +01:00
Garry Newman
42ccf1b050 Linux/Mac use PackSmall 2016-10-25 15:35:48 +01:00
Garry Newman
c3ca4673d1 Workshop.GetItem 2016-10-25 13:59:48 +01:00
Garry Newman
a66f84c0d5 merge fix 2016-10-25 13:55:36 +01:00
Garry Newman
061e3b252b Merged from master 2016-10-25 13:54:59 +01:00
Garry Newman
f90a151150 Mac library name fix 2016-10-25 13:51:57 +01:00
Garry Newman
ef45d94220 Refactoring into platform interfaces 2016-10-25 13:22:59 +01:00
Garry Newman
44abc1ce20 Fixes 2016-10-25 11:51:24 +01:00
Garry Newman
fe7f5a7630 String fixes 2016-10-25 11:16:05 +01:00
Garry Newman
8801f840d4 Boilerplate, proof of concept 2016-10-25 10:29:35 +01:00
Garry Newman
a92d680443 Added Workshop.Item.OwnerName 2016-10-21 14:51:43 +01:00
Garry Newman
b4c48242cb Null ref checks on dispose 2016-10-21 11:00:24 +01:00
Garry Newman
313a6e4564 Ignores 2016-10-18 16:35:08 +01:00
Garry Newman
2680e4c45a Added Generator 2016-10-18 16:34:28 +01:00
369 changed files with 70348 additions and 17138 deletions

100
.editorconfig Normal file
View File

@ -0,0 +1,100 @@
# Remove the line below if you want to inherit .editorconfig settings from higher directories
root = true
# C# files
[*.cs]
indent_style = tab
indent_size = tab
tab_size = 4
# New line preferences
end_of_line = crlf
insert_final_newline = true
#### C# Coding Conventions ####
# Expression-bodied members
csharp_style_expression_bodied_accessors = true:silent
csharp_style_expression_bodied_constructors = false:silent
csharp_style_expression_bodied_indexers = true:silent
csharp_style_expression_bodied_lambdas = true:silent
csharp_style_expression_bodied_local_functions = false:silent
csharp_style_expression_bodied_methods = false:silent
csharp_style_expression_bodied_operators = false:silent
csharp_style_expression_bodied_properties = true:silent
# Pattern matching preferences
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
csharp_style_prefer_not_pattern = true:suggestion
csharp_style_prefer_pattern_matching = true:silent
csharp_style_prefer_switch_expression = true:suggestion
# Null-checking preferences
csharp_style_conditional_delegate_call = true:suggestion
# Code-block preferences
csharp_prefer_braces = true:silent
# Expression-level preferences
csharp_prefer_simple_default_expression = true:suggestion
csharp_style_deconstructed_variable_declaration = true:suggestion
csharp_style_implicit_object_creation_when_type_is_apparent = true:suggestion
csharp_style_inlined_variable_declaration = true:suggestion
csharp_style_pattern_local_over_anonymous_function = true:suggestion
csharp_style_prefer_index_operator = true:suggestion
csharp_style_prefer_range_operator = true:suggestion
csharp_style_throw_expression = true:suggestion
csharp_style_unused_value_assignment_preference = discard_variable:suggestion
csharp_style_unused_value_expression_statement_preference = discard_variable:silent
# 'using' directive preferences
csharp_using_directive_placement = outside_namespace:silent
#### C# Formatting Rules ####
# New line preferences
csharp_new_line_before_catch = true
csharp_new_line_before_else = true
csharp_new_line_before_finally = true
csharp_new_line_before_members_in_anonymous_types = true
csharp_new_line_before_members_in_object_initializers = true
csharp_new_line_before_open_brace = all
csharp_new_line_between_query_expression_clauses = true
# Indentation preferences
csharp_indent_block_contents = true
csharp_indent_braces = false
csharp_indent_case_contents = true
csharp_indent_case_contents_when_block = true
csharp_indent_labels = no_change
csharp_indent_switch_labels = true
# Space preferences
csharp_space_after_cast = false
csharp_space_after_colon_in_inheritance_clause = true
csharp_space_after_comma = true
csharp_space_after_dot = false
csharp_space_after_keywords_in_control_flow_statements = true
csharp_space_after_semicolon_in_for_statement = true
csharp_space_around_binary_operators = before_and_after
csharp_space_around_declaration_statements = false
csharp_space_before_colon_in_inheritance_clause = true
csharp_space_before_comma = false
csharp_space_before_dot = false
csharp_space_before_open_square_brackets = false
csharp_space_before_semicolon_in_for_statement = false
csharp_space_between_empty_square_brackets = false
csharp_space_between_method_call_empty_parameter_list_parentheses = false
csharp_space_between_method_call_name_and_opening_parenthesis = false
csharp_space_between_method_call_parameter_list_parentheses = true
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
csharp_space_between_method_declaration_name_and_open_parenthesis = false
csharp_space_between_method_declaration_parameter_list_parentheses = true
csharp_space_between_parentheses = control_flow_statements
csharp_space_between_square_brackets = false
# Wrapping preferences
csharp_preserve_single_line_blocks = true
csharp_preserve_single_line_statements = true

34
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View File

@ -0,0 +1,34 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: garrynewman
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Set x to y
2. Run for x minutes
3. Call x
4. See error
**Calling Code**
```
// The code you're using to call into Steamworks
Steamworks.DoBug();
```
**Expected behavior**
A clear and concise description of what you expected to happen.
**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Unity: [e.g Unity 2019.3]
**Additional context**
Add any other context about the problem here.

View File

@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.

View File

@ -0,0 +1,10 @@
---
name: Something Else
about: Describe this issue template's purpose here.
title: ''
labels: ''
assignees: ''
---

42
.github/workflows/dotnetcore.yml vendored Normal file
View File

@ -0,0 +1,42 @@
name: Build All
on: [push]
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4.2.2
- name: Setup dotnet 6.0.x
uses: actions/setup-dotnet@v4.1.0
with:
dotnet-version: '6.0.x'
include-prerelease: true
- name: Restore Win64
run: dotnet restore Facepunch.Steamworks\Facepunch.Steamworks.Win64.csproj
- name: Restore Win32
run: dotnet restore Facepunch.Steamworks\Facepunch.Steamworks.Win32.csproj
- name: Restore Posix
run: dotnet restore Facepunch.Steamworks\Facepunch.Steamworks.Posix.csproj
- name: Build Win64
run: dotnet build Facepunch.Steamworks\Facepunch.Steamworks.Win64.csproj
- name: Build Win32
run: dotnet build Facepunch.Steamworks\Facepunch.Steamworks.Win32.csproj
- name: Build Posix
run: dotnet build Facepunch.Steamworks\Facepunch.Steamworks.Posix.csproj
- name: Build Win64 Release
run: dotnet build Facepunch.Steamworks\Facepunch.Steamworks.Win64.csproj --configuration Release
- name: Build Win32 Release
run: dotnet build Facepunch.Steamworks\Facepunch.Steamworks.Win32.csproj --configuration Release
- name: Build Posix Release
run: dotnet build Facepunch.Steamworks\Facepunch.Steamworks.Posix.csproj --configuration Release
- uses: actions/upload-artifact@v4.4.3
with:
name: Compiled Files
path: Facepunch.Steamworks/bin

8
.gitignore vendored
View File

@ -55,11 +55,14 @@ Facepunch.Steamworks.Test/bin/Release/Facepunch.Steamworks.Test.dll
Facepunch.Steamworks.Test/bin/Release/Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll
*.user
*.cache
*.idea
*.vscode
TestResults
obj
Facepunch.Steamworks/bin/Debug/Facepunch.Steamworks.Api.dll
Facepunch.Steamworks/bin/Debug/Facepunch.Steamworks.dll
Facepunch.Steamworks/bin/Release/Facepunch.Steamworks.dll
Facepunch.Steamworks/bin
*.opendb
*.db
Facepunch.Steamworks.dll
@ -67,3 +70,8 @@ Facepunch.Steamworks.Test.dll
*UnitTestFramework.dll
mscorlib.dll
*.nlp
packages
Generator/bin
*.XML
.vs
Facepunch.Steamworks.Test/bin/**

5
CompileFix.bat Normal file
View File

@ -0,0 +1,5 @@
dotnet restore .\Facepunch.Steamworks\Facepunch.Steamworks.Posix.csproj
dotnet restore .\Facepunch.Steamworks\Facepunch.Steamworks.Win32.csproj
dotnet restore .\Facepunch.Steamworks\Facepunch.Steamworks.Win64.csproj
dotnet restore .\Facepunch.Steamworks.Test\Facepunch.Steamworks.TestWin32.csproj
dotnet restore .\Facepunch.Steamworks.Test\Facepunch.Steamworks.TestWin64.csproj

View File

@ -0,0 +1,121 @@
using System;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace Steamworks
{
[TestClass]
[DeploymentItem( "steam_api64.dll" )]
[DeploymentItem( "steam_api.dll" )]
public class AppTest
{
[AssemblyInitialize]
public static void AssemblyInit( TestContext context )
{
Steamworks.Dispatch.OnDebugCallback = ( type, str, server ) =>
{
Console.WriteLine( $"[Callback {type} {(server ? "server" : "client")}]" );
Console.WriteLine( str );
Console.WriteLine( $"" );
};
Steamworks.Dispatch.OnException = ( e ) =>
{
Console.Error.WriteLine( e.Message );
Console.Error.WriteLine( e.StackTrace );
Assert.Fail( e.Message );
};
//
// Init Client
//
Steamworks.SteamClient.Init( 252490 );
//
// Init Server
//
var serverInit = new SteamServerInit( "rust", "Rusty Mode" )
{
GamePort = 28015,
Secure = true,
QueryPort = 28016
};
Steamworks.SteamServer.Init( 252490, serverInit );
//
// Needs to happen before LogOnAnonymous
//
SteamNetworkingSockets.RequestFakeIP();
SteamServer.LogOnAnonymous();
}
[TestMethod]
public void GameLangauge()
{
var gl = SteamApps.GameLanguage;
Assert.IsNotNull( gl );
Assert.IsTrue( gl.Length > 3 );
Console.WriteLine( $"{gl}" );
}
[TestMethod]
public void AppInstallDir()
{
var str = SteamApps.AppInstallDir();
Assert.IsNotNull( str );
Assert.IsTrue( str.Length > 3 );
Console.WriteLine( $"{str}" );
}
[TestMethod]
public void AppOwner()
{
var steamid = SteamApps.AppOwner;
Assert.IsTrue( steamid.Value > 70561197960279927 );
Assert.IsTrue( steamid.Value < 80561197960279927 );
Console.WriteLine( $"{steamid.Value}" );
}
[TestMethod]
public void InstalledDepots()
{
var depots = SteamApps.InstalledDepots().ToArray();
Assert.IsNotNull( depots );
Assert.IsTrue( depots.Length > 0 );
foreach ( var depot in depots )
{
Console.WriteLine( $"{depot.Value}" );
}
}
[TestMethod]
public async Task GetFileDetails()
{
var fileinfo = await SteamApps.GetFileDetailsAsync( "RustClient.exe" );
Console.WriteLine( $"fileinfo.SizeInBytes: {fileinfo?.SizeInBytes}" );
Console.WriteLine( $"fileinfo.Sha1: {fileinfo?.Sha1}" );
Console.WriteLine( $"fileinfo.Flags: {fileinfo?.Flags}" );
}
[TestMethod]
public void CommandLine()
{
var cl = SteamApps.CommandLine;
Console.WriteLine( $"CommandLine: {cl}" );
}
}
}

View File

@ -0,0 +1,59 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Steamworks
{
[DeploymentItem("steam_api64.dll")]
[DeploymentItem("steam_api.dll")]
[TestClass]
public class ClanTest
{
[TestMethod]
public void GetName()
{
var clan = new Clan(103582791433666425);
Assert.AreEqual("Steamworks Development", clan.Name);
}
[TestMethod]
public void GetClanTag()
{
var clan = new Clan(103582791433666425);
Assert.AreEqual("SteamworksDev", clan.Tag);
}
[TestMethod]
public async Task GetOwner()
{
var clan = new Clan(103582791433666425);
await clan.RequestOfficerList();
Assert.AreNotEqual(new SteamId(), clan.Owner.Id);
}
[TestMethod]
public void GetOfficers()
{
var clan = new Clan(103582791433666425);
foreach (var officer in clan.GetOfficers())
{
Console.WriteLine($"{officer.Name} : {officer.Id}");
}
}
[TestMethod]
public async Task RequestOfficerList()
{
var clan = new Clan(103582791433666425);
bool res = await clan.RequestOfficerList();
Assert.AreEqual(true, res);
}
}
}

View File

@ -1,253 +0,0 @@
using System;
using System.Diagnostics;
using System.IO;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace Facepunch.Steamworks.Test
{
[TestClass]
[DeploymentItem( Config.LibraryName + ".dll" )]
[DeploymentItem( "steam_appid.txt" )]
public partial class Client
{
[TestMethod]
public void Init()
{
using ( var client = new Facepunch.Steamworks.Client( 252490 ) )
{
Assert.IsTrue( client.IsValid );
}
}
[TestMethod]
public void Init_50()
{
for ( int i = 0; i < 50; i++ )
{
using ( var client = new Facepunch.Steamworks.Client( 252490 ) )
{
Assert.IsTrue( client.IsValid );
}
GC.Collect();
}
}
[TestMethod]
public void Name()
{
using ( var client = new Facepunch.Steamworks.Client( 252490 ) )
{
var username = client.Username;
Console.WriteLine( username );
Assert.IsTrue( client.IsValid );
Assert.IsNotNull( username );
}
}
[TestMethod]
public void SteamId()
{
using ( var client = new Facepunch.Steamworks.Client( 252490 ) )
{
var steamid = client.SteamId;
Console.WriteLine( steamid );
Assert.IsTrue( client.IsValid );
Assert.AreNotEqual( 0, steamid );
}
}
[TestMethod]
public void AuthSessionTicket()
{
using ( var client = new Facepunch.Steamworks.Client( 252490 ) )
{
var ticket = client.Auth.GetAuthSessionTicket();
Assert.IsTrue( ticket != null );
Assert.IsTrue( ticket.Handle != 0 );
Assert.IsTrue( ticket.Data.Length > 0 );
ticket.Cancel();
Assert.IsTrue( ticket.Handle == 0 );
}
}
[TestMethod]
public void VoiceOptimalSampleRate()
{
using ( var client = new Facepunch.Steamworks.Client( 252490 ) )
{
var rate = client.Voice.OptimalSampleRate;
Assert.AreNotEqual( rate, 0 );
}
}
[TestMethod]
public void Update()
{
using ( var client = new Facepunch.Steamworks.Client( 252490 ) )
{
for( int i=0; i<1024; i++ )
{
client.Update();
}
}
}
static MemoryStream decompressStream = new MemoryStream();
[TestMethod]
public void GetVoice()
{
using ( var client = new Facepunch.Steamworks.Client( 252490 ) )
{
int unCompressed = 0;
int compressed = 0;
client.Voice.OnCompressedData = ( ptr, length ) =>
{
compressed += length;
if ( !client.Voice.Decompress( ptr, 0, length, decompressStream ) )
{
Assert.Fail( "Decompress returned false" );
}
};
client.Voice.OnUncompressedData = ( ptr, length ) =>
{
unCompressed += length;
};
client.Voice.WantsRecording = true;
var sw = Stopwatch.StartNew();
while ( sw.Elapsed.TotalSeconds < 3 )
{
client.Update();
System.Threading.Thread.Sleep( 10 );
}
Assert.AreNotEqual( unCompressed, 0 );
Assert.AreNotEqual( compressed, 0 );
// Should really be > 0 if the mic was getting audio
Console.WriteLine( "unCompressed: {0}", unCompressed );
Console.WriteLine( "compressed: {0}", compressed );
}
}
[TestMethod]
public void GetVoice_Compressed_Only()
{
using ( var client = new Facepunch.Steamworks.Client( 252490 ) )
{
int compressed = 0;
client.Voice.OnCompressedData = ( ptr, length ) =>
{
compressed += length;
};
client.Voice.WantsRecording = true;
var sw = Stopwatch.StartNew();
while ( sw.Elapsed.TotalSeconds < 3 )
{
client.Update();
System.Threading.Thread.Sleep( 10 );
}
Assert.AreNotEqual( compressed, 0 );
Console.WriteLine( "compressed: {0}", compressed );
}
}
[TestMethod]
public void GetVoice_UnCompressed_Only()
{
using ( var client = new Facepunch.Steamworks.Client( 252490 ) )
{
int unCompressed = 0;
client.Voice.OnUncompressedData = ( ptr, length ) =>
{
unCompressed += length;
};
client.Voice.WantsRecording = true;
var sw = Stopwatch.StartNew();
while ( sw.Elapsed.TotalSeconds < 3 )
{
client.Update();
System.Threading.Thread.Sleep( 10 );
}
Assert.AreNotEqual( unCompressed, 0 );
// Should really be > 0 if the mic was getting audio
Console.WriteLine( "unCompressed: {0}", unCompressed );
}
}
[TestMethod]
public void InventoryDefinitions()
{
using ( var client = new Facepunch.Steamworks.Client( 252490 ) )
{
Assert.IsNotNull( client.Inventory.Definitions );
Assert.AreNotEqual( 0, client.Inventory.Definitions.Length );
foreach ( var i in client.Inventory.Definitions )
{
Console.WriteLine( "{0}: {1}", i.Id, i.Name );
}
}
}
[TestMethod]
public void InventoryItemList()
{
using ( var client = new Facepunch.Steamworks.Client( 252490 ) )
{
bool CallbackCalled = false;
// OnUpdate hsould be called when we receive a list of our items
client.Inventory.OnUpdate = () => { CallbackCalled = true; };
// tell steam to download the items
client.Inventory.Refresh();
// Wait for the items
var timeout = Stopwatch.StartNew();
while ( client.Inventory.Items == null )
{
client.Update();
System.Threading.Thread.Sleep( 1000 );
if ( timeout.Elapsed.TotalSeconds > 5 )
break;
}
// make sure callback was called
Assert.IsTrue( CallbackCalled );
// Make sure items are valid
foreach ( var item in client.Inventory.Items )
{
Assert.IsNotNull( item );
Assert.IsNotNull( item.Definition );
Console.WriteLine( item.Definition.Name + " - " + item.Id );
}
}
}
}
}

View File

@ -1,92 +0,0 @@
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Linq;
namespace Facepunch.Steamworks.Test
{
[DeploymentItem( Config.LibraryName + ".dll" )]
[DeploymentItem( "steam_appid.txt" )]
[TestClass]
public class Friends
{
[TestMethod]
public void FriendList()
{
using ( var client = new Facepunch.Steamworks.Client( 252490 ) )
{
Assert.IsTrue( client.IsValid );
client.Friends.Refresh();
Assert.IsNotNull( client.Friends.All );
foreach ( var friend in client.Friends.All )
{
Console.WriteLine( "{0}: {1} (Friend:{2}) (Blocked:{3})", friend.Id, friend.Name, friend.IsFriend, friend.IsBlocked );
}
}
}
[TestMethod]
public void FriendListWithoutRefresh()
{
using ( var client = new Facepunch.Steamworks.Client( 252490 ) )
{
Assert.IsTrue( client.IsValid );
foreach ( var friend in client.Friends.All )
{
Console.WriteLine( "{0}: {1} (Friend:{2}) (Blocked:{3})", friend.Id, friend.Name, friend.IsFriend, friend.IsBlocked );
}
}
}
[TestMethod]
public void Avatar()
{
using ( var client = new Facepunch.Steamworks.Client( 252490 ) )
{
Assert.IsTrue( client.IsValid );
var friend = client.Friends.All.First();
var img = client.Friends.GetAvatar( Steamworks.Friends.AvatarSize.Medium, friend.Id );
Assert.AreEqual( img.Width, 64 );
Assert.AreEqual( img.Height, 64 );
while ( !img.IsLoaded && !img.IsError )
{
client.Update();
System.Threading.Thread.Sleep( 10 );
}
Assert.AreEqual( img.Data.Length, img.Width * img.Height * 4 );
DrawImage( img );
}
}
public static void DrawImage( Image img )
{
var grad = " -:+#";
for ( int y = 0; y<img.Height; y++ )
{
var str = "";
for ( int x = 0; x < img.Width; x++ )
{
var p = img.GetPixel( x, y );
var brightness = 1 - ((float)(p.r + p.g + p.b) / (255.0f * 3.0f));
var c = (int) ((grad.Length) * brightness);
str += grad[c];
}
Console.WriteLine( str );
}
}
}
}

View File

@ -1,108 +0,0 @@
using System;
using System.Diagnostics;
using System.Text;
using System.Threading;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace Facepunch.Steamworks.Test
{
[TestClass]
[DeploymentItem( Config.LibraryName + ".dll" )]
[DeploymentItem( "steam_appid.txt" )]
public partial class Networking
{
[TestMethod]
public void PeerToPeerSend()
{
using ( var client = new Facepunch.Steamworks.Client( 252490 ) )
{
var TestString = "This string will be transformed to bytes, sent over the Steam P2P network, then converted back to a string.";
var OutputReceived = false;
var data = Encoding.UTF8.GetBytes( TestString );
client.Networking.OnP2PData = ( steamid, ms, channel ) =>
{
var str = Encoding.UTF8.GetString( ms.GetBuffer() );
Assert.AreEqual( str, TestString );
Assert.AreEqual( steamid, client.SteamId );
OutputReceived = true;
};
client.Networking.OnIncomingConnection = ( steamid ) =>
{
Console.WriteLine( "Incoming P2P Connection: " + steamid );
return true;
};
client.Networking.OnConnectionFailed = ( steamid, error ) =>
{
Console.WriteLine( "Connection Error: " + steamid + " - " + error );
};
client.Networking.SendP2PPacket( client.SteamId, data, data.Length );
while( true )
{
Thread.Sleep( 10 );
client.Update();
if ( OutputReceived )
break;
}
}
}
[TestMethod]
public void PeerToPeerFailure()
{
using ( var client = new Facepunch.Steamworks.Client( 252490 ) )
{
var TestString = "This string will be transformed to bytes, sent over the Steam P2P network, then converted back to a string.";
var TimeoutReceived = false;
var data = Encoding.UTF8.GetBytes( TestString );
client.Networking.OnIncomingConnection = ( steamid ) =>
{
Console.WriteLine( "Incoming P2P Connection: " + steamid );
return true;
};
client.Networking.OnConnectionFailed = ( steamid, error ) =>
{
Console.WriteLine( "Connection Error: " + steamid + " - " + error );
TimeoutReceived = true;
};
ulong rand = (ulong) new Random().Next( 1024 * 16 );
// Send to an invalid, not listening steamid
if ( !client.Networking.SendP2PPacket( client.SteamId + rand, data, data.Length ) )
{
Console.WriteLine( "Couldn't send packet" );
return;
}
var sw = Stopwatch.StartNew();
while ( true )
{
Thread.Sleep( 10 );
client.Update();
//
// Timout is usually around 15 seconds
//
if ( TimeoutReceived )
break;
if ( sw.Elapsed.TotalSeconds > 30 )
{
Assert.Fail( "Didn't time out" );
}
}
}
}
}
}

View File

@ -0,0 +1,43 @@
using System;
using System.Text;
using System.Threading;
using Microsoft.VisualStudio.TestTools.UnitTesting;
/*
namespace Facepunch.Steamworks.Test
{
public partial class Server
{
[TestMethod]
public void StatsGet()
{
using ( var server = new Facepunch.Steamworks.Server( 252490, new ServerInit( "rust", "Rust" ) ) )
{
Assert.IsTrue( server.IsValid );
server.LogOnAnonymous();
ulong MySteamId = 76561197960279927;
bool GotStats = false;
server.Stats.Refresh( MySteamId, (steamid, success) =>
{
GotStats = true;
Assert.IsTrue( success );
var deathsInCallback = server.Stats.GetInt( MySteamId, "deaths", -1 );
Console.WriteLine( "deathsInCallback: {0}", deathsInCallback );
Assert.IsTrue( deathsInCallback > 0 );
} );
server.UpdateWhile( () => !GotStats );
var deaths = server.Stats.GetInt( MySteamId, "deaths", -1 );
Console.WriteLine( "deathsInCallback: {0}", deaths );
Assert.IsTrue( deaths > 0 );
}
}
}
}
*/

View File

@ -1,357 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace Facepunch.Steamworks.Test
{
[TestClass]
[DeploymentItem( Config.LibraryName + ".dll" )]
[DeploymentItem( "steam_appid.txt" )]
public partial class ServerList
{
[TestMethod]
public void InternetList()
{
using ( var client = new Facepunch.Steamworks.Client( 252490 ) )
{
var filter = new Facepunch.Steamworks.ServerList.Filter();
filter.Add( "appid", client.AppId.ToString() );
filter.Add( "gamedir", "rust" );
filter.Add( "secure", "1" );
var query = client.ServerList.Internet( filter );
for ( int i = 0; i < 1000; i++ )
{
client.Update();
System.Threading.Thread.Sleep( 10 );
foreach ( var s in query.Responded )
{
Assert.AreEqual( s.AppId, client.AppId );
Assert.AreEqual( s.GameDir, "rust" );
}
if ( query.Finished )
break;
}
Console.WriteLine( "Responded: " + query.Responded.Count.ToString() );
Console.WriteLine( "Unresponsive: " + query.Unresponsive.Count.ToString() );
foreach ( var server in query.Responded.Take( 20 ) )
{
Console.WriteLine( "{0} {1}", server.AddressString, server.Name );
}
query.Dispose();
for ( int i = 0; i < 100; i++ )
{
client.Update();
System.Threading.Thread.Sleep( 1 );
}
}
}
[TestMethod]
public void MultipleInternetList()
{
using ( var client = new Facepunch.Steamworks.Client( 252490 ) )
{
var queries = new List<Facepunch.Steamworks.ServerList.Request>();
var filter = new Facepunch.Steamworks.ServerList.Filter();
filter.Add( "map", "barren" );
for ( int i = 0; i < 10; i++ )
queries.Add( client.ServerList.Internet( filter ) );
for ( int i = 0; i < 100; i++ )
{
client.Update();
System.Threading.Thread.Sleep( 5 );
if ( queries.Any( x => x.Finished ) )
break;
}
foreach ( var query in queries )
{
Console.WriteLine( "Responded: " + query.Responded.Count.ToString() );
Console.WriteLine( "Unresponsive: " + query.Unresponsive.Count.ToString() );
client.Update();
query.Dispose();
client.Update();
}
}
}
[TestMethod]
public void Filters()
{
using ( var client = new Facepunch.Steamworks.Client( 252490 ) )
{
var filter = new Facepunch.Steamworks.ServerList.Filter();
filter.Add( "map", "barren" );
var query = client.ServerList.Internet( filter );
while ( true )
{
client.Update();
System.Threading.Thread.Sleep( 2 );
if ( query.Finished )
break;
}
foreach ( var x in query.Responded )
{
Assert.AreEqual( x.Map.ToLower(), "barren" );
}
query.Dispose();
for ( int i = 0; i < 100; i++ )
{
client.Update();
System.Threading.Thread.Sleep( 1 );
}
}
}
[TestMethod]
public void HistoryList()
{
using ( var client = new Facepunch.Steamworks.Client( 252490 ) )
{
var query = client.ServerList.History();
while ( true )
{
client.Update();
System.Threading.Thread.Sleep( 2 );
if ( query.Finished )
break;
}
Console.WriteLine( "Responded: " + query.Responded.Count.ToString() );
Console.WriteLine( "Unresponsive: " + query.Unresponsive.Count.ToString() );
foreach ( var x in query.Responded )
{
Console.WriteLine( x.Map );
}
query.Dispose();
for ( int i = 0; i < 100; i++ )
{
client.Update();
System.Threading.Thread.Sleep( 1 );
}
}
}
[TestMethod]
public void CustomList()
{
using ( var client = new Facepunch.Steamworks.Client( 252490 ) )
{
var servers = new List<string>();
servers.Add( "158.85.101.20:28015" );
servers.Add( "158.85.101.20:28022" );
servers.Add( "173.192.176.171:28615" );
servers.Add( "109.95.212.35:28215" );
servers.Add( "109.95.212.35:28115" );
servers.Add( "27.50.72.176:28015" );
servers.Add( "109.95.212.40:28015" );
servers.Add( "212.38.168.149:28215" );
servers.Add( "27.50.72.167:28215" );
servers.Add( "85.236.105.7:28215" );
servers.Add( "107.182.233.216:28215" );
servers.Add( "85.236.105.11:28215" );
servers.Add( "109.95.211.198:28215" );
servers.Add( "8.26.94.190:28015" );
servers.Add( "221.121.151.37:28215" );
servers.Add( "161.202.144.216:28215" );
servers.Add( "107.182.230.181:28215" );
servers.Add( "107.182.231.134:27101" );
servers.Add( "107.182.233.181:27101" );
servers.Add( "78.129.153.47:27101" );
servers.Add( "109.95.211.206:27101" );
servers.Add( "169.57.142.73:27101" );
servers.Add( "221.121.154.147:27101" );
servers.Add( "31.216.52.44:30015" );
servers.Add( "109.169.94.17:28215" );
servers.Add( "109.169.94.17:28315" );
servers.Add( "109.169.94.17:28015" );
servers.Add( "41.0.11.167:27141" );
servers.Add( "78.129.153.47:27131" );
servers.Add( "109.95.211.206:27111" );
servers.Add( "107.182.231.134:27111" );
servers.Add( "198.27.70.162:28015" );
servers.Add( "198.27.70.162:28215" );
servers.Add( "198.27.70.162:28115" );
servers.Add( "169.57.142.73:27111" );
servers.Add( "221.121.154.147:27111" );
servers.Add( "107.182.233.181:27111" );
servers.Add( "78.129.153.47:27111" );
servers.Add( "109.95.211.215:28015" );
servers.Add( "50.23.131.208:28015" );
servers.Add( "50.23.131.208:28115" );
servers.Add( "50.23.131.208:28215" );
servers.Add( "63.251.114.37:28215" );
servers.Add( "63.251.114.37:28115" );
servers.Add( "63.251.114.37:28015" );
servers.Add( "149.202.89.85:27101" );
servers.Add( "149.202.89.85:27111" );
servers.Add( "149.202.89.85:27131" );
servers.Add( "8.26.94.147:27101" );
servers.Add( "8.26.94.147:27111" );
servers.Add( "8.26.94.147:27121" );
servers.Add( "159.8.147.197:28025" );
servers.Add( "162.248.88.203:27038" );
servers.Add( "162.248.88.203:28091" );
servers.Add( "74.91.119.142:28069" );
servers.Add( "162.248.88.203:25063" );
servers.Add( "64.251.7.189:28115" );
servers.Add( "64.251.7.189:28015" );
servers.Add( "216.52.0.170:28215" );
servers.Add( "217.147.91.80:28215" );
servers.Add( "63.251.112.121:28215" );
servers.Add( "162.248.88.203:28074" );
servers.Add( "74.91.119.142:27095" );
servers.Add( "95.172.92.176:28065" );
servers.Add( "192.223.26.55:26032" );
servers.Add( "40.114.199.6:28085" );
servers.Add( "95.172.92.176:27095" );
servers.Add( "216.52.0.172:28015" );
servers.Add( "216.52.0.171:28115" );
servers.Add( "27.50.72.179:28015" );
servers.Add( "27.50.72.180:28115" );
servers.Add( "221.121.158.203:28015" );
servers.Add( "63.251.242.246:28015" );
servers.Add( "85.236.105.51:28015" );
servers.Add( "85.236.105.47:28015" );
servers.Add( "209.95.60.216:28015" );
servers.Add( "212.38.168.14:28015" );
servers.Add( "217.147.91.138:28015" );
servers.Add( "31.216.52.42:28015" );
servers.Add( "107.182.226.225:28015" );
servers.Add( "109.95.211.69:28015" );
servers.Add( "209.95.56.13:28015" );
servers.Add( "173.244.192.101:28015" );
servers.Add( "221.121.158.201:28115" );
servers.Add( "63.251.242.245:28115" );
servers.Add( "85.236.105.50:28115" );
servers.Add( "85.236.105.46:28115" );
servers.Add( "209.95.60.217:28115" );
servers.Add( "212.38.168.13:28115" );
servers.Add( "217.147.91.139:28115" );
servers.Add( "107.182.226.224:28115" );
servers.Add( "109.95.211.14:28115" );
servers.Add( "109.95.211.16:28115" );
servers.Add( "109.95.211.17:28115" );
servers.Add( "209.95.56.14:28115" );
servers.Add( "173.244.192.100:28115" );
servers.Add( "209.95.60.218:28215" );
servers.Add( "109.95.211.13:28215" );
servers.Add( "109.95.211.15:28215" );
servers.Add( "31.216.52.41:29015" );
var query = client.ServerList.Custom( servers );
for ( int i = 0; i < 1000; i++ )
{
client.Update();
System.Threading.Thread.Sleep( 20 );
if ( query.Finished )
break;
}
Console.WriteLine( "Responded: " + query.Responded.Count.ToString() );
Console.WriteLine( "Unresponsive: " + query.Unresponsive.Count.ToString() );
foreach ( var s in query.Responded )
{
Console.WriteLine( "{0} - {1}", s.AddressString, s.Name );
}
query.Dispose();
}
}
[TestMethod]
public void Rules()
{
using ( var client = new Facepunch.Steamworks.Client( 252490 ) )
{
var filter = new Facepunch.Steamworks.ServerList.Filter();
filter.Add( "appid", client.AppId.ToString() );
filter.Add( "gamedir", "rust" );
filter.Add( "secure", "1" );
using ( var query = client.ServerList.Internet( filter ) )
{
for ( int i = 0; i < 1000; i++ )
{
GC.Collect();
client.Update();
GC.Collect();
System.Threading.Thread.Sleep( 10 );
if ( query.Responded.Count > 20 )
break;
if ( query.Finished )
break;
}
query.Dispose();
foreach ( var server in query.Responded.Take( 20 ) )
{
GC.Collect();
server.FetchRules();
GC.Collect();
int i = 0;
while ( !server.HasRules )
{
i++;
GC.Collect();
client.Update();
GC.Collect();
System.Threading.Thread.Sleep( 2 );
if ( i > 100 )
break;
}
if ( server.HasRules )
{
foreach ( var rule in server.Rules )
{
Console.WriteLine( rule.Key + " = " + rule.Value );
}
}
}
}
}
}
}
}

View File

@ -1,73 +0,0 @@
using System;
using System.Text;
using System.Threading;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace Facepunch.Steamworks.Test
{
[TestClass]
[DeploymentItem( Config.LibraryName + ".dll" )]
[DeploymentItem( "steam_appid.txt" )]
public class Stats
{
[TestMethod]
public void UpdateStats()
{
using ( var client = new Facepunch.Steamworks.Client( 252490 ) )
{
client.Stats.UpdateStats();
}
}
[TestMethod]
public void UpdateSUpdateGlobalStatstats()
{
using ( var client = new Facepunch.Steamworks.Client( 252490 ) )
{
client.Stats.UpdateGlobalStats( 1 );
client.Stats.UpdateGlobalStats( 3 );
client.Stats.UpdateGlobalStats( 7 );
}
}
[TestMethod]
public void GetClientFloat()
{
using ( var client = new Facepunch.Steamworks.Client( 252490 ) )
{
var v = client.Stats.GetFloat( "deaths" );
Console.WriteLine( v );
}
}
[TestMethod]
public void GetClientInt()
{
using ( var client = new Facepunch.Steamworks.Client( 252490 ) )
{
var v = client.Stats.GetInt( "deaths" );
Console.WriteLine( v );
}
}
[TestMethod]
public void GetGlobalFloat()
{
using ( var client = new Facepunch.Steamworks.Client( 252490 ) )
{
var v = client.Stats.GetGlobalFloat( "deaths" );
Console.WriteLine( v );
}
}
[TestMethod]
public void GetGlobalInt()
{
using ( var client = new Facepunch.Steamworks.Client( 252490 ) )
{
var v = client.Stats.GetGlobalInt( "deaths" );
Console.WriteLine( v );
}
}
}
}

View File

@ -1,425 +0,0 @@
using System;
using System.Text;
using System.Threading;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Linq;
namespace Facepunch.Steamworks.Test
{
[TestClass]
[DeploymentItem( Config.LibraryName + ".dll" )]
[DeploymentItem( "steam_appid.txt" )]
public class WorkshopTest
{
[TestMethod]
public void Query()
{
using ( var client = new Facepunch.Steamworks.Client( 252490 ) )
{
Assert.IsTrue( client.IsValid );
var Query = client.Workshop.CreateQuery();
Query.Run();
// Block, wait for result
// (don't do this in realtime)
Query.Block();
Assert.IsFalse( Query.IsRunning );
Assert.IsTrue( Query.TotalResults > 0 );
Assert.IsTrue( Query.Items.Length > 0 );
Console.WriteLine( "Query.TotalResults: {0}", Query.TotalResults );
Console.WriteLine( "Query.Items.Length: {0}", Query.Items.Length );
// results
Console.WriteLine( "Searching" );
Query.Order = Workshop.Order.RankedByTextSearch;
Query.QueryType = Workshop.QueryType.MicrotransactionItems;
Query.SearchText = "black";
Query.RequireTags.Add( "LongTShirt Skin" );
Query.Run();
// Block, wait for result
// (don't do this in realtime)
Query.Block();
Console.WriteLine( "Query.TotalResults: {0}", Query.TotalResults );
Console.WriteLine( "Query.Items.Length: {0}", Query.Items.Length );
Assert.IsTrue( Query.TotalResults > 0 );
Assert.IsTrue( Query.Items.Length > 0 );
foreach ( var item in Query.Items )
{
Console.WriteLine( "{0}", item.Title );
Console.WriteLine( "\t WebsiteViews: {0}", item.WebsiteViews );
Console.WriteLine( "\t VotesUp: {0}", item.VotesUp );
Console.WriteLine( "\t PreviewUrl: {0}", item.PreviewImageUrl );
}
}
}
[TestMethod]
public void QueryTagRequire()
{
using ( var client = new Facepunch.Steamworks.Client( 252490 ) )
{
Assert.IsTrue( client.IsValid );
using ( var Query = client.Workshop.CreateQuery() )
{
Query.RequireTags.Add( "LongTShirt Skin" );
Query.Run();
Query.Block();
Assert.IsFalse( Query.IsRunning );
Assert.IsTrue( Query.TotalResults > 0 );
Assert.IsTrue( Query.Items.Length > 0 );
Console.WriteLine( "Query.TotalResults: {0}", Query.TotalResults );
Console.WriteLine( "Query.Items.Length: {0}", Query.Items.Length );
Assert.IsTrue( Query.TotalResults > 0 );
Assert.IsTrue( Query.Items.Length > 0 );
foreach ( var item in Query.Items )
{
Console.WriteLine( "{0}", item.Title );
Console.WriteLine( "\t{0}", string.Join( ";", item.Tags ) );
Assert.IsTrue( item.Tags.Contains( "LongTShirt Skin" ) );
}
}
}
}
[TestMethod]
public void QueryTagRequireMultiple()
{
using ( var client = new Facepunch.Steamworks.Client( 252490 ) )
{
Assert.IsTrue( client.IsValid );
using ( var Query = client.Workshop.CreateQuery() )
{
Query.RequireTags.Add( "LongTShirt Skin" );
Query.RequireTags.Add( "version2" );
Query.RequireAllTags = true;
Query.Run();
Query.Block();
Assert.IsFalse( Query.IsRunning );
Assert.IsTrue( Query.TotalResults > 0 );
Assert.IsTrue( Query.Items.Length > 0 );
Console.WriteLine( "Query.TotalResults: {0}", Query.TotalResults );
Console.WriteLine( "Query.Items.Length: {0}", Query.Items.Length );
Assert.IsTrue( Query.TotalResults > 0 );
Assert.IsTrue( Query.Items.Length > 0 );
foreach ( var item in Query.Items )
{
Console.WriteLine( "{0}", item.Title );
Console.WriteLine( "\t{0}", string.Join( ";", item.Tags ) );
Assert.IsTrue( item.Tags.Contains( "LongTShirt Skin" ) );
Assert.IsTrue( item.Tags.Contains( "version2" ) );
}
}
}
}
[TestMethod]
public void QueryTagExclude()
{
using ( var client = new Facepunch.Steamworks.Client( 252490 ) )
{
Assert.IsTrue( client.IsValid );
using ( var Query = client.Workshop.CreateQuery() )
{
Query.RequireTags.Add( "LongTShirt Skin" );
Query.ExcludeTags.Add( "version2" );
Query.Run();
Query.Block();
Assert.IsFalse( Query.IsRunning );
Assert.IsTrue( Query.TotalResults > 0 );
Assert.IsTrue( Query.Items.Length > 0 );
Console.WriteLine( "Query.TotalResults: {0}", Query.TotalResults );
Console.WriteLine( "Query.Items.Length: {0}", Query.Items.Length );
Assert.IsTrue( Query.TotalResults > 0 );
Assert.IsTrue( Query.Items.Length > 0 );
foreach ( var item in Query.Items )
{
Console.WriteLine( "{0}", item.Title );
Console.WriteLine( "\t{0}", string.Join( ";", item.Tags ) );
Assert.IsTrue( item.Tags.Contains( "LongTShirt Skin" ) );
Assert.IsFalse( item.Tags.Contains( "version2" ) );
}
}
}
}
[TestMethod]
public void QueryFile()
{
using ( var client = new Facepunch.Steamworks.Client( 252490 ) )
{
Assert.IsTrue( client.IsValid );
using ( var Query = client.Workshop.CreateQuery() )
{
Query.FileId.Add( 751993251 );
Query.Run();
Assert.IsTrue( Query.IsRunning );
Query.Block();
Assert.IsFalse( Query.IsRunning );
Assert.AreEqual( Query.TotalResults, 1 );
Assert.AreEqual( Query.Items.Length, 1 );
Console.WriteLine( "Query.TotalResults: {0}", Query.TotalResults );
Console.WriteLine( "Query.Items.Length: {0}", Query.Items.Length );
Assert.AreEqual<ulong>( Query.Items[0].Id, 751993251 );
}
}
}
[TestMethod]
public void QueryFiles()
{
using ( var client = new Facepunch.Steamworks.Client( 252490 ) )
{
Assert.IsTrue( client.IsValid );
using ( var Query = client.Workshop.CreateQuery() )
{
Query.FileId.Add( 751993251 );
Query.FileId.Add( 747266909 );
Query.Run();
Assert.IsTrue( Query.IsRunning );
Query.Block();
Assert.IsFalse( Query.IsRunning );
Assert.AreEqual( Query.TotalResults, 2 );
Assert.AreEqual( Query.Items.Length, 2 );
Console.WriteLine( "Query.TotalResults: {0}", Query.TotalResults );
Console.WriteLine( "Query.Items.Length: {0}", Query.Items.Length );
Assert.IsTrue( Query.Items.Any( x => x.Id == 751993251 ) );
Assert.IsTrue( Query.Items.Any( x => x.Id == 747266909 ) );
}
}
}
[TestMethod]
public void Query_255()
{
using ( var client = new Facepunch.Steamworks.Client( 252490 ) )
{
Assert.IsTrue( client.IsValid );
using ( var Query = client.Workshop.CreateQuery() )
{
Query.PerPage = 255;
Query.Run();
Assert.IsTrue( Query.IsRunning );
Query.Block();
Assert.IsFalse( Query.IsRunning );
Assert.AreEqual( Query.Items.Length, 255 );
Console.WriteLine( "Query.TotalResults: {0}", Query.TotalResults );
Console.WriteLine( "Query.Items.Length: {0}", Query.Items.Length );
}
}
}
[TestMethod]
public void Query_28()
{
using ( var client = new Facepunch.Steamworks.Client( 252490 ) )
{
Assert.IsTrue( client.IsValid );
using ( var Query = client.Workshop.CreateQuery() )
{
Query.PerPage = 28;
Query.Run();
Query.Block();
var firstPage = Query.Items;
Assert.AreEqual( firstPage.Length, 28 );
Console.WriteLine( "Page 2" );
Query.Page++;
Query.Run();
Query.Block();
var secondPage = Query.Items;
Assert.AreEqual( secondPage.Length, 28 );
Console.WriteLine( "Page 3" );
Query.Page++;
Query.Run();
Query.Block();
var thirdPage = Query.Items;
Assert.AreEqual( thirdPage.Length, 28 );
foreach ( var i in firstPage )
{
Assert.IsFalse( secondPage.Any( x => x.Id == i.Id ) );
Assert.IsFalse( thirdPage.Any( x => x.Id == i.Id ) );
}
foreach ( var i in secondPage )
{
Assert.IsFalse( firstPage.Any( x => x.Id == i.Id ) );
Assert.IsFalse( thirdPage.Any( x => x.Id == i.Id ) );
}
foreach ( var i in thirdPage )
{
Assert.IsFalse( secondPage.Any( x => x.Id == i.Id ) );
Assert.IsFalse( firstPage.Any( x => x.Id == i.Id ) );
}
}
}
}
[TestMethod]
public void DownloadFile()
{
using ( var client = new Facepunch.Steamworks.Client( 252490 ) )
{
Assert.IsTrue( client.IsValid );
using ( var Query = client.Workshop.CreateQuery() )
{
Query.FileId.Add( 661319648 );
Query.Run();
Assert.IsTrue( Query.IsRunning );
Query.Block();
Assert.IsFalse( Query.IsRunning );
Assert.AreEqual( Query.TotalResults, 1 );
Assert.AreEqual( Query.Items.Length, 1 );
var item = Query.Items[0];
if ( !item.Installed )
{
item.Download();
while ( item.Downloading )
{
Thread.Sleep( 500 );
client.Update();
Console.WriteLine( "Download Progress: {0}", item.DownloadProgress );
}
}
Assert.IsNotNull( item.Directory );
Assert.AreNotEqual( 0, item.Size );
Console.WriteLine( "item.Installed: {0}", item.Installed );
Console.WriteLine( "item.Downloading: {0}", item.Downloading );
Console.WriteLine( "item.DownloadPending: {0}", item.DownloadPending );
Console.WriteLine( "item.Directory: {0}", item.Directory );
Console.WriteLine( "item.Size: {0}mb", (item.Size / 1024 / 1024) );
}
}
}
[TestMethod]
[TestCategory( "Run Manually" )]
public void CreatePublish()
{
using ( var client = new Facepunch.Steamworks.Client( 252490 ) )
{
Assert.IsTrue( client.IsValid );
var item = client.Workshop.CreateItem( Workshop.ItemType.Microtransaction );
item.Title = "Facepunch.Steamworks Unit test";
item.Tags.Add( "Apple" );
item.Tags.Add( "Banana" );
item.Publish();
while ( item.Publishing )
{
client.Update();
Thread.Sleep( 100 );
}
Assert.IsFalse( item.Publishing );
Assert.AreNotEqual( 0, item.Id );
Assert.IsNull( item.Error );
Console.WriteLine( "item.Id: {0}", item.Id );
item.Delete();
}
}
[TestMethod]
public void UserQuery()
{
using ( var client = new Facepunch.Steamworks.Client( 252490 ) )
{
Assert.IsTrue( client.IsValid );
var Query = client.Workshop.CreateQuery();
Query.UserId = 76561197960279927;
Query.UserQueryType = Workshop.UserQueryType.Published;
Query.Run();
// Block, wait for result
// (don't do this in realtime)
Query.Block();
Assert.IsFalse( Query.IsRunning );
Assert.IsTrue( Query.TotalResults > 0 );
Assert.IsTrue( Query.Items.Length > 0 );
Console.WriteLine( "Query.TotalResults: {0}", Query.TotalResults );
Console.WriteLine( "Query.Items.Length: {0}", Query.Items.Length );
foreach ( var item in Query.Items )
{
Console.WriteLine( "{0}", item.Title );
Assert.AreEqual<ulong>( item.OwnerId, 76561197960279927 );
}
}
}
}
}

View File

@ -1,137 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{3F6183AD-D966-44F2-A6EB-42E61E591B49}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Facepunch.Steamworks.Test</RootNamespace>
<AssemblyName>Facepunch.Steamworks.Test</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
<IsCodedUITest>False</IsCodedUITest>
<TestProjectType>UnitTest</TestProjectType>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
</ItemGroup>
<Choose>
<When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'">
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
</ItemGroup>
</When>
<Otherwise>
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework">
<Private>False</Private>
</Reference>
</ItemGroup>
</Otherwise>
</Choose>
<ItemGroup>
<Compile Include="Client\Client.cs" />
<Compile Include="Client\Workshop.cs" />
<Compile Include="Client\Networking.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Client\Friends.cs" />
<Compile Include="Server\Inventory.cs" />
<Compile Include="Server\Server.cs" />
<Compile Include="Server\Stats.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Facepunch.Steamworks\Facepunch.Steamworks.csproj">
<Project>{dc2d9fa9-f005-468f-8581-85c79f4e0034}</Project>
<Name>Facepunch.Steamworks</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Compile Include="Client\Serverlist.cs" />
<Compile Include="Client\Stats.cs" />
</ItemGroup>
<Choose>
<When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'">
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.QualityTools.CodedUITestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Extension, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestTools.UITesting, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
</ItemGroup>
</When>
</Choose>
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@ -0,0 +1,55 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DefineConstants>TRACE;DEBUG;TEST_WIN32</DefineConstants>
<PlatformTarget>x86</PlatformTarget>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DefineConstants>TRACE;TEST_WIN32</DefineConstants>
<PlatformTarget>x64</PlatformTarget>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<OutputPath>bin\x64\Debug\</OutputPath>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<OutputPath>bin\x86\Debug\</OutputPath>
<PlatformTarget>x64</PlatformTarget>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<PlatformTarget>x64</PlatformTarget>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Facepunch.Steamworks\Facepunch.Steamworks.Win32.csproj" />
</ItemGroup>
<ItemGroup>
<Content Include="steam_api.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.*" />
<PackageReference Include="MSTest.TestAdapter" Version="2.0.0-beta4" />
<PackageReference Include="MSTest.TestFramework" Version="2.0.0-beta4" />
<PackageReference Include="Newtonsoft.Json" Version="9.0.2-beta1" />
</ItemGroup>
<ItemGroup>
<Compile Remove="ClanTest.cs" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,54 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DefineConstants>TRACE;DEBUG;TEST_WIN64</DefineConstants>
<PlatformTarget>x64</PlatformTarget>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>x64</PlatformTarget>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<OutputPath>bin\x64\Debug\</OutputPath>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<OutputPath>bin\x86\Debug\</OutputPath>
<PlatformTarget>x64</PlatformTarget>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<PlatformTarget>x64</PlatformTarget>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Facepunch.Steamworks\Facepunch.Steamworks.Win64.csproj" />
</ItemGroup>
<ItemGroup>
<Content Include="steam_api64.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.*" />
<PackageReference Include="MSTest.TestAdapter" Version="2.0.0-beta4" />
<PackageReference Include="MSTest.TestFramework" Version="2.0.0-beta4" />
<PackageReference Include="Newtonsoft.Json" Version="9.0.2-beta1" />
</ItemGroup>
<ItemGroup>
<Compile Remove="ClanTest.cs" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,154 @@
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Linq;
using System.Threading.Tasks;
using Steamworks.Data;
namespace Steamworks
{
[DeploymentItem( "steam_api64.dll" )]
[DeploymentItem( "steam_api.dll" )]
[TestClass]
public class FriendsTest
{
[TestMethod]
public void GetFriends()
{
foreach ( var friend in SteamFriends.GetFriends() )
{
Console.WriteLine( $"{friend.Id.Value}: {friend.Name} (Friend:{friend.IsFriend}) (Blocked:{friend.IsBlocked})" );
Console.WriteLine( $" {string.Join( ", ", friend.NameHistory )}" );
// Assert.IsNotNull( friend.GetAvatar( Steamworks.Friends.AvatarSize.Medium ) );
}
}
[TestMethod]
public void GetBlocked()
{
foreach ( var friend in SteamFriends.GetBlocked() )
{
Console.WriteLine( $"{friend.Id.Value}: {friend.Name} (Friend:{friend.IsFriend}) (Blocked:{friend.IsBlocked})" );
Console.WriteLine( $" {string.Join( ", ", friend.NameHistory )}" );
// Assert.IsNotNull( friend.GetAvatar( Steamworks.Friends.AvatarSize.Medium ) );
}
}
[TestMethod]
public async Task GetPlayedWith()
{
foreach ( var friend in SteamFriends.GetPlayedWith() )
{
await friend.RequestInfoAsync();
Console.WriteLine( $"{friend.Id.Value}: {friend.Name} (Friend:{friend.IsFriend}) (Blocked:{friend.IsBlocked})" );
Console.WriteLine( $" {string.Join( ", ", friend.NameHistory )}" );
// Assert.IsNotNull( friend.GetAvatar( Steamworks.Friends.AvatarSize.Medium ) );
}
}
[TestMethod]
public async Task LargeAvatar()
{
ulong id = (ulong)(76561197960279927 + (new Random().Next() % 10000));
var image = await SteamFriends.GetLargeAvatarAsync( id );
if ( !image.HasValue )
return;
Console.WriteLine( $"image.Width {image.Value.Width}" );
Console.WriteLine( $"image.Height {image.Value.Height}" );
DrawImage( image.Value );
}
[TestMethod]
public async Task MediumAvatar()
{
ulong id = (ulong)(76561197960279927 + (new Random().Next() % 10000));
Console.WriteLine( $"Steam: http://steamcommunity.com/profiles/{id}" );
var image = await SteamFriends.GetMediumAvatarAsync( id );
if ( !image.HasValue )
return;
Console.WriteLine( $"image.Width {image.Value.Width}" );
Console.WriteLine( $"image.Height {image.Value.Height}" );
DrawImage( image.Value );
}
[TestMethod]
public async Task SmallAvatar()
{
ulong id = (ulong)(76561197960279927 + (new Random().Next() % 10000));
var image = await SteamFriends.GetSmallAvatarAsync( id );
if ( !image.HasValue )
return;
Console.WriteLine( $"image.Width {image.Value.Width}" );
Console.WriteLine( $"image.Height {image.Value.Height}" );
DrawImage( image.Value );
}
[TestMethod]
public async Task GetFriendsAvatars()
{
foreach ( var friend in SteamFriends.GetFriends() )
{
Console.WriteLine( $"{friend.Id.Value}: {friend.Name}" );
var image = await friend.GetSmallAvatarAsync();
if ( image.HasValue )
{
DrawImage( image.Value );
}
// Assert.IsNotNull( friend.GetAvatar( Steamworks.Friends.AvatarSize.Medium ) );
}
}
[TestMethod]
public async Task OpenWebOverlay()
{
if ( SteamUtils.IsOverlayEnabled )
Console.WriteLine( "Overlay Is Enabled" );
else
Console.WriteLine( "Overlay Is Not Enabled" );
SteamFriends.OpenWebOverlay( "https://www.google.com/" );
await Task.Delay( 2000 );
}
public static void DrawImage( Image img )
{
var grad = " -:+#";
for ( int y = 0; y < img.Height; y++ )
{
var str = "";
for ( int x = 0; x < img.Width; x++ )
{
var p = img.GetPixel( x, y );
var brightness = 1 - ((float)(p.r + p.g + p.b) / (255.0f * 3.0f));
var c = (int)((grad.Length) * brightness);
if ( c > 3 ) c = 3;
str += grad[c];
}
Console.WriteLine( str );
}
}
}
}

View File

@ -0,0 +1,32 @@
using System;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Steamworks.Data;
namespace Steamworks
{
[TestClass]
[DeploymentItem( "steam_api64.dll" )]
[DeploymentItem( "steam_api.dll" )]
public class GameServerStatsTest
{
static SteamId Garry = 76561197960279927;
[TestMethod]
public async Task GetAchievement()
{
var result = await SteamServerStats.RequestUserStatsAsync( Garry );
Assert.AreEqual( result, Result.OK );
var value = SteamServerStats.GetAchievement( Garry, "COLLECT_100_WOOD" );
Assert.IsTrue( value );
value = SteamServerStats.GetAchievement( Garry, "ACHIVEMENT_THAT_DOESNT_EXIST" );
Assert.IsFalse( value );
}
}
}

View File

@ -0,0 +1,128 @@
using System;
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Steamworks.Data;
namespace Steamworks
{
[DeploymentItem( "steam_api64.dll" )]
[DeploymentItem( "steam_api.dll" )]
[TestClass]
public partial class GameServerTest
{
[TestMethod]
public void Init()
{
SteamServer.DedicatedServer = true;
SteamServer.DedicatedServer = false;
}
[TestMethod]
public async Task PublicIp()
{
while ( true )
{
var ip = SteamServer.PublicIp;
if ( ip == null )
{
await Task.Delay( 10 );
continue;
}
Assert.IsNotNull( ip );
Console.WriteLine( ip.ToString() );
break;
}
}
[TestMethod]
public async Task BeginAuthSession()
{
var stopwatch = System.Diagnostics.Stopwatch.StartNew();
bool finished = false;
string failed = null;
AuthResponse response = AuthResponse.AuthTicketInvalidAlreadyUsed;
//
// Clientside calls this function, gets ticket
//
var clientTicket = SteamUser.GetAuthSessionTicket( NetIdentity.LocalHost );
//
// The client sends this data to the server along with their steamid
//
var ticketData = clientTicket.Data;
var clientSteamId = SteamClient.SteamId;
//
// Server listens to auth responses from Gabe
//
SteamServer.OnValidateAuthTicketResponse += ( steamid, ownerid, rsponse ) =>
{
finished = true;
response = rsponse;
if ( steamid == 0 )
failed = $"steamid is 0! {steamid} != {ownerid} ({rsponse})";
if ( ownerid == 0 )
failed = $"ownerid is 0! {steamid} != {ownerid} ({rsponse})";
if ( steamid != ownerid )
failed = $"Steamid and Ownerid are different! {steamid} != {ownerid} ({rsponse})";
};
//
// Server gets the ticket, starts authing
//
if ( !SteamServer.BeginAuthSession( ticketData, clientSteamId ) )
{
Assert.Fail( "BeginAuthSession returned false, called bullshit without even having to check with Gabe" );
}
//
// Wait for that to go through steam
//
while ( !finished )
{
if ( stopwatch.Elapsed.TotalSeconds > 5 )
throw new System.Exception( "Took too long waiting for AuthSessionResponse.OK" );
await Task.Delay( 10 );
}
Assert.AreEqual( response, AuthResponse.OK );
if ( failed != null )
Assert.Fail( failed );
finished = false;
stopwatch = System.Diagnostics.Stopwatch.StartNew();
//
// The client is leaving, and now wants to cancel the ticket
//
Assert.AreNotEqual( 0, clientTicket.Handle );
clientTicket.Cancel();
//
// We should get another callback
//
while ( !finished )
{
if ( stopwatch.Elapsed.TotalSeconds > 5 )
throw new System.Exception( "Took too long waiting for AuthSessionResponse.AuthTicketCanceled" );
await Task.Delay( 10 );
}
if ( failed != null )
Assert.Fail( failed );
//Assert.AreEqual( response, AuthResponse.AuthTicketCanceled );
}
}
}

View File

@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Steamworks.Data;
namespace Steamworks
{
[TestClass]
[DeploymentItem( "steam_api64.dll" )]
[DeploymentItem( "steam_api.dll" )]
[DeploymentItem( "controller_config/game_actions_252490.vdf" )]
public class InputTest
{
[TestMethod]
public void ControllerList()
{
foreach ( var controller in SteamInput.Controllers )
{
Console.Write( $"Controller: {controller}" );
var dstate = controller.GetDigitalState( "fire" );
var astate = controller.GetAnalogState( "Move" );
}
}
}
}

View File

@ -0,0 +1,223 @@
using System;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Steamworks.Data;
namespace Steamworks
{
[TestClass]
[DeploymentItem( "steam_api64.dll" )]
[DeploymentItem( "steam_api.dll" )]
public class InventoryTest
{
[TestMethod]
public async Task LoadItemDefinitionsAsync()
{
var result = await SteamInventory.WaitForDefinitions( 5 );
Assert.IsTrue( result );
result = await SteamInventory.WaitForDefinitions( 5 );
Assert.IsTrue( result );
}
[TestMethod]
public async Task GetDefinitions()
{
await SteamInventory.WaitForDefinitions();
Assert.IsNotNull( SteamInventory.Definitions );
foreach ( var def in SteamInventory.Definitions )
{
Console.WriteLine( $"[{def.Id:0000000000}] {def.Name} [{def.Type}]" );
}
}
[TestMethod]
public async Task GetDefinitionsWithPrices()
{
var defs = await SteamInventory.GetDefinitionsWithPricesAsync();
foreach ( var def in defs )
{
Console.WriteLine( $"[{def.Id:0000000000}] {def.Name} [{def.LocalPriceFormatted}]" );
}
}
[TestMethod]
public async Task GetAllItems()
{
await SteamInventory.WaitForDefinitions();
var result = await SteamInventory.GetAllItemsAsync();
Assert.IsTrue( result.HasValue );
Assert.IsTrue( result.Value.ItemCount > 0 );
using ( result )
{
var items = result.Value.GetItems( true );
Assert.IsNotNull( items );
foreach ( var item in items )
{
Console.WriteLine( $"{item.Id} / {item.DefId} / {item.Quantity} / {item.Def?.Name} /[{item.IsNoTrade}|{item.IsRemoved}|{item.IsConsumed}] " );
foreach ( var prop in item.Properties )
{
Console.WriteLine( $" {prop.Key} : {prop.Value}" );
}
}
}
}
[TestMethod]
public async Task GetItemSpecialProperties()
{
await SteamInventory.WaitForDefinitions();
var result = await SteamInventory.GetAllItemsAsync();
Assert.IsTrue( result.HasValue );
Assert.IsTrue( result.Value.ItemCount > 0 );
using ( result )
{
var items = result.Value.GetItems( true );
Assert.IsNotNull( items );
foreach ( var item in items )
{
Console.WriteLine( $"{item.Id} / {item.DefId} / {item.Quantity} / {item.Def?.Name} " );
Console.WriteLine( $" Acquired: {item.Acquired}" );
Console.WriteLine( $" Origin: {item.Origin}" );
}
}
}
[TestMethod]
public async Task GetAllItemsMultipleTimes()
{
await SteamInventory.WaitForDefinitions();
var fresult = await SteamInventory.GetAllItemsAsync();
Assert.IsTrue( fresult.HasValue );
Assert.IsTrue( fresult.Value.ItemCount > 0 );
await Task.Delay( 1000 );
var result = await SteamInventory.GetAllItemsAsync();
Assert.IsTrue( result.HasValue );
Assert.IsTrue( result.Value.GetItems().Length == fresult.Value.ItemCount );
await Task.Delay( 1000 );
result = await SteamInventory.GetAllItemsAsync();
Assert.IsTrue( result.HasValue );
Assert.IsTrue( result.Value.ItemCount == fresult.Value.ItemCount );
}
[TestMethod]
public async Task Items()
{
SteamInventory.GetAllItems();
await SteamInventory.WaitForDefinitions();
while ( SteamInventory.Items == null )
{
await Task.Delay( 10 );
}
Assert.IsNotNull( SteamInventory.Items );
foreach ( var item in SteamInventory.Items )
{
Console.WriteLine( $"{item.Id} / {item.DefId} / {item.Quantity} / {item.Def.Name}" );
}
}
[TestMethod]
public async Task GetExchanges()
{
var result = await SteamInventory.WaitForDefinitions( 5 );
Assert.IsTrue( result );
foreach ( var def in SteamInventory.Definitions )
{
var exchangelist = def.GetRecipes();
if ( exchangelist == null ) continue;
foreach ( var exchange in exchangelist )
{
Assert.AreEqual( exchange.Result, def );
Console.WriteLine( $"{def.Name}:" );
foreach ( var item in exchange.Ingredients )
{
Console.WriteLine( $" {item.Count} x {item.Definition?.Name ?? item.DefinitionId.ToString()}" );
}
Console.WriteLine( $"" );
}
}
}
[TestMethod]
public async Task Serialize()
{
await SteamInventory.WaitForDefinitions();
var result = await SteamInventory.GetAllItemsAsync();
Assert.IsTrue( result.HasValue );
var data = result.Value.Serialize();
Assert.IsNotNull( data );
Console.WriteLine( string.Join( "", data.Select( x => x.ToString( "x" ) ) ) );
}
[TestMethod]
public async Task Deserialize()
{
await SteamInventory.WaitForDefinitions();
byte[] data;
int itemCount;
// Serialize
{
var result = await SteamInventory.GetAllItemsAsync();
Assert.IsTrue( result.HasValue );
itemCount = result.Value.ItemCount;
data = result.Value.Serialize();
Assert.IsNotNull( data );
result.Value.Dispose();
}
await Task.Delay( 2000 );
// Deserialize
{
var result = await SteamInventory.DeserializeAsync( data );
Assert.IsTrue( result.HasValue );
Assert.AreEqual( itemCount, result.Value.ItemCount );
result.Value.Dispose();
}
}
}
}

View File

@ -0,0 +1,163 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Steamworks.Data;
namespace Steamworks
{
[TestClass]
[DeploymentItem( "steam_api64.dll" )]
[DeploymentItem( "steam_api.dll" )]
public partial class NetworkingSocketsTest
{
void DebugOutput( NetDebugOutput type, string text )
{
Console.WriteLine( $"[NET:{type}]\t\t{text}" );
}
[TestMethod]
public async Task CreateRelayServer()
{
SteamNetworkingUtils.DebugLevel = NetDebugOutput.Everything;
SteamNetworkingUtils.OnDebugOutput += DebugOutput;
var si = SteamNetworkingSockets.CreateRelaySocket<TestSocketInterface>();
Console.WriteLine( $"Created Socket: {si}" );
// Give it a second for something to happen
await Task.Delay( 1000 );
si.Close();
}
[TestMethod]
public async Task CreateNormalServer()
{
SteamNetworkingUtils.DebugLevel = NetDebugOutput.Everything;
SteamNetworkingUtils.OnDebugOutput += DebugOutput;
var si = SteamNetworkingSockets.CreateNormalSocket<TestSocketInterface>( Data.NetAddress.AnyIp( 21893 ) );
Console.WriteLine( $"Created Socket: {si}" );
// Give it a second for something to happen
await Task.Delay( 1000 );
si.Close();
}
[TestMethod]
public async Task CreateRelayServerFakeIP()
{
SteamNetworkingUtils.DebugLevel = NetDebugOutput.Everything;
SteamNetworkingUtils.OnDebugOutput += DebugOutput;
var si = SteamNetworkingSockets.CreateRelaySocketFakeIP<TestSocketInterface>();
Console.WriteLine( $"Created Socket: {si}" );
// Give it a second for something to happen
await Task.Delay( 1000 );
si.Close();
}
[TestMethod]
public async Task RelayEndtoEnd()
{
SteamNetworkingUtils.InitRelayNetworkAccess();
SteamNetworkingUtils.DebugLevel = NetDebugOutput.Warning;
SteamNetworkingUtils.OnDebugOutput += DebugOutput;
// For some reason giving steam a couple of seconds here
// seems to prevent it returning null connections from ConnectNormal
await Task.Delay( 2000 );
Console.WriteLine( $"----- Creating Socket Relay Socket.." );
var socket = SteamNetworkingSockets.CreateRelaySocket<TestSocketInterface>( 6 );
var server = socket.RunAsync();
await Task.Delay( 1000 );
Console.WriteLine( $"----- Connecting To Socket via SteamId ({SteamClient.SteamId})" );
var connection = SteamNetworkingSockets.ConnectRelay<TestConnectionInterface>( SteamClient.SteamId, 6 );
var client = connection.RunAsync();
await Task.WhenAll( server, client );
}
[TestMethod]
public async Task NormalEndtoEnd()
{
SteamNetworkingUtils.DebugLevel = NetDebugOutput.Everything;
SteamNetworkingUtils.OnDebugOutput += DebugOutput;
// For some reason giving steam a couple of seconds here
// seems to prevent it returning null connections from ConnectNormal
await Task.Delay( 2000 );
//
// Start the server
//
Console.WriteLine( "CreateNormalSocket" );
var socket = SteamNetworkingSockets.CreateNormalSocket<TestSocketInterface>( NetAddress.AnyIp( 12445 ) );
var server = socket.RunAsync();
//
// Start the client
//
Console.WriteLine( "ConnectNormal" );
var connection = SteamNetworkingSockets.ConnectNormal<TestConnectionInterface>( NetAddress.From( "127.0.0.1", 12445 ) );
var client = connection.RunAsync();
await Task.WhenAll( server, client );
}
[TestMethod]
public async Task RelayEndtoEndFakeIP()
{
SteamNetworkingUtils.InitRelayNetworkAccess();
SteamNetworkingUtils.DebugLevel = NetDebugOutput.Warning;
SteamNetworkingUtils.OnDebugOutput += DebugOutput;
// For some reason giving steam a couple of seconds here
// seems to prevent it returning null connections from ConnectNormal
await Task.Delay( 2000 );
Console.WriteLine( $"----- Creating Socket Relay Socket.." );
var socket = SteamNetworkingSockets.CreateRelaySocketFakeIP<TestSocketInterface>();
var server = socket.RunAsync();
await Task.Delay( 1000 );
Console.WriteLine( $"----- Retrieving Fake IP.." );
SteamNetworkingSockets.GetFakeIP( 0, out NetAddress address );
Console.WriteLine( $"----- Connecting To Socket via Fake IP ({address})" );
var connection = SteamNetworkingSockets.ConnectNormal<TestConnectionInterface>( address );
var client = connection.RunAsync();
await Task.WhenAll( server, client );
}
[TestMethod]
public void NetAddressTest()
{
{
var n = NetAddress.From( "127.0.0.1", 12445 );
Assert.AreEqual( n.ToString(), "127.0.0.1:12445" );
}
{
var n = NetAddress.AnyIp( 5543 );
Assert.AreEqual( n.ToString(), "[::]:5543" );
}
}
}
}

View File

@ -0,0 +1,130 @@
using System;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Steamworks.Data;
namespace Steamworks
{
public partial class NetworkingSocketsTest
{
private class TestConnectionInterface : ConnectionManager
{
public override void OnConnectionChanged( ConnectionInfo data )
{
Console.WriteLine( $"[Connection][{Connection}] [{data.State}]" );
base.OnConnectionChanged( data );
}
public override void OnConnecting( ConnectionInfo data )
{
Console.WriteLine( $" - OnConnecting" );
base.OnConnecting( data );
}
/// <summary>
/// Client is connected. They move from connecting to Connections
/// </summary>
public override void OnConnected( ConnectionInfo data )
{
Console.WriteLine( $" - OnConnected" );
base.OnConnected( data );
}
/// <summary>
/// The connection has been closed remotely or disconnected locally. Check data.State for details.
/// </summary>
public override void OnDisconnected( ConnectionInfo data )
{
Console.WriteLine( $" - OnDisconnected" );
base.OnDisconnected( data );
}
internal async Task RunAsync()
{
Console.WriteLine( "[Connection] RunAsync" );
var sw = System.Diagnostics.Stopwatch.StartNew();
Console.WriteLine( "[Connection] Connecting" );
while ( Connecting )
{
await Task.Delay( 10 );
if ( sw.Elapsed.TotalSeconds > 10 )
break;
}
if ( !Connected )
{
Console.WriteLine( "[Connection] Couldn't connect!" );
Console.WriteLine( Connection.DetailedStatus() );
return;
}
Console.WriteLine( "[Connection] Hey We're Connected!" );
sw = System.Diagnostics.Stopwatch.StartNew();
while ( Connected )
{
Receive();
await Task.Delay( 100 );
if ( sw.Elapsed.TotalSeconds > 30 )
{
Assert.Fail( "Client Took Too Long" );
break;
}
}
}
public override unsafe void OnMessage( IntPtr data, int size, long messageNum, long recvTime, int channel )
{
// We're only sending strings, so it's fine to read this like this
var str = Utility.Utf8NoBom.GetString( (byte*) data, size );
Console.WriteLine( $"[Connection][{messageNum}][{recvTime}][{channel}] \"{str}\"" );
if ( str.Contains( "Hello" ) )
{
Console.WriteLine( $"[Connection][{messageNum}][{recvTime}][{channel}] Sending: Hello, How are you!?" );
Connection.SendMessage( "Hello, How are you!?" );
Console.WriteLine( $"[Connection][{messageNum}][{recvTime}][{channel}] Sending: How do you like 20 messages in a row?" );
Connection.SendMessage( "How do you like 20 messages in a row?" );
var connections = new[] { Connection };
var results = new Result[1];
for ( int i=0; i<20; i++ )
{
Console.WriteLine( $"[Connection][{messageNum}][{recvTime}][{channel}] Sending: BLAMMO {i}!" );
SendMessages( connections, connections.Length, $"BLAMMO {i}!", results: results );
Assert.AreEqual( Result.OK, results[0] );
}
Connection.Flush();
}
if ( str.Contains( "status" ))
{
Console.WriteLine( Connection.DetailedStatus() );
}
if ( str.Contains( "how about yourself" ) )
{
Connection.SendMessage( "I'm great, but I have to go now, bye." );
}
if ( str.Contains( "hater" ) )
{
Close();
}
}
}
}
}

View File

@ -0,0 +1,137 @@
using System;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Steamworks.Data;
namespace Steamworks
{
public partial class NetworkingSocketsTest
{
private class TestSocketInterface : SocketManager
{
public bool HasFinished = false;
public override void OnConnectionChanged( Connection connection, ConnectionInfo data )
{
Console.WriteLine( $"[Socket{Socket}][connection:{connection}][data.Identity:{data.Identity}] [data.State:{data.State}]" );
base.OnConnectionChanged( connection, data );
}
public override void OnConnecting( Connection connection, ConnectionInfo data )
{
Console.WriteLine( $" - OnConnecting" );
base.OnConnecting( connection, data );
}
/// <summary>
/// Client is connected. They move from connecting to Connections
/// </summary>
public override void OnConnected( Connection connection, ConnectionInfo data )
{
Console.WriteLine( $"" );
Console.WriteLine( $"Socket -> OnConnected:" );
Console.WriteLine( $" data.Address: {data.Address}" );
Console.WriteLine( $" data.Identity: {data.Identity}" );
Console.WriteLine( $" data.Identity.Steamid: {data.Identity.SteamId}" );
Console.WriteLine( $" data.Identity.IsIpAddress: {data.Identity.IsIpAddress}" );
Console.WriteLine( $" data.Identity.IsLocalHost: {data.Identity.IsLocalHost}" );
Console.WriteLine( $" data.Identity.IsSteamId: {data.Identity.IsSteamId}" );
Console.WriteLine( $" data.Identity.Address: {data.Identity.Address}" );
Console.WriteLine( $" data.Identity.Address.Address: {data.Identity.Address.Address}" );
Console.WriteLine( $" data.Identity.Address.Port: {data.Identity.Address.Port}" );
Console.WriteLine( $"" );
base.OnConnected( connection, data );
}
/// <summary>
/// The connection has been closed remotely or disconnected locally. Check data.State for details.
/// </summary>
public override void OnDisconnected( Connection connection, ConnectionInfo data )
{
Console.WriteLine( $" - OnDisconnected" );
base.OnDisconnected( connection, data );
}
internal async Task RunAsync()
{
var sw = System.Diagnostics.Stopwatch.StartNew();
while ( Connected.Count == 0 )
{
await Task.Delay( 10 );
if ( sw.Elapsed.TotalSeconds > 10 )
{
Assert.Fail( "Client Took Too Long To Connect" );
break;
}
}
await Task.Delay( 1000 );
var singleClient = Connected.First();
singleClient.SendMessage( "Hey?" );
await Task.Delay( 100 );
singleClient.SendMessage( "Anyone?" );
await Task.Delay( 100 );
singleClient.SendMessage( "What's this?" );
await Task.Delay( 100 );
singleClient.SendMessage( "What's your status?" );
await Task.Delay( 10 );
singleClient.SendMessage( "Greetings!!??" );
await Task.Delay( 100 );
singleClient.SendMessage( "Hello Client!?" );
sw = System.Diagnostics.Stopwatch.StartNew();
Console.WriteLine( $"Socket: Listening" );
while ( Connected.Contains( singleClient ) )
{
Receive();
await Task.Delay( 100 );
if ( sw.Elapsed.TotalSeconds > 30 )
{
Console.WriteLine( "Socket: This all took too long - throwing an exception" );
Assert.Fail( "Socket Took Too Long" );
break;
}
}
Console.WriteLine( $"Socket: Closing connection because {Connected.Count()} Connected" );
await Task.Delay( 1000 );
Close();
}
public override unsafe void OnMessage( Connection connection, NetIdentity identity, IntPtr data, int size, long messageNum, long recvTime, int channel )
{
// We're only sending strings, so it's fine to read this like this
var str = Utility.Utf8NoBom.GetString( (byte*)data, size );
Console.WriteLine( $"[SOCKET][{connection}[{identity}][{messageNum}][{recvTime}][{channel}] \"{str}\"" );
if ( str.Contains( "Hello, How are you" ) )
{
connection.SendMessage( "I'm great thanks, how about yourself?" );
}
if ( str.Contains( "bye" ) )
{
connection.SendMessage( "See you later, hater." );
connection.Flush();
connection.Close( true, 10, "Said Bye" );
}
}
}
}
}

View File

@ -0,0 +1,63 @@
using System;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace Steamworks
{
[TestClass]
[DeploymentItem( "steam_api64.dll" )]
[DeploymentItem( "steam_api.dll" )]
public class NetworkUtilsTest
{
static string GarrysLocation = "lhr=4+0,ams=13+1/10+0,par=17+1/12+0,lux=17+1,fra=18+1/18+0,sto=25+2,sto2=26+2,mad=27+2,vie=31+3/30+0,iad=90+9/75+0,sgp=173+17/174+17,gru=200+20/219+0";
[TestMethod]
public async Task LocalPingLocation()
{
await SteamNetworkingUtils.WaitForPingDataAsync();
for ( int i = 0; i < 10; i++ )
{
var pl = SteamNetworkingUtils.LocalPingLocation;
if ( !pl.HasValue )
{
await Task.Delay( 1000 );
continue;
}
Console.WriteLine( $"{i} Seconds Until Result: {pl}" );
return;
}
Assert.Fail();
}
[TestMethod]
public void PingLocationParse()
{
var pl = Data.NetPingLocation.TryParseFromString( GarrysLocation );
Assert.IsTrue( pl.HasValue );
Console.WriteLine( $"Parsed OKAY! {pl}" );
}
[TestMethod]
public async Task GetEstimatedPing()
{
await SteamNetworkingUtils.WaitForPingDataAsync();
var garrysping = Data.NetPingLocation.TryParseFromString( GarrysLocation );
Assert.IsTrue( garrysping.HasValue );
var ping = SteamNetworkingUtils.EstimatePingTo( garrysping.Value );
Assert.IsTrue( ping > 0 );
Console.WriteLine( $"Ping returned: {ping}" );
}
}
}

View File

@ -0,0 +1,30 @@
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace Steamworks
{
[TestClass]
[DeploymentItem( "steam_api64.dll" )]
[DeploymentItem( "steam_api.dll" )]
public class RemotePlayTest
{
[TestMethod]
public void BasicUsability()
{
Console.WriteLine( $"Sessions: {SteamRemotePlay.SessionCount}" );
var session = SteamRemotePlay.GetSession( 4 );
Assert.IsFalse( session.IsValid );
Assert.IsFalse( session.SteamId.IsValid );
}
}
}

View File

@ -0,0 +1,79 @@
using System;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Steamworks.Data;
namespace Steamworks
{
[TestClass]
[DeploymentItem( "steam_api64.dll" )]
[DeploymentItem( "steam_api.dll" )]
public class RemoteStorageTest
{
[TestMethod]
public void Quotas()
{
Console.WriteLine( $"SteamRemoteStorage.QuotaBytes: {SteamRemoteStorage.QuotaBytes}" );
Console.WriteLine( $"SteamRemoteStorage.QuotaRemainingBytes: {SteamRemoteStorage.QuotaRemainingBytes}" );
Console.WriteLine( $"SteamRemoteStorage.QuotaUsedBytes: {SteamRemoteStorage.QuotaUsedBytes}" );
}
[TestMethod]
public void IsCloudEnabled()
{
Console.WriteLine( $"SteamRemoteStorage.IsCloudEnabled: {SteamRemoteStorage.IsCloudEnabled}" );
Console.WriteLine( $"SteamRemoteStorage.IsCloudEnabledForAccount: {SteamRemoteStorage.IsCloudEnabledForAccount}" );
Console.WriteLine( $"SteamRemoteStorage.IsCloudEnabledForApp: {SteamRemoteStorage.IsCloudEnabledForApp}" );
}
[TestMethod]
public void FileWrite()
{
var rand = new Random();
var testFile = new byte[1024 * 1024 * 100];
for( int i=0; i< testFile.Length; i++ )
{
testFile[i] = (byte) i;
}
var written = SteamRemoteStorage.FileWrite( "testfile", testFile );
Assert.IsTrue( written );
Assert.IsTrue( SteamRemoteStorage.FileExists( "testfile" ) );
Assert.AreEqual( SteamRemoteStorage.FileSize( "testfile" ), testFile.Length );
}
[TestMethod]
public void FileRead()
{
FileWrite();
var data = SteamRemoteStorage.FileRead( "testfile" );
Assert.IsNotNull( data );
for ( int i = 0; i < data.Length; i++ )
{
Assert.AreEqual( data[i], (byte)i );
}
Assert.AreEqual( SteamRemoteStorage.FileSize( "testfile" ), data.Length );
Assert.AreEqual( SteamRemoteStorage.FileSize( "testfile" ), 1024 * 1024 * 100 );
}
[TestMethod]
public void Files()
{
foreach ( var file in SteamRemoteStorage.Files )
{
Console.WriteLine( $"{file} ({SteamRemoteStorage.FileSize(file)} {SteamRemoteStorage.FileTime( file )})" );
}
}
}
}

View File

@ -1,53 +0,0 @@
using System;
using System.Text;
using System.Threading;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Linq;
namespace Facepunch.Steamworks.Test
{
public partial class Server
{
[TestMethod]
public void InventoryDeserialize()
{
using ( var client = new Facepunch.Steamworks.Client( 252490 ) )
{
Assert.IsTrue( client.IsValid );
Assert.IsNull( client.Inventory.SerializedItems );
client.Inventory.Refresh();
//
// Block until we have the items
//
while ( client.Inventory.SerializedItems == null )
{
client.Update();
}
Assert.IsNotNull( client.Inventory.SerializedItems );
Assert.IsTrue( client.Inventory.SerializedItems.Length > 4 );
using ( var server = new Facepunch.Steamworks.Server( 252490, 0, 30002, true, "VersionString" ) )
{
server.LogOnAnonymous();
Assert.IsTrue( server.IsValid );
var result = server.Inventory.Deserialize( client.Inventory.SerializedItems );
Assert.IsTrue( result.Block() );
Assert.IsNotNull( result.Items );
foreach ( var item in result.Items )
{
Console.WriteLine( "Item: {0} ({1})", item.Id, item.DefinitionId );
Console.WriteLine( "Item: {0} ({1})", item.Id, item.DefinitionId );
}
}
}
}
}
}

View File

@ -1,115 +0,0 @@
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace Facepunch.Steamworks.Test
{
[DeploymentItem( Config.LibraryName + ".dll" )]
[DeploymentItem( "steam_appid.txt" )]
[DeploymentItem( "tier0_s.dll" )]
[DeploymentItem( "vstdlib_s.dll" )]
[DeploymentItem( "steamclient.dll" )]
[TestClass]
public partial class Server
{
[TestMethod]
public void Init()
{
using ( var server = new Facepunch.Steamworks.Server( 252490, 30001, 30002, 30003, false, "VersionString" ) )
{
Assert.IsTrue( server.IsValid );
}
}
[TestMethod]
public void AuthCallback()
{
using ( var client = new Facepunch.Steamworks.Client( 252490 ) )
{
Assert.IsTrue( client.IsValid );
var ticket = client.Auth.GetAuthSessionTicket();
var ticketBinary = ticket.Data;
using ( var server = new Facepunch.Steamworks.Server( 252490, 30001, 30002, 30003, true, "VersionString" ) )
{
server.LogOnAnonymous();
Assert.IsTrue( server.IsValid );
var auth = server.Auth;
var Authed = false;
server.Auth.OnAuthChange = ( steamid, ownerid, status ) =>
{
Authed = status == ServerAuth.Status.OK;
Assert.AreEqual( steamid, client.SteamId );
Assert.AreEqual( steamid, ownerid );
Console.WriteLine( "steamid: {0}", steamid );
Console.WriteLine( "ownerid: {0}", ownerid );
Console.WriteLine( "status: {0}", status );
};
for ( int i = 0; i < 16; i++ )
{
System.Threading.Thread.Sleep( 10 );
GC.Collect();
server.Update();
GC.Collect();
client.Update();
GC.Collect();
}
GC.Collect();
if ( !server.Auth.StartSession( ticketBinary, client.SteamId ) )
{
Assert.Fail( "Start Session returned false" );
}
GC.Collect();
//
// Server should receive a ServerAuth.Status.OK
// message via the OnAuthChange callback
//
for ( int i = 0; i< 100; i++ )
{
GC.Collect();
System.Threading.Thread.Sleep( 100 );
GC.Collect();
server.Update();
client.Update();
if ( Authed )
break;
}
Assert.IsTrue( Authed );
//
// Client cancels ticket
//
ticket.Cancel();
//
// Server should receive a ticket cancelled message
//
for ( int i = 0; i < 100; i++ )
{
System.Threading.Thread.Sleep( 100 );
server.Update();
client.Update();
if ( !Authed )
break;
}
Assert.IsTrue( !Authed );
}
}
}
}
}

View File

@ -1,34 +0,0 @@
using System;
using System.Text;
using System.Threading;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace Facepunch.Steamworks.Test
{
public partial class Server
{
[TestMethod]
public void StatsGet()
{
using ( var server = new Facepunch.Steamworks.Server( 252490, 0, 30002, true, "VersionString" ) )
{
Assert.IsTrue( server.IsValid );
server.LogOnAnonymous();
ulong MySteamId = 76561197960279927;
server.Stats.Refresh( MySteamId );
// TODO - Callback on complete
Thread.Sleep( 2000 );
var deaths = server.Stats.GetInt( MySteamId, "deaths", -1 );
Console.WriteLine( "Deaths: {0}", deaths );
Assert.IsTrue( deaths > 0 );
}
}
}
}

View File

@ -0,0 +1,251 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace Steamworks
{
[TestClass]
[DeploymentItem( "steam_api64.dll" )]
[DeploymentItem( "steam_api.dll" )]
public partial class ServerListTest
{
[TestMethod]
public void IpAddressConversions()
{
var ipstr = "185.38.150.40";
var ip = IPAddress.Parse( ipstr );
var ip_int = Utility.IpToInt32( ip );
var ip_back = Utility.Int32ToIp( ip_int );
Console.WriteLine( "ipstr: " + ipstr );
Console.WriteLine( "ip: " + ip );
Console.WriteLine( "ip int: " + ip_int );
Console.WriteLine( "ip_back: " + ip_back );
}
[TestMethod]
public async Task ServerListInternetInterupted()
{
using ( var list = new ServerList.Internet() )
{
var task = list.RunQueryAsync();
await Task.Delay( 1000 );
Console.WriteLine( $"Querying.." );
list.Cancel();
foreach ( var s in list.Responsive )
{
Console.WriteLine( $"{s.Address} {s.Name}" );
}
Console.WriteLine( $"Found {list.Responsive.Count} Responsive Servers" );
Console.WriteLine( $"Found {list.Unresponsive.Count} Unresponsive Servers" );
Console.WriteLine( $"task.IsCompleted {task.IsCompleted}" );
}
}
[TestMethod]
public async Task ServerListInternet()
{
using ( var list = new ServerList.Internet() )
{
var success = await list.RunQueryAsync();
Console.WriteLine( $"success {success}" );
Console.WriteLine( $"Found {list.Responsive.Count} Responsive Servers" );
Console.WriteLine( $"Found {list.Unresponsive.Count} Unresponsive Servers" );
}
}
// Used to reproduce steam serverlist stopping querying after ~10s around august 2023
[TestMethod]
public async Task RustServerListTest()
{
using ( var list = new ServerList.Internet() )
{
list.AddFilter( "secure", "1" );
list.AddFilter( "and", "1" );
list.AddFilter( "gametype", "v2405" );
list.AddFilter( "appid", "252490" );
list.AddFilter( "gamedir", "rust" );
list.AddFilter( "empty", "1" );
var success = await list.RunQueryAsync( 90 );
Console.WriteLine( $"success {success}" );
Console.WriteLine( $"Found {list.Responsive.Count} Responsive Servers" );
Console.WriteLine( $"Found {list.Unresponsive.Count} Unresponsive Servers" );
}
}
[TestMethod]
public async Task SourceQuery()
{
using ( var list = new ServerList.Internet() )
{
var task = list.RunQueryAsync();
await Task.Delay( 1000 );
list.Cancel();
foreach ( var s in list.Responsive.Take( 10 ).ToArray() )
{
Console.WriteLine( $"{s.Name} [{s.Address}]" );
var rules = await s.QueryRulesAsync();
Assert.IsNotNull( rules );
foreach ( var rule in rules )
{
Console.WriteLine( $" {rule.Key} = {rule.Value}" );
}
}
}
}
[TestMethod]
public async Task ServerListLan()
{
using ( var list = new ServerList.LocalNetwork() )
{
var success = await list.RunQueryAsync();
Console.WriteLine( $"success {success}" );
Console.WriteLine( $"Found {list.Responsive.Count} Responsive Servers" );
Console.WriteLine( $"Found {list.Unresponsive.Count} Unresponsive Servers" );
}
}
[TestMethod]
public async Task ServerListFavourites()
{
using ( var list = new ServerList.Favourites() )
{
var success = await list.RunQueryAsync();
Console.WriteLine( $"success {success}" );
Console.WriteLine( $"Found {list.Responsive.Count} Responsive Servers" );
Console.WriteLine( $"Found {list.Unresponsive.Count} Unresponsive Servers" );
}
}
[TestMethod]
public async Task ServerListFriends()
{
using ( var list = new ServerList.Friends() )
{
var success = await list.RunQueryAsync();
Console.WriteLine( $"success {success}" );
Console.WriteLine( $"Found {list.Responsive.Count} Responsive Servers" );
Console.WriteLine( $"Found {list.Unresponsive.Count} Unresponsive Servers" );
}
}
[TestMethod]
public async Task ServerListHistory()
{
using ( var list = new ServerList.History() )
{
var success = await list.RunQueryAsync();
Console.WriteLine( $"success {success}" );
Console.WriteLine( $"Found {list.Responsive.Count} Responsive Servers" );
Console.WriteLine( $"Found {list.Unresponsive.Count} Unresponsive Servers" );
}
}
[TestMethod]
public async Task FilterByMap()
{
using ( var list = new ServerList.Internet() )
{
list.AddFilter( "map", "de_dust" );
var success = await list.RunQueryAsync();
Console.WriteLine( $"success {success}" );
Console.WriteLine( $"Found {list.Responsive.Count} Responsive Servers" );
Console.WriteLine( $"Found {list.Unresponsive.Count} Unresponsive Servers" );
foreach ( var server in list.Responsive )
{
Assert.AreEqual( server.Map.ToLower(), "de_dust" );
Console.WriteLine( $"[{server.Map}] - {server.Name}" );
}
}
}
[TestMethod]
public async Task ServerListIps()
{
var ips = new string[]
{
"31.186.251.76",
"31.186.251.76",
"31.186.251.76",
"31.186.251.76",
"31.186.251.76",
"74.91.119.142",
"74.91.119.142",
"74.91.119.142",
"74.91.119.142",
"74.91.119.142",
"74.91.119.142",
"74.91.119.142",
"74.91.119.142",
"74.91.119.142",
"74.91.119.142",
"74.91.119.142",
"74.91.119.142",
"139.99.144.70",
"139.99.144.70",
"139.99.144.70",
"139.99.144.70",
"139.99.144.70",
"74.91.119.142",
"74.91.119.142",
"74.91.119.142",
"74.91.119.142",
"95.172.92.176",
"95.172.92.176",
"95.172.92.176",
"95.172.92.176",
"95.172.92.176",
"164.132.205.154",
"164.132.205.154",
"164.132.205.154",
"164.132.205.154",
"164.132.205.154",
};
using ( var list = new ServerList.IpList( ips ) )
{
var success = await list.RunQueryAsync();
Console.WriteLine( $"success {success}" );
Console.WriteLine( $"Found {list.Responsive.Count} Responsive Servers" );
Console.WriteLine( $"Found {list.Unresponsive.Count} Unresponsive Servers" );
Assert.AreNotEqual( list.Responsive.Count, 0 );
foreach ( var server in list.Responsive )
{
Console.WriteLine( $"[{server.Address}:{server.ConnectionPort}] - {server.Name}" );
}
}
}
}
}

View File

@ -0,0 +1,106 @@
using System;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Steamworks.Data;
namespace Steamworks
{
[TestClass]
[DeploymentItem( "steam_api64.dll" )]
[DeploymentItem( "steam_api.dll" )]
public class SteamMatchmakingTest
{
[TestMethod]
public async Task LobbyList()
{
await CreateLobby();
var list = await SteamMatchmaking.LobbyList
.RequestAsync();
if ( list == null )
{
Console.WriteLine( "No Lobbies Found!" );
return;
}
foreach ( var lobby in list )
{
Console.WriteLine( $"[{lobby.Id}] owned by {lobby.Owner} ({lobby.MemberCount}/{lobby.MaxMembers})" );
}
}
[TestMethod]
public async Task LobbyListWithAtLeastOne()
{
await CreateLobby();
await LobbyList();
}
[TestMethod]
public async Task CreateLobby()
{
var lobbyr = await SteamMatchmaking.CreateLobbyAsync( 32 );
if ( !lobbyr.HasValue )
{
Assert.Fail();
}
var lobby = lobbyr.Value;
lobby.SetPublic();
lobby.SetData( "gametype", "sausage" );
lobby.SetData( "dicks", "unlicked" );
Console.WriteLine( $"lobby: {lobby.Id}" );
foreach ( var entry in lobby.Data )
{
Console.WriteLine( $" - {entry.Key} {entry.Value}" );
}
Console.WriteLine( $"members: {lobby.MemberCount}/{lobby.MaxMembers}" );
Console.WriteLine( $"Owner: {lobby.Owner}" );
Console.WriteLine( $"Owner Is Local Player: {lobby.Owner.IsMe}" );
lobby.SendChatString( "Hello I Love Lobbies" );
}
[TestMethod]
public async Task LobbyChat()
{
SteamMatchmaking.OnChatMessage += ( lbby, member, message ) =>
{
Console.WriteLine( $"[{lbby}] {member}: {message}" );
};
var lobbyr = await SteamMatchmaking.CreateLobbyAsync( 10 );
if ( !lobbyr.HasValue )
Assert.Fail();
var lobby = lobbyr.Value;
lobby.SetPublic();
lobby.SetData( "name", "Dave's Chat Room" );
Console.WriteLine( $"lobby: {lobby.Id}" );
lobby.SendChatString( "Hello Friends, It's me - your big fat daddy" );
await Task.Delay( 50 );
lobby.SendChatString( "What? No love for daddy?" );
await Task.Delay( 500 );
lobby.SendChatString( "Okay I will LEAVE" );
lobby.SendChatString( "BYE FOREVER" );
await Task.Delay( 1000 );
lobby.Leave();
}
}
}

View File

@ -0,0 +1,37 @@
using System;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Steamworks.Data;
namespace Steamworks
{
[TestClass]
[DeploymentItem( "steam_api64.dll" )]
[DeploymentItem( "steam_api.dll" )]
public class SteamNetworkingTest
{
[TestMethod]
public async Task SendP2PPacket()
{
var sent = SteamNetworking.SendP2PPacket( SteamClient.SteamId, new byte[] { 1, 2, 3 } );
Assert.IsTrue( sent );
while ( !SteamNetworking.IsP2PPacketAvailable() )
{
await Task.Delay( 10 );
}
var packet = SteamNetworking.ReadP2PPacket();
Assert.IsTrue( packet.HasValue );
Assert.AreEqual( packet.Value.SteamId, SteamClient.SteamId );
Assert.AreEqual( packet.Value.Data[1], 2 );
Assert.AreEqual( packet.Value.Data.Length, 3 );
}
}
}

View File

@ -0,0 +1,183 @@
using System;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Steamworks.Data;
namespace Steamworks
{
[TestClass]
[DeploymentItem( "steam_api64.dll" )]
[DeploymentItem( "steam_api.dll" )]
public class UgcEditor
{
[TestMethod]
public async Task CreateFile()
{
var result = await Ugc.Editor.NewCommunityFile
.WithTitle( "Unit Test Created Item" )
.WithDescription( "This item was created by Facepunch Steamworks unit tests.\n\n" +
"It should have technically been deleted so you should never get to " +
"read this unless something terrible has happened." )
.WithTag( "Arsehole" )
.WithTag( "Spiteful" )
.WithTag( "Fat-Head" )
.SubmitAsync();
Assert.IsTrue( result.Success );
Assert.AreNotEqual( result.FileId.Value, 0 );
var deleted = await SteamUGC.DeleteFileAsync( result.FileId );
Assert.IsTrue( deleted );
}
[TestMethod]
public async Task CreateChineseFile()
{
string fileName = "这是我的项目";
string description = "此项目由Facepunch Steamworks单元测试创建";
var result = await Ugc.Editor.NewCommunityFile
.WithTitle( fileName )
.WithDescription( description )
.WithTag( "Arsehole" )
.WithTag( "Spiteful" )
.WithTag( "Fat-Head" )
.SubmitAsync();
Console.WriteLine( $"Title: {fileName}" );
Console.WriteLine( $"Description: {description}" );
Assert.IsTrue( result.Success );
Assert.AreNotEqual( result.FileId.Value, 0 );
var file = await Steamworks.SteamUGC.QueryFileAsync( result.FileId );
Console.WriteLine( $"FileId: {result.FileId}" );
Console.WriteLine( $"Title: {file.Value.Title}" );
Console.WriteLine( $"Description: {file.Value.Description}" );
Assert.AreEqual( file.Value.Title, fileName );
Assert.AreEqual( file.Value.Description, description );
var deleted = await SteamUGC.DeleteFileAsync( result.FileId );
Assert.IsTrue( deleted );
}
class ProgressBar : IProgress<float>
{
float Value = 0;
public void Report( float value )
{
if ( Value >= value ) return;
Value = value;
Console.WriteLine( value );
}
}
[TestMethod]
public async Task UploadBigishFile()
{
var created = Ugc.Editor.NewCommunityFile
.WithTitle( "Unit Test Upload Item" )
.WithDescription( "This item was created by Facepunch Steamworks unit tests.\n\n" +
"It should have technically been deleted so you should never get to " +
"read this unless something terrible has happened." )
//.WithTag( "Apple" )
//.WithTag( "Banana" )
;
// Make a folder
var testFolder = new System.IO.DirectoryInfo( "WorkshopUpload" );
if ( !testFolder.Exists ) testFolder.Create();
created = created.WithContent( testFolder.FullName );
// Upload a file of random bytes
var rand = new Random();
var testFile = new byte[1024 * 1024 * 32];
rand.NextBytes( testFile );
System.IO.File.WriteAllBytes( testFolder.FullName + "/testfile1.bin", testFile );
Console.WriteLine( testFolder.FullName );
try
{
var done = await created.SubmitAsync( new ProgressBar() );
Assert.IsTrue( done.Success );
Console.WriteLine( "item.Id: {0}", done.FileId );
var deleted = await SteamUGC.DeleteFileAsync( done.FileId );
Assert.IsTrue( deleted );
}
finally
{
System.IO.File.Delete( testFolder.FullName + "/testfile.bin" );
}
}
[TestMethod]
public async Task CreateAndThenEditFile()
{
PublishedFileId fileid;
//
// Make a file
//
{
var result = await Ugc.Editor.NewCommunityFile
.WithTitle( "Unedited File" )
.SubmitAsync();
Assert.IsTrue( result.Success );
Assert.AreNotEqual( result.FileId.Value, 0 );
fileid = result.FileId;
}
await Task.Delay( 1000 );
//
// Edit it
//
{
var editor = new Ugc.Editor( fileid );
editor = editor.WithTitle( "An Edited File" );
var result = await editor.SubmitAsync();
Assert.IsTrue( result.Success );
Assert.AreEqual( result.FileId, fileid );
}
await Task.Delay( 1000 );
//
// Make sure the edited file matches
//
{
var details = await SteamUGC.QueryFileAsync( fileid ) ?? throw new Exception( "Somethign went wrong" );
Assert.AreEqual( details.Id, fileid );
Assert.AreEqual( details.Title, "An Edited File" );
}
//
// Clean up
//
var deleted = await SteamUGC.DeleteFileAsync( fileid );
Assert.IsTrue( deleted );
}
}
}

View File

@ -0,0 +1,131 @@
using System;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Steamworks.Data;
namespace Steamworks
{
[TestClass]
[DeploymentItem( "steam_api64.dll" )]
[DeploymentItem( "steam_api.dll" )]
public class UgcQueryTests
{
[TestMethod]
public async Task QueryAll()
{
var q = Ugc.Query.All;
var result = await q.GetPageAsync( 1 );
Assert.IsNotNull( result );
Console.WriteLine( $"ResultCount: {result?.ResultCount}" );
Console.WriteLine( $"TotalCount: {result?.TotalCount}" );
}
[TestMethod]
public async Task QueryWithTags()
{
var q = Ugc.Query.All
.WithTag( "Version3" )
.WithTag( "Hunting Bow" )
.MatchAllTags();
var result = await q.GetPageAsync( 1 );
Assert.IsNotNull( result );
Assert.IsTrue( result?.ResultCount > 0 );
Console.WriteLine( $"ResultCount: {result?.ResultCount}" );
Console.WriteLine( $"TotalCount: {result?.TotalCount}" );
foreach ( var entry in result.Value.Entries )
{
Assert.IsTrue( entry.HasTag( "Version3" ), "Has Tag Version3" );
Assert.IsTrue( entry.HasTag( "Hunting Bow" ), "Has Tag HuntingBow" );
}
}
[TestMethod]
public async Task QueryAllFromFriends()
{
var q = Ugc.Query.All
.CreatedByFriends();
var result = await q.GetPageAsync( 1 );
Assert.IsNotNull( result );
Console.WriteLine( $"ResultCount: {result?.ResultCount}" );
Console.WriteLine( $"TotalCount: {result?.TotalCount}" );
foreach ( var entry in result.Value.Entries )
{
Console.WriteLine( $" {entry.Title}" );
}
}
[TestMethod]
public async Task QueryUserOwn()
{
var q = Ugc.Query.All
.WhereUserPublished();
var result = await q.GetPageAsync( 1 );
Assert.IsNotNull( result );
Console.WriteLine( $"ResultCount: {result?.ResultCount}" );
Console.WriteLine( $"TotalCount: {result?.TotalCount}" );
foreach ( var entry in result.Value.Entries )
{
Console.WriteLine( $" {entry.Title}" );
}
}
[TestMethod]
public async Task QueryGarry()
{
var q = Ugc.Query.All
.WhereUserPublished( 76561197960279927 );
var result = await q.GetPageAsync( 1 );
Assert.IsNotNull( result );
Assert.IsTrue( result?.ResultCount > 0 );
Console.WriteLine( $"ResultCount: {result?.ResultCount}" );
Console.WriteLine( $"TotalCount: {result?.TotalCount}" );
foreach ( var entry in result.Value.Entries )
{
Console.WriteLine( $" {entry.Title}" );
}
}
[TestMethod]
public async Task QuerySpecificFile()
{
var item = await SteamUGC.QueryFileAsync( 1734427277 );
Assert.IsTrue( item.HasValue );
Assert.IsNotNull( item.Value.Title );
Console.WriteLine( $"Title: {item?.Title}" );
Console.WriteLine( $"Desc: {item?.Description}" );
Console.WriteLine( $"Tags: {string.Join( ",", item?.Tags )}" );
Console.WriteLine( $"Author: {item?.Owner.Name} [{item?.Owner.Id}]" );
Console.WriteLine( $"PreviewImageUrl: {item?.PreviewImageUrl}" );
Console.WriteLine( $"NumComments: {item?.NumComments}" );
Console.WriteLine( $"Url: {item?.Url}" );
Console.WriteLine( $"Directory: {item?.Directory}" );
Console.WriteLine( $"IsInstalled: {item?.IsInstalled}" );
Console.WriteLine( $"IsAcceptedForUse: {item?.IsAcceptedForUse}" );
Console.WriteLine( $"IsPublic: {item?.IsPublic}" );
Console.WriteLine( $"Created: {item?.Created}" );
Console.WriteLine( $"Updated: {item?.Updated}" );
Console.WriteLine( $"Score: {item?.Score}" );
}
}
}

View File

@ -0,0 +1,41 @@
using System;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Steamworks.Data;
namespace Steamworks
{
[TestClass]
[DeploymentItem( "steam_api64.dll" )]
[DeploymentItem( "steam_api.dll" )]
public class UgcTest
{
[TestMethod]
public void Download()
{
SteamUGC.Download( 1717844711 );
}
[TestMethod]
public async Task GetInformation()
{
var itemInfo = await Ugc.Item.GetAsync( 1720164672 );
Assert.IsTrue( itemInfo.HasValue );
Console.WriteLine( $"Title: {itemInfo?.Title}" );
Console.WriteLine( $"IsInstalled: {itemInfo?.IsInstalled}" );
Console.WriteLine( $"IsDownloading: {itemInfo?.IsDownloading}" );
Console.WriteLine( $"IsDownloadPending: {itemInfo?.IsDownloadPending}" );
Console.WriteLine( $"IsSubscribed: {itemInfo?.IsSubscribed}" );
Console.WriteLine( $"NeedsUpdate: {itemInfo?.NeedsUpdate}" );
Console.WriteLine( $"Description: {itemInfo?.Description}" );
Console.WriteLine( $"Owner: {itemInfo?.Owner}" );
Console.WriteLine( $"Score: {itemInfo?.Score}" );
Console.WriteLine( $"PreviewImageUrl: {itemInfo?.PreviewImageUrl}" );
}
}
}

View File

@ -0,0 +1,222 @@
using System;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Steamworks.Data;
namespace Steamworks
{
[TestClass]
[DeploymentItem( "steam_api64.dll" )]
[DeploymentItem( "steam_api.dll" )]
public class UserStatsTest
{
[TestMethod]
public async Task AchievementList()
{
foreach ( var a in SteamUserStats.Achievements )
{
Console.WriteLine( $"{a.Identifier}" );
Console.WriteLine( $" a.State: {a.State}" );
Console.WriteLine( $" a.UnlockTime: {a.UnlockTime}" );
Console.WriteLine( $" a.Name: {a.Name}" );
Console.WriteLine( $" a.Description: {a.Description}" );
Console.WriteLine( $" a.GlobalUnlocked: {a.GlobalUnlocked}" );
var icon = await a.GetIconAsync();
Console.WriteLine( $" a.Icon: {icon}" );
}
}
[TestMethod]
public async Task PlayerCountAsync()
{
var players = await SteamUserStats.PlayerCountAsync();
Assert.AreNotEqual( players, -1 );
Console.WriteLine( $"players: {players}" );
}
public async Task StoreStats()
{
var result = Result.NotSettled;
SteamUserStats.OnUserStatsStored += ( r ) =>
{
result = r;
};
SteamUserStats.StoreStats();
while ( result == Result.NotSettled )
{
await Task.Delay( 10 );
}
Assert.AreEqual( result, Result.OK );
}
[TestMethod]
public async Task CreateLeaderboard()
{
var leaderboard = await SteamUserStats.FindOrCreateLeaderboardAsync( "Testleaderboard", Data.LeaderboardSort.Ascending, Data.LeaderboardDisplay.Numeric );
Assert.IsTrue( leaderboard.HasValue );
}
[TestMethod]
public async Task FindLeaderboard()
{
var leaderboard = await SteamUserStats.FindLeaderboardAsync( "Testleaderboard" );
Assert.IsTrue( leaderboard.HasValue );
}
[TestMethod]
public async Task SubmitScore()
{
var leaderboard = await SteamUserStats.FindLeaderboardAsync( "Testleaderboard" );
Assert.IsTrue( leaderboard.HasValue );
var result = await leaderboard.Value.SubmitScoreAsync( 576 );
Assert.IsTrue( result.HasValue );
Console.WriteLine( $"result.Changed: {result?.Changed}" );
Console.WriteLine( $"result.OldGlobalRank: {result?.OldGlobalRank}" );
Console.WriteLine( $"result.NewGlobalRank: {result?.NewGlobalRank}" );
Console.WriteLine( $"result.RankChange: {result?.RankChange}" );
Console.WriteLine( $"result.Score: {result?.Score}" );
}
[TestMethod]
public async Task ReplaceScore()
{
var leaderboard = await SteamUserStats.FindLeaderboardAsync( "Testleaderboard" );
Assert.IsTrue( leaderboard.HasValue );
var result = await leaderboard.Value.ReplaceScore( 576 );
Assert.IsTrue( result.HasValue );
Console.WriteLine( $"result.Changed: {result?.Changed}" );
Console.WriteLine( $"result.OldGlobalRank: {result?.OldGlobalRank}" );
Console.WriteLine( $"result.NewGlobalRank: {result?.NewGlobalRank}" );
Console.WriteLine( $"result.RankChange: {result?.RankChange}" );
Console.WriteLine( $"result.Score: {result?.Score}" );
}
[TestMethod]
public async Task GetScoresFromFriends()
{
var leaderboard = await SteamUserStats.FindLeaderboardAsync( "Testleaderboard" );
var friendScores = await leaderboard.Value.GetScoresFromFriendsAsync();
foreach ( var e in friendScores )
{
Console.WriteLine( $"{e.GlobalRank}: {e.Score} {e.User}" );
}
}
[TestMethod]
public async Task GetScoresAroundUserAsync()
{
var leaderboard = await SteamUserStats.FindLeaderboardAsync( "Testleaderboard" );
Assert.IsTrue( leaderboard.HasValue );
for ( int i = 1; i < 10; i++ )
{
// Get entries around user
var relativeScores = await leaderboard.Value.GetScoresAroundUserAsync( -i, i );
Assert.IsNotNull( relativeScores );
Console.WriteLine( $"" );
Console.WriteLine( $"Relative Scores:" );
foreach ( var e in relativeScores )
{
Console.WriteLine( $"{e.GlobalRank}: {e.Score} {e.User}" );
}
}
}
[TestMethod]
public async Task GetScoresAsync()
{
var leaderboard = await SteamUserStats.FindLeaderboardAsync( "Testleaderboard" );
Assert.IsTrue( leaderboard.HasValue );
// Get top 20 global scores
var globalsScores = await leaderboard.Value.GetScoresAsync( 20 );
Assert.IsNotNull( globalsScores );
Console.WriteLine( $"" );
Console.WriteLine( $"Global Scores:" );
foreach ( var e in globalsScores )
{
Console.WriteLine( $"{e.GlobalRank}: {e.Score} {e.User}" );
}
}
[TestMethod]
public void GetStatInt()
{
var deaths = new Stat( "deaths" );
Console.WriteLine( $"{deaths.Name} {deaths.GetInt()} times" );
Console.WriteLine( $"{deaths.Name} {deaths.GetFloat()} times" );
Assert.AreNotEqual( 0, deaths.GetInt() );
}
[TestMethod]
public async Task GetFriendStats()
{
var friend = new Friend( 76561197965732579 ); // Hezzy
// Download stats
var status = await friend.RequestUserStatsAsync();
Assert.AreNotEqual( false, status );
var deaths = friend.GetStatInt( "deaths" );
Console.WriteLine( $"Hezzy has died {deaths} times" );
Assert.AreNotEqual( 0, deaths );
var unlocked = friend.GetAchievement( "COLLECT_100_WOOD" );
Assert.AreNotEqual( false, unlocked );
var when = friend.GetAchievementUnlockTime( "COLLECT_100_WOOD" );
Assert.AreNotEqual( when, DateTime.MinValue );
Console.WriteLine( $"Hezzy unlocked COLLECT_100_WOOD {when}" );
}
[TestMethod]
public async Task GetStatGlobalInt()
{
var deaths = new Stat( "deaths" );
await deaths.GetGlobalIntDaysAsync( 5 );
var totalStartups = deaths.GetGlobalInt();
Assert.AreNotEqual( 0, totalStartups );
Console.WriteLine( $"Rust has had {totalStartups} deaths" );
}
[TestMethod]
public async Task GetStatGlobalHistoryInt()
{
var deaths = new Stat( "deaths" );
var history = await deaths.GetGlobalIntDaysAsync( 10 );
Assert.AreNotEqual( 0, history.Length );
for ( int i=0; i< history.Length; i++ )
{
Console.WriteLine( $"{i} : {history[i]}" );
}
}
}
}

View File

@ -0,0 +1,191 @@
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace Steamworks
{
[TestClass]
[DeploymentItem( "steam_api64.dll" )]
[DeploymentItem( "steam_api.dll" )]
public class UserTest
{
[TestMethod]
public void GetVoice()
{
using ( var stream = new MemoryStream() )
{
int compressed = 0;
SteamUser.VoiceRecord = true;
var sw = Stopwatch.StartNew();
while ( sw.Elapsed.TotalSeconds < 3 )
{
System.Threading.Thread.Sleep( 10 );
compressed += SteamUser.ReadVoiceData( stream );
}
Assert.AreEqual( compressed, stream.Length );
Console.WriteLine( $"compressed: {compressed}", compressed );
Console.WriteLine( $"stream.Length: {stream.Length}", stream.Length );
}
}
[TestMethod]
public void OptimalSampleRate()
{
var rate = SteamUser.OptimalSampleRate;
Assert.AreNotEqual( rate, 0 );
Console.WriteLine( $"User.OptimalSampleRate: {SteamUser.OptimalSampleRate}" );
}
[TestMethod]
public void IsLoggedOn()
{
Assert.AreNotEqual( false, SteamClient.IsLoggedOn );
Console.WriteLine( $"User.IsLoggedOn: {SteamClient.IsLoggedOn}" );
}
[TestMethod]
public void SteamID()
{
Assert.AreNotEqual( 0, SteamClient.SteamId.Value );
Console.WriteLine( $"User.SteamID: {SteamClient.SteamId.Value}" );
}
[TestMethod]
public void AuthSession()
{
var ticket = SteamUser.GetAuthSessionTicket( SteamClient.SteamId );
Assert.AreNotEqual( 0, ticket.Handle );
Assert.AreNotEqual( 0, ticket.Data.Length );
Console.WriteLine( $"ticket.Handle: {ticket.Handle}" );
Console.WriteLine( $"ticket.Data: { string.Join( "", ticket.Data.Select( x => x.ToString( "x" ) ) ) }" );
var result = SteamUser.BeginAuthSession( ticket.Data, SteamClient.SteamId );
Console.WriteLine( $"result: { result }" );
Assert.AreEqual( result, BeginAuthResult.OK );
SteamUser.EndAuthSession( SteamClient.SteamId );
}
[TestMethod]
public async Task AuthSessionAsync()
{
var ticket = await SteamUser.GetAuthSessionTicketAsync( SteamClient.SteamId, 5.0 );
Assert.AreNotEqual( 0, ticket.Handle );
Assert.AreNotEqual( 0, ticket.Data.Length );
Console.WriteLine( $"ticket.Handle: {ticket.Handle}" );
Console.WriteLine( $"ticket.Data: { string.Join( "", ticket.Data.Select( x => x.ToString( "x" ) ) ) }" );
}
[TestMethod]
public async Task AuthTicketForWebApiAsync()
{
var ticket = await SteamUser.GetAuthTicketForWebApiAsync( "Test" );
Assert.AreNotEqual( 0, ticket.Handle );
Assert.AreNotEqual( 0, ticket.Data.Length );
Console.WriteLine( $"ticket.Handle: {ticket.Handle}" );
Console.WriteLine( $"ticket.Data: { string.Join( "", ticket.Data.Select( x => x.ToString( "x" ) ) ) }" );
}
[TestMethod]
public void SteamLevel()
{
Assert.AreNotEqual( 0, SteamUser.SteamLevel );
Console.WriteLine( $"User.SteamLevel: {SteamUser.SteamLevel}" );
}
[TestMethod]
public void Name()
{
Console.WriteLine( $"SteamClient.Name: {SteamClient.Name}" );
}
[TestMethod]
public async Task GetStoreAuthUrlAsync()
{
var rustskins = await SteamUser.GetStoreAuthUrlAsync( "https://store.steampowered.com/itemstore/252490/" );
Assert.IsNotNull( rustskins );
Console.WriteLine( $"rustskins: {rustskins}" );
}
[TestMethod]
public void IsPhoneVerified()
{
Console.WriteLine( $"User.IsPhoneVerified: {SteamUser.IsPhoneVerified}" );
}
[TestMethod]
public void IsTwoFactorEnabled()
{
Console.WriteLine( $"User.IsTwoFactorEnabled: {SteamUser.IsTwoFactorEnabled}" );
}
[TestMethod]
public void IsPhoneIdentifying()
{
Console.WriteLine( $"User.IsPhoneIdentifying: {SteamUser.IsPhoneIdentifying}" );
}
[TestMethod]
public void IsPhoneRequiringVerification()
{
Console.WriteLine( $"User.IsPhoneRequiringVerification: {SteamUser.IsPhoneRequiringVerification}" );
}
[TestMethod]
public async Task RequestEncryptedAppTicketAsyncWithData()
{
for ( int i=0; i<10; i++ )
{
var data = await SteamUser.RequestEncryptedAppTicketAsync( new byte[] { 0, 1, 2, 3, 4, 5, 6, 7 } );
if ( data == null )
{
Console.WriteLine( $"Attempt {i}: Returned null.. waiting 1 seconds" );
await Task.Delay( 10000 );
continue;
}
Console.WriteLine( $"data: {BitConverter.ToString( data )}" );
return;
}
Assert.Fail();
}
[TestMethod]
public async Task RequestEncryptedAppTicketAsync()
{
for ( int i = 0; i < 6; i++ )
{
var data = await SteamUser.RequestEncryptedAppTicketAsync();
if ( data == null )
{
Console.WriteLine( $"Attempt {i}: Returned null.. waiting 1 seconds" );
await Task.Delay( 10000 );
continue;
}
Console.WriteLine( $"data: {BitConverter.ToString( data )}" );
return;
}
Assert.Fail();
}
}
}

View File

@ -0,0 +1,118 @@
using System;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace Steamworks
{
[TestClass]
[DeploymentItem( "steam_api64.dll" )]
[DeploymentItem( "steam_api.dll" )]
public class UtilsTest
{
[TestMethod]
public void SecondsSinceAppActive()
{
var time = SteamUtils.SecondsSinceAppActive;
Console.WriteLine( $"{time}" );
}
[TestMethod]
public void SecondsSinceComputerActive()
{
var time = SteamUtils.SecondsSinceComputerActive;
Console.WriteLine( $"{time}" );
}
[TestMethod]
public void ConnectedUniverse()
{
var u = SteamUtils.ConnectedUniverse;
Console.WriteLine( $"{u}" );
}
[TestMethod]
public void SteamServerTime()
{
var time = SteamUtils.SteamServerTime;
Console.WriteLine( $"{time}" );
}
[TestMethod]
public void IpCountry()
{
var cnt = SteamUtils.IpCountry;
Console.WriteLine( $"{cnt}" );
}
[TestMethod]
public void UsingBatteryPower()
{
var cnt = SteamUtils.UsingBatteryPower;
Console.WriteLine( $"{cnt}" );
}
[TestMethod]
public void CurrentBatteryPower()
{
var cnt = SteamUtils.CurrentBatteryPower;
Console.WriteLine( $"{cnt}" );
}
[TestMethod]
public void AppId()
{
var cnt = SteamClient.AppId;
Assert.IsTrue( cnt.Value > 0 );
Console.WriteLine( $"{cnt.Value}" );
}
[TestMethod]
public void IsOverlayEnabled()
{
var cnt = SteamUtils.IsOverlayEnabled;
Console.WriteLine( $"{cnt}" );
}
[TestMethod]
public async Task CheckFileSignature()
{
var sig = await SteamUtils.CheckFileSignatureAsync( "hl2.exe" );
Console.WriteLine( $"{sig}" );
}
[TestMethod]
public void SteamUILanguage()
{
var cnt = SteamUtils.SteamUILanguage;
Console.WriteLine( $"{cnt}" );
}
[TestMethod]
public void IsSteamRunningInVR()
{
var cnt = SteamUtils.IsSteamRunningInVR;
Console.WriteLine( $"{cnt}" );
}
[TestMethod]
public void IsSteamInBigPictureMode()
{
var cnt = SteamUtils.IsSteamInBigPictureMode;
Console.WriteLine( $"{cnt}" );
}
[TestMethod]
public void VrHeadsetStreaming()
{
var cnt = SteamUtils.VrHeadsetStreaming;
Console.WriteLine( $"{cnt}" );
}
}
}

View File

@ -0,0 +1,74 @@
"In Game Actions"
{
"actions"
{
"InGameControls"
{
"title" "#Set_Ingame"
"StickPadGyro"
{
"Move"
{
"title" "#Action_Move"
"input_mode" "joystick_move"
}
"Camera"
{
"title" "#Action_Camera"
"input_mode" "absolute_mouse"
}
}
"AnalogTrigger"
{
"Throttle" "#Action_Throttle"
}
"Button"
{
"fire" "#Action_Fire"
"Jump" "#Action_Jump"
"pause_menu" "#Action_Menu"
}
}
"MenuControls"
{
"title" "#Set_Menu"
"StickPadGyro"
{
}
"AnalogTrigger"
{
}
"Button"
{
"menu_up" "#Menu_Up"
"menu_down" "#Menu_Down"
"menu_left" "#Menu_Left"
"menu_right" "#Menu_Right"
"menu_select" "#Menu_Select"
"menu_cancel" "#Menu_Cancel"
"pause_menu" "#Action_ReturnToGame"
}
}
}
"localization"
{
"english"
{
"Set_Ingame" "In-Game Controls"
"Set_Menu" "Menu Controls"
"Action_Move" "Movement"
"Action_Camera" "Camera"
"Action_Throttle" "Throttle"
"Action_Fire" "Fire Weapon"
"Action_Jump" "Jump"
"Action_Menu" "Pause Menu"
"Action_ReturnToGame" "Return To Game"
"Menu_Up" "Up"
"Menu_Down" "Down"
"Menu_Left" "Left"
"Menu_Right" "Right"
"Menu_Select" "Select"
"Menu_Cancel" "Cancel"
}
}
}

View File

@ -1 +0,0 @@
252490

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,74 @@
"In Game Actions"
{
"actions"
{
"InGameControls"
{
"title" "#Set_Ingame"
"StickPadGyro"
{
"Move"
{
"title" "#Action_Move"
"input_mode" "joystick_move"
}
"Camera"
{
"title" "#Action_Camera"
"input_mode" "absolute_mouse"
}
}
"AnalogTrigger"
{
"Throttle" "#Action_Throttle"
}
"Button"
{
"fire" "#Action_Fire"
"Jump" "#Action_Jump"
"pause_menu" "#Action_Menu"
}
}
"MenuControls"
{
"title" "#Set_Menu"
"StickPadGyro"
{
}
"AnalogTrigger"
{
}
"Button"
{
"menu_up" "#Menu_Up"
"menu_down" "#Menu_Down"
"menu_left" "#Menu_Left"
"menu_right" "#Menu_Right"
"menu_select" "#Menu_Select"
"menu_cancel" "#Menu_Cancel"
"pause_menu" "#Action_ReturnToGame"
}
}
}
"localization"
{
"english"
{
"Set_Ingame" "In-Game Controls"
"Set_Menu" "Menu Controls"
"Action_Move" "Movement"
"Action_Camera" "Camera"
"Action_Throttle" "Throttle"
"Action_Fire" "Fire Weapon"
"Action_Jump" "Jump"
"Action_Menu" "Pause Menu"
"Action_ReturnToGame" "Return To Game"
"Menu_Up" "Up"
"Menu_Down" "Down"
"Menu_Left" "Left"
"Menu_Right" "Right"
"Menu_Select" "Select"
"Menu_Cancel" "Cancel"
}
}
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="MSTest.TestAdapter" version="2.0.0-beta4" targetFramework="net46" />
<package id="MSTest.TestFramework" version="2.0.0-beta4" targetFramework="net46" />
<package id="Newtonsoft.Json" version="9.0.2-beta1" targetFramework="net452" />
</packages>

Binary file not shown.

Binary file not shown.

View File

@ -1,28 +1,107 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25123.0
# Visual Studio Version 16
VisualStudioVersion = 16.0.29009.5
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facepunch.Steamworks", "Facepunch.Steamworks\Facepunch.Steamworks.csproj", "{DC2D9FA9-F005-468F-8581-85C79F4E0034}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Generator", "Generator\Generator.csproj", "{B7225D11-2AAA-49D6-AE93-A73696EA35FE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facepunch.Steamworks.Test", "Facepunch.Steamworks.Test\Facepunch.Steamworks.Test.csproj", "{3F6183AD-D966-44F2-A6EB-42E61E591B49}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Facepunch.Steamworks.Win64", "Facepunch.Steamworks\Facepunch.Steamworks.Win64.csproj", "{8C73DA93-73AD-4445-9A2C-15D4A44337D3}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Facepunch.Steamworks.Win32", "Facepunch.Steamworks\Facepunch.Steamworks.Win32.csproj", "{2D6247F6-8AB2-405F-A00E-3A364B808A55}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Facepunch.Steamworks.Posix", "Facepunch.Steamworks\Facepunch.Steamworks.Posix.csproj", "{C62FF421-BE44-4DB0-B99A-E13E007A30B9}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facepunch.Steamworks.TestWin32", "Facepunch.Steamworks.Test\Facepunch.Steamworks.TestWin32.csproj", "{3F6183AD-D966-44F2-A6EB-42E61E591B49}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facepunch.Steamworks.TestWin64", "Facepunch.Steamworks.Test\Facepunch.Steamworks.TestWin64.csproj", "{165081E3-BD96-404B-B83E-A635F1AF7CDE}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{DC2D9FA9-F005-468F-8581-85C79F4E0034}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DC2D9FA9-F005-468F-8581-85C79F4E0034}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DC2D9FA9-F005-468F-8581-85C79F4E0034}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DC2D9FA9-F005-468F-8581-85C79F4E0034}.Release|Any CPU.Build.0 = Release|Any CPU
{B7225D11-2AAA-49D6-AE93-A73696EA35FE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B7225D11-2AAA-49D6-AE93-A73696EA35FE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B7225D11-2AAA-49D6-AE93-A73696EA35FE}.Debug|x64.ActiveCfg = Debug|Any CPU
{B7225D11-2AAA-49D6-AE93-A73696EA35FE}.Debug|x64.Build.0 = Debug|Any CPU
{B7225D11-2AAA-49D6-AE93-A73696EA35FE}.Debug|x86.ActiveCfg = Debug|Any CPU
{B7225D11-2AAA-49D6-AE93-A73696EA35FE}.Debug|x86.Build.0 = Debug|Any CPU
{B7225D11-2AAA-49D6-AE93-A73696EA35FE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B7225D11-2AAA-49D6-AE93-A73696EA35FE}.Release|Any CPU.Build.0 = Release|Any CPU
{B7225D11-2AAA-49D6-AE93-A73696EA35FE}.Release|x64.ActiveCfg = Release|Any CPU
{B7225D11-2AAA-49D6-AE93-A73696EA35FE}.Release|x64.Build.0 = Release|Any CPU
{B7225D11-2AAA-49D6-AE93-A73696EA35FE}.Release|x86.ActiveCfg = Release|Any CPU
{B7225D11-2AAA-49D6-AE93-A73696EA35FE}.Release|x86.Build.0 = Release|Any CPU
{8C73DA93-73AD-4445-9A2C-15D4A44337D3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8C73DA93-73AD-4445-9A2C-15D4A44337D3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8C73DA93-73AD-4445-9A2C-15D4A44337D3}.Debug|x64.ActiveCfg = Debug|Any CPU
{8C73DA93-73AD-4445-9A2C-15D4A44337D3}.Debug|x64.Build.0 = Debug|Any CPU
{8C73DA93-73AD-4445-9A2C-15D4A44337D3}.Debug|x86.ActiveCfg = Debug|Any CPU
{8C73DA93-73AD-4445-9A2C-15D4A44337D3}.Debug|x86.Build.0 = Debug|Any CPU
{8C73DA93-73AD-4445-9A2C-15D4A44337D3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8C73DA93-73AD-4445-9A2C-15D4A44337D3}.Release|Any CPU.Build.0 = Release|Any CPU
{8C73DA93-73AD-4445-9A2C-15D4A44337D3}.Release|x64.ActiveCfg = Release|Any CPU
{8C73DA93-73AD-4445-9A2C-15D4A44337D3}.Release|x64.Build.0 = Release|Any CPU
{8C73DA93-73AD-4445-9A2C-15D4A44337D3}.Release|x86.ActiveCfg = Release|Any CPU
{8C73DA93-73AD-4445-9A2C-15D4A44337D3}.Release|x86.Build.0 = Release|Any CPU
{2D6247F6-8AB2-405F-A00E-3A364B808A55}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2D6247F6-8AB2-405F-A00E-3A364B808A55}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2D6247F6-8AB2-405F-A00E-3A364B808A55}.Debug|x64.ActiveCfg = Debug|Any CPU
{2D6247F6-8AB2-405F-A00E-3A364B808A55}.Debug|x64.Build.0 = Debug|Any CPU
{2D6247F6-8AB2-405F-A00E-3A364B808A55}.Debug|x86.ActiveCfg = Debug|Any CPU
{2D6247F6-8AB2-405F-A00E-3A364B808A55}.Debug|x86.Build.0 = Debug|Any CPU
{2D6247F6-8AB2-405F-A00E-3A364B808A55}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2D6247F6-8AB2-405F-A00E-3A364B808A55}.Release|Any CPU.Build.0 = Release|Any CPU
{2D6247F6-8AB2-405F-A00E-3A364B808A55}.Release|x64.ActiveCfg = Release|Any CPU
{2D6247F6-8AB2-405F-A00E-3A364B808A55}.Release|x64.Build.0 = Release|Any CPU
{2D6247F6-8AB2-405F-A00E-3A364B808A55}.Release|x86.ActiveCfg = Release|Any CPU
{2D6247F6-8AB2-405F-A00E-3A364B808A55}.Release|x86.Build.0 = Release|Any CPU
{C62FF421-BE44-4DB0-B99A-E13E007A30B9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C62FF421-BE44-4DB0-B99A-E13E007A30B9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C62FF421-BE44-4DB0-B99A-E13E007A30B9}.Debug|x64.ActiveCfg = Debug|Any CPU
{C62FF421-BE44-4DB0-B99A-E13E007A30B9}.Debug|x64.Build.0 = Debug|Any CPU
{C62FF421-BE44-4DB0-B99A-E13E007A30B9}.Debug|x86.ActiveCfg = Debug|Any CPU
{C62FF421-BE44-4DB0-B99A-E13E007A30B9}.Debug|x86.Build.0 = Debug|Any CPU
{C62FF421-BE44-4DB0-B99A-E13E007A30B9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C62FF421-BE44-4DB0-B99A-E13E007A30B9}.Release|Any CPU.Build.0 = Release|Any CPU
{C62FF421-BE44-4DB0-B99A-E13E007A30B9}.Release|x64.ActiveCfg = Release|Any CPU
{C62FF421-BE44-4DB0-B99A-E13E007A30B9}.Release|x64.Build.0 = Release|Any CPU
{C62FF421-BE44-4DB0-B99A-E13E007A30B9}.Release|x86.ActiveCfg = Release|Any CPU
{C62FF421-BE44-4DB0-B99A-E13E007A30B9}.Release|x86.Build.0 = Release|Any CPU
{3F6183AD-D966-44F2-A6EB-42E61E591B49}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3F6183AD-D966-44F2-A6EB-42E61E591B49}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3F6183AD-D966-44F2-A6EB-42E61E591B49}.Debug|x64.ActiveCfg = Debug|x64
{3F6183AD-D966-44F2-A6EB-42E61E591B49}.Debug|x64.Build.0 = Debug|x64
{3F6183AD-D966-44F2-A6EB-42E61E591B49}.Debug|x86.ActiveCfg = Debug|x86
{3F6183AD-D966-44F2-A6EB-42E61E591B49}.Debug|x86.Build.0 = Debug|x86
{3F6183AD-D966-44F2-A6EB-42E61E591B49}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3F6183AD-D966-44F2-A6EB-42E61E591B49}.Release|Any CPU.Build.0 = Release|Any CPU
{3F6183AD-D966-44F2-A6EB-42E61E591B49}.Release|x64.ActiveCfg = Release|x64
{3F6183AD-D966-44F2-A6EB-42E61E591B49}.Release|x64.Build.0 = Release|x64
{3F6183AD-D966-44F2-A6EB-42E61E591B49}.Release|x86.ActiveCfg = Release|x86
{3F6183AD-D966-44F2-A6EB-42E61E591B49}.Release|x86.Build.0 = Release|x86
{165081E3-BD96-404B-B83E-A635F1AF7CDE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{165081E3-BD96-404B-B83E-A635F1AF7CDE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{165081E3-BD96-404B-B83E-A635F1AF7CDE}.Debug|x64.ActiveCfg = Debug|x64
{165081E3-BD96-404B-B83E-A635F1AF7CDE}.Debug|x64.Build.0 = Debug|x64
{165081E3-BD96-404B-B83E-A635F1AF7CDE}.Debug|x86.ActiveCfg = Debug|x86
{165081E3-BD96-404B-B83E-A635F1AF7CDE}.Debug|x86.Build.0 = Debug|x86
{165081E3-BD96-404B-B83E-A635F1AF7CDE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{165081E3-BD96-404B-B83E-A635F1AF7CDE}.Release|Any CPU.Build.0 = Release|Any CPU
{165081E3-BD96-404B-B83E-A635F1AF7CDE}.Release|x64.ActiveCfg = Release|x64
{165081E3-BD96-404B-B83E-A635F1AF7CDE}.Release|x64.Build.0 = Release|x64
{165081E3-BD96-404B-B83E-A635F1AF7CDE}.Release|x86.ActiveCfg = Release|x86
{165081E3-BD96-404B-B83E-A635F1AF7CDE}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {506FC2EC-38D1-45E2-BAE8-D61584162F7D}
EndGlobalSection
EndGlobal

View File

@ -1,146 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Facepunch.Steamworks.Interop;
namespace Facepunch.Steamworks
{
public class BaseSteamworks : IDisposable
{
/// <summary>
/// Current running program's AppId
/// </summary>
public uint AppId { get; internal set; }
public Networking Networking { get; internal set; }
public Inventory Inventory { get; internal set; }
public Workshop Workshop { get; internal set; }
public virtual void Dispose()
{
foreach ( var d in Disposables )
{
d.Dispose();
}
Disposables.Clear();
Workshop.Dispose();
Workshop = null;
Inventory.Dispose();
Inventory = null;
Networking.Dispose();
Networking = null;
if ( native != null )
{
native.Dispose();
native = null;
}
}
public void SetupCommonInterfaces()
{
Networking = new Steamworks.Networking( this, native.networking );
Inventory = new Steamworks.Inventory( native.inventory, IsGameServer );
Workshop = new Steamworks.Workshop( this, native.ugc, native.remoteStorage );
}
public bool IsValid
{
get { return native != null; }
}
internal Interop.NativeInterface native;
internal virtual bool IsGameServer { get { return false; } }
private List<IDisposable> Disposables = new List<IDisposable>();
public enum MessageType : int
{
Message = 0,
Warning = 1
}
/// <summary>
/// Called with a message from Steam
/// </summary>
public Action<MessageType, string> OnMessage;
/// <summary>
/// Global callback type
/// </summary>
internal void AddCallback<T, TSmall>( Action<T> Callback, int id )
{
var callback = new Callback<T, TSmall>( IsGameServer, id, Callback );
Disposables.Add( callback );
}
internal void AddCallback<T>( Action<T> Callback, int id )
{
AddCallback<T, T>( Callback, id );
}
public Action OnUpdate;
public virtual void Update()
{
RunCallbackQueue();
Inventory.Update();
Networking.Update();
if ( OnUpdate != null )
OnUpdate();
}
List<CallResult> Callbacks = new List<CallResult>();
/// <summary>
/// Call results are results to specific actions
/// </summary>
internal void AddCallResult( CallResult call )
{
if ( call == null ) throw new ArgumentNullException( "call" );
if ( FinishCallback( call ) )
return;
Callbacks.Add( call );
}
void RunCallbackQueue()
{
for ( int i=0; i< Callbacks.Count(); i++ )
{
if ( !FinishCallback( Callbacks[i] ) )
continue;
Callbacks.RemoveAt( i );
i--;
}
}
bool FinishCallback( CallResult call )
{
bool failed = true;
if ( !native.utils.IsAPICallCompleted( call.Handle, ref failed ) )
return false;
if ( failed )
{
//
// TODO - failure reason?
//
return true;
}
call.Run( native.utils );
return true;
}
}
}

View File

@ -0,0 +1,98 @@
using Steamworks.Data;
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
namespace Steamworks
{
/// <summary>
/// An awaitable version of a SteamAPICall_t
/// </summary>
internal struct CallResult<T> : INotifyCompletion where T : struct, ICallbackData
{
SteamAPICall_t call;
ISteamUtils utils;
bool server;
public CallResult( SteamAPICall_t call, bool server )
{
this.call = call;
this.server = server;
utils = (server ? SteamUtils.InterfaceServer : SteamUtils.InterfaceClient) as ISteamUtils;
if ( utils == null )
utils = SteamUtils.Interface as ISteamUtils;
}
/// <summary>
/// This gets called if IsComplete returned false on the first call.
/// The Action "continues" the async call. We pass it to the Dispatch
/// to be called when the callback returns.
/// </summary>
public void OnCompleted( Action continuation )
{
if (IsCompleted)
continuation();
else
Dispatch.OnCallComplete<T>(call, continuation, server);
}
/// <summary>
/// Gets the result. This is called internally by the async shit.
/// </summary>
public T? GetResult()
{
bool failed = false;
if ( !utils.IsAPICallCompleted( call, ref failed ) || failed )
return null;
var t = default( T );
var size = t.DataSize;
var ptr = Marshal.AllocHGlobal( size );
try
{
if ( !utils.GetAPICallResult( call, ptr, size, (int)t.CallbackType, ref failed ) || failed )
{
Dispatch.OnDebugCallback?.Invoke( t.CallbackType, "!GetAPICallResult or failed", server );
return null;
}
Dispatch.OnDebugCallback?.Invoke( t.CallbackType, Dispatch.CallbackToString( t.CallbackType, ptr, size ), server );
return ((T)Marshal.PtrToStructure( ptr, typeof( T ) ));
}
finally
{
Marshal.FreeHGlobal( ptr );
}
}
/// <summary>
/// Return true if complete or failed
/// </summary>
public bool IsCompleted
{
get
{
bool failed = false;
if ( utils.IsAPICallCompleted( call, ref failed ) || failed )
return true;
return false;
}
}
/// <summary>
/// This is what makes this struct awaitable
/// </summary>
internal CallResult<T> GetAwaiter()
{
return this;
}
}
}

View File

@ -0,0 +1,17 @@
using Steamworks.Data;
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
namespace Steamworks
{
/// <summary>
/// Gives us a generic way to get the CallbackId of structs
/// </summary>
internal interface ICallbackData
{
CallbackType CallbackType { get; }
int DataSize { get; }
}
}

View File

@ -1,124 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Facepunch.Steamworks.Callbacks
{
internal static class Index
{
internal const int User = 100;
internal const int Networking = 1200;
internal const int RemoteStorage = 1300;
internal const int UGC = 3400;
}
public enum Result : int
{
OK = 1, // success
Fail = 2, // generic failure
NoConnection = 3, // no/failed network connection
// k_EResultNoConnectionRetry = 4, // OBSOLETE - removed
InvalidPassword = 5, // password/ticket is invalid
LoggedInElsewhere = 6, // same user logged in elsewhere
InvalidProtocolVer = 7, // protocol version is incorrect
InvalidParam = 8, // a parameter is incorrect
FileNotFound = 9, // file was not found
Busy = 10, // called method busy - action not taken
InvalidState = 11, // called object was in an invalid state
InvalidName = 12, // name is invalid
InvalidEmail = 13, // email is invalid
DuplicateName = 14, // name is not unique
AccessDenied = 15, // access is denied
Timeout = 16, // operation timed out
Banned = 17, // VAC2 banned
AccountNotFound = 18, // account not found
InvalidSteamID = 19, // steamID is invalid
ServiceUnavailable = 20, // The requested service is currently unavailable
NotLoggedOn = 21, // The user is not logged on
Pending = 22, // Request is pending (may be in process, or waiting on third party)
EncryptionFailure = 23, // Encryption or Decryption failed
InsufficientPrivilege = 24, // Insufficient privilege
LimitExceeded = 25, // Too much of a good thing
Revoked = 26, // Access has been revoked (used for revoked guest passes)
Expired = 27, // License/Guest pass the user is trying to access is expired
AlreadyRedeemed = 28, // Guest pass has already been redeemed by account, cannot be acked again
DuplicateRequest = 29, // The request is a duplicate and the action has already occurred in the past, ignored this time
AlreadyOwned = 30, // All the games in this guest pass redemption request are already owned by the user
IPNotFound = 31, // IP address not found
PersistFailed = 32, // failed to write change to the data store
LockingFailed = 33, // failed to acquire access lock for this operation
LogonSessionReplaced = 34,
ConnectFailed = 35,
HandshakeFailed = 36,
IOFailure = 37,
RemoteDisconnect = 38,
ShoppingCartNotFound = 39, // failed to find the shopping cart requested
Blocked = 40, // a user didn't allow it
Ignored = 41, // target is ignoring sender
NoMatch = 42, // nothing matching the request found
AccountDisabled = 43,
ServiceReadOnly = 44, // this service is not accepting content changes right now
AccountNotFeatured = 45, // account doesn't have value, so this feature isn't available
AdministratorOK = 46, // allowed to take this action, but only because requester is admin
ContentVersion = 47, // A Version mismatch in content transmitted within the Steam protocol.
TryAnotherCM = 48, // The current CM can't service the user making a request, user should try another.
PasswordRequiredToKickSession = 49,// You are already logged in elsewhere, this cached credential login has failed.
AlreadyLoggedInElsewhere = 50, // You are already logged in elsewhere, you must wait
Suspended = 51, // Long running operation (content download) suspended/paused
Cancelled = 52, // Operation canceled (typically by user: content download)
DataCorruption = 53, // Operation canceled because data is ill formed or unrecoverable
DiskFull = 54, // Operation canceled - not enough disk space.
RemoteCallFailed = 55, // an remote call or IPC call failed
PasswordUnset = 56, // Password could not be verified as it's unset server side
ExternalAccountUnlinked = 57, // External account (PSN, Facebook...) is not linked to a Steam account
PSNTicketInvalid = 58, // PSN ticket was invalid
ExternalAccountAlreadyLinked = 59, // External account (PSN, Facebook...) is already linked to some other account, must explicitly request to replace/delete the link first
RemoteFileConflict = 60, // The sync cannot resume due to a conflict between the local and remote files
IllegalPassword = 61, // The requested new password is not legal
SameAsPreviousValue = 62, // new value is the same as the old one ( secret question and answer )
AccountLogonDenied = 63, // account login denied due to 2nd factor authentication failure
CannotUseOldPassword = 64, // The requested new password is not legal
InvalidLoginAuthCode = 65, // account login denied due to auth code invalid
AccountLogonDeniedNoMail = 66, // account login denied due to 2nd factor auth failure - and no mail has been sent
HardwareNotCapableOfIPT = 67, //
IPTInitError = 68, //
ParentalControlRestricted = 69, // operation failed due to parental control restrictions for current user
FacebookQueryError = 70, // Facebook query returned an error
ExpiredLoginAuthCode = 71, // account login denied due to auth code expired
IPLoginRestrictionFailed = 72,
AccountLockedDown = 73,
AccountLogonDeniedVerifiedEmailRequired = 74,
NoMatchingURL = 75,
BadResponse = 76, // parse failure, missing field, etc.
RequirePasswordReEntry = 77, // The user cannot complete the action until they re-enter their password
ValueOutOfRange = 78, // the value entered is outside the acceptable range
UnexpectedError = 79, // something happened that we didn't expect to ever happen
Disabled = 80, // The requested service has been configured to be unavailable
InvalidCEGSubmission = 81, // The set of files submitted to the CEG server are not valid !
RestrictedDevice = 82, // The device being used is not allowed to perform this action
RegionLocked = 83, // The action could not be complete because it is region restricted
RateLimitExceeded = 84, // Temporary rate limit exceeded, try again later, different from k_EResultLimitExceeded which may be permanent
AccountLoginDeniedNeedTwoFactor = 85, // Need two-factor code to login
ItemDeleted = 86, // The thing we're trying to access has been deleted
AccountLoginDeniedThrottle = 87, // login attempt failed, try to throttle response to possible attacker
TwoFactorCodeMismatch = 88, // two factor code mismatch
TwoFactorActivationCodeMismatch = 89, // activation code for two-factor didn't match
AccountAssociatedToMultiplePartners = 90, // account has been associated with multiple partners
NotModified = 91, // data not modified
NoMobileDevice = 92, // the account does not have a mobile device associated with it
TimeNotSynced = 93, // the time presented is out of range or tolerance
SmsCodeFailed = 94, // SMS code failure (no match, none pending, etc.)
AccountLimitExceeded = 95, // Too many accounts access this resource
AccountActivityLimitExceeded = 96, // Too many changes to this account
PhoneActivityLimitExceeded = 97, // Too many changes to this phone
RefundToWallet = 98, // Cannot refund to payment method, must use wallet
EmailSendFailure = 99, // Cannot send an email
NotSettled = 100, // Can't perform operation till payment has settled
NeedCaptcha = 101, // Needs to provide a valid captcha
GSLTDenied = 102, // a game server login token owned by this token's owner has been banned
GSOwnerDenied = 103, // game server owner is denied for other reason (account lock, community ban, vac ban, missing phone)
InvalidItemType = 104, // the type of thing we were requested to act on is invalid
IPBanned = 105, // the ip address has been banned from taking this action
};
}

View File

@ -1,27 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
namespace Facepunch.Steamworks.Callbacks.Networking
{
[StructLayout( LayoutKind.Sequential, Pack = 1 )]
internal class P2PSessionRequest
{
public ulong SteamID;
public const int CallbackId = Index.Networking + 2;
};
[StructLayout( LayoutKind.Sequential, Pack = 1 )]
internal class P2PSessionConnectFail
{
public ulong SteamID;
public Steamworks.Networking.SessionError Error;
public const int CallbackId = Index.Networking + 3;
};
}

View File

@ -1,34 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
namespace Facepunch.Steamworks.Callbacks.User
{
[StructLayout( LayoutKind.Sequential, Pack = 1 )]
internal struct ValidateAuthTicketResponse
{
public ulong SteamID;
public int AuthResponse;
public ulong OwnerSteamID;
public const int CallbackId = Index.User + 43;
public enum Response : int
{
Okay = 0, // Steam has verified the user is online, the ticket is valid and ticket has not been reused.
UserNotConnectedToSteam = 1, // The user in question is not connected to steam
NoLicenseOrExpired = 2, // The license has expired.
VACBanned = 3, // The user is VAC banned for this game.
LoggedInElseWhere = 4, // The user account has logged in elsewhere and the session containing the game instance has been disconnected.
VACCheckTimedOut = 5, // VAC has been unable to perform anti-cheat checks on this user
AuthTicketCanceled = 6, // The ticket has been canceled by the issuer
AuthTicketInvalidAlreadyUsed = 7, // This ticket has already been used, it is not valid.
AuthTicketInvalid = 8, // This ticket is not from a user instance currently connected to steam.
PublisherIssuedBan = 9, // The user is banned for this game. The ban came via the web api and not VAC
};
};
}

View File

@ -1,107 +0,0 @@
using System.Runtime.InteropServices;
using Facepunch.Steamworks.Interop;
namespace Facepunch.Steamworks.Callbacks.Workshop
{
[StructLayout( LayoutKind.Sequential, Pack = 8 )]
internal struct ItemInstalled
{
public uint AppId;
public ulong FileId;
public const int CallbackId = Index.UGC + 5;
[StructLayout( LayoutKind.Sequential, Pack = 4 )]
internal struct Small
{
public uint AppId;
public ulong FileId;
};
};
[StructLayout( LayoutKind.Sequential, Pack = 8 )]
internal struct DownloadResult
{
public uint AppId;
public ulong FileId;
public Result Result;
public const int CallbackId = Index.UGC + 6;
[StructLayout( LayoutKind.Sequential, Pack = 4 )]
internal struct Small
{
public uint AppId;
public ulong FileId;
public Result Result;
};
};
internal class QueryCompleted : CallResult<QueryCompleted.Data, QueryCompleted.Data.Small>
{
public override int CallbackId { get { return Index.UGC + 1; } }
[StructLayout( LayoutKind.Sequential, Pack = 8 )]
internal struct Data
{
internal ulong Handle;
internal int Result;
internal uint NumResultsReturned;
internal uint TotalMatchingResults;
internal bool CachedData;
[StructLayout( LayoutKind.Sequential, Pack = 4 )]
internal struct Small
{
internal ulong Handle;
internal int Result;
internal uint NumResultsReturned;
internal uint TotalMatchingResults;
internal bool CachedData;
};
};
}
internal class CreateItem : CallResult<CreateItem.Data, CreateItem.Data.Small>
{
public override int CallbackId { get { return Index.UGC + 3; } }
[StructLayout( LayoutKind.Sequential, Pack = 8 )]
internal struct Data
{
internal Result Result;
internal ulong FileId;
internal bool NeedsLegalAgreement;
[StructLayout( LayoutKind.Sequential, Pack = 4 )]
internal struct Small
{
internal Result Result;
internal ulong FileId;
internal bool NeedsLegalAgreement;
};
};
}
internal class SubmitItemUpdate : CallResult<SubmitItemUpdate.Data, SubmitItemUpdate.Data.Small>
{
public override int CallbackId { get { return Index.UGC + 4; } }
[StructLayout( LayoutKind.Sequential, Pack = 8 )]
internal struct Data
{
internal Result Result;
internal bool NeedsLegalAgreement;
[StructLayout( LayoutKind.Sequential, Pack = 4 )]
internal struct Small
{
internal Result Result;
internal bool NeedsLegalAgreement;
};
};
}
}

View File

@ -0,0 +1,30 @@
using System;
namespace Steamworks
{
public class AuthTicket : IDisposable
{
public byte[] Data;
public uint Handle;
/// <summary>
/// Cancels a ticket.
/// You should cancel your ticket when you close the game or leave a server.
/// </summary>
public void Cancel()
{
if ( Handle != 0 )
{
SteamUser.Internal.CancelAuthTicket( Handle );
}
Handle = 0;
Data = null;
}
public void Dispose()
{
Cancel();
}
}
}

View File

@ -0,0 +1,334 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
using Steamworks.Data;
using Steamworks;
using System.Linq;
namespace Steamworks
{
/// <summary>
/// Responsible for all callback/callresult handling
///
/// This manually pumps Steam's message queue and dispatches those
/// events to any waiting callbacks/callresults.
/// </summary>
public static class Dispatch
{
/// <summary>
/// If set then we'll call this function every time a callback is generated.
///
/// This is SLOW!! - it's for debugging - don't keep it on all the time. If you want to access a specific
/// callback then please create an issue on github and I'll add it!
///
/// Params are : [Callback Type] [Callback Contents] [server]
///
/// </summary>
public static Action<CallbackType, string, bool> OnDebugCallback;
/// <summary>
/// Called if an exception happens during a callback/callresult.
/// This is needed because the exception isn't always accessible when running
/// async.. and can fail silently. With this hooked you won't be stuck wondering
/// what happened.
/// </summary>
public static Action<Exception> OnException;
#region interop
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ManualDispatch_Init", CallingConvention = CallingConvention.Cdecl )]
internal static extern void SteamAPI_ManualDispatch_Init();
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ManualDispatch_RunFrame", CallingConvention = CallingConvention.Cdecl )]
internal static extern void SteamAPI_ManualDispatch_RunFrame( HSteamPipe pipe );
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ManualDispatch_GetNextCallback", CallingConvention = CallingConvention.Cdecl )]
[return: MarshalAs( UnmanagedType.I1 )]
internal static extern bool SteamAPI_ManualDispatch_GetNextCallback( HSteamPipe pipe, [In, Out] ref CallbackMsg_t msg );
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ManualDispatch_FreeLastCallback", CallingConvention = CallingConvention.Cdecl )]
[return: MarshalAs( UnmanagedType.I1 )]
internal static extern bool SteamAPI_ManualDispatch_FreeLastCallback( HSteamPipe pipe );
[StructLayout( LayoutKind.Sequential, Pack = Platform.StructPlatformPackSize )]
internal struct CallbackMsg_t
{
public HSteamUser m_hSteamUser; // Specific user to whom this callback applies.
public CallbackType Type; // Callback identifier. (Corresponds to the k_iCallback enum in the callback structure.)
public IntPtr Data; // Points to the callback structure
public int DataSize; // Size of the data pointed to by m_pubParam
};
#endregion
internal static HSteamPipe ClientPipe { get; set; }
internal static HSteamPipe ServerPipe { get; set; }
/// <summary>
/// This gets called from Client/Server Init
/// It's important to switch to the manual dispatcher
/// </summary>
internal static void Init()
{
SteamAPI_ManualDispatch_Init();
}
/// <summary>
/// Make sure we don't call Frame in a callback - because that'll cause some issues for everyone.
/// </summary>
static bool runningFrame = false;
/// <summary>
/// Calls RunFrame and processes events from this Steam Pipe
/// </summary>
internal static void Frame( HSteamPipe pipe )
{
if ( runningFrame )
return;
try
{
runningFrame = true;
SteamAPI_ManualDispatch_RunFrame( pipe );
SteamNetworkingUtils.OutputDebugMessages();
CallbackMsg_t msg = default;
while ( SteamAPI_ManualDispatch_GetNextCallback( pipe, ref msg ) )
{
try
{
ProcessCallback( msg, pipe == ServerPipe );
}
finally
{
SteamAPI_ManualDispatch_FreeLastCallback( pipe );
}
}
}
catch ( System.Exception e )
{
OnException?.Invoke( e );
}
finally
{
runningFrame = false;
}
}
/// <summary>
/// To be safe we don't call the continuation functions while iterating
/// the Callback list. This is maybe overly safe because the only way this
/// could be an issue is if the callback list is modified in the continuation
/// which would only happen if starting or shutting down in the callback.
/// </summary>
static List<Action<IntPtr>> actionsToCall = new List<Action<IntPtr>>();
/// <summary>
/// A callback is a general global message
/// </summary>
private static void ProcessCallback( CallbackMsg_t msg, bool isServer )
{
OnDebugCallback?.Invoke( msg.Type, CallbackToString( msg.Type, msg.Data, msg.DataSize ), isServer );
// Is this a special callback telling us that the call result is ready?
if ( msg.Type == CallbackType.SteamAPICallCompleted )
{
ProcessResult( msg );
return;
}
if ( Callbacks.TryGetValue( msg.Type, out var list ) )
{
actionsToCall.Clear();
foreach ( var item in list )
{
if ( item.server != isServer )
continue;
actionsToCall.Add( item.action );
}
foreach ( var action in actionsToCall )
{
action( msg.Data );
}
actionsToCall.Clear();
}
}
/// <summary>
/// Given a callback, try to turn it into a string
/// </summary>
internal static string CallbackToString( CallbackType type, IntPtr data, int expectedsize )
{
if ( !CallbackTypeFactory.All.TryGetValue( type, out var t ) )
return $"[{type} not in sdk]";
var strct = data.ToType( t );
if ( strct == null )
return "[null]";
var str = "";
var fields = t.GetFields( System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic );
if ( fields.Length == 0 )
return "[no fields]";
var columnSize = fields.Max( x => x.Name.Length ) + 1;
if ( columnSize < 10 )
columnSize = 10;
foreach ( var field in fields )
{
var spaces = (columnSize - field.Name.Length);
if ( spaces < 0 ) spaces = 0;
str += $"{new String( ' ', spaces )}{field.Name}: {field.GetValue( strct )}\n";
}
return str.Trim( '\n' );
}
/// <summary>
/// A result is a reply to a specific command
/// </summary>
private static void ProcessResult( CallbackMsg_t msg )
{
var result = msg.Data.ToType<SteamAPICallCompleted_t>();
//
// Do we have an entry added via OnCallComplete
//
if ( !ResultCallbacks.TryGetValue( result.AsyncCall, out var callbackInfo ) )
{
//
// This can happen if the callback result was immediately available
// so we just returned that without actually going through the callback
// dance. It's okay for this to fail.
//
//
// But still let everyone know that this happened..
//
OnDebugCallback?.Invoke( (CallbackType)result.Callback, $"[no callback waiting/required]", false );
return;
}
// Remove it before we do anything, incase the continuation throws exceptions
ResultCallbacks.Remove( result.AsyncCall );
// At this point whatever async routine called this
// continues running.
callbackInfo.continuation();
}
/// <summary>
/// Pumps the queue in an async loop so we don't
/// have to think about it. This has the advantage that
/// you can call .Wait() on async shit and it still works.
/// </summary>
internal static async void LoopClientAsync()
{
while ( ClientPipe != 0 )
{
Frame( ClientPipe );
await Task.Delay( 16 );
}
}
/// <summary>
/// Pumps the queue in an async loop so we don't
/// have to think about it. This has the advantage that
/// you can call .Wait() on async shit and it still works.
/// </summary>
internal static async void LoopServerAsync()
{
while ( ServerPipe != 0 )
{
Frame( ServerPipe );
await Task.Delay( 32 );
}
}
struct ResultCallback
{
public Action continuation;
public bool server;
}
static Dictionary<ulong, ResultCallback> ResultCallbacks = new Dictionary<ulong, ResultCallback>();
/// <summary>
/// Watch for a steam api call
/// </summary>
internal static void OnCallComplete<T>( SteamAPICall_t call, Action continuation, bool server ) where T : struct, ICallbackData
{
ResultCallbacks[call.Value] = new ResultCallback
{
continuation = continuation,
server = server
};
}
struct Callback
{
public Action<IntPtr> action;
public bool server;
}
static Dictionary<CallbackType, List<Callback>> Callbacks = new Dictionary<CallbackType, List<Callback>>();
/// <summary>
/// Install a global callback. The passed function will get called if it's all good.
/// </summary>
internal static void Install<T>( Action<T> p, bool server = false ) where T : ICallbackData
{
var t = default( T );
var type = t.CallbackType;
if ( !Callbacks.TryGetValue( type, out var list ) )
{
list = new List<Callback>();
Callbacks[type] = list;
}
list.Add( new Callback
{
action = x => p( x.ToType<T>() ),
server = server
} );
}
internal static void ShutdownServer()
{
ServerPipe = 0;
foreach ( var callback in Callbacks )
{
Callbacks[callback.Key].RemoveAll( x => x.server );
}
ResultCallbacks = ResultCallbacks.Where( x => !x.Value.server )
.ToDictionary( x => x.Key, x => x.Value );
}
internal static void ShutdownClient()
{
ClientPipe = 0;
foreach ( var callback in Callbacks )
{
Callbacks[callback.Key].RemoveAll( x => !x.server );
}
ResultCallbacks = ResultCallbacks.Where( x => x.Value.server )
.ToDictionary( x => x.Key, x => x.Value );
}
}
}

View File

@ -0,0 +1,54 @@
using System;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using Steamworks.Data;
namespace Steamworks
{
internal static class SteamAPI
{
internal static class Native
{
[DllImport( Platform.LibraryName, EntryPoint = "SteamInternal_SteamAPI_Init", CallingConvention = CallingConvention.Cdecl )]
public static extern SteamAPIInitResult SteamInternal_SteamAPI_Init( IntPtr pszInternalCheckInterfaceVersions, IntPtr pOutErrMsg );
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_Shutdown", CallingConvention = CallingConvention.Cdecl )]
public static extern void SteamAPI_Shutdown();
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_GetHSteamPipe", CallingConvention = CallingConvention.Cdecl )]
public static extern HSteamPipe SteamAPI_GetHSteamPipe();
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_RestartAppIfNecessary", CallingConvention = CallingConvention.Cdecl )]
[return: MarshalAs( UnmanagedType.I1 )]
public static extern bool SteamAPI_RestartAppIfNecessary( uint unOwnAppID );
}
static internal SteamAPIInitResult Init( string pszInternalCheckInterfaceVersions, out string pOutErrMsg )
{
using var interfaceVersionsStr = new Utf8StringToNative( pszInternalCheckInterfaceVersions );
using var buffer = Helpers.Memory.Take();
var result = Native.SteamInternal_SteamAPI_Init( interfaceVersionsStr.Pointer, buffer.Ptr );
pOutErrMsg = Helpers.MemoryToString( buffer.Ptr );
return result;
}
static internal void Shutdown()
{
Native.SteamAPI_Shutdown();
}
static internal HSteamPipe GetHSteamPipe()
{
return Native.SteamAPI_GetHSteamPipe();
}
static internal bool RestartAppIfNecessary( uint unOwnAppID )
{
return Native.SteamAPI_RestartAppIfNecessary( unOwnAppID );
}
}
}

View File

@ -0,0 +1,40 @@
using System;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using Steamworks.Data;
namespace Steamworks
{
internal static class SteamGameServer
{
internal static class Native
{
[DllImport( Platform.LibraryName, EntryPoint = "SteamGameServer_RunCallbacks", CallingConvention = CallingConvention.Cdecl )]
public static extern void SteamGameServer_RunCallbacks();
[DllImport( Platform.LibraryName, EntryPoint = "SteamGameServer_Shutdown", CallingConvention = CallingConvention.Cdecl )]
public static extern void SteamGameServer_Shutdown();
[DllImport( Platform.LibraryName, EntryPoint = "SteamGameServer_GetHSteamPipe", CallingConvention = CallingConvention.Cdecl )]
public static extern HSteamPipe SteamGameServer_GetHSteamPipe();
}
static internal void RunCallbacks()
{
Native.SteamGameServer_RunCallbacks();
}
static internal void Shutdown()
{
Native.SteamGameServer_Shutdown();
}
static internal HSteamPipe GetHSteamPipe()
{
return Native.SteamGameServer_GetHSteamPipe();
}
}
}

View File

@ -0,0 +1,28 @@
using System;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using Steamworks.Data;
namespace Steamworks
{
internal static class SteamInternal
{
internal static class Native
{
[DllImport( Platform.LibraryName, EntryPoint = "SteamInternal_GameServer_Init_V2", CallingConvention = CallingConvention.Cdecl )]
public static extern SteamAPIInitResult SteamInternal_GameServer_Init_V2( uint unIP, ushort usGamePort, ushort usQueryPort, int eServerMode, IntPtr pchVersionString, IntPtr pszInternalCheckInterfaceVersions, IntPtr pOutErrMsg );
}
static internal SteamAPIInitResult GameServer_Init( uint unIP, ushort usGamePort, ushort usQueryPort, int eServerMode, string pchVersionString, string pszInternalCheckInterfaceVersions, out string pOutErrMsg )
{
using var versionStr = new Utf8StringToNative( pchVersionString );
using var interfaceVersionsStr = new Utf8StringToNative( pszInternalCheckInterfaceVersions );
using var buffer = Helpers.Memory.Take();
var result = Native.SteamInternal_GameServer_Init_V2( unIP, usGamePort, usQueryPort, eServerMode, versionStr.Pointer, interfaceVersionsStr.Pointer, buffer.Ptr );
pOutErrMsg = Helpers.MemoryToString( buffer.Ptr );
return result;
}
}
}

View File

@ -1,114 +0,0 @@

using System;
using System.Runtime.InteropServices;
namespace Facepunch.Steamworks
{
public partial class Client : BaseSteamworks
{
/// <summary>
/// Current user's Username
/// </summary>
public string Username { get; private set; }
/// <summary>
/// Current user's SteamId
/// </summary>
public ulong SteamId { get; private set; }
/// <summary>
/// Current Beta name, if ser
/// </summary>
public string BetaName { get; private set; }
public Voice Voice { get; internal set; }
public Client( uint appId )
{
Valve.Steamworks.SteamAPIInterop.SteamAPI_Init();
native = new Interop.NativeInterface();
//
// Get other interfaces
//
if ( !native.InitClient() )
{
native.Dispose();
native = null;
return;
}
//
// Set up warning hook callback
//
SteamAPIWarningMessageHook ptr = InternalOnWarning;
native.client.SetWarningMessageHook( Marshal.GetFunctionPointerForDelegate( ptr ) );
//
// Setup interfaces that client and server both have
//
SetupCommonInterfaces();
//
// Client only interfaces
//
Voice = new Voice( this );
//
// Cache common, unchanging info
//
AppId = appId;
Username = native.friends.GetPersonaName();
SteamId = native.user.GetSteamID();
BetaName = native.apps.GetCurrentBetaName();
//
// Run update, first call does some initialization
//
Update();
}
[UnmanagedFunctionPointer( CallingConvention.Cdecl )]
public delegate void SteamAPIWarningMessageHook( int nSeverity, System.Text.StringBuilder pchDebugText );
private void InternalOnWarning( int nSeverity, System.Text.StringBuilder text )
{
if ( OnMessage != null )
{
OnMessage( ( MessageType)nSeverity, text.ToString() );
}
}
/// <summary>
/// Should be called at least once every frame
/// </summary>
public override void Update()
{
if ( !IsValid )
return;
Valve.Steamworks.SteamAPI.RunCallbacks();
Voice.Update();
base.Update();
}
public override void Dispose()
{
if ( Voice != null )
{
Voice.Dispose();
Voice = null;
}
base.Dispose();
Valve.Interop.NativeEntrypoints.Extended.SteamAPI_Shutdown();
}
}
}

View File

@ -1,52 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Facepunch.Steamworks
{
public partial class Client : IDisposable
{
App _app;
public App App
{
get
{
if ( _app == null )
_app = new App( this );
return _app;
}
}
}
public class App
{
internal Client client;
internal App( Client c )
{
client = c;
}
public void MarkContentCorrupt( bool missingFilesOnly = false )
{
client.native.apps.MarkContentCorrupt( missingFilesOnly );
}
/// <summary>
/// Returns the current BuildId of the game.
/// This is pretty useless, as it isn't guarenteed to return
/// the build id you're playing, or the latest build id.
/// </summary>
public int BuildId
{
get
{
return client.native.apps.GetAppBuildId();
}
}
}
}

View File

@ -1,82 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Facepunch.Steamworks
{
public partial class Client : IDisposable
{
Auth _auth;
public Auth Auth
{
get
{
if ( _auth == null )
_auth = new Auth{ client = this };
return _auth;
}
}
}
public class Auth
{
internal Client client;
public class Ticket : IDisposable
{
internal Client client;
public byte[] Data;
public uint Handle;
/// <summary>
/// Cancels a ticket.
/// You should cancel your ticket when you close the game or leave a server.
/// </summary>
public void Cancel()
{
if ( client.IsValid && Handle != 0 )
{
client.native.user.CancelAuthTicket( Handle );
Handle = 0;
Data = null;
}
}
public void Dispose()
{
Cancel();
}
}
/// <summary>
/// Creates an auth ticket.
/// Which you can send to a server to authenticate that you are who you say you are.
/// </summary>
public unsafe Ticket GetAuthSessionTicket()
{
var data = new byte[1024];
fixed ( byte* b = data )
{
uint ticketLength = 0;
uint ticket = client.native.user.GetAuthSessionTicket( (IntPtr) b, data.Length, ref ticketLength );
if ( ticket == 0 )
return null;
return new Ticket()
{
client = client,
Data = data.Take( (int)ticketLength ).ToArray(),
Handle = ticket
};
}
}
}
}

View File

@ -1,248 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Valve.Steamworks;
namespace Facepunch.Steamworks
{
public partial class Client : IDisposable
{
Friends _friends;
public Friends Friends
{
get
{
if ( _friends == null )
_friends = new Friends( this );
return _friends;
}
}
}
public class SteamFriend
{
/// <summary>
/// Steam Id
/// </summary>
public ulong Id { get; internal set; }
/// <summary>
/// Return true if blocked
/// </summary>
public bool IsBlocked { get; internal set; }
/// <summary>
/// Return true if is a friend. Returns false if blocked, request etc.
/// </summary>
public bool IsFriend { get; internal set; }
/// <summary>
/// Their current display name
/// </summary>
public string Name;
/// <summary>
/// Returns true if this friend is online
/// </summary>
public bool IsOnline { get; internal set; }
/// <summary>
/// Returns true if this friend is online and playing this game
/// </summary>
public bool IsPlayingThisGame { get { return CurrentAppId == Client.AppId; } }
/// <summary>
/// Returns true if this friend is online and playing this game
/// </summary>
public bool IsPlaying { get { return CurrentAppId != 0; } }
/// <summary>
/// The AppId this guy is playing
/// </summary>
public ulong CurrentAppId { get; internal set; }
public uint ServerIp { get; internal set; }
public int ServerGamePort { get; internal set; }
public int ServerQueryPort { get; internal set; }
public ulong ServerLobbyId { get; internal set; }
internal Client Client { get; set; }
public void Refresh()
{
Name = Client.native.friends.GetFriendPersonaName( Id );
EFriendRelationship relationship = (EFriendRelationship) Client.native.friends.GetFriendRelationship( Id );
IsBlocked = relationship == EFriendRelationship.k_EFriendRelationshipBlocked;
IsFriend = relationship == EFriendRelationship.k_EFriendRelationshipFriend;
CurrentAppId = 0;
ServerIp = 0;
ServerGamePort = 0;
ServerQueryPort = 0;
ServerLobbyId = 0;
FriendGameInfo_t gameInfo = new FriendGameInfo_t();
if ( Client.native.friends.GetFriendGamePlayed( Id, out gameInfo ) && gameInfo.m_gameID > 0 )
{
CurrentAppId = gameInfo.m_gameID;
ServerIp = gameInfo.m_unGameIP;
ServerGamePort = gameInfo.m_usGamePort;
ServerQueryPort = gameInfo.m_usQueryPort;
ServerLobbyId = gameInfo.m_steamIDLobby;
}
}
}
public class Friends
{
internal Client client;
internal Friends( Client c )
{
client = c;
}
public string GetName( ulong steamid )
{
client.native.friends.RequestUserInformation( steamid, true );
return client.native.friends.GetFriendPersonaName( steamid );
}
private List<SteamFriend> _allFriends;
/// <summary>
/// Returns all friends, even blocked, ignored, friend requests etc
/// </summary>
public IEnumerable<SteamFriend> All
{
get
{
if ( _allFriends == null )
{
_allFriends = new List<SteamFriend>();
Refresh();
}
return _allFriends;
}
}
public IEnumerable<SteamFriend> AllFriends
{
get
{
foreach ( var friend in All )
{
if ( !friend.IsFriend ) continue;
yield return friend;
}
}
}
public IEnumerable<SteamFriend> AllBlocked
{
get
{
foreach ( var friend in All )
{
if ( !friend.IsBlocked ) continue;
yield return friend;
}
}
}
public void Refresh()
{
if ( _allFriends == null )
{
_allFriends = new List<SteamFriend>();
}
_allFriends.Clear();
var flags = (int) EFriendFlags.k_EFriendFlagAll;
var count = client.native.friends.GetFriendCount( flags );
for ( int i=0; i<count; i++ )
{
var steamid = client.native.friends.GetFriendByIndex( i, flags );
_allFriends.Add( Get( steamid ) );
}
}
public enum AvatarSize
{
/// <summary>
/// Should be 32x32 - but make sure to check!
/// </summary>
Small,
/// <summary>
/// Should be 64x64 - but make sure to check!
/// </summary>
Medium,
/// <summary>
/// Should be 184x184 - but make sure to check!
/// </summary>
Large
}
public Image GetAvatar( AvatarSize size, ulong steamid )
{
var imageid = 0;
switch ( size )
{
case AvatarSize.Small:
imageid = client.native.friends.GetSmallFriendAvatar( steamid );
break;
case AvatarSize.Medium:
imageid = client.native.friends.GetMediumFriendAvatar( steamid );
break;
case AvatarSize.Large:
imageid = client.native.friends.GetLargeFriendAvatar( steamid );
break;
}
var img = new Image()
{
Id = imageid
};
if ( imageid == 0 )
return img;
if ( img.TryLoad( client.native.utils ) )
return img;
throw new System.NotImplementedException( "Deferred Avatar Loading Todo" );
// Add to image loading list
//return img;
}
public SteamFriend Get( ulong steamid )
{
var f = new SteamFriend()
{
Id = steamid,
Client = client
};
f.Refresh();
return f;
}
}
}

View File

@ -1,81 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Valve.Steamworks;
namespace Facepunch.Steamworks
{
public class Image
{
public int Id { get; internal set; }
public int Width { get; internal set; }
public int Height { get; internal set; }
public byte[] Data { get; internal set; }
public bool IsLoaded { get; internal set; }
/// <summary>
/// Return true if this image couldn't be loaded for some reason
/// </summary>
public bool IsError { get; internal set; }
unsafe internal bool TryLoad( ISteamUtils utils )
{
if ( IsLoaded ) return true;
uint width = 0, height = 0;
if ( utils.GetImageSize( Id, ref width, ref height ) == false )
{
IsError = true;
return true;
}
var buffer = new byte[ width * height * 4 ];
fixed ( byte* ptr = buffer )
{
if ( utils.GetImageRGBA( Id, (IntPtr) ptr, buffer.Length ) == false )
{
IsError = true;
return true;
}
}
Width = (int) width;
Height = (int) height;
Data = buffer;
IsLoaded = true;
IsError = false;
return true;
}
public Color GetPixel( int x, int y )
{
if ( !IsLoaded ) throw new System.Exception( "Image not loaded" );
if ( x < 0 || x >= Width ) throw new System.Exception( "x out of bounds" );
if ( y < 0 || y >= Height ) throw new System.Exception( "y out of bounds" );
Color c = new Color();
var i = ( y * Width + x ) * 4;
c.r = Data[i + 0];
c.g = Data[i + 1];
c.b = Data[i + 2];
c.a = Data[i + 3];
return c;
}
}
public struct Color
{
public byte r, g, b, a;
}
}

View File

@ -1,42 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Facepunch.Steamworks
{
public partial class Client : IDisposable
{
private Overlay _overlay;
public Overlay Overlay
{
get
{
if ( _overlay == null )
_overlay = new Overlay { client = this };
return _overlay;
}
}
}
public class Overlay
{
internal Client client;
public void OpenUserPage( string name, ulong steamid ) { client.native.friends.ActivateGameOverlayToUser( name, steamid ); }
public void OpenProfile( ulong steamid ) { OpenUserPage( "steamid", steamid ); }
public void OpenChat( ulong steamid ){ OpenUserPage( "chat", steamid ); }
public void OpenTrade( ulong steamid ) { OpenUserPage( "jointrade", steamid ); }
public void OpenStats( ulong steamid ) { OpenUserPage( "stats", steamid ); }
public void OpenAchievements( ulong steamid ) { OpenUserPage( "achievements", steamid ); }
public void AddFriend( ulong steamid ) { OpenUserPage( "friendadd", steamid ); }
public void RemoveFriend( ulong steamid ) { OpenUserPage( "friendremove", steamid ); }
public void AcceptFriendRequest( ulong steamid ) { OpenUserPage( "friendrequestaccept", steamid ); }
public void IgnoreFriendRequest( ulong steamid ) { OpenUserPage( "friendrequestignore", steamid ); }
public void OpenUrl( string url ) { client.native.friends.ActivateGameOverlayToWebPage( url ); }
}
}

View File

@ -1,39 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Facepunch.Steamworks
{
public partial class Client : IDisposable
{
Screenshots _screenshots;
public Screenshots Screenshots
{
get
{
if ( _screenshots == null )
_screenshots = new Screenshots( this );
return _screenshots;
}
}
}
public class Screenshots
{
internal Client client;
internal Screenshots( Client c )
{
client = c;
}
public void Trigger()
{
client.native.screenshots.TriggerScreenshot();
}
}
}

View File

@ -1,105 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Runtime.InteropServices;
using System.Text;
using Valve.Steamworks;
namespace Facepunch.Steamworks
{
public class Server
{
internal Client client;
internal Server( Client c )
{
client = c;
}
public string Name { get; set; }
public int Ping { get; set; }
public string GameDir { get; set; }
public string Map { get; set; }
public string Description { get; set; }
public uint AppId { get; set; }
public int Players { get; set; }
public int MaxPlayers { get; set; }
public int BotPlayers { get; set; }
public bool Passworded { get; set; }
public bool Secure { get; set; }
public uint LastTimePlayed { get; set; }
public int Version { get; set; }
public string[] Tags { get; set; }
public ulong SteamId { get; set; }
public uint Address { get; set; }
public int ConnectionPort { get; set; }
public int QueryPort { get; set; }
public string AddressString
{
get
{
return string.Format( "{0}.{1}.{2}.{3}", ( Address >> 24 ) & 0xFFul, ( Address >> 16 ) & 0xFFul, ( Address >> 8 ) & 0xFFul, Address & 0xFFul );
}
}
public string ConnectionAddress
{
get
{
return string.Format( "{0}.{1}.{2}.{3}:{4}", ( Address >> 24 ) & 0xFFul, ( Address >> 16 ) & 0xFFul, ( Address >> 8 ) & 0xFFul, Address & 0xFFul, ConnectionPort );
}
}
internal static Server FromSteam( Client c, gameserveritem_t item )
{
return new Server( c )
{
Address = item.m_NetAdr.m_unIP,
ConnectionPort = item.m_NetAdr.m_usConnectionPort,
QueryPort = item.m_NetAdr.m_usQueryPort,
Name = item.m_szServerName,
Ping = item.m_nPing,
GameDir = item.m_szGameDir,
Map = item.m_szMap,
Description = item.m_szGameDescription,
AppId = item.m_nAppID,
Players = item.m_nPlayers,
MaxPlayers = item.m_nMaxPlayers,
BotPlayers = item.m_nBotPlayers,
Passworded = item.m_bPassword,
Secure = item.m_bSecure,
LastTimePlayed = item.m_ulTimeLastPlayed,
Version = item.m_nServerVersion,
Tags = item.m_szGameTags == null ? null : item.m_szGameTags.Split( ',' ),
SteamId = item.m_steamID
};
}
public Dictionary<string, string> Rules;
public Action OnServerRules;
public void UpdateRules()
{
//
//
// TEMPORARY, WE NEED TO WRITE OUR OWN VERSION OF THIS, DOESN'T WORK ON SPLIT PACKETS ETC
//
//
using ( var q = new SourceServerQuery( AddressString, ConnectionPort ) )
{
Rules = q.GetRules();
}
if ( OnServerRules != null && Rules != null )
OnServerRules();
}
}
}

View File

@ -1,215 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using Valve.Steamworks;
namespace Facepunch.Steamworks
{
public partial class ServerList
{
public class Request : IDisposable
{
internal Client client;
internal List<SubRequest> Requests = new List<SubRequest>();
internal class SubRequest
{
internal IntPtr Request;
internal int Pointer = 0;
internal List<int> WatchList = new List<int>();
internal bool Update( ISteamMatchmakingServers servers, Action<gameserveritem_t> OnServer, Action OnUpdate )
{
if ( Request == IntPtr.Zero )
return true;
bool changes = false;
//
// Add any servers we're not watching to our watch list
//
var count = servers.GetServerCount( Request );
if ( count != Pointer )
{
for ( int i = Pointer; i < count; i++ )
{
WatchList.Add( i );
}
}
Pointer = count;
//
// Remove any servers that respond successfully
//
WatchList.RemoveAll( x =>
{
var info = servers.GetServerDetails( Request, x );
if ( info.m_bHadSuccessfulResponse )
{
OnServer( info );
changes = true;
return true;
}
return false;
} );
//
// If we've finished refreshing
//
if ( servers.IsRefreshing( Request ) == false )
{
//
// Put any other servers on the 'no response' list
//
WatchList.RemoveAll( x =>
{
var info = servers.GetServerDetails( Request, x );
OnServer( info );
return true;
} );
servers.CancelQuery( Request );
Request = IntPtr.Zero;
changes = true;
}
if ( changes && OnUpdate != null )
OnUpdate();
return Request == IntPtr.Zero;
}
}
public Action OnUpdate;
/// <summary>
/// A list of servers that responded. If you're only interested in servers that responded since you
/// last updated, then simply clear this list.
/// </summary>
public List<Server> Responded = new List<Server>();
/// <summary>
/// A list of servers that were in the master list but didn't respond.
/// </summary>
public List<Server> Unresponsive = new List<Server>();
/// <summary>
/// True when we have finished
/// </summary>
public bool Finished = false;
internal Request( Client c )
{
client = c;
client.OnUpdate += Update;
}
~Request()
{
Dispose();
}
internal IEnumerable<string> ServerList { get; set; }
internal void StartCustomQuery()
{
if ( ServerList == null )
return;
int blockSize = 16;
int Pointer = 0;
while ( true )
{
var sublist = ServerList.Skip( Pointer ).Take( blockSize );
if ( sublist.Count() == 0 )
break;
Pointer += sublist.Count();
var filter = new Filter();
filter.Add( "or", sublist.Count().ToString() );
foreach ( var server in sublist )
{
filter.Add( "gameaddr", server );
}
filter.Start();
var id = client.native.servers.RequestInternetServerList( client.AppId, filter.NativeArray, filter.Count, IntPtr.Zero );
filter.Free();
AddRequest( id );
}
ServerList = null;
}
internal void AddRequest( IntPtr id )
{
Requests.Add( new SubRequest() { Request = id } );
}
private void Update()
{
if ( Requests.Count == 0 )
return;
for( int i=0; i< Requests.Count(); i++ )
{
if ( Requests[i].Update( client.native.servers, OnServer, OnUpdate ) )
{
Requests.RemoveAt( i );
i--;
}
}
if ( Requests.Count == 0 )
{
Finished = true;
client.OnUpdate -= Update;
}
}
private void OnServer( gameserveritem_t info )
{
if ( info.m_bHadSuccessfulResponse )
{
Responded.Add( Server.FromSteam( client, info ) );
}
else
{
Unresponsive.Add( Server.FromSteam( client, info ) );
}
}
/// <summary>
/// Disposing will end the query
/// </summary>
public void Dispose()
{
client.OnUpdate -= Update;
//
// Cancel the query if it's still running
//
foreach( var subRequest in Requests )
{
if ( client.IsValid )
client.native.servers.CancelQuery( subRequest.Request );
}
Requests.Clear();
}
}
}
}

View File

@ -1,117 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using Valve.Steamworks;
namespace Facepunch.Steamworks
{
public partial class ServerList
{
public class Server
{
public string Name { get; set; }
public int Ping { get; set; }
public string GameDir { get; set; }
public string Map { get; set; }
public string Description { get; set; }
public uint AppId { get; set; }
public int Players { get; set; }
public int MaxPlayers { get; set; }
public int BotPlayers { get; set; }
public bool Passworded { get; set; }
public bool Secure { get; set; }
public uint LastTimePlayed { get; set; }
public int Version { get; set; }
public string[] Tags { get; set; }
public ulong SteamId { get; set; }
public uint Address { get; set; }
public int ConnectionPort { get; set; }
public int QueryPort { get; set; }
internal Client Client;
public string AddressString
{
get
{
return string.Format( "{0}.{1}.{2}.{3}", ( Address >> 24 ) & 0xFFul, ( Address >> 16 ) & 0xFFul, ( Address >> 8 ) & 0xFFul, Address & 0xFFul );
}
}
public string ConnectionAddress
{
get
{
return string.Format( "{0}.{1}.{2}.{3}:{4}", ( Address >> 24 ) & 0xFFul, ( Address >> 16 ) & 0xFFul, ( Address >> 8 ) & 0xFFul, Address & 0xFFul, ConnectionPort );
}
}
internal static Server FromSteam( Client client, gameserveritem_t item )
{
return new Server()
{
Client = client,
Address = item.m_NetAdr.m_unIP,
ConnectionPort = item.m_NetAdr.m_usConnectionPort,
QueryPort = item.m_NetAdr.m_usQueryPort,
Name = item.m_szServerName,
Ping = item.m_nPing,
GameDir = item.m_szGameDir,
Map = item.m_szMap,
Description = item.m_szGameDescription,
AppId = item.m_nAppID,
Players = item.m_nPlayers,
MaxPlayers = item.m_nMaxPlayers,
BotPlayers = item.m_nBotPlayers,
Passworded = item.m_bPassword,
Secure = item.m_bSecure,
LastTimePlayed = item.m_ulTimeLastPlayed,
Version = item.m_nServerVersion,
Tags = item.m_szGameTags == null ? null : item.m_szGameTags.Split( ',' ),
SteamId = item.m_steamID
};
}
/// <summary>
/// Callback when rules are receieved.
/// The bool is true if server responded properly.
/// </summary>
public Action<bool> OnReceivedRules;
/// <summary>
/// List of server rules. Use HasRules to see if this is safe to access.
/// </summary>
public Dictionary<string, string> Rules;
/// <summary>
/// Returns true if this server has rules
/// </summary>
public bool HasRules { get { return Rules != null && Rules.Count > 0; } }
internal Interop.ServerRules RulesRequest;
/// <summary>
/// Populates Rules for this server
/// </summary>
public void FetchRules()
{
if ( RulesRequest != null )
return;
Rules = new Dictionary<string, string>();
RulesRequest = new Interop.ServerRules( this, Address, QueryPort );
}
internal void OnServerRulesReceiveFinished( bool Success )
{
RulesRequest.Dispose();
RulesRequest = null;
if ( OnReceivedRules != null )
OnReceivedRules( Success );
}
}
}
}

View File

@ -1,157 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using Valve.Steamworks;
namespace Facepunch.Steamworks
{
public partial class Client : IDisposable
{
private ServerList _serverlist;
public ServerList ServerList
{
get
{
if ( _serverlist == null )
_serverlist = new ServerList { client = this };
return _serverlist;
}
}
}
public partial class ServerList
{
public class Filter : List<KeyValuePair<string, string>>
{
public void Add( string k, string v )
{
Add( new KeyValuePair<string, string>( k, v ) );
}
internal IntPtr NativeArray;
private IntPtr m_pArrayEntries;
internal void Start()
{
var filters = this.Select( x =>
{
return new MatchMakingKeyValuePair_t()
{
m_szKey = x.Key,
m_szValue = x.Value
};
} ).ToArray();
int sizeOfMMKVP = Marshal.SizeOf(typeof(MatchMakingKeyValuePair_t));
NativeArray = Marshal.AllocHGlobal( Marshal.SizeOf( typeof( IntPtr ) ) * filters.Length );
m_pArrayEntries = Marshal.AllocHGlobal( sizeOfMMKVP * filters.Length );
for ( int i = 0; i < filters.Length; ++i )
{
Marshal.StructureToPtr( filters[i], new IntPtr( m_pArrayEntries.ToInt64() + ( i * sizeOfMMKVP ) ), false );
}
Marshal.WriteIntPtr( NativeArray, m_pArrayEntries );
}
internal void Free()
{
if ( m_pArrayEntries != IntPtr.Zero )
{
Marshal.FreeHGlobal( m_pArrayEntries );
}
if ( NativeArray != IntPtr.Zero )
{
Marshal.FreeHGlobal( NativeArray );
}
}
}
internal Client client;
[StructLayout( LayoutKind.Sequential )]
private struct MatchPair
{
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
public string key;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
public string value;
}
public Request Internet( Filter filter )
{
filter.Start();
var request = new Request( client );
request.AddRequest( client.native.servers.RequestInternetServerList( client.AppId, filter.NativeArray, filter.Count, IntPtr.Zero ) );
filter.Free();
return request;
}
public Request Custom( IEnumerable<string> serverList )
{
var request = new Request( client );
request.ServerList = serverList;
request.StartCustomQuery();
return request;
}
/// <summary>
/// History filters don't seem to work, so we don't bother.
/// You should apply them post process'dly
/// </summary>
public Request History()
{
var request = new Request( client );
request.AddRequest( client.native.servers.RequestHistoryServerList( client.AppId, new IntPtr[] { }, IntPtr.Zero ) );
return request;
}
/// <summary>
/// Favourite filters don't seem to work, so we don't bother.
/// You should apply them post process'dly
/// </summary>
public Request Favourites()
{
var request = new Request( client );
request.AddRequest( client.native.servers.RequestFavoritesServerList( client.AppId, new IntPtr[] { }, IntPtr.Zero ) );
return request;
}
public void AddToHistory( Server server )
{
// client.native.matchmaking
}
public void RemoveFromHistory( Server server )
{
//
}
public void AddToFavourite( Server server )
{
// client.native.matchmaking
}
public void RemoveFromFavourite( Server server )
{
//
}
public bool IsFavourite( Server server )
{
return false;
}
}
}

View File

@ -1,509 +0,0 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Net;
using System.Net.Sockets;
using System.IO;
internal class SourceServerQuery :IDisposable
{
public class PlayersResponse
{
public short player_count;
public List<Player> players = new List<Player>();
public class Player
{
public String name { get; set; }
public int score { get; set; }
public float playtime { get; set; }
}
}
private IPEndPoint endPoint;
private Socket socket;
private UdpClient client;
// send & receive timeouts
private int send_timeout = 2500;
private int receive_timeout = 2500;
// raw response returned from the server
private byte[] raw_data;
private int offset = 0;
// constants
private readonly byte[] FFFFFFFF = new byte[] { 0xFF, 0xFF, 0xFF, 0xFF };
public SourceServerQuery( String ip, int port )
{
this.endPoint = new IPEndPoint( IPAddress.Parse( ip ), port );
}
/// <summary>
/// Get a list of currently in-game clients on the specified gameserver.
/// <b>Please note:</b> the playtime is stored as a float in <i>seconds</i>, you might want to convert it.
///
/// See https://developer.valvesoftware.com/wiki/Server_queries#A2S_PLAYER for more Information
/// </summary>
/// <returns>A PLayersResponse Object containing the name, score and playtime of each player</returns>
public PlayersResponse GetPlayerList()
{
// open socket if not already open
this.GetSocket();
// we don't need the header, so set pointer to where the payload begins
this.offset = 5;
try
{
PlayersResponse pr = new PlayersResponse();
// since A2S_PLAYER requests require a valid challenge, get it first
byte[] challenge = this.GetChallenge(0x55, true);
byte[] request = new byte[challenge.Length + this.FFFFFFFF.Length + 1];
Array.Copy( this.FFFFFFFF, 0, request, 0, this.FFFFFFFF.Length );
request[this.FFFFFFFF.Length] = 0x55;
Array.Copy( challenge, 0, request, this.FFFFFFFF.Length + 1, challenge.Length );
this.socket.Send( request );
// MODIFIED BY ZACKBOE
// Increased byte size from 1024 in order to receive more player data
// Previously returned a socket exception at >~ 51 players.
this.raw_data = new byte[2048];
// END MODIFICATION
this.socket.Receive( this.raw_data );
byte player_count = this.ReadByte();
// fill up the list of players
for ( int i = 0; i < player_count; i++ )
{
this.ReadByte();
PlayersResponse.Player p = new PlayersResponse.Player();
p.name = this.ReadString();
p.score = this.ReadInt32();
p.playtime = this.ReadFloat();
pr.players.Add( p );
}
pr.player_count = player_count;
return pr;
}
catch ( SocketException e )
{
return null;
}
}
/// <summary>
/// Get a list of all publically available CVars ("rules") from the server.
/// <b>Note:</b> Due to a bug in the Source Engine, it might happen that some CVars/values are cut off.
///
/// Example: mp_idlemaxtime = [nothing]
/// Only Valve can fix that.
/// </summary>
/// <returns>A RulesResponse Object containing a Name-Value pair of each CVar</returns>
public Dictionary<string, string> GetRules()
{
// open udpclient if not already open
this.GetClient();
try
{
var d = new Dictionary<string, string>();
// similar to A2S_PLAYER requests, A2S_RULES require a valid challenge
byte[] challenge = this.GetChallenge(0x56, false);
byte[] request = new byte[challenge.Length + this.FFFFFFFF.Length + 1];
Array.Copy( this.FFFFFFFF, 0, request, 0, this.FFFFFFFF.Length );
request[this.FFFFFFFF.Length] = 0x56;
Array.Copy( challenge, 0, request, this.FFFFFFFF.Length + 1, challenge.Length );
this.client.Send( request, request.Length );
//
// Since A2S_RULES responses might be split up into several packages/compressed, we have to do a special handling of them
//
int bytesRead;
// this will keep our assembled message
byte[] buffer = new byte[4096];
// send first request
this.raw_data = this.client.Receive( ref this.endPoint );
bytesRead = this.raw_data.Length;
// reset pointer
this.offset = 0;
int is_split = this.ReadInt32();
int requestid = this.ReadInt32();
this.offset = 4;
// response is split up into several packets
if ( this.PacketIsSplit( is_split ) )
{
bool isCompressed = false;
byte[] splitData;
int packetCount, packetNumber, requestId;
int packetsReceived = 1;
int packetChecksum = 0;
int packetSplit = 0;
short splitSize;
int uncompressedSize = 0;
List<byte[]> splitPackets = new List<byte[]>();
do
{
// unique request id
requestId = this.ReverseBytes( this.ReadInt32() );
isCompressed = this.PacketIsCompressed( requestId );
packetCount = this.ReadByte();
packetNumber = this.ReadByte() + 1;
// so we know how big our byte arrays have to be
splitSize = this.ReadInt16();
splitSize -= 4; // fix
if ( packetsReceived == 1 )
{
for ( int i = 0; i < packetCount; i++ )
{
splitPackets.Add( new byte[] { } );
}
}
// if the packets are compressed, get some data to decompress them
if ( isCompressed )
{
uncompressedSize = ReverseBytes( this.ReadInt32() );
packetChecksum = ReverseBytes( this.ReadInt32() );
}
// ommit header in first packet
if ( packetNumber == 1 ) this.ReadInt32();
splitData = new byte[splitSize];
splitPackets[packetNumber - 1] = this.ReadBytes();
// fixes a case where the returned package might still contain a character after the last \0 terminator (truncated name => value)
// please note: this therefore also removes the value of said variable, but atleast the program won't crash
if ( splitPackets[packetNumber - 1].Length - 1 > 0 && splitPackets[packetNumber - 1][splitPackets[packetNumber - 1].Length - 1] != 0x00 )
{
splitPackets[packetNumber - 1][splitPackets[packetNumber - 1].Length - 1] = 0x00;
}
// reset pointer again, so we can copy over the contents
this.offset = 0;
if ( packetsReceived < packetCount )
{
this.raw_data = this.client.Receive( ref this.endPoint );
bytesRead = this.raw_data.Length;
// continue with the next packets
packetSplit = this.ReadInt32();
packetsReceived++;
}
else
{
// all packets received
bytesRead = 0;
}
}
while ( packetsReceived <= packetCount && bytesRead > 0 && packetSplit == -2 );
// decompress
if ( isCompressed )
{
buffer = ReassemblePacket( splitPackets, true, uncompressedSize, packetChecksum );
}
else
{
buffer = ReassemblePacket( splitPackets, false, 0, 0 );
}
}
else
{
buffer = this.raw_data;
}
// move our final result over to handle it
this.raw_data = buffer;
// omitting header
this.offset += 1;
var count = this.ReadInt16();
for ( int i = 0; i < count; i++ )
{
var k = this.ReadString();
var v = this.ReadString();
if ( !d.ContainsKey( k ) )
d.Add( k, v );
}
return d;
}
catch ( SocketException e )
{
Console.WriteLine( e );
return null;
}
}
/// <summary>
/// Close all currently open socket/UdpClient connections
/// </summary>
public void Dispose()
{
if ( this.socket != null ) this.socket.Close();
if ( this.client != null ) this.client.Close();
}
/// <summary>
/// Open up a new Socket-based connection to a server, if not already open.
/// </summary>
private void GetSocket()
{
if ( this.socket == null )
{
this.socket = new Socket(
AddressFamily.InterNetwork,
SocketType.Dgram,
ProtocolType.Udp );
this.socket.SendTimeout = this.send_timeout;
this.socket.ReceiveTimeout = this.receive_timeout;
this.socket.Connect( this.endPoint );
}
}
/// <summary>
/// Create a new UdpClient connection to a server (mostly used for multi-packet answers)
/// </summary>
private void GetClient()
{
if ( this.client == null )
{
this.client = new UdpClient();
this.client.Connect( this.endPoint );
this.client.DontFragment = true;
this.client.Client.SendTimeout = this.send_timeout;
this.client.Client.ReceiveTimeout = this.receive_timeout;
}
}
/// <summary>
/// Reassmble a multi-packet response.
/// </summary>
/// <param name="splitPackets">The packets to assemble</param>
/// <param name="isCompressed">true: packets are compressed; false: not</param>
/// <param name="uncompressedSize">The size of the message after decompression (for comparison)</param>
/// <param name="packetChecksum">Validation of the result</param>
/// <returns>A byte-array containing all packets assembled together/decompressed.</returns>
private byte[] ReassemblePacket( List<byte[]> splitPackets, bool isCompressed, int uncompressedSize, int packetChecksum )
{
byte[] packetData, tmpData;
packetData = new byte[0];
foreach ( byte[] splitPacket in splitPackets )
{
if ( splitPacket == null )
{
throw new Exception();
}
tmpData = packetData;
packetData = new byte[tmpData.Length + splitPacket.Length];
MemoryStream memStream = new MemoryStream(packetData);
memStream.Write( tmpData, 0, tmpData.Length );
memStream.Write( splitPacket, 0, splitPacket.Length );
}
if ( isCompressed )
{
throw new System.NotImplementedException();
}
return packetData;
}
/// <summary>
/// Invert the Byte-order Mark of an value, used for compatibility between Little <-> Large BOM
/// </summary>
/// <param name="value">The value to invert</param>
/// <returns>BOM-inversed value (if needed), otherwise the original value</returns>
private int ReverseBytes( int value )
{
byte[] bytes = BitConverter.GetBytes(value);
if ( BitConverter.IsLittleEndian )
{
Array.Reverse( bytes );
}
return BitConverter.ToInt32( bytes, 0 );
}
/// <summary>
/// Determine whetever or not a message is compressed.
/// Simply detects if the most significant bit is 1.
/// </summary>
/// <param name="value">The value to check</param>
/// <returns>true, if message is compressed, false otherwise</returns>
private bool PacketIsCompressed( int value )
{
return ( value & 0x8000 ) != 0;
}
/// <summary>
/// Determine whetever or not a message is split up.
/// </summary>
/// <param name="paket">The value to check</param>
/// <returns>true, if message is split up, false otherwise</returns>
private bool PacketIsSplit( int paket )
{
return ( paket == -2 );
}
/// <summary>
/// Request the 4-byte challenge id from the server, required for A2S_RULES and A2S_PLAYER.
/// </summary>
/// <param name="type">The type of message to request the challenge for (see constants)</param>
/// <param name="socket">Request method to use (performance reasons)</param>
/// <returns>A Byte Array (4-bytes) containing the challenge</returns>
private Byte[] GetChallenge( byte type, bool socket = true )
{
byte[] request = new byte[this.FFFFFFFF.Length + this.FFFFFFFF.Length + 1];
Array.Copy( this.FFFFFFFF, 0, request, 0, this.FFFFFFFF.Length );
request[FFFFFFFF.Length] = type;
Array.Copy( this.FFFFFFFF, 0, request, this.FFFFFFFF.Length + 1, this.FFFFFFFF.Length );
byte[] raw_response = new byte[24];
byte[] challenge = new byte[4];
// using sockets
if ( socket )
{
this.socket.Send( request );
this.socket.Receive( raw_response );
}
else
{
this.client.Send( request, request.Length );
raw_response = this.client.Receive( ref this.endPoint );
}
Array.Copy( raw_response, 5, challenge, 0, 4 ); // change this valve modifies the protocol!
return challenge;
}
/// <summary>
/// Read a single byte value from our raw data.
/// </summary>
/// <returns>A single Byte at the next Offset Address</returns>
private Byte ReadByte()
{
byte[] b = new byte[1];
Array.Copy( this.raw_data, this.offset, b, 0, 1 );
this.offset++;
return b[0];
}
/// <summary>
/// Read all remaining Bytes from our raw data.
/// Used for multi-packet responses.
/// </summary>
/// <returns>All remaining data</returns>
private Byte[] ReadBytes()
{
int size = (this.raw_data.Length - this.offset - 4);
if ( size < 1 ) return new Byte[] { };
byte[] b = new byte[size];
Array.Copy( this.raw_data, this.offset, b, 0, this.raw_data.Length - this.offset - 4 );
this.offset += ( this.raw_data.Length - this.offset - 4 );
return b;
}
/// <summary>
/// Read a 32-Bit Integer value from the next offset address.
/// </summary>
/// <returns>The Int32 Value found at the offset address</returns>
private Int32 ReadInt32()
{
byte[] b = new byte[4];
Array.Copy( this.raw_data, this.offset, b, 0, 4 );
this.offset += 4;
return BitConverter.ToInt32( b, 0 );
}
/// <summary>
/// Read a 16-Bit Integer (also called "short") value from the next offset address.
/// </summary>
/// <returns>The Int16 Value found at the offset address</returns>
private Int16 ReadInt16()
{
byte[] b = new byte[2];
Array.Copy( this.raw_data, this.offset, b, 0, 2 );
this.offset += 2;
return BitConverter.ToInt16( b, 0 );
}
/// <summary>
/// Read a Float value from the next offset address.
/// </summary>
/// <returns>The Float Value found at the offset address</returns>
private float ReadFloat()
{
byte[] b = new byte[4];
Array.Copy( this.raw_data, this.offset, b, 0, 4 );
this.offset += 4;
return BitConverter.ToSingle( b, 0 );
}
/// <summary>
/// Read a String until its end starting from the next offset address.
/// Reading stops once the method detects a 0x00 Character at the next position (\0 terminator)
/// </summary>
/// <returns>The String read</returns>
private String ReadString()
{
byte[] cache = new byte[1] { 0x01 };
String output = "";
while ( cache[0] != 0x00 )
{
if ( this.offset == this.raw_data.Length ) break; // fixes Valve's inability to code a proper query protocol
Array.Copy( this.raw_data, this.offset, cache, 0, 1 );
this.offset++;
if ( cache[0] != 0x00)
output += Encoding.UTF8.GetString( cache );
}
return output;
}
}

View File

@ -1,74 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Facepunch.Steamworks
{
public partial class Client : IDisposable
{
Stats _stats;
public Stats Stats
{
get
{
if ( _stats == null )
_stats = new Stats( this );
return _stats;
}
}
}
public class Stats
{
internal Client client;
internal Stats( Client c )
{
client = c;
}
public void UpdateStats()
{
client.native.userstats.RequestCurrentStats();
}
public void UpdateGlobalStats( int days = 1 )
{
client.native.userstats.GetNumberOfCurrentPlayers();
client.native.userstats.RequestGlobalAchievementPercentages();
client.native.userstats.RequestGlobalStats( days );
}
public int GetInt( string name )
{
int data = 0;
client.native.userstats.GetStat( name, ref data );
return data;
}
public long GetGlobalInt( string name )
{
long data = 0;
client.native.userstats.GetGlobalStat( name, ref data );
return data;
}
public float GetFloat( string name )
{
float data = 0;
client.native.userstats.GetStat0( name, ref data );
return data;
}
public double GetGlobalFloat( string name )
{
double data = 0;
client.native.userstats.GetGlobalStat0( name, ref data );
return data;
}
}
}

View File

@ -1,162 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
namespace Facepunch.Steamworks
{
public class Voice : IDisposable
{
const int ReadBufferSize = 1024 * 128;
const int UncompressBufferSize = 1024 * 256;
internal Client client;
internal IntPtr ReadCompressedBuffer;
internal IntPtr ReadUncompressedBuffer;
internal IntPtr UncompressBuffer;
public Action<IntPtr, int> OnCompressedData;
public Action<IntPtr, int> OnUncompressedData;
/// <summary>
/// Returns the optimal sample rate for voice - according to Steam
/// </summary>
public uint OptimalSampleRate
{
get { return client.native.user.GetVoiceOptimalSampleRate(); }
}
private bool _wantsrecording = false;
/// <summary>
/// If set to true we are listening to the mic.
/// You should usually toggle this with the press of a key for push to talk.
/// </summary>
public bool WantsRecording
{
get { return _wantsrecording; }
set
{
_wantsrecording = value;
if ( value )
{
client.native.user.StartVoiceRecording();
}
else
{
client.native.user.StopVoiceRecording();
}
}
}
/// <summary>
/// The last time voice was detected, recorded
/// </summary>
public DateTime LastVoiceRecordTime { get; private set; }
public TimeSpan TimeSinceLastVoiceRecord { get { return DateTime.Now.Subtract( LastVoiceRecordTime ); } }
public bool IsRecording = false;
/// <summary>
/// If set we will capture the audio at this rate. If unset (set to 0) will capture at OptimalSampleRate
/// </summary>
public uint DesiredSampleRate = 0;
public Voice( Client client )
{
this.client = client;
ReadCompressedBuffer = Marshal.AllocHGlobal( ReadBufferSize );
ReadUncompressedBuffer = Marshal.AllocHGlobal( ReadBufferSize );
UncompressBuffer = Marshal.AllocHGlobal( UncompressBufferSize );
}
public void Dispose()
{
Marshal.FreeHGlobal( ReadCompressedBuffer );
Marshal.FreeHGlobal( ReadUncompressedBuffer );
Marshal.FreeHGlobal( UncompressBuffer );
}
internal void Update()
{
if ( OnCompressedData == null && OnUncompressedData == null )
return;
uint bufferRegularLastWrite = 0;
uint bufferCompressedLastWrite = 0;
Valve.Steamworks.EVoiceResult result = (Valve.Steamworks.EVoiceResult) client.native.user.GetVoice( OnCompressedData != null, ReadCompressedBuffer, ReadBufferSize, ref bufferCompressedLastWrite,
OnUncompressedData != null, (IntPtr) ReadUncompressedBuffer, ReadBufferSize, ref bufferRegularLastWrite,
DesiredSampleRate == 0 ? OptimalSampleRate : DesiredSampleRate );
Console.WriteLine( result );
IsRecording = true;
if ( result == Valve.Steamworks.EVoiceResult.k_EVoiceResultOK )
{
if ( OnCompressedData != null && bufferCompressedLastWrite > 0 )
{
OnCompressedData( ReadCompressedBuffer, (int)bufferCompressedLastWrite );
}
if ( OnUncompressedData != null && bufferRegularLastWrite > 0 )
{
OnUncompressedData( ReadUncompressedBuffer, (int)bufferRegularLastWrite );
}
LastVoiceRecordTime = DateTime.Now;
}
if ( result == Valve.Steamworks.EVoiceResult.k_EVoiceResultNotRecording ||
result == Valve.Steamworks.EVoiceResult.k_EVoiceResultNotInitialized )
IsRecording = false;
}
public unsafe bool Decompress( byte[] input, MemoryStream output, uint samepleRate = 0 )
{
fixed ( byte* p = input )
{
return Decompress( (IntPtr)p, 0, input.Length, output, samepleRate );
}
}
public unsafe bool Decompress( IntPtr input, int inputoffset, int inputsize, MemoryStream output, uint samepleRate = 0 )
{
if ( samepleRate == 0 )
samepleRate = OptimalSampleRate;
uint bytesOut = 0;
var result = (Valve.Steamworks.EVoiceResult) client.native.user.DecompressVoice( (IntPtr)( ((byte*)input) + inputoffset ), (uint) inputsize, UncompressBuffer, UncompressBufferSize, ref bytesOut, samepleRate );
if ( bytesOut > 0 )
output.SetLength( bytesOut );
if ( result == Valve.Steamworks.EVoiceResult.k_EVoiceResultOK )
{
if ( output.Capacity < bytesOut )
output.Capacity = (int) bytesOut;
output.SetLength( bytesOut );
Marshal.Copy( UncompressBuffer, output.GetBuffer(), 0, (int) bytesOut );
return true;
}
return false;
}
}
}

View File

@ -1,37 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Facepunch.Steamworks
{
public static class Config
{
/// <summary>
/// Some platforms allow/need CallingConvention.ThisCall. If you're crashing with argument null
/// errors on certain platforms, try flipping this to true.
///
/// I owe this logic to Riley Labrecque's hard work on Steamworks.net - I don't have the knowledge
/// or patience to find this shit on my own, so massive thanks to him. And also massive thanks to him
/// for releasing his shit open source under the MIT license so we can all learn and iterate.
///
/// </summary>
public static bool UseThisCall { get; set; } = true;
/// <summary>
/// Set this to true on Linux and OSX
/// </summary>
public static bool PackSmall { get; set; } = false;
/// <summary>
/// The Native dll to look for. This is the steam_api.dll renamed.
/// We need to rename the dll anyway because we can't dynamically choose the library
/// ie, we can't load steam_api64.dll on windows 64 platforms. So instead we choose to
/// keep the library name the same.
///
/// This is exposed only for the benefit of implementation - and cannot be changed at runtime.
/// </summary>
public const string LibraryName = "FacepunchSteamworksApi";
}
}

View File

@ -0,0 +1,20 @@
namespace Steamworks.Data
{
public enum LeaderboardDisplay : int
{
/// <summary>
/// The score is just a simple numerical value
/// </summary>
Numeric = 1,
/// <summary>
/// The score represents a time, in seconds
/// </summary>
TimeSeconds = 2,
/// <summary>
/// The score represents a time, in milliseconds
/// </summary>
TimeMilliSeconds = 3,
}
}

View File

@ -0,0 +1,15 @@
namespace Steamworks.Data
{
public enum LeaderboardSort : int
{
/// <summary>
/// The top-score is the lowest number
/// </summary>
Ascending = 1,
/// <summary>
/// The top-score is the highest number
/// </summary>
Descending = 2,
}
}

View File

@ -0,0 +1,42 @@
using System;
namespace Steamworks.Data
{
[Flags]
public enum SendType : int
{
/// <summary>
/// Send the message unreliably. Can be lost. Messages *can* be larger than a
/// single MTU (UDP packet), but there is no retransmission, so if any piece
/// of the message is lost, the entire message will be dropped.
///
/// The sending API does have some knowledge of the underlying connection, so
/// if there is no NAT-traversal accomplished or there is a recognized adjustment
/// happening on the connection, the packet will be batched until the connection
/// is open again.
/// </summary>
Unreliable = 0,
/// <summary>
/// Disable Nagle's algorithm.
/// By default, Nagle's algorithm is applied to all outbound messages. This means
/// that the message will NOT be sent immediately, in case further messages are
/// sent soon after you send this, which can be grouped together. Any time there
/// is enough buffered data to fill a packet, the packets will be pushed out immediately,
/// but partially-full packets not be sent until the Nagle timer expires.
/// </summary>
NoNagle = 1 << 0,
/// <summary>
/// If the message cannot be sent very soon (because the connection is still doing some initial
/// handshaking, route negotiations, etc), then just drop it. This is only applicable for unreliable
/// messages. Using this flag on reliable messages is invalid.
/// </summary>
NoDelay = 1 << 2,
/// Reliable message send. Can send up to 0.5mb in a single message.
/// Does fragmentation/re-assembly of messages under the hood, as well as a sliding window for
/// efficient sends of large chunks of data.
Reliable = 1 << 3
}
}

View File

@ -0,0 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<AssemblyName>Facepunch.Steamworks.Posix</AssemblyName>
<DefineConstants>$(DefineConstants);PLATFORM_POSIX</DefineConstants>
<TargetFrameworks>netstandard2.1;net6.0;net46</TargetFrameworks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>10</LangVersion>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<RootNamespace>Steamworks</RootNamespace>
</PropertyGroup>
<Import Project="Facepunch.Steamworks.targets" />
</Project>

View File

@ -0,0 +1,42 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<AssemblyName>Facepunch.Steamworks.Win32</AssemblyName>
<DefineConstants>$(DefineConstants);PLATFORM_WIN32;PLATFORM_WIN</DefineConstants>
<TargetFrameworks>netstandard2.1;net6.0;net46</TargetFrameworks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
<RootNamespace>Steamworks</RootNamespace>
</PropertyGroup>
<PropertyGroup>
<FrameworkPathOverride Condition="'$(TargetFramework)' == 'net40'">C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\Profile\Client</FrameworkPathOverride>
<Authors>Garry Newman</Authors>
<PackageId>Facepunch.Steamworks.win32</PackageId>
<PackageDescription>Steamworks implementation with an emphasis on making things easy. For Windows x86.</PackageDescription>
<PackageProjectUrl>https://github.com/Facepunch/Facepunch.Steamworks</PackageProjectUrl>
<PackageIcon>Facepunch.Steamworks.jpg</PackageIcon>
<PackageTags>facepunch;steam;unity;steamworks;valve</PackageTags>
<LangVersion>10</LangVersion>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<RepositoryUrl>https://github.com/Facepunch/Facepunch.Steamworks.git</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
</PropertyGroup>
<ItemGroup>
<None Include="Facepunch.Steamworks.jpg">
<Pack>true</Pack>
<PackagePath>/</PackagePath>
</None>
<None Include="steam_api.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<Pack>true</Pack>
<PackagePath>content</PackagePath>
</None>
</ItemGroup>
<Import Project="Facepunch.Steamworks.targets" />
</Project>

View File

@ -0,0 +1,55 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<AssemblyName>Facepunch.Steamworks.Win64</AssemblyName>
<DefineConstants>$(DefineConstants);PLATFORM_WIN64;PLATFORM_WIN;PLATFORM_64</DefineConstants>
<TargetFrameworks>netstandard2.1;net6.0;net46</TargetFrameworks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
<RootNamespace>Steamworks</RootNamespace>
</PropertyGroup>
<PropertyGroup>
<FrameworkPathOverride Condition="'$(TargetFramework)' == 'net40'">C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\Profile\Client</FrameworkPathOverride>
<Authors>Garry Newman</Authors>
<PackageId>Facepunch.Steamworks</PackageId>
<PackageDescription>Steamworks implementation with an emphasis on making things easy. For Windows x64.</PackageDescription>
<PackageProjectUrl>https://github.com/Facepunch/Facepunch.Steamworks</PackageProjectUrl>
<PackageIcon>Facepunch.Steamworks.jpg</PackageIcon>
<PackageTags>facepunch;steam;unity;steamworks;valve</PackageTags>
<LangVersion>10</LangVersion>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<RepositoryUrl>https://github.com/Facepunch/Facepunch.Steamworks.git</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
</PropertyGroup>
<ItemGroup>
<None Include="Facepunch.Steamworks.jpg">
<Pack>true</Pack>
<PackagePath>/</PackagePath>
</None>
<None Include="steam_api64.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<Pack>true</Pack>
<PackagePath>content</PackagePath>
</None>
</ItemGroup>
<Import Project="Facepunch.Steamworks.targets" />
<Target Name="PostBuildHome" AfterTargets="PostBuildEvent" Condition="'$(Computername)'=='GarryBasementPc'">
<Exec Command="Copy $(TargetDir)\Facepunch.Steamworks.Win64.* C:\plastic\RustMain\Assets\Plugins\Facepunch.Steamworks\" />
<Exec Command="Copy $(TargetDir)\Facepunch.Steamworks.Posix.* C:\plastic\RustMain\Assets\Plugins\Facepunch.Steamworks\" />
</Target>
<Target Name="PostBuildOffice" AfterTargets="PostBuildEvent" Condition="'$(Computername)'=='GARRYSOFFICEPC'">
<Exec Command="Copy $(TargetDir)\Facepunch.Steamworks.Win64.* C:\Plastic\Rust\Assets\Plugins\Facepunch.Steamworks\" />
<Exec Command="Copy $(TargetDir)\Facepunch.Steamworks.Posix.* C:\Plastic\Rust\Assets\Plugins\Facepunch.Steamworks\" />
<Exec Command="Copy $(TargetDir)\Facepunch.Steamworks.Win64.* C:\Git\Facepunch.Steamworks.UnityTest\Assets\Steamworks" />
<Exec Command="Copy $(TargetDir)\Facepunch.Steamworks.Win32.* C:\Git\Facepunch.Steamworks.UnityTest\Assets\Steamworks" />
<Exec Command="Copy $(TargetDir)\Facepunch.Steamworks.Posix.* C:\Git\Facepunch.Steamworks.UnityTest\Assets\Steamworks" />
</Target>
</Project>

Some files were not shown because too many files have changed in this diff Show More