Skip to content

Commit

Permalink
Obsolete EnumeratePublishedFiles
Browse files Browse the repository at this point in the history
  • Loading branch information
xPaw committed May 8, 2020
1 parent b5dc405 commit 62cf9fb
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 187 deletions.
81 changes: 0 additions & 81 deletions SteamKit2/SteamKit2/Steam/Handlers/SteamWorkshop/Callbacks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,87 +13,6 @@ namespace SteamKit2
{
public sealed partial class SteamWorkshop
{
/// <summary>
/// This callback is received in response to calling <see cref="EnumeratePublishedFiles"/>.
/// </summary>
public sealed class PublishedFilesCallback : 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 number of reports for this file.
/// </summary>
public int Reports { get; private set; }

/// <summary>
/// Gets the score of this file, based on up and down votes.
/// </summary>
public float Score { get; private set; }

/// <summary>
/// Gets the total count of up votes.
/// </summary>
public int UpVotes { get; private set; }
/// <summary>
/// Gets the total count of down votes.
/// </summary>
public int DownVotes { get; private set; }


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

this.Reports = file.reports;

this.Score = file.score;

this.UpVotes = file.votes_for;
this.DownVotes = file.votes_against;
}
}


/// <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 PublishedFilesCallback( JobID jobID, CMsgCREEnumeratePublishedFilesResponse 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>
Expand Down
106 changes: 0 additions & 106 deletions SteamKit2/SteamKit2/Steam/Handlers/SteamWorkshop/SteamWorkshop.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ internal SteamWorkshop()
{
dispatchMap = new Dictionary<EMsg, Action<IPacketMsg>>
{
{ EMsg.CREEnumeratePublishedFilesResponse, HandleEnumPublishedFiles },
{ EMsg.ClientUCMEnumerateUserPublishedFilesResponse, HandleEnumUserPublishedFiles },
{ EMsg.ClientUCMEnumerateUserSubscribedFilesResponse, HandleEnumUserSubscribedFiles },
{ EMsg.ClientUCMEnumeratePublishedFilesByUserActionResponse, HandleEnumPublishedFilesByAction },
Expand Down Expand Up @@ -144,104 +143,6 @@ public AsyncJob<UserActionPublishedFilesCallback> EnumeratePublishedFilesByUserA
return new AsyncJob<UserActionPublishedFilesCallback>( this.Client, enumRequest.SourceJobID );
}

/// <summary>
/// Represents the details of an enumeration request for all published files.
/// </summary>
public sealed class EnumerationDetails
{
/// <summary>
/// Gets or sets the AppID of the workshop to enumerate.
/// </summary>
/// <value>
/// The AppID.
/// </value>
public uint AppID { get; set; }

/// <summary>
/// Gets or sets the type of the enumeration.
/// </summary>
/// <value>
/// The type.
/// </value>
public EWorkshopEnumerationType Type { get; set; }

/// <summary>
/// Gets or sets the start index.
/// </summary>
/// <value>
/// The start index.
/// </value>
public uint StartIndex { get; set; }

/// <summary>
/// Gets or sets the days.
/// </summary>
/// <value>
/// The days.
/// </value>
public uint Days { get; set; }
/// <summary>
/// Gets or sets the number of results to return.
/// </summary>
/// <value>
/// The number of results.
/// </value>
public uint Count { get; set; }

/// <summary>
/// Gets the list of tags to enumerate.
/// </summary>
public List<string> Tags { get; private set; }
/// <summary>
/// Gets the list of user tags to enumerate.
/// </summary>
public List<string> UserTags { get; private set; }


/// <summary>
/// Initializes a new instance of the <see cref="EnumerationDetails"/> class.
/// </summary>
public EnumerationDetails()
{
Tags = new List<string>();
UserTags = new List<string>();
}
}

/// <summary>
/// Enumerates the list of all published files on the Steam workshop.
/// Results are returned in a <see cref="PublishedFilesCallback"/>.
/// 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="PublishedFilesCallback"/>.</returns>
public AsyncJob<PublishedFilesCallback> EnumeratePublishedFiles( EnumerationDetails details )
{
if ( details == null )
{
throw new ArgumentNullException( nameof(details) );
}

var enumRequest = new ClientMsgProtobuf<CMsgCREEnumeratePublishedFiles>( EMsg.CREEnumeratePublishedFiles );
enumRequest.SourceJobID = Client.GetNextJobID();

enumRequest.Body.app_id = details.AppID;

enumRequest.Body.query_type = ( int )details.Type;

enumRequest.Body.start_index = details.StartIndex;

enumRequest.Body.days = details.Days;
enumRequest.Body.count = details.Count;

enumRequest.Body.tags.AddRange( details.Tags );
enumRequest.Body.user_tags.AddRange( details.UserTags );

Client.Send( enumRequest );

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

/// <summary>
/// Handles a client message. This should not be called directly.
/// </summary>
Expand All @@ -266,13 +167,6 @@ public override void HandleMsg( IPacketMsg packetMsg )


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

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

0 comments on commit 62cf9fb

Please sign in to comment.