/* ----------------------------------------------------------------- */ /// /// Invoke /// /// <summary> /// Creates a new archive and saves to the specified path. /// </summary> /// /* ----------------------------------------------------------------- */ private void Invoke(string dest, PasswordQuery query, IProgress <Report> progress) { if (Format == Format.Sfx) { InvokeSfx(GetItems(), dest, query, progress); } else if (Format == Format.Tar) { InvokeTar(GetItems(), dest, query, progress); } else { Invoke(GetItems(), Format, dest, query, progress); } }
/* ----------------------------------------------------------------- */ /// /// ArchiveReader /// /// <summary> /// Initializes a new instance of the ArchiveReader class with /// the specified arguments. /// </summary> /// /* ----------------------------------------------------------------- */ private ArchiveReader(Format format, string src, PasswordQuery password, IO io) { if (format == Format.Unknown) { throw new UnknownFormatException(); } var asr = new ArchiveStreamReader(io.OpenRead(src)); _core = new SevenZipLibrary(); _password = password; _open = new ArchiveOpenCallback(src, asr, io) { Password = _password }; _archive = _core.GetInArchive(format); _archive.Open(asr, IntPtr.Zero, _open); IO = io; Format = format; Source = src; Items = new ReadOnlyArchiveList(_archive, src, _password, io); }
/* ----------------------------------------------------------------- */ /// /// ArchiveReader /// /// <summary> /// Initializes a new instance of the ArchiveReader class with /// the specified arguments. /// </summary> /// /* ----------------------------------------------------------------- */ private ArchiveReader(Format format, string src, PasswordQuery query, IO io) { if (format == Format.Unknown) { throw new NotSupportedException(); } var asr = new ArchiveStreamReader(io.OpenRead(src)); _core = new SevenZipLibrary(); _query = query; _callback = new ArchiveOpenCallback(src, asr, io) { Password = _query }; _module = _core.GetInArchive(format); _module.Open(asr, IntPtr.Zero, _callback); IO = io; Format = format; Source = src; Items = new ReadOnlyArchiveList(_module, format, src, _query, io); }
/* ----------------------------------------------------------------- */ /// /// ArchiveItemController /// /// <summary> /// Initializes a new instance of the ArchvieItemController class /// with the specified arguments. /// </summary> /// /// <param name="archive">7-zip module.</param> /// <param name="password">Query to get password.</param> /// <param name="io">I/O handler.</param> /// /* ----------------------------------------------------------------- */ public ArchiveItemController(IInArchive archive, PasswordQuery password, IO io) { Archive = archive; Password = password; IO = io; }
/* ----------------------------------------------------------------- */ /// /// ReadOnlyArchiveCollection /// /// <summary> /// オブジェクトを初期化します。 /// </summary> /// /// <param name="archive">実装オブジェクト</param> /// <param name="src">圧縮ファイルのパス</param> /// <param name="password">パスワード取得用オブジェクト</param> /// <param name="io">入出力用のオブジェクト</param> /// /* ----------------------------------------------------------------- */ public ReadOnlyArchiveList(IInArchive archive, string src, PasswordQuery password, IO io) { Source = src; _controller = new ArchiveItemController(archive, password, io); }