Skip to content

Commit

Permalink
Added footer/author notes
Browse files Browse the repository at this point in the history
  • Loading branch information
LordZero25 committed Jun 23, 2018
1 parent b2c317c commit 0baf8f8
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 11 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
################################################################################

/src/syosetuDownloader/bin
/src/syosetuDownloader/obj/x86
/src/.vs
4 changes: 2 additions & 2 deletions src/syosetuDownloader/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.3.0")]
[assembly: AssemblyFileVersion("2.3.0")]
[assembly: AssemblyVersion("2.3.1")]
[assembly: AssemblyFileVersion("2.3.1")]
37 changes: 29 additions & 8 deletions src/syosetuDownloader/Syousetsu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,17 @@ public static string GetChapterTitle(HtmlDocument doc)
public static string GetNovelBody(HtmlDocument doc, Constants.FileType fileType)
{
HtmlNode novelNode = doc.DocumentNode.SelectSingleNode("//div[@id='novel_honbun']");
HtmlNode footerNode = doc.DocumentNode.SelectSingleNode("//div[@id='novel_a']");
if (fileType == Constants.FileType.Text)
{
return novelNode.InnerText;
string s = novelNode.InnerText;
if (footerNode != null)
{
s += Environment.NewLine + "=====" + Environment.NewLine;
s += footerNode.InnerText;
}

return s;
}
else if (fileType == Constants.FileType.HTML)
{
Expand All @@ -153,9 +161,22 @@ public static string GetNovelBody(HtmlDocument doc, Constants.FileType fileType)
StringBuilder sb = new StringBuilder();
foreach (String str in s)
{
string temp = (str != "") ? ("<p>" + str + "</p>\n") : ("<p><br/></p>\n");
sb.Append(temp);
string temp = (str != "") ? ("<p>" + str + "</p>") : ("<p><br/></p>");
sb.AppendLine(temp);
}

if (footerNode != null)
{
sb.AppendLine("<hr/>");

s = footerNode.InnerText.Split(new string[] { "\r\n", "\n" }, StringSplitOptions.None);
foreach (String str in s)
{
string temp = (str != "") ? ("<p>" + str + "</p>") : ("<p><br/></p>");
sb.AppendLine(temp);
}
}

return sb.ToString();
}
return String.Empty;
Expand Down Expand Up @@ -285,7 +306,7 @@ public static string[] GenerateContents(Syousetsu.Constants details, HtmlDocumen
if (doc.DocumentNode.SelectSingleNode("//div[@id='novel_honbun']").InnerHtml.Contains("<img"))
{
string subLink = String.Format("{0}{1}", details.Link, current);
chapter[1] += String.Format("\n\n===\n\nContains image(s): {0}\n\n===", subLink);
chapter[1] += String.Format("\n\n===\n\n<a href=\"{0}\">Contains image(s)</a>\n\n===", subLink);
}
}
return chapter;
Expand Down Expand Up @@ -409,8 +430,8 @@ private static string CheckDirectory(Syousetsu.Constants details)
temp = temp.Take(temp.Length - 1).ToArray();
string tempFormat = (temp.Length > 1) ? String.Join("\\", temp) : temp[0];

path = Path.Combine(new string[] {
Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location),
path = Path.Combine(new string[] {
Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location),
details.SeriesTitle,
String.Format(tempFormat, new object[]{ 0, details.ChapterTitle[0], details.SeriesCode})
});
Expand All @@ -434,8 +455,8 @@ private static string CheckDirectory(Syousetsu.Constants details, int current)
temp = temp.Take(temp.Length - 1).ToArray();
string tempFormat = (temp.Length > 1) ? String.Join("\\", temp) : temp[0];

path = Path.Combine(new string[] {
Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location),
path = Path.Combine(new string[] {
Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location),
details.SeriesTitle,
String.Format(tempFormat, new object[]{ current, details.ChapterTitle[current], details.SeriesCode})
});
Expand Down
3 changes: 2 additions & 1 deletion src/syosetuDownloader/syosetuDownloader.csproj.user
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
</StartArguments>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<StartArguments>-h</StartArguments>
<StartArguments>
</StartArguments>
</PropertyGroup>
<PropertyGroup>
<PublishUrlHistory>publish\</PublishUrlHistory>
Expand Down

0 comments on commit 0baf8f8

Please sign in to comment.