protected Stream OpenFileOnlineInternal(IndexEntry idxInfo, MD5Hash key) { Stream s; if (idxInfo != null) { s = CDNIndex.OpenDataFile(idxInfo); } else { s = CDNIndex.OpenDataFileDirect(key); } BLTEStream blte; try { blte = new BLTEStream(s, key); } catch (BLTEDecoderException exc) when(exc.ErrorCode == 0) { return(OpenFileOnlineInternal(idxInfo, key)); } return(blte); }
protected Stream OpenFileOnlineInternal(IndexEntry idxInfo, MD5Hash key) { Stream s; if (idxInfo != null) { s = CDNIndex.OpenDataFile(idxInfo); } else { s = CDNIndex.OpenDataFileDirect(key); } BLTEStream blte; try { blte = new BLTEStream(s, key); } catch (BLTEDecoderException exc) when(exc.ErrorCode == 0) { CDNCache.Instance.InvalidateFile(idxInfo != null ? Config.Archives[idxInfo.Index] : key.ToHexString()); return(OpenFileOnlineInternal(idxInfo, key)); } return(blte); }
private void ExtractFileLocal(MD5Hash key, string path, string name) { Stream stream = GetLocalDataStream(key); using (BLTEStream blte = new BLTEStream(stream, key)) { blte.ExtractToFile(path, name); } }
protected void ExtractFileOnlineInternal(IndexEntry idxInfo, MD5Hash key, string path, string name) { if (idxInfo != null) { using (Stream s = CDNIndex.OpenDataFile(idxInfo)) using (BLTEStream blte = new BLTEStream(s, key)) { blte.ExtractToFile(path, name); } } else { using (Stream s = CDNIndex.OpenDataFileDirect(key)) using (BLTEStream blte = new BLTEStream(s, key)) { blte.ExtractToFile(path, name); } } }