diff --git a/src/syosetuDownloader/App.xaml.cs b/src/syosetuDownloader/App.xaml.cs
index d591e66..6c68624 100644
--- a/src/syosetuDownloader/App.xaml.cs
+++ b/src/syosetuDownloader/App.xaml.cs
@@ -21,6 +21,7 @@ protected override void OnStartup(StartupEventArgs e)
{
AppDomain currentDomain = AppDomain.CurrentDomain;
currentDomain.UnhandledException += new UnhandledExceptionEventHandler(MyHandler);
+ System.Windows.Forms.Application.EnableVisualStyles();
base.OnStartup(e);
}
diff --git a/src/syosetuDownloader/HistoryWindow.xaml b/src/syosetuDownloader/HistoryWindow.xaml
index 694232a..a5740dd 100644
--- a/src/syosetuDownloader/HistoryWindow.xaml
+++ b/src/syosetuDownloader/HistoryWindow.xaml
@@ -1,144 +1,146 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/syosetuDownloader/HistoryWindow.xaml.cs b/src/syosetuDownloader/HistoryWindow.xaml.cs
index c2f251c..0b65068 100644
--- a/src/syosetuDownloader/HistoryWindow.xaml.cs
+++ b/src/syosetuDownloader/HistoryWindow.xaml.cs
@@ -2,6 +2,7 @@
using System;
using System.Collections.ObjectModel;
using System.ComponentModel;
+using System.IO;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
@@ -17,6 +18,8 @@ namespace syosetuDownloader
///
public partial class HistoryWindow : Window
{
+ public string DownloadFolder { get; set; }
+
int _taskNumber = 0;
MainWindow _parent;
@@ -158,6 +161,31 @@ private void UpdateStatus(int n)
Updating = false;
}
+ private void RenameCommand_Executed(object sender, ExecutedRoutedEventArgs e)
+ {
+ var item = GetCurrentItem();
+ var form = new RenameForm();
+ form.textBox1.Text = item.Title;
+ form.textBox2.Text = item.Title;
+ form.DlFolder = DownloadFolder;
+ form.ValidateInput();
+ if (form.ShowDialog() == System.Windows.Forms.DialogResult.OK)
+ {
+ item.Title = form.textBox2.Text;
+ Syousetsu.History.SaveItem(item);
+
+ if (Directory.Exists(form.CurrNovelFolder))
+ {
+ Directory.Move(form.CurrNovelFolder, form.textBox3.Text);
+ }
+
+ ICollectionView view = CollectionViewSource.GetDefaultView(viewHistoryList.ItemsSource);
+ view.Refresh();
+ FocusListView();
+ }
+ form.Dispose();
+ }
+
private void RemoveCommand_Executed(object sender, ExecutedRoutedEventArgs e)
{
foreach (Syousetsu.History.Item item in viewHistoryList.SelectedItems.Cast().ToList())
@@ -251,7 +279,6 @@ public static class CustomCommands
typeof(CustomCommands),
new InputGestureCollection() { new KeyGesture(Key.F2, ModifierKeys.None) }
);
-
public static readonly RoutedUICommand Update = new RoutedUICommand
(
"Update",
@@ -259,7 +286,13 @@ public static class CustomCommands
typeof(CustomCommands),
new InputGestureCollection() { new KeyGesture(Key.F5, ModifierKeys.None) }
);
-
+ public static readonly RoutedUICommand Rename = new RoutedUICommand
+ (
+ "Rename",
+ "Rename",
+ typeof(CustomCommands),
+ new InputGestureCollection() { new KeyGesture(Key.F6, ModifierKeys.None) }
+ );
public static readonly RoutedUICommand Remove = new RoutedUICommand
(
"Remove",
diff --git a/src/syosetuDownloader/MainWindow.xaml.cs b/src/syosetuDownloader/MainWindow.xaml.cs
index d363033..3ddfd93 100644
--- a/src/syosetuDownloader/MainWindow.xaml.cs
+++ b/src/syosetuDownloader/MainWindow.xaml.cs
@@ -242,7 +242,6 @@ private void Download()
// set up download progress gui-controls
Label lb = _controls.Last().Label;
- lb.Content = Syousetsu.Methods.FormatValidFileName(Syousetsu.Methods.GetTitle(toc, sc));
lb.Background = Brushes.Transparent;
lb.ToolTip = "Click to open folder";
@@ -253,13 +252,25 @@ private void Download()
_start = (_start == String.Empty) ? "1" : _start;
_end = pb.Maximum.ToString();
- sc.SeriesTitle = lb.Content.ToString();
sc.Link = _link;
sc.Start = _start;
sc.End = _end;
sc.CurrentFileType = _fileType;
sc.SeriesCode = Syousetsu.Methods.GetSeriesCode(_link);
sc.FilenameFormat = _format;
+
+ // get novel title (also folder) from history
+ string title;
+ var item = new Syousetsu.History.Item();
+ Syousetsu.History.LoadNovel(item, sc);
+ if (!string.IsNullOrEmpty(item.Title))
+ title = item.Title;
+ else
+ title = Syousetsu.Methods.FormatValidFileName(Syousetsu.Methods.GetTitle(toc, sc));
+ // set title
+ lb.Content = title;
+ sc.SeriesTitle = title;
+
Syousetsu.Methods.GetAllChapterTitles(sc, toc);
if (chkList.IsChecked == true)
@@ -351,6 +362,7 @@ private void btnExplore_Click(object sender, RoutedEventArgs e)
private void btnHistory_Click(object sender, RoutedEventArgs e)
{
HistoryWindow win = new HistoryWindow();
+ win.DownloadFolder = _dl_dir;
win.ShowDialog();
}
diff --git a/src/syosetuDownloader/RenameForm.Designer.cs b/src/syosetuDownloader/RenameForm.Designer.cs
new file mode 100644
index 0000000..36f3a1b
--- /dev/null
+++ b/src/syosetuDownloader/RenameForm.Designer.cs
@@ -0,0 +1,149 @@
+namespace syosetuDownloader
+{
+ partial class RenameForm
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(RenameForm));
+ this.textBox1 = new System.Windows.Forms.TextBox();
+ this.label1 = new System.Windows.Forms.Label();
+ this.textBox2 = new System.Windows.Forms.TextBox();
+ this.lblError = new System.Windows.Forms.Label();
+ this.btnOK = new System.Windows.Forms.Button();
+ this.btnCancel = new System.Windows.Forms.Button();
+ this.textBox3 = new System.Windows.Forms.TextBox();
+ this.SuspendLayout();
+ //
+ // textBox1
+ //
+ this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.textBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.textBox1.Location = new System.Drawing.Point(12, 12);
+ this.textBox1.Name = "textBox1";
+ this.textBox1.ReadOnly = true;
+ this.textBox1.Size = new System.Drawing.Size(704, 21);
+ this.textBox1.TabIndex = 4;
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.Location = new System.Drawing.Point(12, 39);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(62, 13);
+ this.label1.TabIndex = 1;
+ this.label1.Text = "Rename to:";
+ //
+ // textBox2
+ //
+ this.textBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.textBox2.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.textBox2.Location = new System.Drawing.Point(12, 55);
+ this.textBox2.Name = "textBox2";
+ this.textBox2.Size = new System.Drawing.Size(704, 21);
+ this.textBox2.TabIndex = 0;
+ this.textBox2.TextChanged += new System.EventHandler(this.textBox2_TextChanged);
+ //
+ // lblError
+ //
+ this.lblError.AutoSize = true;
+ this.lblError.ForeColor = System.Drawing.Color.Red;
+ this.lblError.Location = new System.Drawing.Point(12, 82);
+ this.lblError.Name = "lblError";
+ this.lblError.Size = new System.Drawing.Size(39, 13);
+ this.lblError.TabIndex = 3;
+ this.lblError.Text = "lblError";
+ //
+ // btnOK
+ //
+ this.btnOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
+ this.btnOK.Location = new System.Drawing.Point(172, 145);
+ this.btnOK.Name = "btnOK";
+ this.btnOK.Size = new System.Drawing.Size(75, 23);
+ this.btnOK.TabIndex = 2;
+ this.btnOK.Text = "OK";
+ this.btnOK.UseVisualStyleBackColor = true;
+ this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
+ //
+ // btnCancel
+ //
+ this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
+ this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
+ this.btnCancel.Location = new System.Drawing.Point(277, 145);
+ this.btnCancel.Name = "btnCancel";
+ this.btnCancel.Size = new System.Drawing.Size(75, 23);
+ this.btnCancel.TabIndex = 3;
+ this.btnCancel.Text = "Cancel";
+ this.btnCancel.UseVisualStyleBackColor = true;
+ this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
+ //
+ // textBox3
+ //
+ this.textBox3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.textBox3.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.textBox3.Location = new System.Drawing.Point(12, 98);
+ this.textBox3.Name = "textBox3";
+ this.textBox3.ReadOnly = true;
+ this.textBox3.Size = new System.Drawing.Size(704, 20);
+ this.textBox3.TabIndex = 1;
+ //
+ // RenameForm
+ //
+ this.AcceptButton = this.btnOK;
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.CancelButton = this.btnCancel;
+ this.ClientSize = new System.Drawing.Size(728, 180);
+ this.Controls.Add(this.textBox3);
+ this.Controls.Add(this.btnCancel);
+ this.Controls.Add(this.btnOK);
+ this.Controls.Add(this.lblError);
+ this.Controls.Add(this.textBox2);
+ this.Controls.Add(this.label1);
+ this.Controls.Add(this.textBox1);
+ this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
+ this.MinimizeBox = false;
+ this.Name = "RenameForm";
+ this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
+ this.Text = "Rename";
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+ private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.Label lblError;
+ private System.Windows.Forms.Button btnOK;
+ private System.Windows.Forms.Button btnCancel;
+ public System.Windows.Forms.TextBox textBox1;
+ public System.Windows.Forms.TextBox textBox2;
+ public System.Windows.Forms.TextBox textBox3;
+ }
+}
\ No newline at end of file
diff --git a/src/syosetuDownloader/RenameForm.cs b/src/syosetuDownloader/RenameForm.cs
new file mode 100644
index 0000000..293b52f
--- /dev/null
+++ b/src/syosetuDownloader/RenameForm.cs
@@ -0,0 +1,67 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Windows.Forms;
+
+namespace syosetuDownloader
+{
+ public partial class RenameForm : Form
+ {
+ public string DlFolder { get; set; }
+ public string CurrNovelFolder { get => DlFolder + Path.DirectorySeparatorChar + textBox1.Text; }
+
+ List _invalidChars = new List() { '\\', '/', ':', '*', '?', '"', '<', '>', '|' };
+
+ public RenameForm()
+ {
+ InitializeComponent();
+ }
+
+ private void btnOK_Click(object sender, EventArgs e)
+ {
+ this.DialogResult = DialogResult.OK;
+ this.Close();
+ }
+
+ private void btnCancel_Click(object sender, EventArgs e)
+ {
+ this.DialogResult = DialogResult.Cancel;
+ this.Close();
+ }
+
+ private void textBox2_TextChanged(object sender, EventArgs e)
+ {
+ ValidateInput();
+ }
+
+ public void ValidateInput()
+ {
+ textBox3.Text = DlFolder + Path.DirectorySeparatorChar + textBox2.Text;
+
+ if (string.IsNullOrEmpty(textBox2.Text))
+ {
+ lblError.Text = "";
+ btnOK.Enabled = false;
+ return;
+ }
+
+ if (_invalidChars.Any(character => textBox2.Text.Contains(character)))
+ {
+ lblError.Text = "A folder name can't contain any of the following characters: \\ / : * ? \" < > |";
+ btnOK.Enabled = false;
+ return;
+ }
+
+ if (Directory.Exists(textBox3.Text))
+ {
+ lblError.Text = "Folder already exists";
+ btnOK.Enabled = false;
+ return;
+ }
+
+ lblError.Text = "";
+ btnOK.Enabled = true;
+ }
+ }
+}
diff --git a/src/syosetuDownloader/RenameForm.resx b/src/syosetuDownloader/RenameForm.resx
new file mode 100644
index 0000000..5e2c553
--- /dev/null
+++ b/src/syosetuDownloader/RenameForm.resx
@@ -0,0 +1,377 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+
+
+ AAABAAMAEBAAAAEAIABoBAAANgAAACAgAAABACAAqBAAAJ4EAAAwMAAAAQAgAKglAABGFQAAKAAAABAA
+ AAAgAAAAAQAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAQAAAAH//vs1////nf/+
+ /NP////1////9f/+/NP///+d//77NQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAH///+d////////
+ //////////////////////////////////////+dAAAAAQAAAAEAAAABAAAAAQAAAAH//vzT////////
+ ////////+ffk//n35P/////////////////////////////+/NMAAAABAAAAAQAAAAH///+d////////
+ ///z7sf/8+7H//Pux//59+T/8+7H/+7mrv//////////////////////////nQAAAAH//vs1+ffk/+7m
+ rv/z7sf/8+7H//n35P///////////+bai//GrQL/8+7H/////////////////////////vs1+fbjofPu
+ x//m2ov/5tqL///////////////////////u5q7/xq0C//Pux///////////////////////////nf/+
+ /NP59+T///////Pux//XxUX/+ffk/////////////////9fFRf/z7sf////////////z7sf/8+7H///+
+ /NP////1////////////////7uau/8y1Gf////////////n35P/MtRn/3s9m////////////zLUZ/8y1
+ Gf/////1////9f/////////////////////XxUX/18VF////////////xq0C/8y1Gf///////////8at
+ Av/m2ov/////9f/+/NP//////////////////////////7iYAP/m2ov//////97PZv/XxUX//////+ba
+ i//XxUX////////+/NP///+d///////////////////////////m2ov/7uau///////ez2b/zLUZ//Pu
+ x//z7sf///////////////+d//77Nf//////////////////////////////////////////3s9m/7iY
+ AP/m2ov///////////////////77NQAAAAH///+d/////////////////////////////////////+ba
+ i/+4mAD/18VF////////////////nQAAAAEAAAABAAAAAf/+/NP/////////////////////////////
+ ///59+T/5tqL/+7mrv////////780wAAAAEAAAABAAAAAQAAAAEAAAAB////nf//////////////////
+ ////////////////////////////nQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAH//vs1////nf/+
+ /NP////1////9f/+/NP///+d//77NQAAAAEAAAABAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAKAAAACAAAABAAAAAAQAgAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAA
+ AAH///0h///9Wf79+J3////N////7f///+3////t////7f///83+/fid///9Wf///SEAAAABAAAAAQAA
+ AAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAA
+ AAH///0h/v34nf///+3///////////////////////////////////////////////////////////79
+ +J3///0hAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAA
+ AAEAAAAB////if//////////////////////////////////////////////////////////////////
+ ///////////////////+/fidAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAA
+ AAEAAAAB///9If///83/////////////////////////////////////////////////////////////
+ ///////////////////////////////////////N///9IQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAA
+ AAEAAAABAAAAAf///SH////t////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////9IQAAAAEAAAABAAAAAQAA
+ AAEAAAABAAAAAQAAAAH///0h////7f////////////////////////////////////////////////by
+ 1v/28tb/9vLW///////////////////////////////////////////////////////////////9IQAA
+ AAEAAAABAAAAAQAAAAEAAAABAAAAAf///83/////////////////////////////////////7uev/+nf
+ mf/p35n/7uev//by1v/28tb/9vLW/+7nr///////////////////////////////////////////////
+ ///////tAAAAAQAAAAEAAAABAAAAAQAAAAH///+J////////////////////////////////6d+Z/+DS
+ b//p35n/9vLW///////////////////////28tb/z7oj//by1v//////////////////////////////
+ ///////////////////+/fidAAAAAQAAAAEAAAAB///9Ie7nr//28tb/////////////////7uev/+DS
+ b//p35n/9vLW/////////////////////////////////+DSb//HrQP/z7oj//by1v//////////////
+ //////////////////////////////////////0hAAAAAQAAAAH+/fid7uev/+nfmf/p35n/7uev/+nf
+ mf/p35n/9vLW///////////////////////////////////////28tb/x60D/+DSb//PuiP/4NJv////
+ //////////////////////////////////////////////79+J0AAAABAAAAAf//////////9vLW/+DS
+ b//PuiP/2MZI///////////////////////////////////////////////////////PuiP/4NJv/9jG
+ SP/p35n//////////////////////////////////////////////////////wAAAAH///1Z9vLW/+7n
+ r//p35n/9vLW///////p35n/z7oj//by1v////////////////////////////////////////////by
+ 1v/HrQP/x60D//by1v/////////////////////////////////////////////////////////9Wf79
+ +J3u56//9vLW///////////////////////p35n/x60D/+7nr///////////////////////////////
+ /////////////8+6I/+9oAD/9vLW////////////////////////////////////////////////////
+ ///+/fid////zf/////////////////////////////////////p35n/vaAA/+7nr///////////////
+ ////////////////////////6d+Z/+DSb//u56/////////////////////////////28tb/z7oj/+DS
+ b////////////////83////t///////////////////////////////////////////g0m//vaAA/+7n
+ r/////////////////////////////by1v/Yxkj/z7oj/8etA//28tb//////////////////////+nf
+ mf+9oAD/vaAA/+7nr///////////7f///+3/////////////////////////////////////////////
+ ///PuiP/vaAA//by1v//////////////////////9vLW/8etA//HrQP/x60D/+nfmf//////////////
+ ////////4NJv/8etA//HrQP/7uev///////////t////7f//////////////////////////////////
+ //////////////by1v+9oAD/z7oj////////////////////////////z7oj/8etA//HrQP/4NJv////
+ ///////////////////Yxkj/x60D/8etA//28tb//////////+3////t////////////////////////
+ /////////////////////////////9jGSP+9oAD/2MZI///////////////////////Yxkj/x60D/8et
+ A//PuiP//////////////////////8+6I/+9oAD/4NJv////////////////7f///83/////////////
+ ////////////////////////////////////////9vLW/8etA/+9oAD/7uev/////////////////9jG
+ SP/HrQP/z7oj/+DSb//////////////////p35n/vaAA/9jGSP/////////////////////N/v34nf//
+ ////////////////////////////////////////////////////////2MZI/72gAP+9oAD/6d+Z////
+ ////////7uev/+DSb//g0m//4NJv//by1v///////////8etA//PuiP///////////////////////79
+ +J3///1Z///////////////////////////////////////////////////////////p35n/vaAA/9jG
+ SP/u56/////////////p35n/x60D/8etA/+9oAD/6d+Z///////g0m//2MZI////////////////////
+ ///////////9WQAAAAH///////////////////////////////////////////////////////////by
+ 1v/28tb//////////////////////+nfmf/HrQP/z7oj/8etA//g0m////////by1v//////////////
+ //////////////////8AAAABAAAAAf79+J3/////////////////////////////////////////////
+ ////////////////////////////////////////7uev/8etA//PuiP/x60D/9jGSP//////////////
+ /////////////////////////v34nQAAAAEAAAAB///9If//////////////////////////////////
+ ///////////////////////////////////////////////////28tb/x60D/8etA//HrQP/z7oj////
+ //////////////////////////////////////0hAAAAAQAAAAEAAAAB////if//////////////////
+ ///////////////////////////////////////////////////////////////////PuiP/x60D/8et
+ A//HrQP/9vLW////////////////////////////////iQAAAAEAAAABAAAAAQAAAAEAAAAB////zf//
+ /////////////////////////////////////////////////////////////////////////////8+6
+ I/+9oAD/x60D/72gAP/p35n//////////////////////////80AAAABAAAAAQAAAAEAAAABAAAAAQAA
+ AAH///0h////7f//////////////////////////////////////////////////////////////////
+ ////////6d+Z/8+6I//Yxkj/z7oj/+nfmf/////////////////////t///9IQAAAAEAAAABAAAAAQAA
+ AAEAAAABAAAAAQAAAAH///0h////7f//////////////////////////////////////////////////
+ ////////////////////////////////////////////////////////////7f///SEAAAABAAAAAQAA
+ AAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAH///0h////zf//////////////////////////////////
+ /////////////////////////////////////////////////////////////////83///0hAAAAAQAA
+ AAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAAB////if//////////////////
+ //////////////////////////////////////////////////////////////////////+JAAAAAQAA
+ AAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAAB///9If//
+ /4n////t/////////////////////////////////////////////////////////+3+/fid///9IQAA
+ AAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAA
+ AAEAAAABAAAAAQAAAAH///1Z/v34nf///83////t////7f///+3////t////zf79+J3///1ZAAAAAQAA
+ AAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACgAAAAwAAAAYAAAAAEA
+ IAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAA
+ AAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAf///yP//vth////rf///9P////T////7///
+ /+/////v////7////9P////T////rf/++2H///8jAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAA
+ AAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAA
+ AAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAf///yP///2F////0///////////////////
+ ////////////////////////////////////////////////////////////0////YX///8jAAAAAQAA
+ AAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAA
+ AAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAH///8j////rf//////////////////
+ ////////////////////////////////////////////////////////////////////////////////
+ ////////////rf///yMAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAA
+ AAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAf///YX/////////////
+ ////////////////////////////////////////////////////////////////////////////////
+ //////////////////////////////////////2FAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAA
+ AAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAH///8j////0///
+ ////////////////////////////////////////////////////////////////////////////////
+ ////////////////////////////////////////////////////////////0////yMAAAABAAAAAQAA
+ AAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAf/+
+ +2H/////////////////////////////////////////////////////////////////////////////
+ ////////////////////////////////////////////////////////////////////////////////
+ /////vthAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAA
+ AAEAAAAB//77Yf//////////////////////////////////////////////////////////////////
+ ////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////9hQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAA
+ AAEAAAABAAAAAQAAAAH//vth////////////////////////////////////////////////////////
+ ////////////////////////////////////////////////////////////////////////////////
+ /////////////////////////////////////////////////YUAAAABAAAAAQAAAAEAAAABAAAAAQAA
+ AAEAAAABAAAAAQAAAAEAAAABAAAAAf/++2H/////////////////////////////////////////////
+ ////////////////////////////////////////+PTc//j03P/w6rv/+PTc////////////////////
+ /////////////////////////////////////////////////////////////////////vthAAAAAQAA
+ AAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAAB////I///////////////////////////////////
+ ///////////////////////////////////w6rv/6N2U/+jdlP/o3ZT/6N2U//Dqu//w6rv/+PTc//j0
+ 3P/o3ZT/////////////////////////////////////////////////////////////////////////
+ ////////////IwAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAAB////0///////////////////
+ ///////////////////////////////////49Nz/39Bq/9/Qav/o3ZT/6N2U//Dqu///////////////
+ //////////////Dqu//OuBr/8Oq7////////////////////////////////////////////////////
+ ////////////////////////////7wAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAH//vth////////
+ ////////////////////////////////////////8Oq7/9/Qav/WxET/6N2U//j03P//////////////
+ /////////////////////////////+jdlP/OuBr/1sRE////////////////////////////////////
+ /////////////////////////////////////////////////YUAAAABAAAAAQAAAAEAAAABAAAAAQAA
+ AAH49Nz///////////////////////////////////////j03P/f0Gr/1sRE/+jdlP//////////////
+ /////////////////////////////////////////////864Gv/WxET/zrga/864Gv//////////////
+ //////////////////////////////////////////////////////////////////////8jAAAAAQAA
+ AAEAAAABAAAAAeXaiZff0Gr/39Bq/+jdlP/49Nz/////////////////39Bq/9bERP/o3ZT/////////
+ ////////////////////////////////////////////////////////6N2U/8SqAf/WxET/1sRE/8Sq
+ Af/f0Gr/////////////////////////////////////////////////////////////////////////
+ //////+tAAAAAQAAAAEAAAABAAAAAf//////////8Oq7/+jdlP/f0Gr/6N2U//Dqu//f0Gr/39Bq//j0
+ 3P//////////////////////////////////////////////////////////////////////39Bq/8Sq
+ Af/f0Gr/6N2U/8SqAf/WxET/////////////////////////////////////////////////////////
+ ////////////////////////////IwAAAAEAAAAB//77Yf/////////////////////w6rv/xKoB/8Sq
+ Af/WxET/////////////////////////////////////////////////////////////////////////
+ ////////8Oq7/8SqAf/o3ZT//////8SqAf/f0Gr/////////////////////////////////////////
+ ///////////////////////////////////////////9hQAAAAEAAAAB////0///////////+PTc/9/Q
+ av/f0Gr/8Oq7//j03P/WxET/zrga//j03P//////////////////////////////////////////////
+ /////////////////////////////9bERP/EqgH/1sRE/8SqAf/o3ZT/////////////////////////
+ ////////////////////////////////////////////////////////////0wAAAAH///8j+PTc//Dq
+ u//o3ZT/39Bq/+jdlP//////////////////////zrga/8SqAf/w6rv/////////////////////////
+ //////////////////////////////////////////////Dqu//EqgH/xKoB/8SqAf/w6rv/////////
+ ////////////////////////////////////////////////////////////////////////////////
+ /yP//vth39Bq/+jdlP/w6rv//////////////////////////////////////9/Qav/EqgH/6N2U////
+ ///////////////////////////////////////////////////////////////////OuBr/xKoB/8Sq
+ Af/o3ZT/////////////////////////////////////////////////////////////////////////
+ ///////////////++2H///2F////////////////////////////////////////////////////////
+ ///WxET/xKoB/9/Qav//////////////////////////////////////////////////////////////
+ ///WxET/xKoB/864Gv/w6rv/////////////////////////////////////////////////+PTc/+jd
+ lP/49Nz//////////////////////////63///+t////////////////////////////////////////
+ ////////////////////////1sRE/8SqAf/f0Gr/////////////////////////////////////////
+ ///////////////////49Nz/6N2U/+jdlP/o3ZT/8Oq7////////////////////////////////////
+ ////////1sRE/8SqAf/EqgH/8Oq7/////////////////////9P////T////////////////////////
+ /////////////////////////////////////////////864Gv/EqgH/39Bq////////////////////
+ //////////////////////////////Dqu//WxET/zrga/864Gv/EqgH/zrga////////////////////
+ ///////////////////49Nz/xKoB/8SqAf/EqgH/zrga/////////////////////9P////v////////
+ //////////////////////////////////////////////////////////////Dqu//EqgH/xKoB/9/Q
+ av///////////////////////////////////////////+jdlP/EqgH/xKoB/864Gv/EqgH/zrga////
+ ///////////////////////////////////w6rv/xKoB/864Gv/EqgH/zrga////////////////////
+ /+/////v////////////////////////////////////////////////////////////////////////
+ ///f0Gr/xKoB/8SqAf/o3ZT///////////////////////////////////////j03P/OuBr/xKoB/864
+ Gv/OuBr/xKoB//j03P/////////////////////////////////o3ZT/xKoB/864Gv/EqgH/zrga////
+ /////////////////+/////v////////////////////////////////////////////////////////
+ ////////////////////////zrga/8SqAf/EqgH/+PTc////////////////////////////////////
+ ///OuBr/xKoB/864Gv/OuBr/xKoB//Dqu//////////////////////////////////f0Gr/xKoB/864
+ Gv/EqgH/1sRE/////////////////////+/////v////////////////////////////////////////
+ ////////////////////////////////////////39Bq/8SqAf/EqgH/zrga////////////////////
+ ///////////////////WxET/xKoB/864Gv/OuBr/xKoB/9/Qav//////////////////////////////
+ ///WxET/xKoB/864Gv/EqgH/8Oq7/////////////////////+/////T////////////////////////
+ /////////////////////////////////////////////////////////////864Gv/EqgH/xKoB/9bE
+ RP/////////////////////////////////f0Gr/xKoB/864Gv/OuBr/xKoB/9bERP//////////////
+ //////////////j03P/EqgH/zrga/8SqAf/f0Gr//////////////////////////9P///+t////////
+ /////////////////////////////////////////////////////////////////////////////+jd
+ lP/EqgH/zrga/8SqAf/o3ZT////////////////////////////f0Gr/xKoB/8SqAf/EqgH/xKoB/864
+ Gv///////////////////////////9/Qav/EqgH/xKoB/864Gv//////////////////////////////
+ /9P///2F////////////////////////////////////////////////////////////////////////
+ ///////////////////OuBr/xKoB/8SqAf/EqgH/+PTc///////////////////////o3ZT/zrga/9/Q
+ av/o3ZT/6N2U//Dqu////////////////////////////864Gv/EqgH/zrga//j03P//////////////
+ /////////////////63//vth////////////////////////////////////////////////////////
+ ///////////////////////////////////f0Gr/xKoB/864Gv/EqgH/xKoB//Dqu///////////////
+ ///49Nz/8Oq7//Dqu//o3ZT/6N2U/9bERP/w6rv/////////////////6N2U/8SqAf/OuBr/+PTc////
+ ///////////////////////////////++2H///8j////////////////////////////////////////
+ ///////////////////////////////////////////////////w6rv/xKoB/8SqAf/EqgH/1sRE//j0
+ 3P/////////////////w6rv/xKoB/8SqAf/EqgH/xKoB/8SqAf/f0Gr////////////w6rv/xKoB/9bE
+ RP///////////////////////////////////////////////yMAAAAB////0///////////////////
+ ////////////////////////////////////////////////////////////////////////1sRE/9/Q
+ av/49Nz////////////////////////////w6rv/xKoB/864Gv/OuBr/zrga/8SqAf/WxET/////////
+ ///o3ZT/39Bq////////////////////////////////////////////////0wAAAAEAAAAB//77Yf//
+ ////////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////49Nz/zrga/8SqAf/OuBr/zrga/8Sq
+ Af/OuBr///////////////////////////////////////////////////////////////////77YQAA
+ AAEAAAABAAAAAf//////////////////////////////////////////////////////////////////
+ ////////////////////////////////////////////////////////////////////////zrga/8Sq
+ Af/OuBr/zrga/8SqAf/OuBr/+PTc////////////////////////////////////////////////////
+ ////////AAAAAQAAAAEAAAABAAAAAf///YX/////////////////////////////////////////////
+ ////////////////////////////////////////////////////////////////////////////////
+ ////////1sRE/8SqAf/OuBr/zrga/864Gv/EqgH/6N2U////////////////////////////////////
+ //////////////////////+tAAAAAQAAAAEAAAABAAAAAQAAAAH/////////////////////////////
+ ////////////////////////////////////////////////////////////////////////////////
+ ////////////////////////1sRE/8SqAf/OuBr/zrga/864Gv/EqgH/39Bq////////////////////
+ //////////////////////////////////////8jAAAAAQAAAAEAAAABAAAAAQAAAAH//vth////////
+ ////////////////////////////////////////////////////////////////////////////////
+ ////////////////////////////////////////6N2U/8SqAf/OuBr/zrga/864Gv/EqgH/39Bq////
+ /////////////////////////////////////////////////YUAAAABAAAAAQAAAAEAAAABAAAAAQAA
+ AAEAAAAB////0///////////////////////////////////////////////////////////////////
+ ////////////////////////////////////////////////////////6N2U/8SqAf/OuBr/zrga/864
+ Gv/EqgH/1sRE////////////////////////////////////////////////0wAAAAEAAAABAAAAAQAA
+ AAEAAAABAAAAAQAAAAEAAAAB////I///////////////////////////////////////////////////
+ ////////////////////////////////////////////////////////////////////////8Oq7/8Sq
+ Af/OuBr/zrga/864Gv/EqgH/zrga//j03P//////////////////////////////////////////IwAA
+ AAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAf///yP/////////////////////////////
+ ////////////////////////////////////////////////////////////////////////////////
+ /////////////864Gv/EqgH/xKoB/8SqAf/EqgH/xKoB//Dqu///////////////////////////////
+ /////vthAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAH//vth////////
+ ////////////////////////////////////////////////////////////////////////////////
+ //////////////////////////////j03P/w6rv/8Oq7//j03P/49Nz/8Oq7////////////////////
+ ///////////////++2EAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAA
+ AAEAAAAB//77Yf//////////////////////////////////////////////////////////////////
+ ////////////////////////////////////////////////////////////////////////////////
+ //////////////////////////77YQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAA
+ AAEAAAABAAAAAQAAAAEAAAABAAAAAf/++2H////v////////////////////////////////////////
+ ////////////////////////////////////////////////////////////////////////////////
+ /////////////////////////////////////vthAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAA
+ AAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAH///8j////0///////////////////
+ ////////////////////////////////////////////////////////////////////////////////
+ ////////////////////////////////////////////0////yMAAAABAAAAAQAAAAEAAAABAAAAAQAA
+ AAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAf/+
+ +2H////v////////////////////////////////////////////////////////////////////////
+ /////////////////////////////////////////////////////vthAAAAAQAAAAEAAAABAAAAAQAA
+ AAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAA
+ AAEAAAABAAAAAQAAAAH///8j///9hf///+//////////////////////////////////////////////
+ ///////////////////////////////////////////////////////v///9hf///yMAAAABAAAAAQAA
+ AAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAA
+ AAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAH//vth////rf//////////////////
+ ////////////////////////////////////////////////////////////rf/++2EAAAABAAAAAQAA
+ AAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAA
+ AAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAf//
+ /yP//vth///9hf///63////T////7////+/////v////7////9P///+t///9hf/++2H///8jAAAAAQAA
+ AAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAA
+ AAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
+
+
+
\ No newline at end of file
diff --git a/src/syosetuDownloader/syosetuDownloader.csproj b/src/syosetuDownloader/syosetuDownloader.csproj
index 44dee9c..ad96670 100644
--- a/src/syosetuDownloader/syosetuDownloader.csproj
+++ b/src/syosetuDownloader/syosetuDownloader.csproj
@@ -94,6 +94,12 @@
MSBuild:Compile
Designer
+
+ Form
+
+
+ RenameForm.cs
+
Designer
@@ -133,6 +139,9 @@
ResXFileCodeGenerator
Resources.Designer.cs
+
+ RenameForm.cs
+
Always
diff --git a/src/syosetuDownloaderCore/History.cs b/src/syosetuDownloaderCore/History.cs
index 4e3b6ad..9d4483c 100644
--- a/src/syosetuDownloaderCore/History.cs
+++ b/src/syosetuDownloaderCore/History.cs
@@ -1,203 +1,209 @@
-using System;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.ComponentModel;
-using System.Linq;
-using System.Reflection;
-using System.Text;
-using System.Threading.Tasks;
-using System.Xml;
-using System.Xml.Linq;
-using Microsoft.VisualBasic.FileIO;
-
-namespace Syousetsu
-{
- public class History
- {
- public class Item : INotifyPropertyChanged
- {
- string _link = "";
- bool _favorite = false;
- string _title = "";
- int _downloaded = 0;
- int _total = 0;
- DateTime _date = new DateTime();
- Constants.SiteType _site;
- string _code = "";
- bool _finished = false;
-
- public string Link { get => _link; set => _link = value; }
- public bool Favorite
- {
- get => _favorite;
- set { _favorite = value; OnPropertyChanged(nameof(Favorite)); }
- }
- public string Title { get => _title; set => _title = value; }
- public int Downloaded { get => _downloaded; set => _downloaded = value; }
- public int Total
- {
- get => _total;
- set { _total = value; OnPropertyChanged(nameof(Total)); }
- }
- public DateTime Date { get => _date; set => _date = value; }
- public Constants.SiteType Site { get => _site; set => _site = value; }
- public string Code { get => _code; set => _code = value; }
- public string New
- {
- get
- {
- if (Downloaded < Total) return "+";
- else if (Downloaded > Total) return "-";
- else return "";
- }
- }
- public bool Finished
- {
- get => _finished;
- set { _finished = value; OnPropertyChanged(nameof(Finished)); }
- }
-
- public event PropertyChangedEventHandler PropertyChanged;
-
- public void OnPropertyChanged(string propName)
- {
- if (this.PropertyChanged != null)
- this.PropertyChanged(this, new PropertyChangedEventArgs(propName));
- }
- }
-
- private static readonly string _folder = System.IO.Path.GetDirectoryName(Assembly.GetEntryAssembly().Location) +
- System.IO.Path.DirectorySeparatorChar + "_HISTORY_" + System.IO.Path.DirectorySeparatorChar;
- private ObservableCollection- _items = new ObservableCollection
- ();
-
- public History()
- {
- // check directory
- if (!System.IO.Directory.Exists(_folder))
- {
- System.IO.Directory.CreateDirectory(_folder);
- }
- }
-
- public static void SaveItem(Item item)
- {
- SaveFile(item, _folder + item.Code + ".xml");
- }
-
- public static void DeleteItemFile(Item item)
- {
- string file = _folder + item.Code + ".xml";
- if (System.IO.File.Exists(file))
- {
- FileSystem.DeleteFile(file, UIOption.OnlyErrorDialogs, RecycleOption.SendToRecycleBin);
- }
- }
-
- public static void SaveNovel(Constants details)
- {
- string file = _folder + details.SeriesCode + ".xml";
- Item item = new Item();
- LoadFile(item, file); // load last data
- item.Link = details.Link; // update with new data
- item.Title = details.SeriesTitle;
- item.Downloaded = details.LastDownloaded;
- item.Total = details.TotalChapters;
- item.Date = DateTime.Now;
- item.Site = details.Site();
- item.Code = details.SeriesCode;
- SaveFile(item, file);
- }
-
- public void LoadAll()
- {
- _items.Clear();
- string[] fileEntries = System.IO.Directory.GetFiles(_folder);
- foreach (string file in fileEntries)
- {
- if (System.IO.Path.GetExtension(file).Equals(".xml", StringComparison.OrdinalIgnoreCase))
- {
- Item it = new Item();
- LoadFile(it, file);
- _items.Add(it);
- }
- }
- }
-
- public static void LoadFile(Item item, string file)
- {
- if (!System.IO.File.Exists(file)) return;
-
- XElement elem = XElement.Load(file).Element("item");
- item.Link = elem.Attribute("link").Value;
- item.Favorite = bool.Parse(elem.Attribute("favorite").Value);
- item.Title = elem.Attribute("title").Value;
- item.Downloaded = int.Parse(elem.Attribute("downloaded").Value);
- item.Total = int.Parse(elem.Attribute("total").Value);
- item.Date = DateTime.Parse(elem.Attribute("date").Value);
- Enum.TryParse(elem.Attribute("site").Value, out Constants.SiteType site);
- item.Site = site;
- item.Code = elem.Attribute("code").Value;
- try // newly added stuff
- {
- item.Finished = bool.Parse(elem.Attribute("finished").Value);
- }
- catch { }
- }
-
- public static void SaveFile(Item item, string file)
- {
- XmlDocument doc = new XmlDocument();
- XmlNode docNode = doc.CreateXmlDeclaration("1.0", "UTF-8", null);
- doc.AppendChild(docNode);
-
- XmlNode rootNode = doc.CreateElement("root");
- doc.AppendChild(rootNode);
-
- XmlNode node = doc.CreateElement("item");
-
- XmlAttribute attr = doc.CreateAttribute("link");
- attr.Value = item.Link;
- node.Attributes.Append(attr);
-
- attr = doc.CreateAttribute("favorite");
- attr.Value = item.Favorite.ToString();
- node.Attributes.Append(attr);
-
- attr = doc.CreateAttribute("title");
- attr.Value = item.Title;
- node.Attributes.Append(attr);
-
- attr = doc.CreateAttribute("downloaded");
- attr.Value = item.Downloaded.ToString();
- node.Attributes.Append(attr);
-
- attr = doc.CreateAttribute("total");
- attr.Value = item.Total.ToString();
- node.Attributes.Append(attr);
-
- attr = doc.CreateAttribute("date");
- attr.Value = item.Date.ToString();
- node.Attributes.Append(attr);
-
- attr = doc.CreateAttribute("site");
- attr.Value = item.Site.ToString();
- node.Attributes.Append(attr);
-
- attr = doc.CreateAttribute("code");
- attr.Value = item.Code;
- node.Attributes.Append(attr);
-
- attr = doc.CreateAttribute("finished");
- attr.Value = item.Finished.ToString();
- node.Attributes.Append(attr);
-
- rootNode.AppendChild(node);
- doc.Save(file);
- }
-
- public ObservableCollection
- Items
- {
- get { return _items; }
- }
- }
-}
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.ComponentModel;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+using System.Threading.Tasks;
+using System.Xml;
+using System.Xml.Linq;
+using Microsoft.VisualBasic.FileIO;
+
+namespace Syousetsu
+{
+ public class History
+ {
+ public class Item : INotifyPropertyChanged
+ {
+ string _link = "";
+ bool _favorite = false;
+ string _title = "";
+ int _downloaded = 0;
+ int _total = 0;
+ DateTime _date = new DateTime();
+ Constants.SiteType _site;
+ string _code = "";
+ bool _finished = false;
+
+ public string Link { get => _link; set => _link = value; }
+ public bool Favorite
+ {
+ get => _favorite;
+ set { _favorite = value; OnPropertyChanged(nameof(Favorite)); }
+ }
+ public string Title { get => _title; set => _title = value; }
+ public int Downloaded { get => _downloaded; set => _downloaded = value; }
+ public int Total
+ {
+ get => _total;
+ set { _total = value; OnPropertyChanged(nameof(Total)); }
+ }
+ public DateTime Date { get => _date; set => _date = value; }
+ public Constants.SiteType Site { get => _site; set => _site = value; }
+ public string Code { get => _code; set => _code = value; }
+ public string New
+ {
+ get
+ {
+ if (Downloaded < Total) return "+";
+ else if (Downloaded > Total) return "-";
+ else return "";
+ }
+ }
+ public bool Finished
+ {
+ get => _finished;
+ set { _finished = value; OnPropertyChanged(nameof(Finished)); }
+ }
+
+ public event PropertyChangedEventHandler PropertyChanged;
+
+ public void OnPropertyChanged(string propName)
+ {
+ if (this.PropertyChanged != null)
+ this.PropertyChanged(this, new PropertyChangedEventArgs(propName));
+ }
+ }
+
+ private static readonly string _folder = System.IO.Path.GetDirectoryName(Assembly.GetEntryAssembly().Location) +
+ System.IO.Path.DirectorySeparatorChar + "_HISTORY_" + System.IO.Path.DirectorySeparatorChar;
+ private ObservableCollection
- _items = new ObservableCollection
- ();
+
+ public History()
+ {
+ // check directory
+ if (!System.IO.Directory.Exists(_folder))
+ {
+ System.IO.Directory.CreateDirectory(_folder);
+ }
+ }
+
+ public static void SaveItem(Item item)
+ {
+ SaveFile(item, _folder + item.Code + ".xml");
+ }
+
+ public static void DeleteItemFile(Item item)
+ {
+ string file = _folder + item.Code + ".xml";
+ if (System.IO.File.Exists(file))
+ {
+ FileSystem.DeleteFile(file, UIOption.OnlyErrorDialogs, RecycleOption.SendToRecycleBin);
+ }
+ }
+
+ public static void SaveNovel(Constants details)
+ {
+ string file = _folder + details.SeriesCode + ".xml";
+ Item item = new Item();
+ LoadFile(item, file); // load last data
+ item.Link = details.Link; // update with new data
+ item.Title = details.SeriesTitle;
+ item.Downloaded = details.LastDownloaded;
+ item.Total = details.TotalChapters;
+ item.Date = DateTime.Now;
+ item.Site = details.Site();
+ item.Code = details.SeriesCode;
+ SaveFile(item, file);
+ }
+
+ public static void LoadNovel(Item item, Constants details)
+ {
+ string file = _folder + details.SeriesCode + ".xml";
+ LoadFile(item, file); // load last data
+ }
+
+ public void LoadAll()
+ {
+ _items.Clear();
+ string[] fileEntries = System.IO.Directory.GetFiles(_folder);
+ foreach (string file in fileEntries)
+ {
+ if (System.IO.Path.GetExtension(file).Equals(".xml", StringComparison.OrdinalIgnoreCase))
+ {
+ Item it = new Item();
+ LoadFile(it, file);
+ _items.Add(it);
+ }
+ }
+ }
+
+ public static void LoadFile(Item item, string file)
+ {
+ if (!System.IO.File.Exists(file)) return;
+
+ XElement elem = XElement.Load(file).Element("item");
+ item.Link = elem.Attribute("link").Value;
+ item.Favorite = bool.Parse(elem.Attribute("favorite").Value);
+ item.Title = elem.Attribute("title").Value;
+ item.Downloaded = int.Parse(elem.Attribute("downloaded").Value);
+ item.Total = int.Parse(elem.Attribute("total").Value);
+ item.Date = DateTime.Parse(elem.Attribute("date").Value);
+ Enum.TryParse(elem.Attribute("site").Value, out Constants.SiteType site);
+ item.Site = site;
+ item.Code = elem.Attribute("code").Value;
+ try // newly added stuff
+ {
+ item.Finished = bool.Parse(elem.Attribute("finished").Value);
+ }
+ catch { }
+ }
+
+ public static void SaveFile(Item item, string file)
+ {
+ XmlDocument doc = new XmlDocument();
+ XmlNode docNode = doc.CreateXmlDeclaration("1.0", "UTF-8", null);
+ doc.AppendChild(docNode);
+
+ XmlNode rootNode = doc.CreateElement("root");
+ doc.AppendChild(rootNode);
+
+ XmlNode node = doc.CreateElement("item");
+
+ XmlAttribute attr = doc.CreateAttribute("link");
+ attr.Value = item.Link;
+ node.Attributes.Append(attr);
+
+ attr = doc.CreateAttribute("favorite");
+ attr.Value = item.Favorite.ToString();
+ node.Attributes.Append(attr);
+
+ attr = doc.CreateAttribute("title");
+ attr.Value = item.Title;
+ node.Attributes.Append(attr);
+
+ attr = doc.CreateAttribute("downloaded");
+ attr.Value = item.Downloaded.ToString();
+ node.Attributes.Append(attr);
+
+ attr = doc.CreateAttribute("total");
+ attr.Value = item.Total.ToString();
+ node.Attributes.Append(attr);
+
+ attr = doc.CreateAttribute("date");
+ attr.Value = item.Date.ToString();
+ node.Attributes.Append(attr);
+
+ attr = doc.CreateAttribute("site");
+ attr.Value = item.Site.ToString();
+ node.Attributes.Append(attr);
+
+ attr = doc.CreateAttribute("code");
+ attr.Value = item.Code;
+ node.Attributes.Append(attr);
+
+ attr = doc.CreateAttribute("finished");
+ attr.Value = item.Finished.ToString();
+ node.Attributes.Append(attr);
+
+ rootNode.AppendChild(node);
+ doc.Save(file);
+ }
+
+ public ObservableCollection
- Items
+ {
+ get { return _items; }
+ }
+ }
+}