Пример #1
0
        internal CascFileStream(CascStorageFileSafeHandle handle, CascApi api)
        {
            Debug.Assert(handle != null);
            Debug.Assert(!handle.IsInvalid);
            Debug.Assert(api != null);

            _api    = api;
            _handle = handle;
        }
Пример #2
0
        /// <summary>
        /// Creates a new CascStorageContext for the specified path.
        /// </summary>
        /// <param name="dataPath">The path to a game's data directory.</param>
        /// <example>An example directory is <c>c:\Program Files (x86)\Heroes of the Storm\HeroesData</c>.</example>
        public CascStorageContext(string dataPath)
        {
            _api = CascApi.Instance;

            if (!_api.CascOpenStorage(dataPath, 0, out _handle) || _handle.IsInvalid)
            {
                throw new CascException();
            }
            _handle.Api = _api;

            _hasListfile = new Lazy <bool>(CheckHasListfile);
            _clientType  = new Lazy <CascKnownClient>(GetClient);
            _fileCount   = new Lazy <long>(GetFileCount);
            _gameBuild   = new Lazy <int>(GetGameBuild);
        }