コード例 #1
0
        private ArchiveWorker(Memory.Archive archive, StreamWithRangeValues fI, ArchiveBase fS, StreamWithRangeValues fL, bool skipList = false)
        {
            ArchiveMap = new ArchiveMap(fI, fL, fS.GetMaxSize(archive));
            Archive    = archive;
            FsArchive  = fS;
            //FS = null;
            if (!skipList)
            {
                GetListOfFiles();
            }

            IsOpen = true;
        }
コード例 #2
0
        /// <summary>
        /// Saves the active archive and file list.
        /// </summary>
        /// <param name="archive">Memory.Archive</param>
        /// <param name="skipList">If list generation is unneeded you can skip it by setting true</param>
        private ArchiveWorker(Memory.Archive archive, bool skipList = false)
        {
            if (archive.IsDir)
            {
                Memory.Log.WriteLine($"{nameof(ArchiveWorker)}:: opening directory: {archive}");
                IsDir = true;
            }
            else
            {
                Memory.Log.WriteLine($"{nameof(ArchiveWorker)}:: opening archiveFile: {archive}");
            }
            Archive    = archive;
            ParentPath = FindParentPath(archive);
            ArchiveBase tempArchive = null;

            if (ParentPath != null && ParentPath.Count > 0)
            {
                foreach (var p in ParentPath)
                {
                    if (tempArchive != null)
                    {
                        tempArchive = tempArchive.GetArchive(p);
                    }
                    else if (p.IsDir || p.IsFile)
                    {
                        tempArchive = ArchiveBase.Load(p);
                    }
                }
            }
            if (tempArchive != null)
            {
                tempArchive.GetArchive(archive, out var fi, out FsArchive, out var fl);
                ArchiveMap = new ArchiveMap(fi, fl, tempArchive.GetMaxSize(archive));
            }
            if (!skipList)
            {
                GetListOfFiles();
            }
            IsOpen = true;
        }