• R/O
  • SSH
  • HTTPS

autocodeforsql: Commit


Commit MetaInfo

Revisão378 (tree)
Hora2020-09-10 21:54:42
Autorhilinwei

Mensagem de Log

Mudança Sumário

Diff

--- AutoEpub3/AutoEpub8.vb (revision 377)
+++ AutoEpub3/AutoEpub8.vb (revision 378)
@@ -16,8 +16,84 @@
1616
1717 End Sub
1818
19+ Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
1920
2021
22+ 'Dim sTest As String = "<sup class=""calibre48""><small class=""calibre51"" id=""filepos64449""><a href=""text00741.html#filepos69854"">①</a></small></sup>"
2123
24+ 'Dim aa1 As HtmlAgilityPack.HtmlDocument = New HtmlAgilityPack.HtmlDocument()
25+ 'aa1.LoadHtml(sTest)
26+
27+ 'Dim k21kk211 = aa1.DocumentNode.SelectNodes("//a[@href]")(0).Attributes("href").Value
28+
29+
30+
31+ Dim sChapter As String = cTools.sFileReader("C:\Users\DTC_PC07\Downloads\BS1\OEBPS\Text\part0003.xhtml", cEpub6.encUTF8)
32+ Dim formatted As String = System.Xml.Linq.XElement.Parse(sChapter).ToString()
33+
34+
35+
36+ Dim aa As HtmlAgilityPack.HtmlDocument = New HtmlAgilityPack.HtmlDocument()
37+ aa.LoadHtml(formatted)
38+
39+
40+
41+ Dim listDel1 = aa.DocumentNode.SelectNodes(("//div[contains(@class, 'calibre1')]"))
42+
43+ For Each uDel As HtmlAgilityPack.HtmlNode In listDel1
44+
45+ formatted = formatted.Replace(uDel.OuterHtml, "")
46+ Next
47+
48+ aa.LoadHtml(formatted)
49+
50+
51+
52+ Dim listMemoC = aa.DocumentNode.SelectNodes(("//span"))
53+ Dim listMemoM = aa.DocumentNode.SelectNodes(("//a[contains(@class, 'calibre2')]"))
54+
55+
56+ If listMemoC.Count = listMemoM.Count Then
57+
58+ For iMemo As Integer = 0 To listMemoC.Count - 1
59+
60+ Dim sNewC As String = "<a id=""w" & iMemo.ToString().PadLeft(2, "0") & """ href=""#m" & iMemo.ToString().PadLeft(2, "0") & """><sup>[" & (iMemo + 1).ToString().PadLeft(2, "0") & "]</sup></a>"
61+
62+ Dim sNewM As String = "<a id=""m" & iMemo.ToString().PadLeft(2, "0") & """ href=""#w" & iMemo.ToString().PadLeft(2, "0") & """><sup>[" & (iMemo + 1).ToString().PadLeft(2, "0") & "]</sup></a>"
63+
64+ formatted = formatted.Replace(listMemoC(iMemo).OuterHtml, sNewC)
65+
66+ formatted = formatted.Replace(listMemoM(iMemo).OuterHtml, sNewM)
67+
68+ Next
69+
70+
71+ Else
72+ Throw New Exception(listMemoC.Count & ":" & listMemoM.Count)
73+ End If
74+
75+
76+
77+
78+ Dim kkk212 = aa.DocumentNode.SelectNodes("//span")
79+
80+ For Each kke In kkk212
81+ sChapter = sChapter.Replace(kke.OuterHtml, kke.InnerText)
82+
83+
84+ Next
85+
86+
87+
88+
89+
90+ Dim kkk211 = aa.DocumentNode.SelectNodes("//sup")
91+
92+
93+ Dim kkk2121 = aa.DocumentNode.SelectNodes("//calibre2")
94+ Dim kkk2122 = aa.DocumentNode.DescendantNodes.Where(Function(x) x.HasClass("calibre2")).ToArray()
95+
96+
97+ End Sub
2298 End Class
2399
--- AutoEpub3/Logic/DEP3/cDep3_003.vb (revision 377)
+++ AutoEpub3/Logic/DEP3/cDep3_003.vb (revision 378)
@@ -42,6 +42,10 @@
4242 Dim mSection As New modelSection()
4343 mSection.Title = cTools.listNav_SE(ncxSection.navLabel.text, "《", "》", False)(0)
4444
45+ If mSection.Title.IndexOf("第一章") > -1 Then
46+ Dim sStop As String = "1"
47+ End If
48+
4549 Dim ncxVolume As List(Of ncxNavPointNavPoint) = ncxSection.navPoint.Where(Function(x) x.navLabel.text.IndexOf("第") > -1).ToList()
4650
4751 If ncxVolume.Count = 0 Then
@@ -84,6 +88,13 @@
8488
8589 Dim listText As List(Of String) = cTools.listText_P(sVolume)
8690
91+ If listText.Count > 0 Then
92+ If listText(0).Trim().IndexOf(mVolume.Title) > -1 Then
93+ listText.RemoveAt(0)
94+ End If
95+ End If
96+
97+
8798 mVolume.listText = listText
8899
89100 End If
@@ -114,6 +125,13 @@
114125
115126 mChapter.listText = listText
116127
128+ If listText.Count > 0 Then
129+ If listText(0).Trim().IndexOf(mVolume.Title) > -1 Then
130+ listText.RemoveAt(0)
131+ End If
132+ End If
133+
134+
117135 mVolume.listChapter.Add(mChapter)
118136
119137 iTemp += 1
@@ -132,10 +150,14 @@
132150
133151 mEpub.RemoveAt(6)
134152
153+ chkEPUB001("href")
154+
135155 End Sub
136156
137157 Private Sub ResetImgUrl(ByRef sChapter As String)
138158
159+
160+
139161 Dim listImg As List(Of String) = cTools.listNav_SE(sChapter, "<img", "/>", True)
140162 For Each eachImg As String In listImg
141163 Dim sScr As String = eachImg.Split("/").ToList()(2).Split("""").ToList()(0)
@@ -180,10 +202,18 @@
180202
181203 Dim sChapter As String = cTools.sFileReader(sPath & mVolume.Scr, cEpub6.encUTF8)
182204
205+ DelHtml(sChapter)
206+ Edithref(sChapter)
183207
184208 Dim listText As List(Of String) = cTools.listText_P(sChapter)
185209
210+ 'If listText.Count > 0 Then
211+ ' If listText(0).Trim().IndexOf(mVolume.Title) > -1 Then
212+ ' listText.RemoveAt(0)
213+ ' End If
214+ 'End If
186215
216+
187217 mVolume.listText = listText
188218
189219
@@ -202,33 +232,201 @@
202232
203233
204234 Private Sub sReplaceHtml(ByRef sHtml As String, ByVal kbnDep As emEpub6.emUrlImgDep)
205-
206- 'sHtml = sHtml.Replace("<img class=""calibre_14"" src=""Image00076.jpg"" /> ", "坚")
207235 sHtml = sHtml.Replace("<img class=""calibre_14"" src=""Image00076.jpg"" />" & vbCrLf & " ", "坚")
236+ sHtml = sHtml.Replace("<img class=""calibre_14"" src=""Image00015.jpg"" />" & vbCrLf & " ", "坚")
237+ sHtml = sHtml.Replace("<img class=""calibre_15"" src=""Image00017.jpg"" />" & vbCrLf & " ", "坚")
238+ sHtml = sHtml.Replace("<img class=""calibre_14"" src=""Image00016.jpg"" />" & vbCrLf & " ", "坚")
239+ sHtml = sHtml.Replace("<img class=""calibre_15"" src=""Image00016.jpg"" />" & vbCrLf & " ", "坚")
240+ sHtml = sHtml.Replace("<img class=""calibre_15"" src=""Image00018.jpg"" />" & vbCrLf & " ", "坚")
241+ ResetImgUrl(sHtml, kbnDep)
208242
209- ResetImgUrl(sHtml, kbnDep)
243+ Dim listMemo As List(Of String) = cTools.listNav_SE(sHtml, "<a", "</a>", True)
244+ If listMemo.Count > 0 Then
245+ Dim sStop As String = "1"
246+ End If
247+
210248 End Sub
211249
250+ Private Sub DelHtml(ByRef sHtml As String)
212251
252+ Dim sHtmlFormat As String = System.Xml.Linq.XElement.Parse(sHtml).ToString()
253+ Dim hapHtml As HtmlAgilityPack.HtmlDocument = New HtmlAgilityPack.HtmlDocument()
254+ hapHtml.LoadHtml(sHtmlFormat)
255+ Dim listDel1 As HtmlAgilityPack.HtmlNode() = hapHtml.DocumentNode.SelectNodes(("//div[contains(@class, 'calibre1')]")).ToArray()
213256
257+ For Each uDel As HtmlAgilityPack.HtmlNode In listDel1
258+
259+ sHtml = sHtml.Replace(uDel.OuterHtml, "")
260+ Next
261+
262+ End Sub
263+
264+
265+ Private Sub Edithref(ByRef sHtml As String)
266+
267+ Dim sHtmlFormat As String = System.Xml.Linq.XElement.Parse(sHtml).ToString()
268+ Dim hapHtml As HtmlAgilityPack.HtmlDocument = New HtmlAgilityPack.HtmlDocument()
269+ hapHtml.LoadHtml(sHtmlFormat)
270+
271+ Dim listMemoC = hapHtml.DocumentNode.SelectNodes(("//span"))
272+ Dim listMemoM = hapHtml.DocumentNode.SelectNodes(("//a[contains(@class, 'calibre2')]"))
273+
274+ If listMemoM Is Nothing OrElse listMemoC Is Nothing Then
275+ Exit Sub
276+ End If
277+
278+
279+
280+ If listMemoC.Count = listMemoM.Count Then
281+
282+ For iMemo As Integer = 0 To listMemoC.Count - 1
283+
284+ Dim sNewC As String = "<a id=""w" & iMemo.ToString().PadLeft(2, "0") & """ href=""#m" & iMemo.ToString().PadLeft(2, "0") & """><sup>[" & (iMemo + 1).ToString().PadLeft(2, "0") & "]</sup></a>"
285+
286+ Dim sNewM As String = "<a id=""m" & iMemo.ToString().PadLeft(2, "0") & """ href=""#w" & iMemo.ToString().PadLeft(2, "0") & """>[" & (iMemo + 1).ToString().PadLeft(2, "0") & "]</a>"
287+
288+ sHtml = sHtml.Replace(listMemoC(iMemo).OuterHtml, sNewC)
289+
290+ sHtml = sHtml.Replace(listMemoM(iMemo).OuterHtml, sNewM)
291+
292+ Next
293+ Else
294+ Throw New Exception(listMemoC.Count & ":" & listMemoM.Count)
295+ End If
296+
297+ End Sub
298+
299+
300+ Private Sub Edithref2(ByRef sHtml As String)
301+
302+ Dim sHtmlFormat As String = System.Xml.Linq.XElement.Parse(sHtml).ToString()
303+ Dim hapHtml As HtmlAgilityPack.HtmlDocument = New HtmlAgilityPack.HtmlDocument()
304+ hapHtml.LoadHtml(sHtmlFormat)
305+
306+ Dim listMemoC = hapHtml.DocumentNode.SelectNodes(("//span"))
307+ Dim listMemoM = hapHtml.DocumentNode.SelectNodes(("//a[contains(@class, 'calibre2')]"))
308+
309+ If listMemoM Is Nothing OrElse listMemoC Is Nothing Then
310+ Exit Sub
311+ End If
312+
313+
314+
315+ If listMemoC.Count = listMemoM.Count Then
316+
317+ For iMemo As Integer = 0 To listMemoC.Count - 1
318+
319+ Dim sNewC As String = "<a id=""w" & iMemo.ToString().PadLeft(2, "0") & """ href=""#m" & iMemo.ToString().PadLeft(2, "0") & """><sup>[" & (iMemo + 1).ToString().PadLeft(2, "0") & "]</sup></a>"
320+
321+ Dim sNewM As String = "<a id=""m" & iMemo.ToString().PadLeft(2, "0") & """ href=""#w" & iMemo.ToString().PadLeft(2, "0") & """>[" & (iMemo + 1).ToString().PadLeft(2, "0") & "]</a>"
322+
323+ sHtml = sHtml.Replace(listMemoC(iMemo).OuterHtml, sNewC)
324+
325+ sHtml = sHtml.Replace(listMemoM(iMemo).OuterHtml, sNewM)
326+
327+ Next
328+ Else
329+ Throw New Exception(listMemoC.Count & ":" & listMemoM.Count)
330+ End If
331+
332+ End Sub
333+
334+
335+
336+
214337 Private Sub ResetImgUrl(ByRef sChapter As String, ByVal kbnDep As emEpub6.emUrlImgDep)
215338
216- Dim listImg As List(Of String) = cTools.listNav_SE(sChapter, "<img", "/>", True)
217- For Each eachImg As String In listImg
218- Dim sScr As String = eachImg.Split("/").ToList()(2).Split("""").ToList()(0)
219- Dim sNewImg As String = cTools.sGaiji(sScr, kbnDep)
339+ 'Dim listImg As List(Of String) = cTools.listNav_SE(sChapter, "<img", "/>", True)
340+ 'For Each eachImg As String In listImg
341+ ' Dim sScr As String = eachImg.Split("/").ToList()(2).Split("""").ToList()(0)
342+ ' Dim sNewImg As String = cTools.sGaiji(sScr, kbnDep)
220343
221- If eachImg.IndexOf("calibre20") > -1 Then
222- sNewImg = cTools.sMapImg(sScr, kbnDep)
223- End If
344+ ' If eachImg.IndexOf("calibre20") > -1 Then
345+ ' sNewImg = cTools.sMapImg(sScr, kbnDep)
346+ ' End If
224347
225- sChapter = sChapter.Replace(eachImg, sNewImg)
226- Next
348+ ' sChapter = sChapter.Replace(eachImg, sNewImg)
349+ 'Next
227350
228351
229352 End Sub
230353
354+ Public Sub chkEPUB001(ByVal sKey As String)
231355
232356
357+ For Each uSection As modelSection In mEpub
233358
359+ For Each uVolume As modelVolume In uSection.listVolume
360+
361+ Dim listChk = From dtSeq In uVolume.listText Where dtSeq.IndexOf(sKey) > -1
362+ Dim listStop1 As List(Of String) = listChk.ToList()
363+
364+ If listStop1.Count > 0 Then
365+
366+ Dim sString As String = String.Join(vbCrLf, listStop1)
367+ Console.WriteLine(String.Join(vbCrLf, listStop1))
368+
369+
370+ If listStop1.Count > 0 Then
371+ Dim sStop As String = ""
372+ End If
373+
374+
375+ Dim sHtml As String = String.Join(vbCrLf, uVolume.listText)
376+
377+
378+ Dim listCHK_SP As List(Of String) = cTools.listNav_SE(sHtml, "<", ">", True)
379+
380+
381+ If listCHK_SP.Count > 0 Then
382+ Dim sStop As String = ""
383+ End If
384+
385+
386+ End If
387+
388+
389+
390+ For Each uChapter As modelChapter In uVolume.listChapter
391+
392+ Dim listChk2 = From dtSeq In uChapter.listText Where dtSeq.IndexOf(sKey) > -1
393+
394+ Dim listStop2 As List(Of String) = listChk.ToList()
395+
396+ Console.WriteLine(String.Join(vbCrLf, listStop2))
397+ Dim sString As String = String.Join(vbCrLf, listStop1)
398+
399+ If listStop2.Count > 0 Then
400+ Dim sStop As String = ""
401+ End If
402+
403+ Next
404+
405+ Next
406+
407+
408+ Next
409+
410+ End Sub
411+
412+ Public Sub chkEPUB002(ByRef listChk As List(Of String))
413+
414+ For iCtr As Integer = 0 To listChk.Count - 1
415+
416+ Dim sEdit As String = listChk(iCtr)
417+ Dim listEdit01 As List(Of String) = cTools.listNav_SE(sEdit, "<", ">", True)
418+
419+ For Each uEdit01 As String In listEdit01
420+
421+ sEdit = sEdit.Replace(uEdit01, "")
422+ Next
423+
424+ listChk(iCtr) = sEdit
425+
426+ Next
427+
428+
429+
430+ End Sub
431+
234432 End Class
Show on old repository browser