• R/O
  • SSH
  • HTTPS

autocodeforsql: 提交


Commit MetaInfo

修订版413 (tree)
时间2021-01-13 15:02:12
作者hilinwei

Log Message

更改概述

差异

--- AutoEpub3/AutoEpub8.Designer.vb (revision 412)
+++ AutoEpub3/AutoEpub8.Designer.vb (revision 413)
@@ -29,6 +29,7 @@
2929 Me.Button4 = New System.Windows.Forms.Button()
3030 Me.Button6 = New System.Windows.Forms.Button()
3131 Me.Button7 = New System.Windows.Forms.Button()
32+ Me.Button8 = New System.Windows.Forms.Button()
3233 Me.SuspendLayout()
3334 '
3435 'Button5
@@ -94,11 +95,21 @@
9495 Me.Button7.Text = "NCX Dep 2"
9596 Me.Button7.UseVisualStyleBackColor = True
9697 '
98+ 'Button8
99+ '
100+ Me.Button8.Location = New System.Drawing.Point(73, 320)
101+ Me.Button8.Name = "Button8"
102+ Me.Button8.Size = New System.Drawing.Size(173, 69)
103+ Me.Button8.TabIndex = 23
104+ Me.Button8.Text = "DebugHelp"
105+ Me.Button8.UseVisualStyleBackColor = True
106+ '
97107 'AutoEpub8
98108 '
99109 Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 12.0!)
100110 Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
101111 Me.ClientSize = New System.Drawing.Size(800, 450)
112+ Me.Controls.Add(Me.Button8)
102113 Me.Controls.Add(Me.Button7)
103114 Me.Controls.Add(Me.Button6)
104115 Me.Controls.Add(Me.Button4)
@@ -119,4 +130,5 @@
119130 Friend WithEvents Button4 As Button
120131 Friend WithEvents Button6 As Button
121132 Friend WithEvents Button7 As Button
133+ Friend WithEvents Button8 As Button
122134 End Class
--- AutoEpub3/AutoEpub8.vb (revision 412)
+++ AutoEpub3/AutoEpub8.vb (revision 413)
@@ -123,11 +123,11 @@
123123
124124 Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
125125
126- Dim cAutoEpub As New cDep3_006("C:\Users\DTC_PC07\Downloads\Jhis\OEBPS\")
126+ Dim cAutoEpub As New cDep3_007("C:\Users\DTC_PC07\Downloads\ad\OEBPS\")
127127 cAutoEpub.CreadEpub()
128128
129129
130- Dim cEpub As New cEpub6(emEpub6.emEncCode.GB2321, emEpub6.emLan.ZH, "岩波日本史", "DEP3", "岩波出版社", "DYGW01_202009")
130+ Dim cEpub As New cEpub6(emEpub6.emEncCode.GB2321, emEpub6.emLan.ZH, "大江东去", "阿耐", "DJDV01_202009")
131131 cEpub.bConvertToMobi = False
132132 cEpub.CreateEpub(cAutoEpub.mEpub)
133133 MessageBox.Show("Finished")
@@ -228,7 +228,7 @@
228228
229229
230230 Dim cEpub As New cEpub6(emEpub6.emEncCode.GB2321, emEpub6.emLan.ZH, "渡边淳一合集", "渡边淳一", "DB_202012")
231- cEpub.bConvertToMobi = False
231+ cEpub.bConvertToMobi = True
232232 cEpub.CreateEpub(cAutoEpub.mEpub)
233233 MessageBox.Show("Finished")
234234 System.Diagnostics.Process.Start(cEpub.sOutPutPathFolder)
@@ -236,5 +236,125 @@
236236
237237 End Sub
238238
239+ Dim CHARSTOTRIM() As Char = {Chr(0), Chr(&H3F), vbNullChar, " "c}
240+
241+
242+ Private Sub Button8_Click(sender As Object, e As EventArgs) Handles Button8.Click
243+
244+ If System.IO.Directory.Exists("k:\tmp\sample\") Then
245+ Dim kke1 = "1"
246+ Else
247+ Dim kk3 = "2"
248+ End If
249+
250+
251+
252+ Dim c1 As Decimal = 0
253+ Dim c2 As Decimal = 100.3
254+ Dim c3 As Decimal = -200.6
255+
256+
257+ Dim sTest1 As String = c1.ToString("C", Globalization.CultureInfo.CreateSpecificCulture("en-US"))
258+ Dim sTest2 As String = c2.ToString("C", Globalization.CultureInfo.CreateSpecificCulture("en-US"))
259+ Dim sTest3 As String = c3.ToString("C", Globalization.CultureInfo.CreateSpecificCulture("en-US"))
260+
261+
262+
263+
264+
265+ Dim mOctopus As New modelOctopus
266+
267+ mOctopus.DeviceNo = CUInt("5504785").ToString("x").ToUpper()
268+
269+
270+ Dim sText As String = "25410689,0-5504822-3-0-5,01010801F219E910,180,-10,659936440,65297,0100000000,180,+24,659931600,65297,0100000000,180,0,659929669,65297,0100000000,180,-15,659928950,65297,0100000000,180,-9,660717289,65297,0100000000,180,-25,660704100,65297,0100000000,180,-9,660698306,65297,0100000000,180,-3,660698159,65297,0100000000,180,-3,660659453,65297,0100000000,180,-8,660659382,65297,0100000000"
271+
272+ Dim rawData2 = sText.TrimEnd(CHARSTOTRIM)
273+ Dim listInfo As List(Of String) = rawData2.Split(",").ToList()
274+ mOctopus.OctopusNo = listInfo(0)
275+ mOctopus.OctopusType = listInfo(1).Split("-")(0)
276+
277+ For iDtl As Integer = 0 To 3
278+ Dim uDTL As New modelOctopusDtl
279+ uDTL.No = iDtl + 1
280+ uDTL.Amt = Math.Round(CDec(listInfo(4 + 5 * iDtl)) / 10, 1).ToString("$#0.0")
281+ uDTL.TxnDateTime = (CDate("2000/01/01").AddSeconds(listInfo(5 + 5 * iDtl)) + (System.TimeZoneInfo.Local.BaseUtcOffset)).ToString("yyyy/MM/dd HH:mm:ss")
282+ uDTL.DeviceNo = Convert.ToUInt32(listInfo(6 + 5 * iDtl)).ToString("x").ToUpper()
283+
284+ If mOctopus.DeviceNo.Length > 3 AndAlso mOctopus.DeviceNo.Substring(2) = uDTL.DeviceNo Then
285+ uDTL.No = uDTL.No & "#"
286+ End If
287+ mOctopus.listDtl.Add(uDTL)
288+ Next
289+
290+ End Sub
291+
292+
293+
294+ Private Const OFFSET_2 = 65536
295+ Function IntegerToUnsigned(Value As Integer) As Long
296+ If Value < 0 Then
297+ IntegerToUnsigned = Value + OFFSET_2
298+ Else
299+ IntegerToUnsigned = Value
300+ End If
301+ End Function
302+
303+
304+
239305 End Class
240306
307+
308+
309+
310+Public Class modelOctopus
311+
312+ Public Property OctopusNo As String = String.Empty
313+ Public Property DeviceNo As String = String.Empty
314+ Public Property RemainingValue As String = String.Empty
315+ Public Property OctopusType As Integer = -1
316+ Public Property TxnDateTime As String = String.Empty
317+ Public Property LastAddValueType As Integer = -1
318+ Public Property listDtl As New List(Of modelOctopusDtl)
319+ Public Property ErrorStep As String = ""
320+ Public Property ErrorCode As String = ""
321+
322+ Public Property PayAmt As Decimal = 0.0
323+
324+ Public Property RecNo As String = ""
325+
326+ Public Property xfRe_FileName As String = ""
327+
328+ Public Property xfRe_MPS As Integer = 1
329+
330+ Public Property xfRe_Xfile As Integer = 100001
331+
332+ Public Property xfRe_NgSend As Integer = 2
333+
334+ Public Property xfRe_MpsSend As Integer = 1
335+
336+
337+ Public Property Re_InitComm As Integer = 100001
338+
339+ Public Property Re_TimeVer As Integer = 100001
340+
341+ Public Property Re_GetSysInfo As Integer = 0
342+
343+ Public Property Re_Blacklist As Integer = 1
344+
345+End Class
346+
347+Public Class modelOctopusDtl
348+
349+ Public Property No As String = 1
350+
351+ Public Property TxnDateTime As String = String.Empty
352+
353+ Public Property Amt As String = String.Empty
354+
355+ Public Property DeviceNo As String = String.Empty
356+
357+End Class
358+
359+
360+
--- AutoEpub3/Logic/DEP2/cDep2_007.vb (revision 412)
+++ AutoEpub3/Logic/DEP2/cDep2_007.vb (revision 413)
@@ -198,7 +198,7 @@
198198
199199 iSpanIndex += 1
200200
201- sHtml = sHtml.Replace(sKey, sKey & "_" & iSpanIndex.ToString().PadLeft(2, "0"))
201+ sHtml = sHtml.Replace(sKey, sKey & "_" & iSpanIndex.ToString().PadLeft(5, "0"))
202202
203203
204204
--- AutoEpub3/Logic/DEP3/cDep3_007.vb (nonexistent)
+++ AutoEpub3/Logic/DEP3/cDep3_007.vb (revision 413)
@@ -0,0 +1,357 @@
1+Imports System.IO
2+Imports HtmlAgilityPack
3+
4+Public Class cDep3_007
5+
6+ Dim bookPath As String
7+ Dim emCurreDep As emEpub6.emDep
8+
9+ Public mEpub As New List(Of modelSection)
10+
11+ Dim listSkip As List(Of String) = {"版权", "目录", "书名页", "版权页", "作家榜经典文库", "勇者物语", "书籍导读", "封面", "书名页", "扉页", "书名", "麒麟之翼", "作者简介", "内容简介", "版权信息", "总目录"}.ToList
12+ Dim listMobiRight As List(Of String) = {"inscribe"}.ToList()
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+ For iCtrSection As Integer = 0 To model.navMap.Count - 1
33+
34+ emCurreDep = emEpub6.emDep.Dep1
35+
36+ Dim ncxSection As ncxNavPoint = model.navMap(iCtrSection)
37+ Dim mSection As New modelSection()
38+ mSection.Title = ncxSection.navLabel.text
39+ If listSkip.Any(Function(x) mSection.Title.IndexOf(x) > -1) Then
40+ Continue For
41+ End If
42+
43+ mSection.Title = mSection.Title.Split("(")(1).Replace(")", "").Replace("岩波日本史", "") & " " & mSection.Title.Split("(")(0)
44+
45+ If ncxSection.navPoint Is Nothing Then
46+ mSection.Title = ncxSection.navLabel.text
47+ mSection.Scr = ncxSection.content.src
48+ Dim sPath As String = Path.Combine(bookPath, mSection.Scr).Split("#").ToList(0)
49+ Dim sTemp As String = sFileEditRead(sPath)
50+ Dim listText As List(Of String) = GetListText(sTemp)
51+ mSection.listText = listText
52+ mEpub.Add(mSection)
53+ Continue For
54+ End If
55+
56+
57+ For ctrVolume As Integer = 0 To ncxSection.navPoint.Count - 1
58+
59+ emCurreDep = emEpub6.emDep.Dep2
60+ Dim ncxVolume As ncxNavPointNavPoint = ncxSection.navPoint(ctrVolume)
61+
62+
63+ Dim mVolume As New modelVolume
64+ mVolume.Title = ncxVolume.navLabel.text
65+
66+ If listSkip.Any(Function(x) mVolume.Title.IndexOf(x) > -1) Then
67+ Continue For
68+ End If
69+
70+ If ncxVolume.navPoint Is Nothing Then
71+ mVolume.Title = ncxVolume.navLabel.text
72+ mVolume.Scr = ncxVolume.content.src
73+ Dim sPath As String = Path.Combine(bookPath, mVolume.Scr).Split("#").ToList(0)
74+ Dim sTemp As String = sFileEditRead(sPath)
75+ Dim listText As List(Of String) = GetListText(sTemp)
76+ mVolume.listText = listText
77+ mSection.listVolume.Add(mVolume)
78+ Continue For
79+ End If
80+
81+
82+ For ctrChapter As Integer = 0 To ncxVolume.navPoint.Count - 1
83+
84+ emCurreDep = emEpub6.emDep.Dep2
85+ Dim ncxChapter As ncxNavPointNavPointNavPoint = ncxVolume.navPoint(ctrChapter)
86+
87+ Dim mChapter As New modelChapter
88+
89+ mChapter.Title = ncxChapter.navLabel.text
90+ mChapter.Scr = ncxChapter.content.src
91+
92+ If listSkip.Any(Function(x) mChapter.Title.IndexOf(x) > -1) Then
93+ Continue For
94+ End If
95+
96+ Dim sPath As String = Path.Combine(bookPath, mChapter.Scr).Split("#").ToList(0)
97+
98+ Dim sChapter As String = sFileEditRead(sPath)
99+ Dim listText As List(Of String) = GetListText(sChapter)
100+
101+ mChapter.listText = listText
102+ mVolume.listChapter.Add(mChapter)
103+
104+ Next
105+
106+ mSection.listVolume.Add(mVolume)
107+
108+ Next
109+
110+
111+ mEpub.Add(mSection)
112+
113+ Next
114+
115+
116+ End Sub
117+
118+ Private Function GetListText(ByVal sHtml) As List(Of String)
119+
120+ GetListText = New List(Of String)
121+ Dim apHtml As HtmlAgilityPack.HtmlDocument = New HtmlAgilityPack.HtmlDocument()
122+ apHtml.LoadHtml(sHtml)
123+ Dim listHtmlNode = apHtml.DocumentNode.Descendants.Where(Function(x) x.Name = "p" OrElse x.Name = "h3" OrElse x.Name = "img")
124+ For Each uHtmlNode As HtmlAgilityPack.HtmlNode In listHtmlNode
125+
126+ If uHtmlNode.Attributes("class").Value = "pageheader" Then
127+ Continue For
128+ End If
129+
130+ If uHtmlNode.Name = "p" Then
131+ Dim sTarget As String = uHtmlNode.InnerHtml
132+ If listMobiRight.Any(Function(x) uHtmlNode.OuterHtml.Contains(x)) Then
133+ sTarget = sTarget + emEpub6.spDl_Right
134+ End If
135+ GetListText.Add(sTarget)
136+ End If
137+
138+ If uHtmlNode.Name = "h3" Then
139+ Dim sTarget As String = uHtmlNode.InnerHtml
140+ sTarget = sTarget + emEpub6.spText_SubTitle
141+ GetListText.Add(sTarget)
142+ End If
143+
144+
145+ If uHtmlNode.Name = "img" Then
146+
147+ Dim imgScr As String = uHtmlNode.Attributes("src").Value
148+ Dim sNewImg As String = cTools.sGaiji(imgScr, emCurreDep)
149+ If uHtmlNode.OuterHtml.IndexOf("image-100") > -1 Then
150+ sNewImg = cTools.sMapImg(imgScr, emCurreDep)
151+ End If
152+ GetListText.Add(sNewImg)
153+ End If
154+
155+
156+ Next
157+
158+ End Function
159+
160+
161+ Private Function sFileEditRead(ByVal sPath As String) As String
162+ sFileEditRead = cTools.sFileReader(sPath, cEpub6.encUTF8)
163+
164+ DelHtml(sFileEditRead)
165+
166+ EditHref00(sFileEditRead)
167+ EditHref01(sFileEditRead)
168+ EditHref02(sFileEditRead)
169+ EditHref03(sFileEditRead)
170+ ResetImgUrl(sFileEditRead)
171+
172+ End Function
173+
174+
175+ Private Sub DelHtml(ByRef sHtml As String)
176+
177+
178+ End Sub
179+
180+ Private Sub EditHref00(ByRef sHtml As String)
181+
182+ Dim hapHtmlEdit As HtmlAgilityPack.HtmlDocument = New HtmlAgilityPack.HtmlDocument()
183+ hapHtmlEdit.LoadHtml(sHtml)
184+ Dim linqHap = hapHtmlEdit.DocumentNode.SelectNodes(("//a"))
185+
186+ If linqHap IsNot Nothing Then
187+
188+ For Each uHap As HtmlNode In linqHap
189+
190+ Dim sScr As String = uHap.Attributes("href").Value
191+
192+ If sScr.Split("#").Count = 2 Then
193+ sHtml = sHtml.Replace(sScr, "#" & sScr.Split("#")(1))
194+ Else
195+ Dim sError As String = ""
196+ End If
197+ Next
198+
199+ End If
200+
201+
202+ End Sub
203+
204+
205+ Private Sub EditHref01(ByRef sHtml As String)
206+
207+ End Sub
208+
209+
210+ Private Sub EditHref02(ByRef sHtml As String)
211+
212+ End Sub
213+
214+
215+ Private Sub EditHref03(ByRef sHtml As String)
216+
217+ End Sub
218+
219+
220+ Public Sub chkEPUB001(ByVal sKey As String)
221+
222+
223+ For Each uSection As modelSection In mEpub
224+
225+ For Each uVolume As modelVolume In uSection.listVolume
226+
227+ Dim listChk = From dtSeq In uVolume.listText Where dtSeq.IndexOf(sKey) > -1
228+ Dim listStop1 As List(Of String) = listChk.ToList()
229+
230+ If listStop1.Count > 0 Then
231+
232+ Dim sString As String = String.Join(vbCrLf, listStop1)
233+ Console.WriteLine(String.Join(vbCrLf, listStop1))
234+
235+
236+ If listStop1.Count > 0 Then
237+ Dim sStop As String = ""
238+ End If
239+
240+
241+ Dim sHtml As String = String.Join(vbCrLf, uVolume.listText)
242+
243+
244+ Dim listCHK_SP As List(Of String) = cTools.listNav_SE(sHtml, "<", ">", True)
245+
246+
247+ If listCHK_SP.Count > 0 Then
248+ Dim sStop As String = ""
249+ End If
250+
251+
252+ End If
253+
254+
255+
256+ For Each uChapter As modelChapter In uVolume.listChapter
257+
258+ Dim listChk2 = From dtSeq In uChapter.listText Where dtSeq.IndexOf(sKey) > -1
259+
260+ Dim listStop2 As List(Of String) = listChk.ToList()
261+
262+ Console.WriteLine(String.Join(vbCrLf, listStop2))
263+ Dim sString As String = String.Join(vbCrLf, listStop1)
264+
265+ If listStop2.Count > 0 Then
266+ Dim sStop As String = ""
267+ End If
268+
269+ Next
270+
271+ Next
272+
273+
274+ Next
275+
276+ End Sub
277+
278+ Public Sub chkEPUB002(ByRef listChk As List(Of String))
279+
280+ For iCtr As Integer = 0 To listChk.Count - 1
281+
282+ Dim sEdit As String = listChk(iCtr)
283+ Dim listEdit01 As List(Of String) = cTools.listNav_SE(sEdit, "<", ">", True)
284+
285+ For Each uEdit01 As String In listEdit01
286+
287+ sEdit = sEdit.Replace(uEdit01, "")
288+ Next
289+
290+ listChk(iCtr) = sEdit
291+
292+ Next
293+
294+
295+
296+ End Sub
297+
298+ Private Sub ReMoveTopTitle()
299+
300+
301+ For iCtr1 As Integer = 0 To mEpub.Count - 1
302+
303+ chkListTopLine(mEpub(iCtr1).listText, mEpub(iCtr1).Title)
304+
305+ For iCtr2 As Integer = 0 To mEpub(iCtr1).listVolume.Count - 1
306+
307+ chkListTopLine(mEpub(iCtr1).listVolume(iCtr2).listText, mEpub(iCtr1).listVolume(iCtr2).Title)
308+
309+ For iCtr3 As Integer = 0 To mEpub(iCtr1).listVolume(iCtr2).listChapter.Count - 1
310+ chkListTopLine(mEpub(iCtr1).listVolume(iCtr2).listChapter(iCtr3).listText, mEpub(iCtr1).listVolume(iCtr2).listChapter(iCtr3).Title)
311+ chkListTopLine(mEpub(iCtr1).listVolume(iCtr2).listChapter(iCtr3).listText, mEpub(iCtr1).listVolume(iCtr2).Title)
312+
313+ Next
314+ Next
315+ Next
316+
317+ End Sub
318+
319+ Private Sub chkListTopLine(ByRef listText As List(Of String), ByVal sTitle As String)
320+
321+ If listText.Count > 0 AndAlso sTitle.Length > 0 Then
322+ Dim hapHtml As HtmlAgilityPack.HtmlDocument = New HtmlAgilityPack.HtmlDocument()
323+ hapHtml.LoadHtml(listText(0))
324+ Dim chkNode = hapHtml.DocumentNode.SelectNodes("span")
325+
326+ If chkNode IsNot Nothing Then
327+
328+ If chkNode.Item(0).InnerText.Trim() = sTitle.Trim() Then
329+ listText.RemoveAt(0)
330+ End If
331+
332+ End If
333+
334+
335+ End If
336+
337+
338+ End Sub
339+
340+ Private Sub ResetImgUrl(ByRef sChapter As String)
341+
342+ Dim hapHtml As HtmlDocument = New HtmlDocument()
343+ hapHtml.LoadHtml(sChapter)
344+ Dim listTarget = hapHtml.DocumentNode.SelectNodes(("//img"))
345+ If listTarget IsNot Nothing Then
346+ For Each uTarget As HtmlNode In listTarget
347+ Dim imgScr As String = uTarget.Attributes("src").Value
348+ Dim sNewImg As String = cTools.sGaiji(imgScr, emCurreDep)
349+ If uTarget.OuterHtml.IndexOf("image-100") > -1 Then
350+ sNewImg = cTools.sMapImg(sNewImg, emCurreDep)
351+ End If
352+ sChapter = sChapter.Replace(uTarget.OuterHtml, sNewImg)
353+ Next
354+ End If
355+ End Sub
356+
357+End Class
Show on old repository browser