/// <summary> /// Open the internal image browser /// </summary> private void OpenImageBrowser() { if (PicBx_Cover.Image == null) { return; } int iretPage = -1; if (Directory.Exists(acTxBx_Loc.Text)) { //process 'loose' images string[] sFiles = new string[0]; if ((sFiles = Ext.GetFiles(acTxBx_Loc.Text, SearchOption.TopDirectoryOnly)).Length > 0) { using (ImageBrowser fmBrowse = new ImageBrowser(page)) { fmBrowse.Files = new List<string>(sFiles.Length); fmBrowse.Files.AddRange(sFiles); fmBrowse.StartPosition = FormStartPosition.CenterScreen; fmBrowse.ShowDialog(); iretPage = Math.Abs(fmBrowse.Page); } } } else if (Ext.IsArchive(acTxBx_Loc.Text)) { //process compressed images SCA.IArchive scArchive = SCA.ArchiveFactory.Open(acTxBx_Loc.Text); if (scArchive.Entries.Count() > 0) { SCA.IArchiveEntry[] scEntries = scArchive.Entries.ToArray(); using (ImageBrowser fmBrowse = new ImageBrowser(page)) { fmBrowse.Files = new List<string>(scEntries.Length); for (int i = 0; i < scEntries.Length; i++) { if (!scEntries[i].IsDirectory && Ext.ImageTypes.Contains(Path.GetExtension(scEntries[i].Key).ToLower())) { fmBrowse.Files.Add(scEntries[i].Key); } } fmBrowse.Archive = scEntries; fmBrowse.StartPosition = FormStartPosition.CenterScreen; fmBrowse.ShowDialog(); iretPage = Math.Abs(fmBrowse.Page); } } scArchive.Dispose(); } else { xMessage.ShowError("The following path is no longer valid:\n" + acTxBx_Loc.Text); return; } if (page != iretPage) { bRead = true; page = iretPage; SQL.SaveReadProgress(mangaID, page); } GC.Collect(0); }
/// <summary> /// Open the internal image browser /// </summary> private void OpenImageBrowser() { if (PicBx_Cover.Image == null) return; ImageBrowser fmBrowse = new ImageBrowser(); fmBrowse.Page = page; if (Directory.Exists(TxBx_Loc.Text)) { //process 'loose' images string[] sFiles = new string[0]; if ((sFiles = Ext.GetFiles(TxBx_Loc.Text, SearchOption.TopDirectoryOnly)).Length > 0) { fmBrowse.Files = new List<string>(sFiles.Length); fmBrowse.Files.AddRange(sFiles); fmBrowse.ShowDialog(); page = Math.Abs(fmBrowse.Page); } } else if (IsArchive(TxBx_Loc.Text)) { //process compressed images SCA.IArchive scArchive = SCA.ArchiveFactory.Open(@TxBx_Loc.Text); if (scArchive.Entries.Count() > 0) { SCA.IArchiveEntry[] scEntries = scArchive.Entries.ToArray(); fmBrowse.Files = new List<string>(scEntries.Length); for (int i = 0; i < scEntries.Length; i++) { fmBrowse.Files.Add(scEntries[i].FilePath); } fmBrowse.Archive = scEntries; fmBrowse.ShowDialog(); page = Math.Abs(fmBrowse.Page); } scArchive.Dispose(); } else { MessageBox.Show("The following path is no longer valid:\n" + TxBx_Loc.Text, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); } fmBrowse.Dispose(); GC.Collect(0); }