isteamgameserverugc.cs (33506B)
1 // This file is provided under The MIT License as part of Steamworks.NET. 2 // Copyright (c) 2013-2019 Riley Labrecque 3 // Please see the included LICENSE.txt for additional information. 4 5 // This file is automatically generated. 6 // Changes to this file will be reverted when you update Steamworks.NET 7 8 #if UNITY_ANDROID || UNITY_IOS || UNITY_TIZEN || UNITY_TVOS || UNITY_WEBGL || UNITY_WSA || UNITY_PS4 || UNITY_WII || UNITY_XBOXONE || UNITY_SWITCH 9 #define DISABLESTEAMWORKS 10 #endif 11 12 #if !DISABLESTEAMWORKS 13 14 using System.Runtime.InteropServices; 15 using IntPtr = System.IntPtr; 16 17 namespace Steamworks { 18 public static class SteamGameServerUGC { 19 /// <summary> 20 /// <para> Query UGC associated with a user. Creator app id or consumer app id must be valid and be set to the current running app. unPage should start at 1.</para> 21 /// </summary> 22 public static UGCQueryHandle_t CreateQueryUserUGCRequest(AccountID_t unAccountID, EUserUGCList eListType, EUGCMatchingUGCType eMatchingUGCType, EUserUGCListSortOrder eSortOrder, AppId_t nCreatorAppID, AppId_t nConsumerAppID, uint unPage) { 23 InteropHelp.TestIfAvailableGameServer(); 24 return (UGCQueryHandle_t)NativeMethods.ISteamUGC_CreateQueryUserUGCRequest(CSteamGameServerAPIContext.GetSteamUGC(), unAccountID, eListType, eMatchingUGCType, eSortOrder, nCreatorAppID, nConsumerAppID, unPage); 25 } 26 27 /// <summary> 28 /// <para> Query for all matching UGC. Creator app id or consumer app id must be valid and be set to the current running app. unPage should start at 1.</para> 29 /// </summary> 30 public static UGCQueryHandle_t CreateQueryAllUGCRequest(EUGCQuery eQueryType, EUGCMatchingUGCType eMatchingeMatchingUGCTypeFileType, AppId_t nCreatorAppID, AppId_t nConsumerAppID, uint unPage) { 31 InteropHelp.TestIfAvailableGameServer(); 32 return (UGCQueryHandle_t)NativeMethods.ISteamUGC_CreateQueryAllUGCRequest(CSteamGameServerAPIContext.GetSteamUGC(), eQueryType, eMatchingeMatchingUGCTypeFileType, nCreatorAppID, nConsumerAppID, unPage); 33 } 34 35 /// <summary> 36 /// <para> Query for all matching UGC using the new deep paging interface. Creator app id or consumer app id must be valid and be set to the current running app. pchCursor should be set to NULL or "*" to get the first result set.</para> 37 /// </summary> 38 public static UGCQueryHandle_t CreateQueryAllUGCRequest(EUGCQuery eQueryType, EUGCMatchingUGCType eMatchingeMatchingUGCTypeFileType, AppId_t nCreatorAppID, AppId_t nConsumerAppID, string pchCursor = null) { 39 InteropHelp.TestIfAvailableGameServer(); 40 using (var pchCursor2 = new InteropHelp.UTF8StringHandle(pchCursor)) { 41 return (UGCQueryHandle_t)NativeMethods.ISteamUGC_CreateQueryAllUGCRequest0(CSteamGameServerAPIContext.GetSteamUGC(), eQueryType, eMatchingeMatchingUGCTypeFileType, nCreatorAppID, nConsumerAppID, pchCursor2); 42 } 43 } 44 45 /// <summary> 46 /// <para> Query for the details of the given published file ids (the RequestUGCDetails call is deprecated and replaced with this)</para> 47 /// </summary> 48 public static UGCQueryHandle_t CreateQueryUGCDetailsRequest(PublishedFileId_t[] pvecPublishedFileID, uint unNumPublishedFileIDs) { 49 InteropHelp.TestIfAvailableGameServer(); 50 return (UGCQueryHandle_t)NativeMethods.ISteamUGC_CreateQueryUGCDetailsRequest(CSteamGameServerAPIContext.GetSteamUGC(), pvecPublishedFileID, unNumPublishedFileIDs); 51 } 52 53 /// <summary> 54 /// <para> Send the query to Steam</para> 55 /// </summary> 56 public static SteamAPICall_t SendQueryUGCRequest(UGCQueryHandle_t handle) { 57 InteropHelp.TestIfAvailableGameServer(); 58 return (SteamAPICall_t)NativeMethods.ISteamUGC_SendQueryUGCRequest(CSteamGameServerAPIContext.GetSteamUGC(), handle); 59 } 60 61 /// <summary> 62 /// <para> Retrieve an individual result after receiving the callback for querying UGC</para> 63 /// </summary> 64 public static bool GetQueryUGCResult(UGCQueryHandle_t handle, uint index, out SteamUGCDetails_t pDetails) { 65 InteropHelp.TestIfAvailableGameServer(); 66 return NativeMethods.ISteamUGC_GetQueryUGCResult(CSteamGameServerAPIContext.GetSteamUGC(), handle, index, out pDetails); 67 } 68 69 public static bool GetQueryUGCPreviewURL(UGCQueryHandle_t handle, uint index, out string pchURL, uint cchURLSize) { 70 InteropHelp.TestIfAvailableGameServer(); 71 IntPtr pchURL2 = Marshal.AllocHGlobal((int)cchURLSize); 72 bool ret = NativeMethods.ISteamUGC_GetQueryUGCPreviewURL(CSteamGameServerAPIContext.GetSteamUGC(), handle, index, pchURL2, cchURLSize); 73 pchURL = ret ? InteropHelp.PtrToStringUTF8(pchURL2) : null; 74 Marshal.FreeHGlobal(pchURL2); 75 return ret; 76 } 77 78 public static bool GetQueryUGCMetadata(UGCQueryHandle_t handle, uint index, out string pchMetadata, uint cchMetadatasize) { 79 InteropHelp.TestIfAvailableGameServer(); 80 IntPtr pchMetadata2 = Marshal.AllocHGlobal((int)cchMetadatasize); 81 bool ret = NativeMethods.ISteamUGC_GetQueryUGCMetadata(CSteamGameServerAPIContext.GetSteamUGC(), handle, index, pchMetadata2, cchMetadatasize); 82 pchMetadata = ret ? InteropHelp.PtrToStringUTF8(pchMetadata2) : null; 83 Marshal.FreeHGlobal(pchMetadata2); 84 return ret; 85 } 86 87 public static bool GetQueryUGCChildren(UGCQueryHandle_t handle, uint index, PublishedFileId_t[] pvecPublishedFileID, uint cMaxEntries) { 88 InteropHelp.TestIfAvailableGameServer(); 89 return NativeMethods.ISteamUGC_GetQueryUGCChildren(CSteamGameServerAPIContext.GetSteamUGC(), handle, index, pvecPublishedFileID, cMaxEntries); 90 } 91 92 public static bool GetQueryUGCStatistic(UGCQueryHandle_t handle, uint index, EItemStatistic eStatType, out ulong pStatValue) { 93 InteropHelp.TestIfAvailableGameServer(); 94 return NativeMethods.ISteamUGC_GetQueryUGCStatistic(CSteamGameServerAPIContext.GetSteamUGC(), handle, index, eStatType, out pStatValue); 95 } 96 97 public static uint GetQueryUGCNumAdditionalPreviews(UGCQueryHandle_t handle, uint index) { 98 InteropHelp.TestIfAvailableGameServer(); 99 return NativeMethods.ISteamUGC_GetQueryUGCNumAdditionalPreviews(CSteamGameServerAPIContext.GetSteamUGC(), handle, index); 100 } 101 102 public static bool GetQueryUGCAdditionalPreview(UGCQueryHandle_t handle, uint index, uint previewIndex, out string pchURLOrVideoID, uint cchURLSize, out string pchOriginalFileName, uint cchOriginalFileNameSize, out EItemPreviewType pPreviewType) { 103 InteropHelp.TestIfAvailableGameServer(); 104 IntPtr pchURLOrVideoID2 = Marshal.AllocHGlobal((int)cchURLSize); 105 IntPtr pchOriginalFileName2 = Marshal.AllocHGlobal((int)cchOriginalFileNameSize); 106 bool ret = NativeMethods.ISteamUGC_GetQueryUGCAdditionalPreview(CSteamGameServerAPIContext.GetSteamUGC(), handle, index, previewIndex, pchURLOrVideoID2, cchURLSize, pchOriginalFileName2, cchOriginalFileNameSize, out pPreviewType); 107 pchURLOrVideoID = ret ? InteropHelp.PtrToStringUTF8(pchURLOrVideoID2) : null; 108 Marshal.FreeHGlobal(pchURLOrVideoID2); 109 pchOriginalFileName = ret ? InteropHelp.PtrToStringUTF8(pchOriginalFileName2) : null; 110 Marshal.FreeHGlobal(pchOriginalFileName2); 111 return ret; 112 } 113 114 public static uint GetQueryUGCNumKeyValueTags(UGCQueryHandle_t handle, uint index) { 115 InteropHelp.TestIfAvailableGameServer(); 116 return NativeMethods.ISteamUGC_GetQueryUGCNumKeyValueTags(CSteamGameServerAPIContext.GetSteamUGC(), handle, index); 117 } 118 119 public static bool GetQueryUGCKeyValueTag(UGCQueryHandle_t handle, uint index, uint keyValueTagIndex, out string pchKey, uint cchKeySize, out string pchValue, uint cchValueSize) { 120 InteropHelp.TestIfAvailableGameServer(); 121 IntPtr pchKey2 = Marshal.AllocHGlobal((int)cchKeySize); 122 IntPtr pchValue2 = Marshal.AllocHGlobal((int)cchValueSize); 123 bool ret = NativeMethods.ISteamUGC_GetQueryUGCKeyValueTag(CSteamGameServerAPIContext.GetSteamUGC(), handle, index, keyValueTagIndex, pchKey2, cchKeySize, pchValue2, cchValueSize); 124 pchKey = ret ? InteropHelp.PtrToStringUTF8(pchKey2) : null; 125 Marshal.FreeHGlobal(pchKey2); 126 pchValue = ret ? InteropHelp.PtrToStringUTF8(pchValue2) : null; 127 Marshal.FreeHGlobal(pchValue2); 128 return ret; 129 } 130 131 /// <summary> 132 /// <para> Return the first value matching the pchKey. Note that a key may map to multiple values. Returns false if there was an error or no matching value was found.</para> 133 /// </summary> 134 public static bool GetQueryUGCKeyValueTag(UGCQueryHandle_t handle, uint index, string pchKey, out string pchValue, uint cchValueSize) { 135 InteropHelp.TestIfAvailableGameServer(); 136 IntPtr pchValue2 = Marshal.AllocHGlobal((int)cchValueSize); 137 using (var pchKey2 = new InteropHelp.UTF8StringHandle(pchKey)) { 138 bool ret = NativeMethods.ISteamUGC_GetQueryUGCKeyValueTag0(CSteamGameServerAPIContext.GetSteamUGC(), handle, index, pchKey2, pchValue2, cchValueSize); 139 pchValue = ret ? InteropHelp.PtrToStringUTF8(pchValue2) : null; 140 Marshal.FreeHGlobal(pchValue2); 141 return ret; 142 } 143 } 144 145 /// <summary> 146 /// <para> Release the request to free up memory, after retrieving results</para> 147 /// </summary> 148 public static bool ReleaseQueryUGCRequest(UGCQueryHandle_t handle) { 149 InteropHelp.TestIfAvailableGameServer(); 150 return NativeMethods.ISteamUGC_ReleaseQueryUGCRequest(CSteamGameServerAPIContext.GetSteamUGC(), handle); 151 } 152 153 /// <summary> 154 /// <para> Options to set for querying UGC</para> 155 /// </summary> 156 public static bool AddRequiredTag(UGCQueryHandle_t handle, string pTagName) { 157 InteropHelp.TestIfAvailableGameServer(); 158 using (var pTagName2 = new InteropHelp.UTF8StringHandle(pTagName)) { 159 return NativeMethods.ISteamUGC_AddRequiredTag(CSteamGameServerAPIContext.GetSteamUGC(), handle, pTagName2); 160 } 161 } 162 163 public static bool AddExcludedTag(UGCQueryHandle_t handle, string pTagName) { 164 InteropHelp.TestIfAvailableGameServer(); 165 using (var pTagName2 = new InteropHelp.UTF8StringHandle(pTagName)) { 166 return NativeMethods.ISteamUGC_AddExcludedTag(CSteamGameServerAPIContext.GetSteamUGC(), handle, pTagName2); 167 } 168 } 169 170 public static bool SetReturnOnlyIDs(UGCQueryHandle_t handle, bool bReturnOnlyIDs) { 171 InteropHelp.TestIfAvailableGameServer(); 172 return NativeMethods.ISteamUGC_SetReturnOnlyIDs(CSteamGameServerAPIContext.GetSteamUGC(), handle, bReturnOnlyIDs); 173 } 174 175 public static bool SetReturnKeyValueTags(UGCQueryHandle_t handle, bool bReturnKeyValueTags) { 176 InteropHelp.TestIfAvailableGameServer(); 177 return NativeMethods.ISteamUGC_SetReturnKeyValueTags(CSteamGameServerAPIContext.GetSteamUGC(), handle, bReturnKeyValueTags); 178 } 179 180 public static bool SetReturnLongDescription(UGCQueryHandle_t handle, bool bReturnLongDescription) { 181 InteropHelp.TestIfAvailableGameServer(); 182 return NativeMethods.ISteamUGC_SetReturnLongDescription(CSteamGameServerAPIContext.GetSteamUGC(), handle, bReturnLongDescription); 183 } 184 185 public static bool SetReturnMetadata(UGCQueryHandle_t handle, bool bReturnMetadata) { 186 InteropHelp.TestIfAvailableGameServer(); 187 return NativeMethods.ISteamUGC_SetReturnMetadata(CSteamGameServerAPIContext.GetSteamUGC(), handle, bReturnMetadata); 188 } 189 190 public static bool SetReturnChildren(UGCQueryHandle_t handle, bool bReturnChildren) { 191 InteropHelp.TestIfAvailableGameServer(); 192 return NativeMethods.ISteamUGC_SetReturnChildren(CSteamGameServerAPIContext.GetSteamUGC(), handle, bReturnChildren); 193 } 194 195 public static bool SetReturnAdditionalPreviews(UGCQueryHandle_t handle, bool bReturnAdditionalPreviews) { 196 InteropHelp.TestIfAvailableGameServer(); 197 return NativeMethods.ISteamUGC_SetReturnAdditionalPreviews(CSteamGameServerAPIContext.GetSteamUGC(), handle, bReturnAdditionalPreviews); 198 } 199 200 public static bool SetReturnTotalOnly(UGCQueryHandle_t handle, bool bReturnTotalOnly) { 201 InteropHelp.TestIfAvailableGameServer(); 202 return NativeMethods.ISteamUGC_SetReturnTotalOnly(CSteamGameServerAPIContext.GetSteamUGC(), handle, bReturnTotalOnly); 203 } 204 205 public static bool SetReturnPlaytimeStats(UGCQueryHandle_t handle, uint unDays) { 206 InteropHelp.TestIfAvailableGameServer(); 207 return NativeMethods.ISteamUGC_SetReturnPlaytimeStats(CSteamGameServerAPIContext.GetSteamUGC(), handle, unDays); 208 } 209 210 public static bool SetLanguage(UGCQueryHandle_t handle, string pchLanguage) { 211 InteropHelp.TestIfAvailableGameServer(); 212 using (var pchLanguage2 = new InteropHelp.UTF8StringHandle(pchLanguage)) { 213 return NativeMethods.ISteamUGC_SetLanguage(CSteamGameServerAPIContext.GetSteamUGC(), handle, pchLanguage2); 214 } 215 } 216 217 public static bool SetAllowCachedResponse(UGCQueryHandle_t handle, uint unMaxAgeSeconds) { 218 InteropHelp.TestIfAvailableGameServer(); 219 return NativeMethods.ISteamUGC_SetAllowCachedResponse(CSteamGameServerAPIContext.GetSteamUGC(), handle, unMaxAgeSeconds); 220 } 221 222 /// <summary> 223 /// <para> Options only for querying user UGC</para> 224 /// </summary> 225 public static bool SetCloudFileNameFilter(UGCQueryHandle_t handle, string pMatchCloudFileName) { 226 InteropHelp.TestIfAvailableGameServer(); 227 using (var pMatchCloudFileName2 = new InteropHelp.UTF8StringHandle(pMatchCloudFileName)) { 228 return NativeMethods.ISteamUGC_SetCloudFileNameFilter(CSteamGameServerAPIContext.GetSteamUGC(), handle, pMatchCloudFileName2); 229 } 230 } 231 232 /// <summary> 233 /// <para> Options only for querying all UGC</para> 234 /// </summary> 235 public static bool SetMatchAnyTag(UGCQueryHandle_t handle, bool bMatchAnyTag) { 236 InteropHelp.TestIfAvailableGameServer(); 237 return NativeMethods.ISteamUGC_SetMatchAnyTag(CSteamGameServerAPIContext.GetSteamUGC(), handle, bMatchAnyTag); 238 } 239 240 public static bool SetSearchText(UGCQueryHandle_t handle, string pSearchText) { 241 InteropHelp.TestIfAvailableGameServer(); 242 using (var pSearchText2 = new InteropHelp.UTF8StringHandle(pSearchText)) { 243 return NativeMethods.ISteamUGC_SetSearchText(CSteamGameServerAPIContext.GetSteamUGC(), handle, pSearchText2); 244 } 245 } 246 247 public static bool SetRankedByTrendDays(UGCQueryHandle_t handle, uint unDays) { 248 InteropHelp.TestIfAvailableGameServer(); 249 return NativeMethods.ISteamUGC_SetRankedByTrendDays(CSteamGameServerAPIContext.GetSteamUGC(), handle, unDays); 250 } 251 252 public static bool AddRequiredKeyValueTag(UGCQueryHandle_t handle, string pKey, string pValue) { 253 InteropHelp.TestIfAvailableGameServer(); 254 using (var pKey2 = new InteropHelp.UTF8StringHandle(pKey)) 255 using (var pValue2 = new InteropHelp.UTF8StringHandle(pValue)) { 256 return NativeMethods.ISteamUGC_AddRequiredKeyValueTag(CSteamGameServerAPIContext.GetSteamUGC(), handle, pKey2, pValue2); 257 } 258 } 259 260 /// <summary> 261 /// <para> DEPRECATED - Use CreateQueryUGCDetailsRequest call above instead!</para> 262 /// </summary> 263 public static SteamAPICall_t RequestUGCDetails(PublishedFileId_t nPublishedFileID, uint unMaxAgeSeconds) { 264 InteropHelp.TestIfAvailableGameServer(); 265 return (SteamAPICall_t)NativeMethods.ISteamUGC_RequestUGCDetails(CSteamGameServerAPIContext.GetSteamUGC(), nPublishedFileID, unMaxAgeSeconds); 266 } 267 268 /// <summary> 269 /// <para> Steam Workshop Creator API</para> 270 /// <para> create new item for this app with no content attached yet</para> 271 /// </summary> 272 public static SteamAPICall_t CreateItem(AppId_t nConsumerAppId, EWorkshopFileType eFileType) { 273 InteropHelp.TestIfAvailableGameServer(); 274 return (SteamAPICall_t)NativeMethods.ISteamUGC_CreateItem(CSteamGameServerAPIContext.GetSteamUGC(), nConsumerAppId, eFileType); 275 } 276 277 /// <summary> 278 /// <para> start an UGC item update. Set changed properties before commiting update with CommitItemUpdate()</para> 279 /// </summary> 280 public static UGCUpdateHandle_t StartItemUpdate(AppId_t nConsumerAppId, PublishedFileId_t nPublishedFileID) { 281 InteropHelp.TestIfAvailableGameServer(); 282 return (UGCUpdateHandle_t)NativeMethods.ISteamUGC_StartItemUpdate(CSteamGameServerAPIContext.GetSteamUGC(), nConsumerAppId, nPublishedFileID); 283 } 284 285 /// <summary> 286 /// <para> change the title of an UGC item</para> 287 /// </summary> 288 public static bool SetItemTitle(UGCUpdateHandle_t handle, string pchTitle) { 289 InteropHelp.TestIfAvailableGameServer(); 290 using (var pchTitle2 = new InteropHelp.UTF8StringHandle(pchTitle)) { 291 return NativeMethods.ISteamUGC_SetItemTitle(CSteamGameServerAPIContext.GetSteamUGC(), handle, pchTitle2); 292 } 293 } 294 295 /// <summary> 296 /// <para> change the description of an UGC item</para> 297 /// </summary> 298 public static bool SetItemDescription(UGCUpdateHandle_t handle, string pchDescription) { 299 InteropHelp.TestIfAvailableGameServer(); 300 using (var pchDescription2 = new InteropHelp.UTF8StringHandle(pchDescription)) { 301 return NativeMethods.ISteamUGC_SetItemDescription(CSteamGameServerAPIContext.GetSteamUGC(), handle, pchDescription2); 302 } 303 } 304 305 /// <summary> 306 /// <para> specify the language of the title or description that will be set</para> 307 /// </summary> 308 public static bool SetItemUpdateLanguage(UGCUpdateHandle_t handle, string pchLanguage) { 309 InteropHelp.TestIfAvailableGameServer(); 310 using (var pchLanguage2 = new InteropHelp.UTF8StringHandle(pchLanguage)) { 311 return NativeMethods.ISteamUGC_SetItemUpdateLanguage(CSteamGameServerAPIContext.GetSteamUGC(), handle, pchLanguage2); 312 } 313 } 314 315 /// <summary> 316 /// <para> change the metadata of an UGC item (max = k_cchDeveloperMetadataMax)</para> 317 /// </summary> 318 public static bool SetItemMetadata(UGCUpdateHandle_t handle, string pchMetaData) { 319 InteropHelp.TestIfAvailableGameServer(); 320 using (var pchMetaData2 = new InteropHelp.UTF8StringHandle(pchMetaData)) { 321 return NativeMethods.ISteamUGC_SetItemMetadata(CSteamGameServerAPIContext.GetSteamUGC(), handle, pchMetaData2); 322 } 323 } 324 325 /// <summary> 326 /// <para> change the visibility of an UGC item</para> 327 /// </summary> 328 public static bool SetItemVisibility(UGCUpdateHandle_t handle, ERemoteStoragePublishedFileVisibility eVisibility) { 329 InteropHelp.TestIfAvailableGameServer(); 330 return NativeMethods.ISteamUGC_SetItemVisibility(CSteamGameServerAPIContext.GetSteamUGC(), handle, eVisibility); 331 } 332 333 /// <summary> 334 /// <para> change the tags of an UGC item</para> 335 /// </summary> 336 public static bool SetItemTags(UGCUpdateHandle_t updateHandle, System.Collections.Generic.IList<string> pTags) { 337 InteropHelp.TestIfAvailableGameServer(); 338 return NativeMethods.ISteamUGC_SetItemTags(CSteamGameServerAPIContext.GetSteamUGC(), updateHandle, new InteropHelp.SteamParamStringArray(pTags)); 339 } 340 341 /// <summary> 342 /// <para> update item content from this local folder</para> 343 /// </summary> 344 public static bool SetItemContent(UGCUpdateHandle_t handle, string pszContentFolder) { 345 InteropHelp.TestIfAvailableGameServer(); 346 using (var pszContentFolder2 = new InteropHelp.UTF8StringHandle(pszContentFolder)) { 347 return NativeMethods.ISteamUGC_SetItemContent(CSteamGameServerAPIContext.GetSteamUGC(), handle, pszContentFolder2); 348 } 349 } 350 351 /// <summary> 352 /// <para> change preview image file for this item. pszPreviewFile points to local image file, which must be under 1MB in size</para> 353 /// </summary> 354 public static bool SetItemPreview(UGCUpdateHandle_t handle, string pszPreviewFile) { 355 InteropHelp.TestIfAvailableGameServer(); 356 using (var pszPreviewFile2 = new InteropHelp.UTF8StringHandle(pszPreviewFile)) { 357 return NativeMethods.ISteamUGC_SetItemPreview(CSteamGameServerAPIContext.GetSteamUGC(), handle, pszPreviewFile2); 358 } 359 } 360 361 /// <summary> 362 /// <para> use legacy upload for a single small file. The parameter to SetItemContent() should either be a directory with one file or the full path to the file. The file must also be less than 10MB in size.</para> 363 /// </summary> 364 public static bool SetAllowLegacyUpload(UGCUpdateHandle_t handle, bool bAllowLegacyUpload) { 365 InteropHelp.TestIfAvailableGameServer(); 366 return NativeMethods.ISteamUGC_SetAllowLegacyUpload(CSteamGameServerAPIContext.GetSteamUGC(), handle, bAllowLegacyUpload); 367 } 368 369 /// <summary> 370 /// <para> remove all existing key-value tags (you can add new ones via the AddItemKeyValueTag function)</para> 371 /// </summary> 372 public static bool RemoveAllItemKeyValueTags(UGCUpdateHandle_t handle) { 373 InteropHelp.TestIfAvailableGameServer(); 374 return NativeMethods.ISteamUGC_RemoveAllItemKeyValueTags(CSteamGameServerAPIContext.GetSteamUGC(), handle); 375 } 376 377 /// <summary> 378 /// <para> remove any existing key-value tags with the specified key</para> 379 /// </summary> 380 public static bool RemoveItemKeyValueTags(UGCUpdateHandle_t handle, string pchKey) { 381 InteropHelp.TestIfAvailableGameServer(); 382 using (var pchKey2 = new InteropHelp.UTF8StringHandle(pchKey)) { 383 return NativeMethods.ISteamUGC_RemoveItemKeyValueTags(CSteamGameServerAPIContext.GetSteamUGC(), handle, pchKey2); 384 } 385 } 386 387 /// <summary> 388 /// <para> add new key-value tags for the item. Note that there can be multiple values for a tag.</para> 389 /// </summary> 390 public static bool AddItemKeyValueTag(UGCUpdateHandle_t handle, string pchKey, string pchValue) { 391 InteropHelp.TestIfAvailableGameServer(); 392 using (var pchKey2 = new InteropHelp.UTF8StringHandle(pchKey)) 393 using (var pchValue2 = new InteropHelp.UTF8StringHandle(pchValue)) { 394 return NativeMethods.ISteamUGC_AddItemKeyValueTag(CSteamGameServerAPIContext.GetSteamUGC(), handle, pchKey2, pchValue2); 395 } 396 } 397 398 /// <summary> 399 /// <para> add preview file for this item. pszPreviewFile points to local file, which must be under 1MB in size</para> 400 /// </summary> 401 public static bool AddItemPreviewFile(UGCUpdateHandle_t handle, string pszPreviewFile, EItemPreviewType type) { 402 InteropHelp.TestIfAvailableGameServer(); 403 using (var pszPreviewFile2 = new InteropHelp.UTF8StringHandle(pszPreviewFile)) { 404 return NativeMethods.ISteamUGC_AddItemPreviewFile(CSteamGameServerAPIContext.GetSteamUGC(), handle, pszPreviewFile2, type); 405 } 406 } 407 408 /// <summary> 409 /// <para> add preview video for this item</para> 410 /// </summary> 411 public static bool AddItemPreviewVideo(UGCUpdateHandle_t handle, string pszVideoID) { 412 InteropHelp.TestIfAvailableGameServer(); 413 using (var pszVideoID2 = new InteropHelp.UTF8StringHandle(pszVideoID)) { 414 return NativeMethods.ISteamUGC_AddItemPreviewVideo(CSteamGameServerAPIContext.GetSteamUGC(), handle, pszVideoID2); 415 } 416 } 417 418 /// <summary> 419 /// <para> updates an existing preview file for this item. pszPreviewFile points to local file, which must be under 1MB in size</para> 420 /// </summary> 421 public static bool UpdateItemPreviewFile(UGCUpdateHandle_t handle, uint index, string pszPreviewFile) { 422 InteropHelp.TestIfAvailableGameServer(); 423 using (var pszPreviewFile2 = new InteropHelp.UTF8StringHandle(pszPreviewFile)) { 424 return NativeMethods.ISteamUGC_UpdateItemPreviewFile(CSteamGameServerAPIContext.GetSteamUGC(), handle, index, pszPreviewFile2); 425 } 426 } 427 428 /// <summary> 429 /// <para> updates an existing preview video for this item</para> 430 /// </summary> 431 public static bool UpdateItemPreviewVideo(UGCUpdateHandle_t handle, uint index, string pszVideoID) { 432 InteropHelp.TestIfAvailableGameServer(); 433 using (var pszVideoID2 = new InteropHelp.UTF8StringHandle(pszVideoID)) { 434 return NativeMethods.ISteamUGC_UpdateItemPreviewVideo(CSteamGameServerAPIContext.GetSteamUGC(), handle, index, pszVideoID2); 435 } 436 } 437 438 /// <summary> 439 /// <para> remove a preview by index starting at 0 (previews are sorted)</para> 440 /// </summary> 441 public static bool RemoveItemPreview(UGCUpdateHandle_t handle, uint index) { 442 InteropHelp.TestIfAvailableGameServer(); 443 return NativeMethods.ISteamUGC_RemoveItemPreview(CSteamGameServerAPIContext.GetSteamUGC(), handle, index); 444 } 445 446 /// <summary> 447 /// <para> commit update process started with StartItemUpdate()</para> 448 /// </summary> 449 public static SteamAPICall_t SubmitItemUpdate(UGCUpdateHandle_t handle, string pchChangeNote) { 450 InteropHelp.TestIfAvailableGameServer(); 451 using (var pchChangeNote2 = new InteropHelp.UTF8StringHandle(pchChangeNote)) { 452 return (SteamAPICall_t)NativeMethods.ISteamUGC_SubmitItemUpdate(CSteamGameServerAPIContext.GetSteamUGC(), handle, pchChangeNote2); 453 } 454 } 455 456 public static EItemUpdateStatus GetItemUpdateProgress(UGCUpdateHandle_t handle, out ulong punBytesProcessed, out ulong punBytesTotal) { 457 InteropHelp.TestIfAvailableGameServer(); 458 return NativeMethods.ISteamUGC_GetItemUpdateProgress(CSteamGameServerAPIContext.GetSteamUGC(), handle, out punBytesProcessed, out punBytesTotal); 459 } 460 461 /// <summary> 462 /// <para> Steam Workshop Consumer API</para> 463 /// </summary> 464 public static SteamAPICall_t SetUserItemVote(PublishedFileId_t nPublishedFileID, bool bVoteUp) { 465 InteropHelp.TestIfAvailableGameServer(); 466 return (SteamAPICall_t)NativeMethods.ISteamUGC_SetUserItemVote(CSteamGameServerAPIContext.GetSteamUGC(), nPublishedFileID, bVoteUp); 467 } 468 469 public static SteamAPICall_t GetUserItemVote(PublishedFileId_t nPublishedFileID) { 470 InteropHelp.TestIfAvailableGameServer(); 471 return (SteamAPICall_t)NativeMethods.ISteamUGC_GetUserItemVote(CSteamGameServerAPIContext.GetSteamUGC(), nPublishedFileID); 472 } 473 474 public static SteamAPICall_t AddItemToFavorites(AppId_t nAppId, PublishedFileId_t nPublishedFileID) { 475 InteropHelp.TestIfAvailableGameServer(); 476 return (SteamAPICall_t)NativeMethods.ISteamUGC_AddItemToFavorites(CSteamGameServerAPIContext.GetSteamUGC(), nAppId, nPublishedFileID); 477 } 478 479 public static SteamAPICall_t RemoveItemFromFavorites(AppId_t nAppId, PublishedFileId_t nPublishedFileID) { 480 InteropHelp.TestIfAvailableGameServer(); 481 return (SteamAPICall_t)NativeMethods.ISteamUGC_RemoveItemFromFavorites(CSteamGameServerAPIContext.GetSteamUGC(), nAppId, nPublishedFileID); 482 } 483 484 /// <summary> 485 /// <para> subscribe to this item, will be installed ASAP</para> 486 /// </summary> 487 public static SteamAPICall_t SubscribeItem(PublishedFileId_t nPublishedFileID) { 488 InteropHelp.TestIfAvailableGameServer(); 489 return (SteamAPICall_t)NativeMethods.ISteamUGC_SubscribeItem(CSteamGameServerAPIContext.GetSteamUGC(), nPublishedFileID); 490 } 491 492 /// <summary> 493 /// <para> unsubscribe from this item, will be uninstalled after game quits</para> 494 /// </summary> 495 public static SteamAPICall_t UnsubscribeItem(PublishedFileId_t nPublishedFileID) { 496 InteropHelp.TestIfAvailableGameServer(); 497 return (SteamAPICall_t)NativeMethods.ISteamUGC_UnsubscribeItem(CSteamGameServerAPIContext.GetSteamUGC(), nPublishedFileID); 498 } 499 500 /// <summary> 501 /// <para> number of subscribed items</para> 502 /// </summary> 503 public static uint GetNumSubscribedItems() { 504 InteropHelp.TestIfAvailableGameServer(); 505 return NativeMethods.ISteamUGC_GetNumSubscribedItems(CSteamGameServerAPIContext.GetSteamUGC()); 506 } 507 508 /// <summary> 509 /// <para> all subscribed item PublishFileIDs</para> 510 /// </summary> 511 public static uint GetSubscribedItems(PublishedFileId_t[] pvecPublishedFileID, uint cMaxEntries) { 512 InteropHelp.TestIfAvailableGameServer(); 513 return NativeMethods.ISteamUGC_GetSubscribedItems(CSteamGameServerAPIContext.GetSteamUGC(), pvecPublishedFileID, cMaxEntries); 514 } 515 516 /// <summary> 517 /// <para> get EItemState flags about item on this client</para> 518 /// </summary> 519 public static uint GetItemState(PublishedFileId_t nPublishedFileID) { 520 InteropHelp.TestIfAvailableGameServer(); 521 return NativeMethods.ISteamUGC_GetItemState(CSteamGameServerAPIContext.GetSteamUGC(), nPublishedFileID); 522 } 523 524 /// <summary> 525 /// <para> get info about currently installed content on disc for items that have k_EItemStateInstalled set</para> 526 /// <para> if k_EItemStateLegacyItem is set, pchFolder contains the path to the legacy file itself (not a folder)</para> 527 /// </summary> 528 public static bool GetItemInstallInfo(PublishedFileId_t nPublishedFileID, out ulong punSizeOnDisk, out string pchFolder, uint cchFolderSize, out uint punTimeStamp) { 529 InteropHelp.TestIfAvailableGameServer(); 530 IntPtr pchFolder2 = Marshal.AllocHGlobal((int)cchFolderSize); 531 bool ret = NativeMethods.ISteamUGC_GetItemInstallInfo(CSteamGameServerAPIContext.GetSteamUGC(), nPublishedFileID, out punSizeOnDisk, pchFolder2, cchFolderSize, out punTimeStamp); 532 pchFolder = ret ? InteropHelp.PtrToStringUTF8(pchFolder2) : null; 533 Marshal.FreeHGlobal(pchFolder2); 534 return ret; 535 } 536 537 /// <summary> 538 /// <para> get info about pending update for items that have k_EItemStateNeedsUpdate set. punBytesTotal will be valid after download started once</para> 539 /// </summary> 540 public static bool GetItemDownloadInfo(PublishedFileId_t nPublishedFileID, out ulong punBytesDownloaded, out ulong punBytesTotal) { 541 InteropHelp.TestIfAvailableGameServer(); 542 return NativeMethods.ISteamUGC_GetItemDownloadInfo(CSteamGameServerAPIContext.GetSteamUGC(), nPublishedFileID, out punBytesDownloaded, out punBytesTotal); 543 } 544 545 /// <summary> 546 /// <para> download new or update already installed item. If function returns true, wait for DownloadItemResult_t. If the item is already installed,</para> 547 /// <para> then files on disk should not be used until callback received. If item is not subscribed to, it will be cached for some time.</para> 548 /// <para> If bHighPriority is set, any other item download will be suspended and this item downloaded ASAP.</para> 549 /// </summary> 550 public static bool DownloadItem(PublishedFileId_t nPublishedFileID, bool bHighPriority) { 551 InteropHelp.TestIfAvailableGameServer(); 552 return NativeMethods.ISteamUGC_DownloadItem(CSteamGameServerAPIContext.GetSteamUGC(), nPublishedFileID, bHighPriority); 553 } 554 555 /// <summary> 556 /// <para> game servers can set a specific workshop folder before issuing any UGC commands.</para> 557 /// <para> This is helpful if you want to support multiple game servers running out of the same install folder</para> 558 /// </summary> 559 public static bool BInitWorkshopForGameServer(DepotId_t unWorkshopDepotID, string pszFolder) { 560 InteropHelp.TestIfAvailableGameServer(); 561 using (var pszFolder2 = new InteropHelp.UTF8StringHandle(pszFolder)) { 562 return NativeMethods.ISteamUGC_BInitWorkshopForGameServer(CSteamGameServerAPIContext.GetSteamUGC(), unWorkshopDepotID, pszFolder2); 563 } 564 } 565 566 /// <summary> 567 /// <para> SuspendDownloads( true ) will suspend all workshop downloads until SuspendDownloads( false ) is called or the game ends</para> 568 /// </summary> 569 public static void SuspendDownloads(bool bSuspend) { 570 InteropHelp.TestIfAvailableGameServer(); 571 NativeMethods.ISteamUGC_SuspendDownloads(CSteamGameServerAPIContext.GetSteamUGC(), bSuspend); 572 } 573 574 /// <summary> 575 /// <para> usage tracking</para> 576 /// </summary> 577 public static SteamAPICall_t StartPlaytimeTracking(PublishedFileId_t[] pvecPublishedFileID, uint unNumPublishedFileIDs) { 578 InteropHelp.TestIfAvailableGameServer(); 579 return (SteamAPICall_t)NativeMethods.ISteamUGC_StartPlaytimeTracking(CSteamGameServerAPIContext.GetSteamUGC(), pvecPublishedFileID, unNumPublishedFileIDs); 580 } 581 582 public static SteamAPICall_t StopPlaytimeTracking(PublishedFileId_t[] pvecPublishedFileID, uint unNumPublishedFileIDs) { 583 InteropHelp.TestIfAvailableGameServer(); 584 return (SteamAPICall_t)NativeMethods.ISteamUGC_StopPlaytimeTracking(CSteamGameServerAPIContext.GetSteamUGC(), pvecPublishedFileID, unNumPublishedFileIDs); 585 } 586 587 public static SteamAPICall_t StopPlaytimeTrackingForAllItems() { 588 InteropHelp.TestIfAvailableGameServer(); 589 return (SteamAPICall_t)NativeMethods.ISteamUGC_StopPlaytimeTrackingForAllItems(CSteamGameServerAPIContext.GetSteamUGC()); 590 } 591 592 /// <summary> 593 /// <para> parent-child relationship or dependency management</para> 594 /// </summary> 595 public static SteamAPICall_t AddDependency(PublishedFileId_t nParentPublishedFileID, PublishedFileId_t nChildPublishedFileID) { 596 InteropHelp.TestIfAvailableGameServer(); 597 return (SteamAPICall_t)NativeMethods.ISteamUGC_AddDependency(CSteamGameServerAPIContext.GetSteamUGC(), nParentPublishedFileID, nChildPublishedFileID); 598 } 599 600 public static SteamAPICall_t RemoveDependency(PublishedFileId_t nParentPublishedFileID, PublishedFileId_t nChildPublishedFileID) { 601 InteropHelp.TestIfAvailableGameServer(); 602 return (SteamAPICall_t)NativeMethods.ISteamUGC_RemoveDependency(CSteamGameServerAPIContext.GetSteamUGC(), nParentPublishedFileID, nChildPublishedFileID); 603 } 604 605 /// <summary> 606 /// <para> add/remove app dependence/requirements (usually DLC)</para> 607 /// </summary> 608 public static SteamAPICall_t AddAppDependency(PublishedFileId_t nPublishedFileID, AppId_t nAppID) { 609 InteropHelp.TestIfAvailableGameServer(); 610 return (SteamAPICall_t)NativeMethods.ISteamUGC_AddAppDependency(CSteamGameServerAPIContext.GetSteamUGC(), nPublishedFileID, nAppID); 611 } 612 613 public static SteamAPICall_t RemoveAppDependency(PublishedFileId_t nPublishedFileID, AppId_t nAppID) { 614 InteropHelp.TestIfAvailableGameServer(); 615 return (SteamAPICall_t)NativeMethods.ISteamUGC_RemoveAppDependency(CSteamGameServerAPIContext.GetSteamUGC(), nPublishedFileID, nAppID); 616 } 617 618 /// <summary> 619 /// <para> request app dependencies. note that whatever callback you register for GetAppDependenciesResult_t may be called multiple times</para> 620 /// <para> until all app dependencies have been returned</para> 621 /// </summary> 622 public static SteamAPICall_t GetAppDependencies(PublishedFileId_t nPublishedFileID) { 623 InteropHelp.TestIfAvailableGameServer(); 624 return (SteamAPICall_t)NativeMethods.ISteamUGC_GetAppDependencies(CSteamGameServerAPIContext.GetSteamUGC(), nPublishedFileID); 625 } 626 627 /// <summary> 628 /// <para> delete the item without prompting the user</para> 629 /// </summary> 630 public static SteamAPICall_t DeleteItem(PublishedFileId_t nPublishedFileID) { 631 InteropHelp.TestIfAvailableGameServer(); 632 return (SteamAPICall_t)NativeMethods.ISteamUGC_DeleteItem(CSteamGameServerAPIContext.GetSteamUGC(), nPublishedFileID); 633 } 634 } 635 } 636 637 #endif // !DISABLESTEAMWORKS