Skip to content

Commit

Permalink
Remove EnumerateUserPublishedFiles and EnumerateUserSubscribedFiles
Browse files Browse the repository at this point in the history
  • Loading branch information
xPaw committed Jul 29, 2021
1 parent 4e94498 commit 6517cdd
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 194 deletions.
118 changes: 0 additions & 118 deletions SteamKit2/SteamKit2/Steam/Handlers/SteamWorkshop/Callbacks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
*/

using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using SteamKit2.Internal;
Expand All @@ -13,123 +12,6 @@ namespace SteamKit2
{
public sealed partial class SteamWorkshop
{
/// <summary>
/// This callback is received in response to calling <see cref="EnumerateUserPublishedFiles"/>.
/// </summary>
public sealed class UserPublishedFilesCallback : CallbackMsg
{
/// <summary>
/// Represents the details of a single published file.
/// </summary>
public sealed class File
{
/// <summary>
/// Gets the file ID.
/// </summary>
public PublishedFileID FileID { get; private set; }


internal File( CMsgClientUCMEnumerateUserPublishedFilesResponse.PublishedFileId file )
{
this.FileID = file.published_file_id;
}
}


/// <summary>
/// Gets the result.
/// </summary>
public EResult Result { get; private set; }

/// <summary>
/// Gets the list of enumerated files.
/// </summary>
public ReadOnlyCollection<File> Files { get; private set; }

/// <summary>
/// Gets the count of total results.
/// </summary>
public int TotalResults { get; private set; }


internal UserPublishedFilesCallback( JobID jobID, CMsgClientUCMEnumerateUserPublishedFilesResponse msg)
{
this.JobID = jobID;

this.Result = ( EResult )msg.eresult;

var fileList = msg.published_files
.Select( f => new File( f ) )
.ToList();

this.Files = new ReadOnlyCollection<File>( fileList );

this.TotalResults = ( int )msg.total_results;
}
}

/// <summary>
/// This callback is received in response to calling <see cref="EnumerateUserPublishedFiles"/>.
/// </summary>
public sealed class UserSubscribedFilesCallback : CallbackMsg
{
/// <summary>
/// Represents the details of a single published file.
/// </summary>
public sealed class File
{
/// <summary>
/// Gets the file ID.
/// </summary>
public PublishedFileID FileID { get; private set; }

/// <summary>
/// Gets the time this file was subscribed to.
/// </summary>
public DateTime TimeSubscribed { get; private set; }


internal File( CMsgClientUCMEnumerateUserSubscribedFilesResponse.PublishedFileId file )
{
this.FileID = file.published_file_id;

this.TimeSubscribed = DateUtils.DateTimeFromUnixTime( file.rtime32_subscribed );
}
}


/// <summary>
/// Gets the result.
/// </summary>
public EResult Result { get; private set; }

/// <summary>
/// Gets the list of enumerated files.
/// </summary>
public ReadOnlyCollection<File> Files { get; private set; }

/// <summary>
/// Gets the count of total results.
/// </summary>
public int TotalResults { get; private set; }


internal UserSubscribedFilesCallback( JobID jobID, CMsgClientUCMEnumerateUserSubscribedFilesResponse msg )
{
this.JobID = jobID;

this.Result = ( EResult )msg.eresult;

var fileList = msg.subscribed_files
.Select( f => new File( f ) )
.ToList();

this.Files = new ReadOnlyCollection<File>( fileList );

this.TotalResults = ( int )msg.total_results;
}
}

/// <summary>
/// This callback is received in response to calling <see cref="EnumeratePublishedFilesByUserAction"/>.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ internal SteamWorkshop()
{
dispatchMap = new Dictionary<EMsg, Action<IPacketMsg>>
{
{ EMsg.ClientUCMEnumerateUserPublishedFilesResponse, HandleEnumUserPublishedFiles },
{ EMsg.ClientUCMEnumerateUserSubscribedFilesResponse, HandleEnumUserSubscribedFiles },
{ EMsg.ClientUCMEnumeratePublishedFilesByUserActionResponse, HandleEnumPublishedFilesByAction },
};
}
Expand All @@ -40,15 +38,6 @@ public sealed class EnumerationUserDetails
/// </value>
public uint AppID { get; set; }

/// <summary>
/// Gets or sets the sort order.
/// This value is only used by <see cref="SteamWorkshop.EnumerateUserPublishedFiles"/>.
/// </summary>
/// <value>
/// The sort order.
/// </value>
public uint SortOrder { get; set; }

/// <summary>
/// Gets or sets the start index.
/// </summary>
Expand All @@ -66,57 +55,7 @@ public sealed class EnumerationUserDetails
/// </value>
public EWorkshopFileAction UserAction { get; set; }
}

/// <summary>
/// Enumerates the list of published files for the current logged in user.
/// Results are returned in a <see cref="UserPublishedFilesCallback"/>.
/// The returned <see cref="AsyncJob{T}"/> can also be awaited to retrieve the callback result.
/// </summary>
/// <param name="details">The specific details of the request.</param>
/// <returns>The Job ID of the request. This can be used to find the appropriate <see cref="UserPublishedFilesCallback"/>.</returns>
public AsyncJob<UserPublishedFilesCallback> EnumerateUserPublishedFiles( EnumerationUserDetails details )
{
if ( details == null )
{
throw new ArgumentNullException( nameof(details) );
}

var enumRequest = new ClientMsgProtobuf<CMsgClientUCMEnumerateUserPublishedFiles>( EMsg.ClientUCMEnumerateUserPublishedFiles );
enumRequest.SourceJobID = Client.GetNextJobID();

enumRequest.Body.app_id = details.AppID;
enumRequest.Body.sort_order = details.SortOrder;
enumRequest.Body.start_index = details.StartIndex;

Client.Send( enumRequest );

return new AsyncJob<UserPublishedFilesCallback>( this.Client, enumRequest.SourceJobID );
}
/// <summary>
/// Enumerates the list of subscribed files for the current logged in user.
/// Results are returned in a <see cref="UserSubscribedFilesCallback"/>.
/// The returned <see cref="AsyncJob{T}"/> can also be awaited to retrieve the callback result.
/// </summary>
/// <param name="details">The specific details of the request.</param>
/// <returns>The Job ID of the request. This can be used to find the appropriate <see cref="UserSubscribedFilesCallback"/>.</returns>
public AsyncJob<UserSubscribedFilesCallback> EnumerateUserSubscribedFiles( EnumerationUserDetails details )
{
if ( details == null )
{
throw new ArgumentNullException( nameof(details) );
}

var enumRequest = new ClientMsgProtobuf<CMsgClientUCMEnumerateUserSubscribedFiles>( EMsg.ClientUCMEnumerateUserSubscribedFiles );
enumRequest.SourceJobID = Client.GetNextJobID();

enumRequest.Body.app_id = details.AppID;
enumRequest.Body.start_index = details.StartIndex;

Client.Send( enumRequest );

return new AsyncJob<UserSubscribedFilesCallback>( this.Client, enumRequest.SourceJobID );
}


/// <summary>
/// Enumerates the list of published files for the current logged in user based on user action.
/// Results are returned in a <see cref="UserActionPublishedFilesCallback"/>.
Expand Down Expand Up @@ -167,20 +106,6 @@ public override void HandleMsg( IPacketMsg packetMsg )


#region ClientMsg Handlers
void HandleEnumUserPublishedFiles( IPacketMsg packetMsg )
{
var response = new ClientMsgProtobuf<CMsgClientUCMEnumerateUserPublishedFilesResponse>( packetMsg );

var callback = new UserPublishedFilesCallback(response.TargetJobID, response.Body);
Client.PostCallback( callback );
}
void HandleEnumUserSubscribedFiles( IPacketMsg packetMsg )
{
var response = new ClientMsgProtobuf<CMsgClientUCMEnumerateUserSubscribedFilesResponse>( packetMsg );

var callback = new UserSubscribedFilesCallback( response.TargetJobID, response.Body );
Client.PostCallback( callback );
}
void HandleEnumPublishedFilesByAction( IPacketMsg packetMsg )
{
var response = new ClientMsgProtobuf<CMsgClientUCMEnumeratePublishedFilesByUserActionResponse>( packetMsg );
Expand Down

0 comments on commit 6517cdd

Please sign in to comment.