public bool FindUGC(string search, out ulong pubFileId) { pubFileId = 0; var ugcMatches = ugcCache .Where(kvp => kvp.Value.Name.IndexOf(search, StringComparison.OrdinalIgnoreCase) != -1) .ToList(); if (ugcMatches.Count == 0) { return(false); } var ugcList = ugcMatches.Select(kvp => kvp.Value); UGCCacheEntry searchResult = ugcList.FirstOrDefault(); if (searchResult != null) { pubFileId = searchResult.PubFileID; return(true); } return(false); }
public bool FindUGC(string search, out ulong pubFileId, uint?appId = null) { pubFileId = 0; var ugcMatches = ugcCache .Where(kvp => kvp.Value.Name.IndexOf(search, StringComparison.OrdinalIgnoreCase) != -1); if (appId != null) { // filter to only the appid we're interested in, if provided ugcMatches = ugcMatches .Where(kvp => kvp.Value.AppID == appId.Value); } var ugcList = ugcMatches .Select(kvp => kvp.Value) .ToList(); if (ugcList.Count == 0) { return(false); } UGCCacheEntry searchResult = ugcList.FirstOrDefault(); if (searchResult != null) { pubFileId = searchResult.PubFileID; return(true); } return(false); }
public bool LookupUGC( ulong pubFile, out UGCCacheEntry entry ) { entry = null; if ( ugcCache.TryGetValue( pubFile, out entry ) ) { return true; } // nothing in our cache, ask steam RequestUGC( pubFile, res => { } ); return false; }
public bool LookupUGC(ulong pubFile, out UGCCacheEntry entry) { entry = null; if (ugcCache.TryGetValue(pubFile, out entry)) { return(true); } // nothing in our cache, ask steam RequestUGC(pubFile, res => { }); return(false); }
public bool LookupUGCName(ulong pubFile, out string name) { name = null; UGCCacheEntry cacheEntry; if (ugcCache.TryGetValue(pubFile, out cacheEntry)) { name = cacheEntry.Name; // we had the name cached in memory, no need to touch disk return(true); } // otherwise, need to see if we have it on disk PublishedFileDetails fileDetails = GetDetailsFromDisk(pubFile); if (fileDetails == null) { // couldn't load details from disk cache, lets try requesting info from steam RequestUGC(pubFile, res => { }); return(false); } name = fileDetails.title; ugcCache[pubFile] = new UGCCacheEntry { PubFileID = pubFile, AppID = fileDetails.consumer_appid, Name = name, Tags = fileDetails.tags }; return(true); }
public bool LookupUGCName( ulong pubFile, out string name ) { name = null; UGCCacheEntry cacheEntry; if ( ugcCache.TryGetValue( pubFile, out cacheEntry ) ) { name = cacheEntry.Name; // we had the name cached in memory, no need to touch disk return true; } // otherwise, need to see if we have it on disk PublishedFileDetails fileDetails = GetDetailsFromDisk( pubFile ); if ( fileDetails == null ) { // couldn't load details from disk cache, lets try requesting info from steam RequestUGC( pubFile, res => { } ); return false; } name = fileDetails.title; ugcCache[pubFile] = new UGCCacheEntry { PubFileID = pubFile, AppID = fileDetails.consumer_appid, Name = name, Tags = fileDetails.tags }; return true; }