• R/O
  • SSH
  • HTTPS

autocodeforsql: Commit


Commit MetaInfo

Revisão322 (tree)
Hora2020-02-14 17:58:32
Autorhilinwei

Mensagem de Log

Mudança Sumário

Diff

--- AutoEpub3/AutoEpub7.Designer.vb (revision 321)
+++ AutoEpub3/AutoEpub7.Designer.vb (revision 322)
@@ -30,6 +30,7 @@
3030 Me.Button5 = New System.Windows.Forms.Button()
3131 Me.Button6 = New System.Windows.Forms.Button()
3232 Me.Button7 = New System.Windows.Forms.Button()
33+ Me.Button8 = New System.Windows.Forms.Button()
3334 Me.SuspendLayout()
3435 '
3536 'btnNCXDep2
@@ -104,11 +105,21 @@
104105 Me.Button7.Text = "POS Code"
105106 Me.Button7.UseVisualStyleBackColor = True
106107 '
108+ 'Button8
109+ '
110+ Me.Button8.Location = New System.Drawing.Point(591, 135)
111+ Me.Button8.Name = "Button8"
112+ Me.Button8.Size = New System.Drawing.Size(173, 69)
113+ Me.Button8.TabIndex = 18
114+ Me.Button8.Text = "NCX Dep 3"
115+ Me.Button8.UseVisualStyleBackColor = True
116+ '
107117 'AutoEpub7
108118 '
109119 Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 12.0!)
110120 Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
111121 Me.ClientSize = New System.Drawing.Size(800, 450)
122+ Me.Controls.Add(Me.Button8)
112123 Me.Controls.Add(Me.Button7)
113124 Me.Controls.Add(Me.Button6)
114125 Me.Controls.Add(Me.Button5)
@@ -132,4 +143,5 @@
132143 Friend WithEvents Button5 As Button
133144 Friend WithEvents Button6 As Button
134145 Friend WithEvents Button7 As Button
146+ Friend WithEvents Button8 As Button
135147 End Class
--- AutoEpub3/AutoEpub7.vb (revision 321)
+++ AutoEpub3/AutoEpub7.vb (revision 322)
@@ -795,7 +795,7 @@
795795
796796 Try
797797
798- Dim ncxFilePath As String = "C:\Users\DataTrade\Downloads\kk1\toc.ncx"
798+ Dim ncxFilePath As String = "C:\Users\DataTrade\Downloads\cdcd1\OEBPS\toc.ncx"
799799
800800 Dim fs As System.IO.FileStream = New System.IO.FileStream(ncxFilePath, System.IO.FileMode.Open)
801801 Dim serializer As System.Xml.Serialization.XmlSerializer = New System.Xml.Serialization.XmlSerializer(GetType(ncx))
@@ -811,7 +811,7 @@
811811
812812 Dim fileSection As ncxNavPoint = fileNCX.navMap(ctrSection)
813813 Dim mSection As New modelSection
814- mSection.Title = fileSection.navLabel.text.Replace("(新修版)", "")
814+ mSection.Title = fileSection.navLabel.text
815815
816816
817817 If ctrSection = 0 Then
@@ -1023,5 +1023,144 @@
10231023
10241024 End Sub
10251025
1026+ Private Sub Button8_Click(sender As Object, e As EventArgs) Handles Button8.Click
10261027
1028+ Dim listError As New List(Of String)
1029+
1030+ Dim ikke As Integer = 0
1031+
1032+ Try
1033+
1034+ Dim ncxFilePath As String = "C:\Users\DataTrade\Downloads\cdcd1\OEBPS\toc.ncx"
1035+
1036+ Dim fs As System.IO.FileStream = New System.IO.FileStream(ncxFilePath, System.IO.FileMode.Open)
1037+ Dim serializer As System.Xml.Serialization.XmlSerializer = New System.Xml.Serialization.XmlSerializer(GetType(ncx))
1038+ Dim fileNCX As ncx = CType(serializer.Deserialize(fs), ncx)
1039+ fs.Dispose()
1040+
1041+ Dim mEpub As New List(Of modelSection)
1042+
1043+ Dim listNav As List(Of ncxNavPoint) = fileNCX.navMap.ToList()
1044+ Dim linqSection = From dtSeq In listNav Where dtSeq.navLabel.text.IndexOf("大唐辟邪司") > -1
1045+
1046+ For iCtrSection As Integer = 0 To 2
1047+ Dim dSectionFrom As Decimal = listNav.IndexOf(linqSection(iCtrSection))
1048+ Dim dSectionTo As Decimal = listNav.Count - 1
1049+
1050+ If iCtrSection < 2 Then
1051+ dSectionTo = listNav.IndexOf(linqSection(iCtrSection + 1)) - 1
1052+ End If
1053+
1054+ Dim mSection As New modelSection
1055+ mSection.Title = listNav(dSectionFrom).navLabel.text
1056+
1057+ mSection.Title = mSection.Title.Replace("大唐辟邪司", "")
1058+
1059+ mSection.Title = mSection.Title.Replace("III:", "第叁册 ")
1060+ mSection.Title = mSection.Title.Replace("II:", "第贰册 ")
1061+ mSection.Title = mSection.Title.Replace("I:", "第壹册 ")
1062+
1063+ Dim listTargetSec As New List(Of ncxNavPoint)
1064+
1065+ Dim linqVoluem = From dtSeq In listNav Where dtSeq.navLabel.text.IndexOf("卷") > -1
1066+
1067+
1068+ For iCtrVoluen As Integer = 0 To 1
1069+
1070+ Dim dVoluenFrom As Decimal = listNav.IndexOf(linqVoluem(iCtrVoluen + ikke))
1071+ Dim dVoluenTo As Decimal = dSectionTo
1072+
1073+ If iCtrVoluen < 1 Then
1074+ dVoluenTo = listNav.IndexOf(linqVoluem(iCtrVoluen + 1 + ikke)) - 1
1075+ End If
1076+
1077+ Dim mVolume As New modelVolume
1078+ mVolume.Title = listNav(dVoluenFrom).navLabel.text
1079+ listError.Add("," & mVolume.Title)
1080+
1081+ For iCtrChapter As Integer = dVoluenFrom + 1 To dVoluenTo
1082+
1083+ Dim mChapter As New modelChapter
1084+ mChapter.Title = listNav(iCtrChapter).navLabel.text
1085+
1086+ If mChapter.Title.IndexOf("章节") > -1 Then
1087+
1088+ mChapter.Title = mChapter.Title.Replace("章节", "第")
1089+ mChapter.Title = mChapter.Title.Replace(" ", "章 ")
1090+
1091+
1092+ End If
1093+
1094+
1095+
1096+
1097+ mChapter.Scr = listNav(iCtrChapter).content.src
1098+ listError.Add("," & mChapter.Title)
1099+
1100+
1101+ Dim listScr As List(Of String) = mChapter.Scr.Split("#").ToList()
1102+ Dim sScr01 As String = mChapter.Scr.Split("#")(0)
1103+ Dim sScr02 As String = "640401"
1104+
1105+ If listScr.Count > 1 Then
1106+ sScr02 = mChapter.Scr.Split("#")(1)
1107+ End If
1108+
1109+
1110+ Dim sChapter As String = cTools.sFileReader("C:\Users\DataTrade\Downloads\cdcd1\OEBPS\" & sScr01, cEpub6.encUTF8)
1111+
1112+ Dim listChapter As List(Of String) = sChapter.Split({"<span id="}, StringSplitOptions.None).ToList().Where(Function(x) x.IndexOf(sScr02) > -1).ToList()
1113+
1114+ Dim listText As List(Of String) = cTools.listText_P(listChapter(0))
1115+
1116+
1117+ mChapter.listText = listText
1118+
1119+ mVolume.listChapter.Add(mChapter)
1120+ Next
1121+
1122+ mSection.listVolume.Add(mVolume)
1123+
1124+ Next
1125+
1126+ ikke += 2
1127+
1128+ mEpub.Add(mSection)
1129+
1130+ Next
1131+
1132+
1133+
1134+ Dim addSection As New modelSection
1135+
1136+ Dim dTarget As Decimal = mEpub(2).listVolume(1).listChapter.Count - 1
1137+ addSection.Title = mEpub(2).listVolume(1).listChapter(dTarget).Title
1138+ addSection.listText = mEpub(2).listVolume(1).listChapter(dTarget).listText
1139+
1140+ addSection.listText.RemoveAt(0)
1141+
1142+ addSection.listText.RemoveRange(addSection.listText.Count - 4, 4)
1143+
1144+ mEpub(2).listVolume(1).listChapter.RemoveAt(dTarget)
1145+ mEpub.Add(addSection)
1146+
1147+
1148+ Dim cEpub As New cEpub6(emEpub6.emEncCode.GB2321, emEpub6.emLan.ZH, "大唐辟邪司", "王晴川", "DTPXS_202002")
1149+ cEpub.bConvertToMobi = True
1150+ cEpub.CreateEpub(mEpub)
1151+ MessageBox.Show("Finished")
1152+
1153+
1154+ Catch ex As Exception
1155+
1156+ MessageBox.Show(ex.Message)
1157+
1158+ Dim k1 = listError
1159+
1160+ End Try
1161+
1162+
1163+ End Sub
1164+
1165+
10271166 End Class
\ No newline at end of file
Show on old repository browser