@@ -26,6 +26,7 @@ | ||
26 | 26 | Me.btnNCXDep1 = New System.Windows.Forms.Button() |
27 | 27 | Me.btnNCXDep3 = New System.Windows.Forms.Button() |
28 | 28 | Me.Button1 = New System.Windows.Forms.Button() |
29 | + Me.txtPickUp = New System.Windows.Forms.Button() | |
29 | 30 | Me.SuspendLayout() |
30 | 31 | ' |
31 | 32 | 'btnNCXDep2 |
@@ -64,11 +65,21 @@ | ||
64 | 65 | Me.Button1.Text = "NCX Dep 2" |
65 | 66 | Me.Button1.UseVisualStyleBackColor = True |
66 | 67 | ' |
68 | + 'txtPickUp | |
69 | + ' | |
70 | + Me.txtPickUp.Location = New System.Drawing.Point(407, 26) | |
71 | + Me.txtPickUp.Name = "txtPickUp" | |
72 | + Me.txtPickUp.Size = New System.Drawing.Size(173, 69) | |
73 | + Me.txtPickUp.TabIndex = 13 | |
74 | + Me.txtPickUp.Text = "PickUp" | |
75 | + Me.txtPickUp.UseVisualStyleBackColor = True | |
76 | + ' | |
67 | 77 | 'AutoEpub6 |
68 | 78 | ' |
69 | 79 | Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 12.0!) |
70 | 80 | Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font |
71 | 81 | Me.ClientSize = New System.Drawing.Size(648, 360) |
82 | + Me.Controls.Add(Me.txtPickUp) | |
72 | 83 | Me.Controls.Add(Me.Button1) |
73 | 84 | Me.Controls.Add(Me.btnNCXDep3) |
74 | 85 | Me.Controls.Add(Me.btnNCXDep1) |
@@ -84,4 +95,5 @@ | ||
84 | 95 | Friend WithEvents btnNCXDep1 As Button |
85 | 96 | Friend WithEvents btnNCXDep3 As Button |
86 | 97 | Friend WithEvents Button1 As Button |
98 | + Friend WithEvents txtPickUp As Button | |
87 | 99 | End Class |
@@ -1,8 +1,10 @@ | ||
1 | 1 | Imports System.IO |
2 | +Imports System.Text.RegularExpressions | |
2 | 3 | |
3 | 4 | Public Class AutoEpub6 |
4 | 5 | Private Sub btnNCXDep1_Click(sender As Object, e As EventArgs) Handles btnNCXDep1.Click |
5 | 6 | |
7 | + Dim listPickString As New List(Of String) | |
6 | 8 | |
7 | 9 | |
8 | 10 | Dim sPath As String = "C:\Users\vmware\Downloads\121432\toc.ncx" |
@@ -13,6 +15,8 @@ | ||
13 | 15 | |
14 | 16 | Dim mEpub As New List(Of modelChapter) |
15 | 17 | |
18 | + | |
19 | + | |
16 | 20 | For Each eachPoint As ncxNavPoint In model.navMap |
17 | 21 | |
18 | 22 | Dim sTitle As String = eachPoint.navLabel.text.Trim() |
@@ -28,8 +32,39 @@ | ||
28 | 32 | mChapter.listText = listTemp |
29 | 33 | mEpub.Add(mChapter) |
30 | 34 | |
35 | + | |
36 | + For Each sVolumLine As String In listTemp | |
37 | + | |
38 | + PickUpString(sVolumLine.Trim(), listPickString) | |
39 | + | |
40 | + Next | |
41 | + | |
42 | + | |
43 | + | |
31 | 44 | Next |
32 | 45 | |
46 | + Dim Cntdd = listPickString.GroupBy(Function(S) S).ToDictionary(Function(a) a.Key, Function(a) a.Count) | |
47 | + | |
48 | + | |
49 | + | |
50 | + Dim sbEee As New System.Text.StringBuilder | |
51 | + | |
52 | + | |
53 | + For Each kk1 In Cntdd | |
54 | + | |
55 | + | |
56 | + sbEee.AppendLine(kk1.Key) | |
57 | + | |
58 | + Next | |
59 | + | |
60 | + | |
61 | + Dim k2k1 As String = sbEee.ToString() | |
62 | + | |
63 | + | |
64 | + | |
65 | + | |
66 | + | |
67 | + | |
33 | 68 | Dim cEpub As New cEpub6(emEpub6.emEncCode.SHIFT_JIS, emEpub6.emLan.ZH, "童亮", "鬼称骨", "GCG_201901") |
34 | 69 | cEpub.bConvertToMobi = False |
35 | 70 | cEpub.CreateEpub(mEpub) |
@@ -445,6 +480,181 @@ | ||
445 | 480 | |
446 | 481 | End Sub |
447 | 482 | |
483 | + Private Sub txtPickUp_Click(sender As Object, e As EventArgs) Handles txtPickUp.Click | |
448 | 484 | |
485 | + Dim sTest As String = cTools.sFileReader("C:\Soft\Epub\20190116\OEBPS\test.txt", cEpub6.encUTF8) | |
449 | 486 | |
487 | + Dim listPictUpTemp As New List(Of String) | |
488 | + | |
489 | + PickUpString(sTest, listPictUpTemp) | |
490 | + | |
491 | + | |
492 | + Dim a1 = listPictUpTemp.Count | |
493 | + | |
494 | + 'For Each errChar As Char In sPick | |
495 | + ' listPictUpTemp.Add(errChar) | |
496 | + 'Next | |
497 | + | |
498 | + | |
499 | + | |
500 | + 'Dim a1 = listPictUpTemp.Count | |
501 | + | |
502 | + | |
503 | + End Sub | |
504 | + | |
505 | + Private Function listSkipChart() As List(Of String) | |
506 | + listSkipChart = New List(Of String) | |
507 | + | |
508 | + listSkipChart.Add(",") | |
509 | + listSkipChart.Add("。") | |
510 | + listSkipChart.Add(":") | |
511 | + listSkipChart.Add("!") | |
512 | + listSkipChart.Add("?") | |
513 | + | |
514 | + | |
515 | + listSkipChart.Add(Convert.ToChar(8220)) | |
516 | + listSkipChart.Add(Convert.ToChar(8221)) | |
517 | + | |
518 | + | |
519 | + | |
520 | + End Function | |
521 | + | |
522 | + | |
523 | + Private Sub PickUpString(ByVal sText As String, ByRef listRep As List(Of String)) | |
524 | + | |
525 | + Dim sPick As String = Regex.Replace(sText, "[\u4e00-\u9fa5]", "") | |
526 | + If sPick = String.Empty Then | |
527 | + Exit Sub | |
528 | + End If | |
529 | + | |
530 | + | |
531 | + Dim sTempPick As String = "" | |
532 | + | |
533 | + For iCtr As Integer = 0 To sPick.Length - 1 | |
534 | + sTempPick += sPick.Substring(iCtr, 1) | |
535 | + If sText.IndexOf(sTempPick) = -1 Then | |
536 | + sTempPick = sTempPick.Substring(0, sTempPick.Length - 1) | |
537 | + Exit For | |
538 | + End If | |
539 | + Next | |
540 | + | |
541 | + If sTempPick.Length > 2 Then | |
542 | + listRep.Add(sTempPick) | |
543 | + End If | |
544 | + | |
545 | + | |
546 | + | |
547 | + Dim indexSp1 As Decimal = sText.IndexOf(sTempPick) | |
548 | + sText = sText.Remove(indexSp1, sTempPick.Length) | |
549 | + PickUpString(sText, listRep) | |
550 | + | |
551 | + End Sub | |
552 | + | |
553 | + | |
554 | + 'Private Sub PickUpString(ByVal sText As String, ByRef listRep As List(Of String)) | |
555 | + | |
556 | + ' 'Dim listSkipChart As List(Of String) = {",", "。", Convert.ToChar(8220), Convert.ToChar(8221), ":", "!", "?", "--", "……"}.ToList | |
557 | + ' Dim listSkipChart As List(Of String) = {"……。"}.ToList | |
558 | + | |
559 | + ' If sText.IndexOf("……") > -1 Then | |
560 | + ' Dim kk1 = "1" | |
561 | + ' End If | |
562 | + | |
563 | + | |
564 | + ' Dim sPick As String = Regex.Replace(sText, "[\u4e00-\u9fa5]", "") | |
565 | + | |
566 | + ' If sPick = String.Empty Then | |
567 | + ' Exit Sub | |
568 | + ' End If | |
569 | + | |
570 | + | |
571 | + ' Dim sTempPick As String = "" | |
572 | + | |
573 | + ' Dim bEnd As Boolean = True | |
574 | + | |
575 | + ' For iCtr As Integer = 0 To sPick.Length - 1 | |
576 | + ' sTempPick += sPick.Substring(iCtr, 1) | |
577 | + ' If sText.IndexOf(sTempPick) = -1 Then | |
578 | + ' sTempPick = sTempPick.Substring(0, sTempPick.Length - 1) | |
579 | + | |
580 | + ' Dim sTempPickCopy As String = sTempPick | |
581 | + | |
582 | + ' For Each eachSkip As String In listSkipChart | |
583 | + | |
584 | + ' If sTempPickCopy.Length > 0 Then | |
585 | + ' If sTempPickCopy.Substring(0, 1) = eachSkip Then | |
586 | + ' Dim indexSp2 As Decimal = sText.IndexOf(sTempPickCopy) | |
587 | + | |
588 | + ' If indexSp2 > 0 Then | |
589 | + | |
590 | + ' Dim sChkChart As String = sText.Substring(indexSp2 - 1, 1) | |
591 | + | |
592 | + ' If Regex.IsMatch(sChkChart, "[\u4e00-\u9fa5]") Then | |
593 | + ' sTempPickCopy = sTempPickCopy.Replace(eachSkip, "") | |
594 | + ' End If | |
595 | + | |
596 | + ' End If | |
597 | + | |
598 | + | |
599 | + ' End If | |
600 | + ' End If | |
601 | + | |
602 | + | |
603 | + ' Next | |
604 | + | |
605 | + | |
606 | + ' If sTempPickCopy.Length > 1 Then | |
607 | + ' listRep.Add(sTempPickCopy) | |
608 | + ' End If | |
609 | + | |
610 | + ' bEnd = False | |
611 | + ' Exit For | |
612 | + ' End If | |
613 | + | |
614 | + ' Next | |
615 | + | |
616 | + ' If bEnd Then | |
617 | + ' Dim sTempPickCopy As String = sTempPick | |
618 | + | |
619 | + | |
620 | + ' For Each eachSkip As String In listSkipChart | |
621 | + | |
622 | + | |
623 | + ' If sTempPickCopy.Length > 0 Then | |
624 | + ' If sTempPickCopy.Substring(0, 1) = eachSkip Then | |
625 | + ' Dim indexSp2 As Decimal = sText.IndexOf(sTempPickCopy) | |
626 | + | |
627 | + ' If indexSp2 <> -1 Then | |
628 | + | |
629 | + ' Dim sChkChart As String = sText.Substring(indexSp2 - 1, 1) | |
630 | + | |
631 | + ' If Regex.IsMatch(sChkChart, "[\u4e00-\u9fa5]") Then | |
632 | + ' sTempPickCopy = sTempPickCopy.Replace(eachSkip, "") | |
633 | + ' End If | |
634 | + | |
635 | + ' End If | |
636 | + | |
637 | + | |
638 | + ' End If | |
639 | + ' End If | |
640 | + | |
641 | + | |
642 | + ' Next | |
643 | + | |
644 | + ' If sTempPickCopy.Length > 1 Then | |
645 | + ' listRep.Add(sTempPickCopy) | |
646 | + ' End If | |
647 | + | |
648 | + | |
649 | + ' End If | |
650 | + | |
651 | + | |
652 | + ' Dim indexSp1 As Decimal = sText.IndexOf(sTempPick) | |
653 | + ' sText = sText.Remove(indexSp1, sTempPick.Length) | |
654 | + ' PickUpString(sText, listRep) | |
655 | + | |
656 | + 'End Sub | |
657 | + | |
658 | + | |
659 | + | |
450 | 660 | End Class |
\ No newline at end of file |