• R/O
  • SSH
  • HTTPS

autocodeforsql: Commit


Commit MetaInfo

Revisão381 (tree)
Hora2020-09-12 08:50:54
Autorhilinwei

Mensagem de Log

Mudança Sumário

Diff

--- AutoEpub3/AutoEpub8.Designer.vb (revision 380)
+++ AutoEpub3/AutoEpub8.Designer.vb (revision 381)
@@ -24,6 +24,7 @@
2424 Private Sub InitializeComponent()
2525 Me.Button5 = New System.Windows.Forms.Button()
2626 Me.Button1 = New System.Windows.Forms.Button()
27+ Me.Button2 = New System.Windows.Forms.Button()
2728 Me.SuspendLayout()
2829 '
2930 'Button5
@@ -44,11 +45,21 @@
4445 Me.Button1.Text = "El His Mon"
4546 Me.Button1.UseVisualStyleBackColor = True
4647 '
48+ 'Button2
49+ '
50+ Me.Button2.Location = New System.Drawing.Point(60, 149)
51+ Me.Button2.Name = "Button2"
52+ Me.Button2.Size = New System.Drawing.Size(173, 69)
53+ Me.Button2.TabIndex = 18
54+ Me.Button2.Text = "NCX Dep 2"
55+ Me.Button2.UseVisualStyleBackColor = True
56+ '
4757 'AutoEpub8
4858 '
4959 Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 12.0!)
5060 Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
5161 Me.ClientSize = New System.Drawing.Size(800, 450)
62+ Me.Controls.Add(Me.Button2)
5263 Me.Controls.Add(Me.Button1)
5364 Me.Controls.Add(Me.Button5)
5465 Me.Name = "AutoEpub8"
@@ -59,4 +70,5 @@
5970
6071 Friend WithEvents Button5 As Button
6172 Friend WithEvents Button1 As Button
73+ Friend WithEvents Button2 As Button
6274 End Class
--- AutoEpub3/AutoEpub8.vb (revision 380)
+++ AutoEpub3/AutoEpub8.vb (revision 381)
@@ -1,4 +1,6 @@
11 Public Class AutoEpub8
2+
3+
24 Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click
35
46
@@ -95,5 +97,28 @@
9597
9698
9799 End Sub
100+
101+ Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
102+
103+
104+ Dim cAutoEpub As New cDep3_004("C:\Users\DTC_PC07\Downloads\dygw\OEBPS\")
105+ cAutoEpub.CreadEpub()
106+
107+
108+ Dim cEpub As New cEpub6(emEpub6.emEncCode.GB2321, emEpub6.emLan.ZH, "A2", "东野圭吾 伽利略系列", "东野圭吾", "DYGW01_202009")
109+ cEpub.bConvertToMobi = False
110+ cEpub.CreateEpub(cAutoEpub.mEpub)
111+ MessageBox.Show("Finished")
112+ System.Diagnostics.Process.Start(cEpub.sOutPutPathFolder)
113+
114+ End Sub
115+
116+ Private Sub AutoEpub8_Load(sender As Object, e As EventArgs) Handles Me.Load
117+
118+ Dim KKE As String = Format(31111.662, "#,0.##")
119+
120+
121+ Console.WriteLine(KKE)
122+ End Sub
98123 End Class
99124
--- AutoEpub3/Logic/DEP3/cDep3_003.vb (revision 380)
+++ AutoEpub3/Logic/DEP3/cDep3_003.vb (revision 381)
@@ -284,35 +284,19 @@
284284 'Dim sHtmlFormat As String = System.Xml.Linq.XElement.Parse(sHtml).ToString()
285285 Dim hapHtml As HtmlAgilityPack.HtmlDocument = New HtmlAgilityPack.HtmlDocument()
286286 hapHtml.LoadHtml(sHtml)
287-
288287 Dim listMemoC = hapHtml.DocumentNode.SelectNodes(("//sup[contains(@class, 'calibre48')]"))
289288 Dim listMemoM = hapHtml.DocumentNode.SelectNodes(("//p[contains(@class, 'calibre_16')]"))
290-
291-
292-
293-
294289 If listMemoM Is Nothing OrElse listMemoC Is Nothing Then
295290 Exit Sub
296291 End If
297292
298-
299-
300293 If listMemoC.Count = listMemoM.Count Then
301294
302-
303-
304295 For iMemo As Integer = 0 To listMemoC.Count - 1
305-
306296 Dim hapHtmlSub As HtmlAgilityPack.HtmlDocument = New HtmlAgilityPack.HtmlDocument()
307297 hapHtmlSub.LoadHtml(listMemoM(iMemo).InnerHtml)
308-
309298 Dim listMemoSub As String = hapHtmlSub.DocumentNode.SelectNodes(("//span"))(1).InnerText
310299
311-
312-
313-
314-
315-
316300 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>"
317301
318302 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>"
@@ -335,8 +319,6 @@
335319 End Sub
336320
337321
338-
339-
340322 Public Sub chkEPUB001(ByVal sKey As String)
341323
342324
--- AutoEpub3/Logic/DEP3/cDep3_004.vb (nonexistent)
+++ AutoEpub3/Logic/DEP3/cDep3_004.vb (revision 381)
@@ -0,0 +1,388 @@
1+Imports System.IO
2+
3+Public Class cDep3_004
4+
5+ Dim bookPath As String
6+
7+ Public mEpub As New List(Of modelSection)
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+
19+ Public Sub CreadEpub()
20+
21+
22+ Dim sText As String = String.Empty
23+ Dim listLine As New List(Of String)
24+
25+ Dim ncxFilePath As String = Path.Combine(bookPath, "toc.ncx")
26+
27+ Dim fs As System.IO.FileStream = New System.IO.FileStream(ncxFilePath, System.IO.FileMode.Open)
28+ Dim serializer As System.Xml.Serialization.XmlSerializer = New System.Xml.Serialization.XmlSerializer(GetType(ncx))
29+ Dim model As ncx = CType(serializer.Deserialize(fs), ncx)
30+ fs.Dispose()
31+ fs = Nothing
32+
33+
34+ Dim linqPick = From dtSeq In model.navMap Where dtSeq.navLabel.text.IndexOf("加贺") > -1
35+
36+ Dim listPick As List(Of ncxNavPoint) = linqPick.ToList()
37+
38+
39+ For iCtr As Integer = 0 To listPick.Count - 1
40+
41+ Dim ncxSection As ncxNavPoint = listPick(iCtr)
42+
43+ Dim mSection As New modelSection()
44+ mSection.Title = cTools.listNav_SE(ncxSection.navLabel.text, "《", "》", False)(0)
45+
46+ If mSection.Title.IndexOf("第一章") > -1 Then
47+ Dim sStop As String = "1"
48+ End If
49+
50+ Dim ncxVolume As List(Of ncxNavPointNavPoint) = ncxSection.navPoint.Where(Function(x) x.navLabel.text.IndexOf("第") > -1).ToList()
51+
52+ If ncxVolume.Count = 0 Then
53+ ncxVolume = ncxSection.navPoint.ToList()
54+ End If
55+
56+
57+ For ctrVolume As Integer = 0 To ncxVolume.Count - 1
58+
59+ Dim mVolume As New modelVolume
60+ mVolume.Title = ncxVolume(ctrVolume).navLabel.text
61+
62+
63+ If listSkip.Any(Function(x) mVolume.Title.IndexOf(x) > -1) Then
64+ Continue For
65+ End If
66+
67+
68+ If mVolume.Title.IndexOf("第十九章") > -1 Then
69+ Dim sStop As String = "1"
70+ End If
71+
72+
73+ Dim indexFrom As Integer = ncxSection.navPoint.ToList().IndexOf(ncxVolume(ctrVolume))
74+
75+ Dim indexTo As Integer = ncxSection.navPoint.Count - 1
76+
77+ If ctrVolume < ncxVolume.Count - 1 Then
78+ indexTo = ncxSection.navPoint.ToList().IndexOf(ncxVolume(ctrVolume + 1))
79+ End If
80+
81+ If indexTo - indexFrom <= 1 Then
82+
83+ Dim ncxChapter As ncxNavPointNavPoint = ncxSection.navPoint(indexFrom)
84+
85+ Dim sPath As String = Path.Combine(bookPath, ncxChapter.content.src).Split("#").ToList(0)
86+
87+ Dim sVolume As String = sFileEditRead(sPath, emEpub6.emDep.Dep2)
88+
89+ Dim listText As List(Of String) = cTools.listText_P(sVolume)
90+
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+
98+ mVolume.listText = listText
99+
100+ End If
101+
102+
103+ Dim iTemp As Integer = 1
104+
105+ For ctrChapter As Integer = indexFrom + 1 To indexTo - 1
106+
107+
108+ Dim ncxChapter As ncxNavPointNavPoint = ncxSection.navPoint(ctrChapter)
109+
110+ Dim mChapter As New modelChapter
111+
112+ mChapter.Title = iTemp
113+ mChapter.Scr = ncxChapter.content.src
114+
115+ If listSkip.Any(Function(x) mChapter.Title.IndexOf(x) > -1) Then
116+ Continue For
117+ End If
118+
119+
120+ Dim sPath As String = Path.Combine(bookPath, mChapter.Scr).Split("#").ToList(0)
121+
122+ Dim sChapter As String = sFileEditRead(sPath, emEpub6.emDep.Dep3)
123+ Dim listText As List(Of String) = cTools.listText_P(sChapter)
124+
125+ mChapter.listText = listText
126+
127+ 'If listText.Count > 0 Then
128+ ' If listText(0).Trim().IndexOf(mVolume.Title) > -1 Then
129+ ' listText.RemoveAt(0)
130+ ' End If
131+ 'End If
132+
133+
134+ mVolume.listChapter.Add(mChapter)
135+
136+ iTemp += 1
137+ Next
138+
139+
140+ mSection.listVolume.Add(mVolume)
141+
142+ Next
143+
144+ mEpub.Add(mSection)
145+ Next
146+
147+ ReMoveTopTitle()
148+
149+ chkEPUB001("href")
150+
151+ End Sub
152+
153+
154+
155+ Private Function sFileEditRead(ByVal sPath As String, ByVal KBN_DEP As emEpub6.emDep) As String
156+ sFileEditRead = cTools.sFileReader(sPath, cEpub6.encUTF8)
157+
158+ DelHtml(sFileEditRead)
159+
160+ EditHref00(sFileEditRead)
161+ EditHref01(sFileEditRead)
162+ EditHref02(sFileEditRead)
163+ EditHref03(sFileEditRead)
164+
165+ End Function
166+
167+
168+ Private Sub DelHtml(ByRef sHtml As String)
169+
170+ Dim sHtmlFormat As String = System.Xml.Linq.XElement.Parse(sHtml).ToString()
171+ Dim hapHtml As HtmlAgilityPack.HtmlDocument = New HtmlAgilityPack.HtmlDocument()
172+ hapHtml.LoadHtml(sHtmlFormat)
173+ Dim listDel1 = hapHtml.DocumentNode.SelectNodes(("//div[contains(@class, 'calibre1')]"))
174+
175+ If listDel1 IsNot Nothing Then
176+ For Each uDel As HtmlAgilityPack.HtmlNode In listDel1
177+ sHtml = sHtml.Replace(uDel.OuterHtml, "")
178+ Next
179+ End If
180+
181+ End Sub
182+
183+ Private Sub EditHref00(ByRef sHtml As String)
184+ sHtml = sHtml.Replace("<img class=""calibre_14"" src=""Image00076.jpg"" />" & vbCrLf & " ", "坚")
185+ sHtml = sHtml.Replace("<img class=""calibre_14"" src=""Image00015.jpg"" />" & vbCrLf & " ", "坚")
186+ sHtml = sHtml.Replace("<img class=""calibre_15"" src=""Image00017.jpg"" />" & vbCrLf & " ", "坚")
187+ sHtml = sHtml.Replace("<img class=""calibre_14"" src=""Image00016.jpg"" />" & vbCrLf & " ", "坚")
188+ sHtml = sHtml.Replace("<img class=""calibre_15"" src=""Image00016.jpg"" />" & vbCrLf & " ", "坚")
189+ sHtml = sHtml.Replace("<img class=""calibre_15"" src=""Image00018.jpg"" />" & vbCrLf & " ", "坚")
190+ End Sub
191+
192+
193+ Private Sub EditHref01(ByRef sHtml As String)
194+
195+ Dim sHtmlFormat As String = System.Xml.Linq.XElement.Parse(sHtml).ToString()
196+ Dim hapHtml As HtmlAgilityPack.HtmlDocument = New HtmlAgilityPack.HtmlDocument()
197+ hapHtml.LoadHtml(sHtmlFormat)
198+
199+ Dim listMemoC = hapHtml.DocumentNode.SelectNodes(("//span"))
200+ Dim listMemoM = hapHtml.DocumentNode.SelectNodes(("//a[contains(@class, 'calibre2')]"))
201+
202+ If listMemoM Is Nothing OrElse listMemoC Is Nothing Then
203+ Exit Sub
204+ End If
205+
206+
207+
208+ If listMemoC.Count = listMemoM.Count Then
209+
210+ For iMemo As Integer = 0 To listMemoC.Count - 1
211+
212+ 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>"
213+
214+ 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>"
215+
216+ sHtml = sHtml.Replace(listMemoC(iMemo).OuterHtml, sNewC)
217+
218+ sHtml = sHtml.Replace(listMemoM(iMemo).OuterHtml, sNewM)
219+
220+ Next
221+ Else
222+ Throw New Exception(listMemoC.Count & ":" & listMemoM.Count)
223+ End If
224+
225+ End Sub
226+
227+
228+ Private Sub EditHref02(ByRef sHtml As String)
229+
230+ 'Dim sHtmlFormat As String = System.Xml.Linq.XElement.Parse(sHtml).ToString()
231+ Dim hapHtml As HtmlAgilityPack.HtmlDocument = New HtmlAgilityPack.HtmlDocument()
232+ hapHtml.LoadHtml(sHtml)
233+ Dim listMemoC = hapHtml.DocumentNode.SelectNodes(("//sup[contains(@class, 'calibre48')]"))
234+ Dim listMemoM = hapHtml.DocumentNode.SelectNodes(("//p[contains(@class, 'calibre_16')]"))
235+ If listMemoM Is Nothing OrElse listMemoC Is Nothing Then
236+ Exit Sub
237+ End If
238+
239+ If listMemoC.Count = listMemoM.Count Then
240+
241+ For iMemo As Integer = 0 To listMemoC.Count - 1
242+ Dim hapHtmlSub As HtmlAgilityPack.HtmlDocument = New HtmlAgilityPack.HtmlDocument()
243+ hapHtmlSub.LoadHtml(listMemoM(iMemo).InnerHtml)
244+ Dim listMemoSub As String = hapHtmlSub.DocumentNode.SelectNodes(("//span"))(1).InnerText
245+
246+ 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>"
247+
248+ 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>"
249+
250+ sHtml = sHtml.Replace(listMemoC(iMemo).InnerHtml, sNewC)
251+
252+ sHtml = sHtml.Replace(listMemoM(iMemo).InnerHtml, sNewM & listMemoSub)
253+
254+ Next
255+ Else
256+ Throw New Exception(listMemoC.Count & ":" & listMemoM.Count)
257+ End If
258+
259+ End Sub
260+
261+
262+ Private Sub EditHref03(ByRef sHtml As String)
263+
264+
265+ End Sub
266+
267+
268+ Public Sub chkEPUB001(ByVal sKey As String)
269+
270+
271+ For Each uSection As modelSection In mEpub
272+
273+ For Each uVolume As modelVolume In uSection.listVolume
274+
275+ Dim listChk = From dtSeq In uVolume.listText Where dtSeq.IndexOf(sKey) > -1
276+ Dim listStop1 As List(Of String) = listChk.ToList()
277+
278+ If listStop1.Count > 0 Then
279+
280+ Dim sString As String = String.Join(vbCrLf, listStop1)
281+ Console.WriteLine(String.Join(vbCrLf, listStop1))
282+
283+
284+ If listStop1.Count > 0 Then
285+ Dim sStop As String = ""
286+ End If
287+
288+
289+ Dim sHtml As String = String.Join(vbCrLf, uVolume.listText)
290+
291+
292+ Dim listCHK_SP As List(Of String) = cTools.listNav_SE(sHtml, "<", ">", True)
293+
294+
295+ If listCHK_SP.Count > 0 Then
296+ Dim sStop As String = ""
297+ End If
298+
299+
300+ End If
301+
302+
303+
304+ For Each uChapter As modelChapter In uVolume.listChapter
305+
306+ Dim listChk2 = From dtSeq In uChapter.listText Where dtSeq.IndexOf(sKey) > -1
307+
308+ Dim listStop2 As List(Of String) = listChk.ToList()
309+
310+ Console.WriteLine(String.Join(vbCrLf, listStop2))
311+ Dim sString As String = String.Join(vbCrLf, listStop1)
312+
313+ If listStop2.Count > 0 Then
314+ Dim sStop As String = ""
315+ End If
316+
317+ Next
318+
319+ Next
320+
321+
322+ Next
323+
324+ End Sub
325+
326+ Public Sub chkEPUB002(ByRef listChk As List(Of String))
327+
328+ For iCtr As Integer = 0 To listChk.Count - 1
329+
330+ Dim sEdit As String = listChk(iCtr)
331+ Dim listEdit01 As List(Of String) = cTools.listNav_SE(sEdit, "<", ">", True)
332+
333+ For Each uEdit01 As String In listEdit01
334+
335+ sEdit = sEdit.Replace(uEdit01, "")
336+ Next
337+
338+ listChk(iCtr) = sEdit
339+
340+ Next
341+
342+
343+
344+ End Sub
345+
346+ Private Sub ReMoveTopTitle()
347+
348+
349+ For iCtr1 As Integer = 0 To mEpub.Count - 1
350+
351+ chkListTopLine(mEpub(iCtr1).listText, mEpub(iCtr1).Title)
352+
353+ For iCtr2 As Integer = 0 To mEpub(iCtr1).listVolume.Count - 1
354+
355+ chkListTopLine(mEpub(iCtr1).listVolume(iCtr2).listText, mEpub(iCtr1).listVolume(iCtr2).Title)
356+
357+ For iCtr3 As Integer = 0 To mEpub(iCtr1).listVolume(iCtr2).listChapter.Count - 1
358+ chkListTopLine(mEpub(iCtr1).listVolume(iCtr2).listChapter(iCtr3).listText, mEpub(iCtr1).listVolume(iCtr2).listChapter(iCtr3).Title)
359+ Next
360+ Next
361+ Next
362+
363+ End Sub
364+
365+ Private Sub chkListTopLine(ByRef listText As List(Of String), ByVal sTitle As String)
366+
367+ If listText.Count > 0 AndAlso sTitle.Length > 0 Then
368+ Dim hapHtml As HtmlAgilityPack.HtmlDocument = New HtmlAgilityPack.HtmlDocument()
369+ hapHtml.LoadHtml(listText(0))
370+ Dim chkNode = hapHtml.DocumentNode.SelectNodes("span")
371+
372+ If chkNode IsNot Nothing Then
373+
374+ If chkNode.Item(0).InnerText.Trim() = sTitle.Trim() Then
375+ listText.RemoveAt(0)
376+ End If
377+
378+ End If
379+
380+
381+ End If
382+
383+
384+ End Sub
385+
386+
387+
388+End Class
Show on old repository browser