@@ -6,60 +6,212 @@ | ||
6 | 6 | |
7 | 7 | Private Sub btnNCXDep2_Click(sender As Object, e As EventArgs) Handles btnNCXDep2.Click |
8 | 8 | |
9 | + 'Dim listVolumn As List(Of String) = {"part0003", "part0017", "part0029", "part0041", "part0053", "part0065", "part0077", "part0089"}.ToList() | |
10 | + | |
11 | + | |
12 | + Dim listVolumn As List(Of String) = {"part0003"}.ToList() | |
13 | + | |
14 | + | |
15 | + | |
9 | 16 | Try |
10 | 17 | |
11 | - Dim ncxFilePath As String = "C:\Users\DataTrade\Downloads\cd\OEBPS\toc.ncx" | |
12 | - | |
13 | - Dim fs As System.IO.FileStream = New System.IO.FileStream(ncxFilePath, System.IO.FileMode.Open) | |
14 | - Dim serializer As System.Xml.Serialization.XmlSerializer = New System.Xml.Serialization.XmlSerializer(GetType(ncx)) | |
15 | - Dim fileNCX As ncx = CType(serializer.Deserialize(fs), ncx) | |
16 | 18 | Dim mEpub As New List(Of modelVolume) |
17 | 19 | |
20 | + For Each uPage As String In listVolumn | |
18 | 21 | |
19 | - For ctrVolume As Integer = 1 To fileNCX.navMap.Count - 1 | |
22 | + Dim sPath As String = "C:\Soft\A1\OEBPS\Text\" & uPage & ".xhtml" | |
23 | + Dim sHtml As String = cTools.sFileReader(sPath, cEpub6.encUTF8) | |
20 | 24 | |
21 | - Dim fileVoluem As ncxNavPoint = fileNCX.navMap(ctrVolume) | |
25 | + Dim listVolume As List(Of String) = cTools.listNav_SE(sHtml, "<p class=""kindle-cn-toc-level-1"">", "</p>", False) | |
22 | 26 | |
27 | + listVolume.RemoveAt(listVolume.Count - 1) | |
23 | 28 | |
24 | - Dim mVolume As New modelVolume | |
25 | - mVolume.Title = fileVoluem.navLabel.text | |
26 | 29 | |
27 | - For ctrChapter As Integer = 0 To fileVoluem.navPoint.Length - 1 | |
30 | + For Each eachVolume As String In listVolume | |
28 | 31 | |
29 | - Dim fileChapter As ncxNavPointNavPoint = fileVoluem.navPoint(ctrChapter) | |
32 | + Dim sURL As String = cTools.listNav_SE(eachVolume, "<a href=""", """>", False)(0) | |
33 | + Dim sTitle As String = cTools.listNav_SE(eachVolume, """>", "</a>", False)(0) | |
30 | 34 | |
31 | - Dim mChapter As New modelChapter | |
32 | - mChapter.Title = fileChapter.navLabel.text | |
33 | - mChapter.Scr = fileChapter.content.src | |
34 | - mChapter.Scr = mChapter.Scr.Split("#")(0) | |
35 | + If sTitle.IndexOf("青霞") > 0 Then | |
36 | + Continue For | |
37 | + End If | |
35 | 38 | |
36 | - Dim sChapter As String = cTools.sFileReader("C:\Users\DataTrade\Downloads\cd\OEBPS\" & mChapter.Scr, cEpub6.encUTF8) | |
37 | - Dim listText As List(Of String) = cTools.listText_P(sChapter) | |
38 | 39 | |
39 | - mChapter.listText = listText | |
40 | + Dim mVolume As New modelVolume | |
41 | + mVolume.Title = sTitle | |
40 | 42 | |
41 | - mVolume.listChapter.Add(mChapter) | |
42 | 43 | |
43 | - Next | |
44 | + If sTitle.IndexOf("第四十一回") > -1 Then | |
44 | 45 | |
45 | - mEpub.Add(mVolume) | |
46 | + Dim kkkere = "1" | |
46 | 47 | |
48 | + End If | |
49 | + | |
50 | + | |
51 | + Dim listChart As List(Of String) = cTools.listNav_SE(sHtml, sURL, """>", True) | |
52 | + | |
53 | + | |
54 | + | |
55 | + sURL = "C:\Soft\A1\OEBPS\Text\" & sURL | |
56 | + | |
57 | + If listChart.Count = 1 Then | |
58 | + | |
59 | + Dim sChartHtml As String = cTools.sFileReader(sURL, cEpub6.encUTF8) | |
60 | + | |
61 | + mVolume.listText = cTools.listText_P(sChartHtml) | |
62 | + | |
63 | + | |
64 | + Else | |
65 | + | |
66 | + Dim sChartHtml As String = cTools.sFileReader(sURL, cEpub6.encUTF8) | |
67 | + | |
68 | + | |
69 | + | |
70 | + | |
71 | + | |
72 | + | |
73 | + Dim listChartLine As List(Of String) = sChartHtml.Split(New String() {"<h2"}, StringSplitOptions.None).ToList | |
74 | + listChartLine.RemoveAt(0) | |
75 | + | |
76 | + For Each eachChartLine11 As String In listChartLine | |
77 | + | |
78 | + Dim eachChartLine As String = eachChartLine11 | |
79 | + | |
80 | + | |
81 | + | |
82 | + If sChartHtml.IndexOf("image01385") > -1 Then | |
83 | + | |
84 | + Dim kkdfd = "1" | |
85 | + End If | |
86 | + | |
87 | + | |
88 | + | |
89 | + | |
90 | + Dim listImg As List(Of String) = cTools.listNav_SE(eachChartLine, "<img", "/>", True) | |
91 | + | |
92 | + For Each eachImg As String In listImg | |
93 | + | |
94 | + | |
95 | + Dim sScr As String = eachImg.Split("/").ToList()(2).Split("""").ToList()(0) | |
96 | + | |
97 | + | |
98 | + Dim sNewImg As String = cTools.sGaiji(sScr, emEpub6.emUrlImgDep.Chapter) | |
99 | + | |
100 | + eachChartLine = eachChartLine.Replace(eachImg, sNewImg) | |
101 | + | |
102 | + Next | |
103 | + | |
104 | + | |
105 | + | |
106 | + | |
107 | + | |
108 | + | |
109 | + Dim mChart As New modelChapter | |
110 | + | |
111 | + Dim listCHK As List(Of String) = cTools.listNav_SE(eachChartLine, "</a>", "</h2>", False) | |
112 | + | |
113 | + If listCHK.Count = 0 Then | |
114 | + listCHK = cTools.listNav_SE(eachChartLine, """>", "</h2>", False) | |
115 | + End If | |
116 | + | |
117 | + If listCHK.Count = 0 Then | |
118 | + | |
119 | + Dim kk1 = "11" | |
120 | + | |
121 | + End If | |
122 | + | |
123 | + | |
124 | + | |
125 | + mChart.Title = listCHK(0) | |
126 | + mChart.listText = cTools.listText_P(eachChartLine) | |
127 | + | |
128 | + | |
129 | + mVolume.listChapter.Add(mChart) | |
130 | + Next | |
131 | + | |
132 | + | |
133 | + | |
134 | + | |
135 | + End If | |
136 | + | |
137 | + mEpub.Add(mVolume) | |
138 | + | |
139 | + | |
140 | + Next | |
47 | 141 | Next |
48 | 142 | |
49 | - Dim cEpub As New cEpub6(emEpub6.emEncCode.GB2321, emEpub6.emLan.ZH, "王占君武侠小说合集", "王占君", "WZJWX_201906") | |
50 | - cEpub.bConvertToMobi = False | |
143 | + | |
144 | + Dim cEpub As New cEpub6(emEpub6.emEncCode.GB2321, emEpub6.emLan.ZH, "蒋勋说红楼梦", "蒋勋", "JXHLM_201910") | |
145 | + cEpub.bConvertToMobi = True | |
51 | 146 | cEpub.CreateEpub(mEpub) |
52 | 147 | MessageBox.Show("Finished") |
53 | 148 | |
54 | 149 | |
150 | + | |
151 | + | |
55 | 152 | Catch ex As Exception |
56 | 153 | |
57 | - MessageBox.Show(ex.Message) | |
58 | - | |
59 | 154 | End Try |
60 | 155 | |
61 | 156 | |
62 | 157 | |
158 | + 'Try | |
159 | + | |
160 | + ' Dim ncxFilePath As String = "C:\CD1\toc.ncx" | |
161 | + | |
162 | + ' Dim fs As System.IO.FileStream = New System.IO.FileStream(ncxFilePath, System.IO.FileMode.Open) | |
163 | + ' Dim serializer As System.Xml.Serialization.XmlSerializer = New System.Xml.Serialization.XmlSerializer(GetType(ncx)) | |
164 | + ' Dim fileNCX As ncx = CType(serializer.Deserialize(fs), ncx) | |
165 | + ' fs.Dispose() | |
166 | + | |
167 | + | |
168 | + ' Dim mEpub As New List(Of modelVolume) | |
169 | + | |
170 | + | |
171 | + ' For ctrVolume As Integer = 1 To fileNCX.navMap.Count - 1 | |
172 | + | |
173 | + ' Dim fileVoluem As ncxNavPoint = fileNCX.navMap(ctrVolume) | |
174 | + | |
175 | + | |
176 | + ' Dim mVolume As New modelVolume | |
177 | + ' mVolume.Title = fileVoluem.navLabel.text | |
178 | + | |
179 | + ' For ctrChapter As Integer = 0 To fileVoluem.navPoint.Length - 1 | |
180 | + | |
181 | + ' Dim fileChapter As ncxNavPointNavPoint = fileVoluem.navPoint(ctrChapter) | |
182 | + | |
183 | + ' Dim mChapter As New modelChapter | |
184 | + ' mChapter.Title = fileChapter.navLabel.text | |
185 | + ' mChapter.Scr = fileChapter.content.src | |
186 | + ' mChapter.Scr = mChapter.Scr.Split("#")(0) | |
187 | + | |
188 | + ' Dim sChapter As String = cTools.sFileReader("C:\CD1\" & mChapter.Scr, cEpub6.encUTF8) | |
189 | + ' Dim listText As List(Of String) = cTools.listText_P(sChapter) | |
190 | + | |
191 | + ' mChapter.listText = listText | |
192 | + | |
193 | + ' mVolume.listChapter.Add(mChapter) | |
194 | + | |
195 | + ' Next | |
196 | + | |
197 | + ' mEpub.Add(mVolume) | |
198 | + | |
199 | + ' Next | |
200 | + | |
201 | + ' Dim cEpub As New cEpub6(emEpub6.emEncCode.GB2321, emEpub6.emLan.ZH, "中篇推理小说", "合集", "ZPTLXSHJ_201909") | |
202 | + ' cEpub.bConvertToMobi = True | |
203 | + ' cEpub.CreateEpub(mEpub) | |
204 | + ' MessageBox.Show("Finished") | |
205 | + | |
206 | + | |
207 | + 'Catch ex As Exception | |
208 | + | |
209 | + ' MessageBox.Show(ex.Message) | |
210 | + | |
211 | + 'End Try | |
212 | + | |
213 | + | |
214 | + | |
63 | 215 | End Sub |
64 | 216 | |
65 | 217 | Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click |
@@ -91,6 +91,11 @@ | ||
91 | 91 | .mobiText { |
92 | 92 | text-indent: 2em; |
93 | 93 | display: block; |
94 | + letter-spacing: auto; | |
95 | + line-height: 1.5em; | |
96 | + text-align: left; | |
97 | + text-indent: 2em; | |
98 | + margin: 10pt 0 | |
94 | 99 | } |
95 | 100 | |
96 | 101 | .mobiCommand { |
@@ -32,7 +32,7 @@ | ||
32 | 32 | |
33 | 33 | <Global.System.Diagnostics.DebuggerStepThroughAttribute()> _ |
34 | 34 | Protected Overrides Sub OnCreateMainForm() |
35 | - Me.MainForm = Global.AutoEpub3.AutoPdf | |
35 | + Me.MainForm = Global.AutoEpub3.AutoEpub7 | |
36 | 36 | End Sub |
37 | 37 | End Class |
38 | 38 | End Namespace |
@@ -1089,18 +1089,18 @@ | ||
1089 | 1089 | Public Shared Function sGaiji(ByVal sScr As String, ByVal iDep As emEpub6.emUrlImgDep) As String |
1090 | 1090 | |
1091 | 1091 | Dim listTemp As List(Of String) = sScr.Split("/").ToList() |
1092 | - sScr = "/Img/" & listTemp(listTemp.Count - 1) | |
1092 | + sScr = "Img/" & listTemp(listTemp.Count - 1) | |
1093 | 1093 | |
1094 | 1094 | If iDep = emEpub6.emUrlImgDep.Section Then |
1095 | - sScr = "../../" & sScr | |
1095 | + sScr = "" & sScr | |
1096 | 1096 | End If |
1097 | 1097 | |
1098 | 1098 | If iDep = emEpub6.emUrlImgDep.Volume Then |
1099 | - sScr = "../../../" & sScr | |
1099 | + sScr = "../" & sScr | |
1100 | 1100 | End If |
1101 | 1101 | |
1102 | 1102 | If iDep = emEpub6.emUrlImgDep.Chapter Then |
1103 | - sScr = "../../../" & sScr | |
1103 | + sScr = "../../" & sScr | |
1104 | 1104 | End If |
1105 | 1105 | |
1106 | 1106 | sGaiji = "<img class=""mobiImgChar_Bottom_5px"" alt="""" src=""" & sScr & """/>" |