Skip to content

Commit

Permalink
fixed exception on download if history folder doesn't exist
Browse files Browse the repository at this point in the history
  • Loading branch information
setsumi committed Nov 1, 2024
1 parent 100047e commit 6f3f67b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/syosetuDownloader/HistoryWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
<GridViewColumn Header="Downloaded"
DisplayMemberBinding="{Binding Downloaded}"
util:GridViewSort.PropertyName="Downloaded"/>
<GridViewColumn Header="Total"
<GridViewColumn Header="Total" Width="40"
DisplayMemberBinding="{Binding Total}"
util:GridViewSort.PropertyName="Total"/>
<GridViewColumn Header="New"
Expand Down
4 changes: 2 additions & 2 deletions src/syosetuDownloader/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public partial class MainWindow : Window
static readonly Random _random = new Random((int)DateTime.Now.Ticks & 0x0000FFFF);
static readonly InputSimulator _sim = new InputSimulator();

readonly string _version = "2.4.0 plus 26";
readonly string _version = "2.4.0 plus 27";
readonly Shell32.Shell _shell;

public Util.GridViewTool.SortInfo sortInfo = new Util.GridViewTool.SortInfo();
Expand Down Expand Up @@ -487,7 +487,7 @@ private void Window_Loaded(object sender, RoutedEventArgs e)
PopulateNovelsURLs(txtLink);
PopulateSiteLinks(cbSite);
if (cbSite.Items.Count > 0) cbSite.SelectedIndex = 0;

Syousetsu.History.CheckDirectory();
FocusHistoryButton();
}

Expand Down
6 changes: 5 additions & 1 deletion src/syosetuDownloaderCore/History.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,11 @@ public void OnPropertyChanged(string propName)

public History()
{
// check directory
CheckDirectory();
}

public static void CheckDirectory()
{
if (!System.IO.Directory.Exists(_folder))
{
System.IO.Directory.CreateDirectory(_folder);
Expand Down
1 change: 1 addition & 0 deletions src/syosetuDownloaderCore/Syousetsu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -819,6 +819,7 @@ public static string DownloadHttpText(string link, Constants details)
request.UserAgent = details.UserAgent;
request.CookieContainer = details.SyousetsuCookie;
request.Timeout = Constants.NetTimeout;
//request.Proxy = new WebProxy("localhost", 10809);
//When you get the response from the website, the cookies will be stored
//automatically in "_cookies".
response = (HttpWebResponse)request.GetResponse();
Expand Down

0 comments on commit 6f3f67b

Please sign in to comment.