示例#1
0
        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);
        }
示例#2
0
        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);
        }
示例#3
0
        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;
        }
示例#4
0
        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);
        }
示例#5
0
        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);
        }
示例#6
0
        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;
        }