• R/O
  • SSH
  • HTTPS

autocodeforsql: Commit


Commit MetaInfo

Revisão385 (tree)
Hora2020-10-27 15:19:13
Autorhilinwei

Mensagem de Log

Mudança Sumário

Diff

--- AutoEpub3/AutoEpub8.Designer.vb (revision 384)
+++ AutoEpub3/AutoEpub8.Designer.vb (revision 385)
@@ -26,6 +26,7 @@
2626 Me.Button1 = New System.Windows.Forms.Button()
2727 Me.Button2 = New System.Windows.Forms.Button()
2828 Me.Button3 = New System.Windows.Forms.Button()
29+ Me.Button4 = New System.Windows.Forms.Button()
2930 Me.SuspendLayout()
3031 '
3132 'Button5
@@ -64,11 +65,21 @@
6465 Me.Button3.Text = "NCX Dep 2"
6566 Me.Button3.UseVisualStyleBackColor = True
6667 '
68+ 'Button4
69+ '
70+ Me.Button4.Location = New System.Drawing.Point(594, 53)
71+ Me.Button4.Name = "Button4"
72+ Me.Button4.Size = New System.Drawing.Size(173, 69)
73+ Me.Button4.TabIndex = 20
74+ Me.Button4.Text = "NCX Dep 2"
75+ Me.Button4.UseVisualStyleBackColor = True
76+ '
6777 'AutoEpub8
6878 '
6979 Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 12.0!)
7080 Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
7181 Me.ClientSize = New System.Drawing.Size(800, 450)
82+ Me.Controls.Add(Me.Button4)
7283 Me.Controls.Add(Me.Button3)
7384 Me.Controls.Add(Me.Button2)
7485 Me.Controls.Add(Me.Button1)
@@ -83,4 +94,5 @@
8394 Friend WithEvents Button1 As Button
8495 Friend WithEvents Button2 As Button
8596 Friend WithEvents Button3 As Button
97+ Friend WithEvents Button4 As Button
8698 End Class
--- AutoEpub3/AutoEpub8.vb (revision 384)
+++ AutoEpub3/AutoEpub8.vb (revision 385)
@@ -135,6 +135,20 @@
135135
136136 End Sub
137137
138+ Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
138139
140+ Dim cAutoEpub As New cDep2_004("C:\Users\DTC_PC07\Downloads\je\")
141+ cAutoEpub.CreadEpub()
142+
143+ Dim cEpub As New cEpub6(emEpub6.emEncCode.GB2321, emEpub6.emLan.ZH, "全怪谈:扶桑鬼话", "合集", "TXDZ_202009")
144+ cEpub.bConvertToMobi = True
145+ cEpub.CreateEpub(cAutoEpub.mEpub)
146+ MessageBox.Show("Finished")
147+ System.Diagnostics.Process.Start(cEpub.sOutPutPathFolder)
148+
149+
150+ End Sub
151+
152+
139153 End Class
140154
--- AutoEpub3/Logic/DEP2/cDep2_004.vb (nonexistent)
+++ AutoEpub3/Logic/DEP2/cDep2_004.vb (revision 385)
@@ -0,0 +1,105 @@
1+Imports System.IO
2+
3+Public Class cDep2_004
4+
5+ Dim bookPath As String
6+
7+ Public mEpub As New List(Of modelVolume)
8+
9+ Dim listSkip As List(Of String) = {"版权", "目录", "书名页", "版权页", "作家榜经典文库", "勇者物语"}.ToList
10+ Dim listMobiRight As List(Of String) = {"signature"}.ToList()
11+
12+
13+
14+ Sub New(_bookPath As String)
15+ bookPath = _bookPath
16+ End Sub
17+
18+ Public Sub CreadEpub()
19+
20+ Dim sText As String = String.Empty
21+ Dim listLine As New List(Of String)
22+
23+ Dim ncxFilePath As String = Path.Combine(bookPath, "toc.ncx")
24+
25+ Dim fs As System.IO.FileStream = New System.IO.FileStream(ncxFilePath, System.IO.FileMode.Open)
26+ Dim serializer As System.Xml.Serialization.XmlSerializer = New System.Xml.Serialization.XmlSerializer(GetType(ncx))
27+ Dim model As ncx = CType(serializer.Deserialize(fs), ncx)
28+ fs.Dispose()
29+ fs = Nothing
30+
31+
32+
33+ For iCtr As Integer = 0 To model.navMap.Count - 1
34+ Dim unitOne As ncxNavPoint = model.navMap(iCtr)
35+ Dim unitVolume As New modelVolume
36+ unitVolume.Title = unitOne.navLabel.text
37+
38+ If listSkip.Any(Function(x) unitVolume.Title.IndexOf(x) > -1) Then
39+ Continue For
40+ End If
41+
42+
43+ If unitOne.navPoint Is Nothing Then
44+ Dim sHtml As String = cTools.sFileReader(bookPath & unitOne.content.src, cEpub6.encUTF8)
45+ Else
46+ unitVolume.Title = unitOne.navLabel.text
47+ For Each eachNax As ncxNavPointNavPoint In unitOne.navPoint
48+
49+
50+ Dim sPath As String = Path.Combine(bookPath, eachNax.content.src).Split("#").ToList(0)
51+ Dim mChapter As New modelChapter
52+ mChapter.Title = eachNax.navLabel.text
53+ Dim sHtml As String = String.Empty
54+
55+ If listSkip.Any(Function(x) mChapter.Title.IndexOf(x) > -1) Then
56+ Continue For
57+ End If
58+
59+ Dim sChapter As String = cTools.sFileReader(sPath, cEpub6.encUTF8)
60+
61+
62+
63+
64+ If sChapter.IndexOf("00008.jpeg") > 0 Then
65+ Dim sStop As String = "001"
66+ End If
67+ 'ResetImgUrl(sChapter)
68+
69+ Dim listText As List(Of String) = cTools.listText_P_Hap(sChapter)
70+
71+ mChapter.listText = listText
72+
73+
74+ unitVolume.listChapter.Add(mChapter)
75+
76+ Next
77+
78+ End If
79+
80+ mEpub.Add(unitVolume)
81+
82+ Next
83+
84+ End Sub
85+
86+
87+ Private Sub ResetImgUrl(ByRef sChapter As String)
88+
89+ Dim listImg As List(Of String) = cTools.listNav_SE(sChapter, "<img", "/>", True)
90+ For Each eachImg As String In listImg
91+ Dim sScr As String = eachImg.Split("/").ToList()(2).Split("""").ToList()(0)
92+ Dim sNewImg As String = cTools.sGaiji(sScr, emEpub6.emUrlImgDep.Volume)
93+
94+ If eachImg.IndexOf("calibre20") > -1 Then
95+ sNewImg = cTools.sMapImg(sScr, emEpub6.emUrlImgDep.Volume)
96+ End If
97+
98+ sChapter = sChapter.Replace(eachImg, sNewImg)
99+ Next
100+
101+
102+ End Sub
103+
104+
105+End Class
--- AutoEpub3/cTools.vb (revision 384)
+++ AutoEpub3/cTools.vb (revision 385)
@@ -126,6 +126,27 @@
126126
127127 End Function
128128
129+
130+ Public Shared Function listText_P_Hap(str As String) As List(Of String)
131+
132+ listText_P_Hap = New List(Of String)
133+
134+ Dim hapHtml As HtmlAgilityPack.HtmlDocument = New HtmlAgilityPack.HtmlDocument()
135+ hapHtml.LoadHtml(str)
136+ Dim listP = hapHtml.DocumentNode.SelectNodes(("//p"))
137+
138+ If listP IsNot Nothing Then
139+ For Each uP As HtmlAgilityPack.HtmlNode In listP
140+ listText_P_Hap.Add(uP.InnerText)
141+ Next
142+ End If
143+
144+
145+
146+ End Function
147+
148+
149+
129150 Public Shared Function listText_P(str As String, listMobiRight As List(Of String)) As List(Of String)
130151
131152 str = str.Replace("<P", "<p")
Show on old repository browser