public PeRecordReader GetReader(string key) { if (mIndexFile == null) { return(null); } ArchiveIndex index = mIndexFile.GetArchiveIndex(key); if (null == index) { return(null); } string fileDir; if (index.yird) { if (string.IsNullOrEmpty(mIndexFile.yirdName)) { Debug.LogError("yird name is empty or null"); return(null); } fileDir = mIndexFile.GetYirdDir(dir); } else { fileDir = dir; } return(new PeRecordReader(index, fileDir, mIndexFile.header)); }
public void Add(string key, ArchiveIndex index) { if (index.yird) { mYirdDicIndex.Add(key, index); } else { mDicIndex.Add(key, index); } }
static Archive.Header Load(string path, Dictionary <string, ArchiveIndex> dic, Header curHeader = null) { if (!File.Exists(path)) { return(null); } try { using (FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read)) { using (BinaryReader br = new BinaryReader(fs)) { Archive.Header header = new Header(); if (!header.Read(br)) { return(null); } if (curHeader != null && !curHeader.IsMatch(header)) { return(null); } dic.Clear(); int count = br.ReadInt32(); for (int i = 0; i < count; i++) { string key = br.ReadString(); ArchiveIndex index = new ArchiveIndex(); index.Read(br); dic.Add(key, index); } return(header); } } } catch (Exception ex) { Debug.LogWarning(ex); return(null); } }
static void CopyIndex(ArchiveIndexFile indexFile, ArchiveIndexFile oldIndexFile, ArchiveObj serializeObj) { if (oldIndexFile == null) { return; } serializeObj.Foreach((obj) => { Profiler.BeginSample("only copy index:" + obj.key); ArchiveIndex index = oldIndexFile.GetArchiveIndex(obj.key); if (index != null) { indexFile.Add(obj.key, index); } Profiler.EndSample(); }); }
public PeRecordReader(ArchiveIndex index, string path, Archive.Header header) { mPath = path; mIndex = index; mHeader = header; }