internal PICSProductInfoCallback( JobID jobID, CMsgClientPICSProductInfoResponse msg ) { JobID = jobID; MetaDataOnly = msg.meta_data_only; ResponsePending = msg.response_pending; UnknownPackages = new ReadOnlyCollection<uint>( msg.unknown_packageids ); UnknownApps = new ReadOnlyCollection<uint>( msg.unknown_appids ); Packages = new Dictionary<uint, PICSProductInfo>(); Apps = new Dictionary<uint, PICSProductInfo>(); foreach ( var package_info in msg.packages ) { Packages.Add( package_info.packageid, new PICSProductInfo( package_info ) ); } foreach ( var app_info in msg.apps ) { Apps.Add( app_info.appid, new PICSProductInfo( msg, app_info ) ); } }
internal PICSProductInfo( CMsgClientPICSProductInfoResponse.PackageInfo package_info ) { this.ID = package_info.packageid; this.ChangeNumber = package_info.change_number; this.MissingToken = package_info.missing_token; this.SHAHash = package_info.sha; this.KeyValues = new KeyValue(); if ( package_info.buffer != null ) { using ( MemoryStream ms = new MemoryStream( package_info.buffer ) ) using ( var br = new BinaryReader( ms ) ) { // steamclient checks this value == 1 before it attempts to read the KV from the buffer // see: CPackageInfo::UpdateFromBuffer(CSHA const&,uint,CUtlBuffer &) // todo: we've apparently ignored this with zero ill effects, but perhaps we want to respect it? br.ReadUInt32(); this.KeyValues.TryReadAsBinary( ms ); } } }
internal PICSProductInfo( CMsgClientPICSProductInfoResponse parentResponse, CMsgClientPICSProductInfoResponse.AppInfo app_info) { this.ID = app_info.appid; this.ChangeNumber = app_info.change_number; this.MissingToken = app_info.missing_token; this.SHAHash = app_info.sha; this.KeyValues = new KeyValue(); if ( app_info.buffer != null ) { // we don't want to read the trailing null byte using ( var ms = new MemoryStream( app_info.buffer, 0, app_info.buffer.Length - 1 ) ) { this.KeyValues.ReadAsText( ms ); } } this.OnlyPublic = app_info.only_public; // We should have all these fields set for the response to a metadata-only request, but guard here just in case. if (this.SHAHash != null && this.SHAHash.Length > 0 && !string.IsNullOrEmpty(parentResponse.http_host)) { var shaString = BitConverter.ToString(this.SHAHash) .Replace("-", string.Empty) .ToLower(); var uriString = string.Format("http://{0}/appinfo/{1}/sha/{2}.txt.gz", parentResponse.http_host, this.ID, shaString); this.HttpUri = new Uri(uriString); } this.UseHttp = this.HttpUri != null && app_info.size >= parentResponse.http_min_size; }
internal PICSProductInfo( CMsgClientPICSProductInfoResponse.PackageInfo package_info ) { this.ID = package_info.packageid; this.ChangeNumber = package_info.change_number; this.MissingToken = package_info.missing_token; this.SHAHash = package_info.sha; this.KeyValues = new KeyValue(); if ( package_info.buffer != null ) { using ( MemoryStream ms = new MemoryStream( package_info.buffer ) ) using ( var br = new BinaryReader( ms ) ) { br.ReadUInt32(); this.KeyValues.ReadAsBinary( ms ); } } }
internal PICSProductInfo( CMsgClientPICSProductInfoResponse.AppInfo app_info ) { this.ID = app_info.appid; this.ChangeNumber = app_info.change_number; this.MissingToken = app_info.missing_token; this.SHAHash = app_info.sha; this.KeyValues = new KeyValue(); if ( app_info.buffer != null ) { // we don't want to read the trailing null byte using ( var ms = new MemoryStream( app_info.buffer, 0, app_info.buffer.Length - 1 ) ) { this.KeyValues.ReadAsText( ms ); } } this.OnlyPublic = app_info.only_public; }
internal PICSProductInfo( CMsgClientPICSProductInfoResponse.AppInfo app_info ) { this.ID = app_info.appid; this.ChangeNumber = app_info.change_number; this.MissingToken = app_info.missing_token; this.SHAHash = app_info.sha; this.KeyValues = new KeyValue(); using (MemoryStream ms = new MemoryStream(app_info.buffer, 0, app_info.buffer.Length - 1)) this.KeyValues.ReadAsText(ms); this.OnlyPublic = app_info.only_public; }