Example #1
0
        /// <summary>
        ///     Grabs the banner from the Steam store
        /// </summary>
        /// <param name="appIds">AppId of the apps to fetch</param>
        public static async void GrabBanners(List <int> appIds)
        {
            appIds = appIds.Distinct().ToList();
            await Task.Run(() => { Parallel.ForEach(appIds, FetchBanner); });

#if DEBUG
            // Report failing banners using Sentry.IO
            IgnoreList.AddRange(BannerFailed);
            Sentry.Log(new InvalidDataException($"Failed banners ${JsonConvert.SerializeObject(IgnoreList)}"));
#endif
        }
Example #2
0
        /// <summary>
        ///     Steam AppInfo.vdf Reader
        /// </summary>
        /// <param name="path">appinfo.vdf path</param>
        public AppInfoReader(string path)
        {
            try
            {
                _fileStream   = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read);
                _binaryReader = new BinaryReader(_fileStream);

                // Read some header fields
                _binaryReader.ReadByte();
                if ((_binaryReader.ReadByte() != 0x44) || (_binaryReader.ReadByte() != 0x56))
                {
                    throw new InvalidDataException("Invalid VDF format");
                }

                // Skip more header fields
                _binaryReader.ReadBytes(5);

                while (true)
                {
                    uint id = _binaryReader.ReadUInt32();
                    if (id == 0)
                    {
                        break;
                    }

                    // Skip unused fields
                    _binaryReader.ReadBytes(44);

                    // Load details
                    Items[id] = ReadEntries();
                }
            }
            catch (Exception e)
            {
                Sentry.Log(e);

                throw;
            }
            finally
            {
                if (_fileStream != null)
                {
                    _fileStream.Dispose();
                }

                if (_binaryReader != null)
                {
                    _binaryReader.Dispose();
                }
            }
        }