From c1bc540d1861a3be3dbf5fdd23b58c3a92a223cf Mon Sep 17 00:00:00 2001 From: Eris Loona <142046400+ErisLoona@users.noreply.github.com> Date: Tue, 18 Jun 2024 18:54:26 +0200 Subject: [PATCH] new features backup - Added bulk (de)selection in the downloader; the user can select a chapter, hold shift and select another chapter, this will invert the selection of every chapter in between - as an example, if chapters 1 through 10 were all selected and I wanted to exclude them all I can select chapter 1, hold shift and select chapter 10; this will lead to chapters 1 through 10 inclusive to be deselected; please keep in mind that this *inverts the selection* - After the download itself has finished in the downloader, the (now) cancel button will indicate that the program is creating the archive; this is to alleviate any worries with regards to the program temporarily not responding while creating the archive - The program will now remember if it was maximized and will restore that on launch; this is on a per-system basis --- App.config | 18 +++++++ Manga Library Manager.csproj | 15 +++++- Manga Library Manager.sln | 8 ++- .../PublishProfiles/FolderProfile.pubxml | 2 +- .../PublishProfiles/FolderProfile.pubxml.user | 2 +- Properties/Settings.Designer.cs | 50 +++++++++++++++++++ Properties/Settings.settings | 12 +++++ mainMenu.cs | 11 ++++ mangaDownloader.Designer.cs | 2 +- mangaDownloader.cs | 24 ++++++++- mangaDownloader.resx | 6 +-- 11 files changed, 141 insertions(+), 9 deletions(-) create mode 100644 App.config create mode 100644 Properties/Settings.Designer.cs create mode 100644 Properties/Settings.settings diff --git a/App.config b/App.config new file mode 100644 index 0000000..10a3ce2 --- /dev/null +++ b/App.config @@ -0,0 +1,18 @@ + + + + +
+ + + + + + False + + + 0, 0 + + + + \ No newline at end of file diff --git a/Manga Library Manager.csproj b/Manga Library Manager.csproj index 03a3449..d31fd06 100644 --- a/Manga Library Manager.csproj +++ b/Manga Library Manager.csproj @@ -9,11 +9,12 @@ enable ytpfp.ico en - 2.1.0 + 2.2.0 https://github.com/ErisLoona/Manga-Library-Manager Eris Loona, pseudonym A manga downloader and offline library manager. + AnyCPU;x64 @@ -40,6 +41,11 @@ True Resources.resx + + True + True + Settings.settings + @@ -49,4 +55,11 @@ + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + \ No newline at end of file diff --git a/Manga Library Manager.sln b/Manga Library Manager.sln index 66bdf96..0cb1b4c 100644 --- a/Manga Library Manager.sln +++ b/Manga Library Manager.sln @@ -3,18 +3,24 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.9.34728.123 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Manga Library Manager", "Manga Library Manager.csproj", "{8F5E112A-6EEC-46F1-A5F0-845D93AE1BCE}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Manga Library Manager", "Manga Library Manager.csproj", "{8F5E112A-6EEC-46F1-A5F0-845D93AE1BCE}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {8F5E112A-6EEC-46F1-A5F0-845D93AE1BCE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {8F5E112A-6EEC-46F1-A5F0-845D93AE1BCE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8F5E112A-6EEC-46F1-A5F0-845D93AE1BCE}.Debug|x64.ActiveCfg = Debug|x64 + {8F5E112A-6EEC-46F1-A5F0-845D93AE1BCE}.Debug|x64.Build.0 = Debug|x64 {8F5E112A-6EEC-46F1-A5F0-845D93AE1BCE}.Release|Any CPU.ActiveCfg = Release|Any CPU {8F5E112A-6EEC-46F1-A5F0-845D93AE1BCE}.Release|Any CPU.Build.0 = Release|Any CPU + {8F5E112A-6EEC-46F1-A5F0-845D93AE1BCE}.Release|x64.ActiveCfg = Release|x64 + {8F5E112A-6EEC-46F1-A5F0-845D93AE1BCE}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Properties/PublishProfiles/FolderProfile.pubxml b/Properties/PublishProfiles/FolderProfile.pubxml index c21f27f..d5e3f85 100644 --- a/Properties/PublishProfiles/FolderProfile.pubxml +++ b/Properties/PublishProfiles/FolderProfile.pubxml @@ -5,7 +5,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121. Release - Any CPU + x64 bin\Release\net8.0-windows\publish\win-x64\ FileSystem <_TargetId>Folder diff --git a/Properties/PublishProfiles/FolderProfile.pubxml.user b/Properties/PublishProfiles/FolderProfile.pubxml.user index ec41aed..f46b0f7 100644 --- a/Properties/PublishProfiles/FolderProfile.pubxml.user +++ b/Properties/PublishProfiles/FolderProfile.pubxml.user @@ -4,7 +4,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121. --> - True|2024-06-17T09:12:58.4583359Z||;True|2024-06-17T10:36:25.6841440+02:00||;True|2024-06-14T11:31:32.6934516+02:00||;True|2024-06-14T11:31:23.3706499+02:00||;True|2024-06-14T11:31:18.7205494+02:00||;True|2024-06-13T09:43:43.5390795+02:00||;True|2024-06-13T08:57:35.0322797+02:00||;True|2024-06-06T15:42:28.6568298+02:00||;True|2024-06-06T15:40:12.6240419+02:00||;True|2024-06-06T13:48:19.4662781+02:00||;True|2024-06-06T12:38:52.6425012+02:00||;True|2024-06-06T12:31:36.7948282+02:00||;True|2024-06-06T10:35:12.1369025+02:00||;True|2024-06-06T10:34:54.5189019+02:00||;True|2024-06-05T23:32:06.1114024+02:00||;True|2024-05-27T18:47:08.3065316+02:00||;True|2024-05-27T18:43:26.7575713+02:00||;True|2024-05-27T16:16:44.1211325+02:00||;True|2024-05-27T16:16:29.4947310+02:00||;True|2024-05-27T11:07:49.8981157+02:00||;True|2024-05-27T11:07:01.1240671+02:00||;True|2024-05-27T11:06:53.1694382+02:00||;True|2024-05-27T09:10:47.9526993+02:00||;True|2024-05-27T09:10:02.8503554+02:00||;True|2024-05-27T09:09:35.2317189+02:00||;True|2024-05-27T08:58:09.8645241+02:00||;True|2024-05-27T08:52:52.8051920+02:00||;True|2024-05-27T08:45:19.6197985+02:00||;True|2024-05-24T11:02:27.2916636+02:00||;True|2024-05-24T08:59:01.6326756+02:00||;True|2024-05-23T09:17:13.9644300+02:00||;True|2024-05-23T09:05:46.2467509+02:00||;True|2024-05-22T22:13:45.9526537+02:00||;True|2024-05-22T22:09:03.4000755+02:00||;True|2024-05-22T22:08:00.0350517+02:00||;True|2024-05-22T21:44:48.4725626+02:00||;True|2024-05-22T21:32:35.3627900+02:00||;True|2024-05-22T19:33:34.6467061+02:00||;True|2024-05-19T19:19:28.1467287+02:00||;True|2024-05-19T19:17:09.7006733+02:00||;True|2024-05-19T19:14:06.6668981+02:00||;True|2024-05-19T14:42:07.1301968+02:00||;True|2024-05-19T14:38:02.4943907+02:00||;True|2024-05-19T09:20:51.2871097+02:00||;True|2024-05-19T09:18:16.6124371+02:00||;True|2024-05-19T09:15:08.6048404+02:00||;True|2024-05-18T22:34:28.8521894+02:00||;True|2024-05-18T22:22:14.4673452+02:00||;True|2024-05-18T21:56:58.6143811+02:00||;True|2024-05-18T07:41:43.4161277+02:00||;True|2024-05-17T11:48:43.3293227+02:00||;True|2024-05-17T09:31:58.9329403+02:00||;True|2024-05-17T09:25:57.4957904+02:00||;True|2024-05-16T19:52:10.0997229+02:00||;True|2024-05-16T18:17:01.7850021+02:00||;True|2024-05-15T09:33:00.6957135+02:00||;True|2024-05-15T08:32:31.7735956+02:00||;True|2024-05-13T17:25:21.1454345+02:00||;True|2024-05-13T17:15:09.7285346+02:00||;True|2024-05-13T16:52:20.9054581+02:00||;True|2024-05-13T16:51:27.0891569+02:00||;True|2024-05-13T16:50:34.5522468+02:00||;True|2024-05-13T16:49:22.6946988+02:00||; + True|2024-06-18T16:11:20.9585577Z||;True|2024-06-18T17:54:04.9775606+02:00||;True|2024-06-18T17:53:03.5685184+02:00||;True|2024-06-18T17:52:26.3088028+02:00||;True|2024-06-17T11:12:58.4583359+02:00||;True|2024-06-17T10:36:25.6841440+02:00||;True|2024-06-14T11:31:32.6934516+02:00||;True|2024-06-14T11:31:23.3706499+02:00||;True|2024-06-14T11:31:18.7205494+02:00||;True|2024-06-13T09:43:43.5390795+02:00||;True|2024-06-13T08:57:35.0322797+02:00||;True|2024-06-06T15:42:28.6568298+02:00||;True|2024-06-06T15:40:12.6240419+02:00||;True|2024-06-06T13:48:19.4662781+02:00||;True|2024-06-06T12:38:52.6425012+02:00||;True|2024-06-06T12:31:36.7948282+02:00||;True|2024-06-06T10:35:12.1369025+02:00||;True|2024-06-06T10:34:54.5189019+02:00||;True|2024-06-05T23:32:06.1114024+02:00||;True|2024-05-27T18:47:08.3065316+02:00||;True|2024-05-27T18:43:26.7575713+02:00||;True|2024-05-27T16:16:44.1211325+02:00||;True|2024-05-27T16:16:29.4947310+02:00||;True|2024-05-27T11:07:49.8981157+02:00||;True|2024-05-27T11:07:01.1240671+02:00||;True|2024-05-27T11:06:53.1694382+02:00||;True|2024-05-27T09:10:47.9526993+02:00||;True|2024-05-27T09:10:02.8503554+02:00||;True|2024-05-27T09:09:35.2317189+02:00||;True|2024-05-27T08:58:09.8645241+02:00||;True|2024-05-27T08:52:52.8051920+02:00||;True|2024-05-27T08:45:19.6197985+02:00||;True|2024-05-24T11:02:27.2916636+02:00||;True|2024-05-24T08:59:01.6326756+02:00||;True|2024-05-23T09:17:13.9644300+02:00||;True|2024-05-23T09:05:46.2467509+02:00||;True|2024-05-22T22:13:45.9526537+02:00||;True|2024-05-22T22:09:03.4000755+02:00||;True|2024-05-22T22:08:00.0350517+02:00||;True|2024-05-22T21:44:48.4725626+02:00||;True|2024-05-22T21:32:35.3627900+02:00||;True|2024-05-22T19:33:34.6467061+02:00||;True|2024-05-19T19:19:28.1467287+02:00||;True|2024-05-19T19:17:09.7006733+02:00||;True|2024-05-19T19:14:06.6668981+02:00||;True|2024-05-19T14:42:07.1301968+02:00||;True|2024-05-19T14:38:02.4943907+02:00||;True|2024-05-19T09:20:51.2871097+02:00||;True|2024-05-19T09:18:16.6124371+02:00||;True|2024-05-19T09:15:08.6048404+02:00||;True|2024-05-18T22:34:28.8521894+02:00||;True|2024-05-18T22:22:14.4673452+02:00||;True|2024-05-18T21:56:58.6143811+02:00||;True|2024-05-18T07:41:43.4161277+02:00||;True|2024-05-17T11:48:43.3293227+02:00||;True|2024-05-17T09:31:58.9329403+02:00||;True|2024-05-17T09:25:57.4957904+02:00||;True|2024-05-16T19:52:10.0997229+02:00||;True|2024-05-16T18:17:01.7850021+02:00||;True|2024-05-15T09:33:00.6957135+02:00||;True|2024-05-15T08:32:31.7735956+02:00||;True|2024-05-13T17:25:21.1454345+02:00||;True|2024-05-13T17:15:09.7285346+02:00||;True|2024-05-13T16:52:20.9054581+02:00||;True|2024-05-13T16:51:27.0891569+02:00||;True|2024-05-13T16:50:34.5522468+02:00||;True|2024-05-13T16:49:22.6946988+02:00||; \ No newline at end of file diff --git a/Properties/Settings.Designer.cs b/Properties/Settings.Designer.cs new file mode 100644 index 0000000..db73255 --- /dev/null +++ b/Properties/Settings.Designer.cs @@ -0,0 +1,50 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Manga_Library_Manager.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.10.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default { + get { + return defaultInstance; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("False")] + public bool Maximized { + get { + return ((bool)(this["Maximized"])); + } + set { + this["Maximized"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("0, 0")] + public global::System.Drawing.Point Location { + get { + return ((global::System.Drawing.Point)(this["Location"])); + } + set { + this["Location"] = value; + } + } + } +} diff --git a/Properties/Settings.settings b/Properties/Settings.settings new file mode 100644 index 0000000..da0fad8 --- /dev/null +++ b/Properties/Settings.settings @@ -0,0 +1,12 @@ + + + + + + False + + + 0, 0 + + + \ No newline at end of file diff --git a/mainMenu.cs b/mainMenu.cs index 54e3b23..c4f4bfe 100644 --- a/mainMenu.cs +++ b/mainMenu.cs @@ -173,6 +173,11 @@ private void mainMenu_Load(object sender, EventArgs e) searchTextBox.AutoCompleteSource = AutoCompleteSource.CustomSource; searchTextBox.AutoCompleteCustomSource = searchTextBoxAutomcompleteStrings; mangaDescControls(false); + if (Properties.Settings.Default.Maximized == true) + { + this.Location = Properties.Settings.Default.Location; + this.WindowState = FormWindowState.Maximized; + } } private void mangaDescControls(bool show) @@ -1040,6 +1045,12 @@ private void mainMenu_FormClosing(object sender, FormClosingEventArgs e) form.Dispose(); } } + if (this.WindowState == FormWindowState.Maximized) + Properties.Settings.Default.Maximized = true; + else + Properties.Settings.Default.Maximized = false; + Properties.Settings.Default.Location = this.RestoreBounds.Location; + Properties.Settings.Default.Save(); } private void tagsTextBox_Enter(object sender, EventArgs e) diff --git a/mangaDownloader.Designer.cs b/mangaDownloader.Designer.cs index 9b5ad06..96643a7 100644 --- a/mangaDownloader.Designer.cs +++ b/mangaDownloader.Designer.cs @@ -99,7 +99,6 @@ private void InitializeComponent() downloadButton.Size = new Size(908, 30); downloadButton.TabIndex = 7; downloadButton.Text = "Start Downloading"; - toolTip.SetToolTip(downloadButton, "Defaults to wherever the executable is located"); downloadButton.UseVisualStyleBackColor = false; downloadButton.Click += downloadButton_Click; // @@ -359,6 +358,7 @@ private void InitializeComponent() selectedChaptersList.Name = "selectedChaptersList"; selectedChaptersList.Size = new Size(451, 466); selectedChaptersList.TabIndex = 0; + selectedChaptersList.SelectedIndexChanged += selectedChaptersList_SelectedIndexChanged; // // flowLayout // diff --git a/mangaDownloader.cs b/mangaDownloader.cs index 2b1441d..bd13ab8 100644 --- a/mangaDownloader.cs +++ b/mangaDownloader.cs @@ -16,7 +16,7 @@ public partial class mangaDownloader : Form private bool downloading = false, excludedExtras = false, linkChanged = false; private List tempChapterIDs = new List(); private string savingPath; - private int startOffset = 2; + private int startOffset = 2, oldChapterIndex = -1; private List tempChapterNumbers = new List(); private List checkedIndexes = new List(), duplicateIndexes = new List(), chapterNrPages = new List(); private mainMenu.eBook becomingBook = new mainMenu.eBook(); @@ -446,6 +446,7 @@ private void downloadButton_Click(object sender, EventArgs e) return; } downloading = true; + selectedChaptersList.SelectedIndex = -1; if (titleSelectionDropDown.SelectedIndex == 0) titleSelectionDropDown.SelectedIndex = 1; string fileName = becomingBook.Title; @@ -464,6 +465,7 @@ private void downloadButton_Click(object sender, EventArgs e) pageFileNames.Clear(); SendMessage(this.Handle, 11, false, 0); controlStatus(false); + selectedChaptersList.Enabled = true; downloadButton.Text = "Cancel Download"; downloadButton.Font = new(downloadButton.Font, FontStyle.Bold | FontStyle.Italic); downloadButton.Enabled = true; @@ -881,6 +883,7 @@ private void downloaderThread_RunWorkerCompleted(object sender, RunWorkerComplet else { downloadButton.Enabled = false; + downloadButton.Text = "Creating archive. Please wait!"; becomingBook.Path += ".cbz"; string fileName = becomingBook.Title; foreach (char c in Path.GetInvalidFileNameChars()) @@ -1103,6 +1106,7 @@ private void epubMakerThread_RunWorkerCompleted(object sender, RunWorkerComplete if (e.Cancelled == true) return; downloadButton.Enabled = false; + downloadButton.Text = "Creating archive. Please wait!"; becomingBook.Path += ".epub"; string fileName = becomingBook.Title; foreach (char c in Path.GetInvalidFileNameChars()) @@ -1168,5 +1172,23 @@ public string padDecimal(decimal value, string padding) return Convert.ToInt32(Math.Floor(value)).ToString(padding) + (value - Convert.ToInt32(Math.Floor(value))).ToString().Substring(1); return Convert.ToInt32(value).ToString(padding); } + + private void selectedChaptersList_SelectedIndexChanged(object sender, EventArgs e) + { + if (selectedChaptersList.SelectedIndex == -1) + return; + if (downloading == true) + { + selectedChaptersList.SetItemChecked(selectedChaptersList.SelectedIndex, !selectedChaptersList.GetItemChecked(selectedChaptersList.SelectedIndex)); + selectedChaptersList.SelectedIndexChanged -= selectedChaptersList_SelectedIndexChanged; + selectedChaptersList.SelectedIndex = -1; + selectedChaptersList.SelectedIndexChanged += selectedChaptersList_SelectedIndexChanged; + return; + } + if (oldChapterIndex != -1 && (Control.ModifierKeys & Keys.Shift) == Keys.Shift) + for (int i = Int32.Min(selectedChaptersList.SelectedIndex, oldChapterIndex) + 1; i < Int32.Max(selectedChaptersList.SelectedIndex, oldChapterIndex); i++) + selectedChaptersList.SetItemChecked(i, !selectedChaptersList.GetItemChecked(i)); + oldChapterIndex = selectedChaptersList.SelectedIndex; + } } } diff --git a/mangaDownloader.resx b/mangaDownloader.resx index 0e104e9..e2b131b 100644 --- a/mangaDownloader.resx +++ b/mangaDownloader.resx @@ -117,9 +117,6 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 172, 30 - @@ -308,6 +305,9 @@ kiRJkiRJkiRJkiRJkiRJkiRpCdzsZv8flKSpI1rW7bUAAAAASUVORK5CYII= + + 172, 30 + 19, 26