static bool AccountHasAccess( uint depotId ) { if (steam3 == null || steam3.steamUser.SteamID == null || (steam3.Licenses == null && steam3.steamUser.SteamID.AccountType != EAccountType.AnonUser)) return false; IEnumerable<uint> licenseQuery; if ( steam3.steamUser.SteamID.AccountType == EAccountType.AnonUser ) { licenseQuery = new List<uint>() { 17906 }; } else { licenseQuery = steam3.Licenses.Select( x => x.PackageID ); } steam3.RequestPackageInfo( licenseQuery ); foreach ( var license in licenseQuery ) { SteamApps.PICSProductInfoCallback.PICSProductInfo package; if ( steam3.PackageInfo.TryGetValue( license, out package ) && package != null ) { if ( package.KeyValues["appids"].Children.Any( child => child.AsInteger() == depotId ) ) return true; if ( package.KeyValues["depotids"].Children.Any( child => child.AsInteger() == depotId ) ) return true; } } return false; }
static bool AccountHasAccess(int depotId, bool appId = false) { if (steam3 == null || steam3.Licenses == null) { return(CDRManager.SubHasDepot(0, depotId)); } foreach (var license in steam3.Licenses) { steam3.RequestPackageInfo(license.PackageID); SteamApps.PackageInfoCallback.Package package; if (steam3.PackageInfo.TryGetValue((uint)license.PackageID, out package) && package.Status == SteamApps.PackageInfoCallback.Package.PackageStatus.OK) { KeyValue root = package.Data[license.PackageID.ToString()]; KeyValue subset = (appId == true ? root["appids"] : root["depotids"]); foreach (var child in subset.Children) { if (child.AsInteger() == depotId) { return(true); } } } if (CDRManager.SubHasDepot(( int )license.PackageID, depotId)) { return(true); } } return(false); }
static bool AccountHasAccess(int depotId, bool appId = false) { if (steam3 == null || (steam3.Licenses == null && steam3.steamUser.SteamID.AccountType != EAccountType.AnonUser)) { return(CDRManager.SubHasDepot(0, depotId)); } IEnumerable <uint> licenseQuery; if (steam3.steamUser.SteamID.AccountType == EAccountType.AnonUser) { licenseQuery = new List <uint>() { 17906 }; } else { licenseQuery = steam3.Licenses.Select(x => x.PackageID); } steam3.RequestPackageInfo(licenseQuery); foreach (var license in licenseQuery) { SteamApps.PICSProductInfoCallback.PICSProductInfo package; if (steam3.PackageInfo.TryGetValue(license, out package) || package == null) { KeyValue root = package.KeyValues[license.ToString()]; KeyValue subset = (appId == true ? root["appids"] : root["depotids"]); foreach (var child in subset.Children) { if (child.AsInteger() == depotId) { return(true); } } } if (CDRManager.SubHasDepot(( int )license, depotId)) { return(true); } } return(false); }