Skip to content

Commit

Permalink
fox syosetu css
Browse files Browse the repository at this point in the history
  • Loading branch information
setsumi committed Oct 26, 2022
1 parent b5488e1 commit 4b400cb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/syosetuDownloader/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public partial class MainWindow : Window
Shell32.Shell _shell;
string _exe_dir;
string _dl_dir;
readonly string _version = "2.4.0 plus 12";
readonly string _version = "2.4.0 plus 13";

public Util.GridViewTool.SortInfo sortInfo = new Util.GridViewTool.SortInfo();

Expand Down
20 changes: 13 additions & 7 deletions src/syosetuDownloaderCore/Syousetsu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -539,18 +539,24 @@ public static void GenerateTableOfContents(Syousetsu.Constants details, HtmlDocu

//get css link and download
List<string> cssink = new List<string>();
string[] patterns = { "(href=\")(?<link>.+)(?=\" media)", "(href=\")(?<link>.+)(?=\">)" };
string pattern;
Regex r;
Match m;
Match m = Match.Empty;
foreach (HtmlNode node in cssNode)
{
if (details.Site() == Constants.SiteType.Syousetsu) // syousetsu
pattern = "(href=\")(?<link>.+)(?=\" media)";
else // kakuyomu
pattern = "(href=\")(?<link>.+)(?=\">)";
foreach (string p in patterns)
{
r = new Regex(p);
m = r.Match(node.OuterHtml);
if (m.Groups["link"].Value.Length > 0) break;
}

//if (details.Site() == Constants.SiteType.Syousetsu) // syousetsu
// pattern = "(href=\")(?<link>.+)(?=\" media)";
//else // kakuyomu
// pattern = "(href=\")(?<link>.+)(?=\">)";

r = new Regex(pattern);
m = r.Match(node.OuterHtml);
cssink.Add(m.Groups["link"].Value);
}
DownloadCss(details, cssink);
Expand Down

0 comments on commit 4b400cb

Please sign in to comment.