'=============================================================== ' ' Dainagon v0.01 YouKan No Kata for win10 ' ' Copy Right Miyama. 2025 May ' ' http://kazutomimiyama.sakura.ne.jp ' KazutomiMiyamaSub@gmail.com ' ' ============================================================== Option Explicit On Imports System Imports System.IO Public Class Form1 Dim FSO = CreateObject("Scripting.FileSystemObject") Dim RTS As StreamReader Dim WTS As StreamWriter Dim VacantCHR As String = VacantCHR Dim CHRNumonLine As Integer = 10 Private Sub Form1_load(sender As Object, e As EventArgs) Handles Me.Load With Me .Width = 300 .Height = 200 .Text = "Dainagon Ver0.01" .BackColor = Color.FromArgb(128, 128, 0) End With With GoBTN .Top = 50 .Left = 2 .Width = 280 .Height = 108 .Text = "Go &G" .BackColor = Color.FromArgb(180, 64, 180) End With With ExitBTN .Top = 2 .Left = 2 .Width = 280 .Height = 50 .Text = "Exit &X" .BackColor = Color.FromArgb(128, 255, 128) End With End Sub Private Sub ExitBTN_Click(sender As Object, e As EventArgs) Handles ExitBTN.Click Me.Close() End Sub Private Sub GoBTN_Click(sender As Object, e As EventArgs) Handles GoBTN.Click Dim FileNameSTR As String = VacantCHR Dim CHKIndentCHR As String 'CHKIndentCHR As String Dim CI Dim SegWholeSTR As String = VacantCHR Dim tmpLineSTR As String = VacantCHR Dim NrmSTR As String = VacantCHR Dim i As Integer Dim CHR2d As String '------ With FSO While .fileexists(FileNameSTR) = False FileNameSTR = InputBox("FileName?") End While End With CHRNumonLine = 0 While CHRNumonLine <= 0 Or 200 <= CHRNumonLine CHRNumonLine = Int(InputBox("Chr Number on one line?")) End While RTS = New StreamReader(FileNameSTR) WTS = New StreamWriter("output.txt") For i = 1 To 80 If i < 10 Then CHR2d = "0" Else CHR2d = VacantCHR End If NrmSTR = NrmSTR + CHR2d + CStr(i) Next i WTS.Write("== by Dinagon v0.01forWin10 ==" + vbCrLf + NrmSTR + vbCrLf) With RTS While .EndOfStream = False tmpLineSTR = .ReadLine CHKIndentCHR = Mid(tmpLineSTR, 1, 1) If CHKIndentCHR = " " Or CHKIndentCHR = " " Or CHKIndentCHR = "*" Or CHKIndentCHR = "*" Or CHKIndentCHR = "#" Or CHKIndentCHR = "#" Or CHKIndentCHR = "<" Or CHKIndentCHR = "<" Or CHKIndentCHR = "(" Or CHKIndentCHR = "(" Or CHKIndentCHR = "「" Or CHKIndentCHR = "[" Or CHKIndentCHR = "※" Or CHKIndentCHR = "・" Then Call SegWrite(SegWholeSTR) SegWholeSTR = VacantCHR End If SegWholeSTR = SegWholeSTR + tmpLineSTR End While SegWrite(SegWholeSTR) End With WTS.Write(NrmSTR + vbCrLf + "==============================" + vbCrLf) WTS.Close() RTS.Close() MessageBox.Show("finished.") End Sub Private Sub SegWrite(MassSTR As String) Dim tmpCHR As String = VacantCHR Dim StakeSTR As String = VacantCHR Dim j, i As Single Dim LenMassSTR1st As Single = 0 Dim LenMassSTR As Single = 0 Dim CHRByteWidth As Single = 0 Dim CHRByteCounter As Single = 0 Dim tmpLineSTR As String = VacantCHR Dim OutLineSTR As String = VacantCHR Dim KinSokuFlag As Boolean = False Dim tmpKinSokuFlag As Boolean = False '------ LenMassSTR1st = Len(MassSTR) If Not LenMassSTR1st = 0 Then For j = 1 To LenMassSTR1st tmpCHR = Mid(MassSTR, j, 1) Select Case tmpCHR Case vbCr tmpCHR = VacantCHR Case vbLf tmpCHR = VacantCHR End Select StakeSTR = StakeSTR + tmpCHR Next j MassSTR = StakeSTR LenMassSTR1st = Len(MassSTR) For i = 1 To LenMassSTR1st tmpCHR = Mid(MassSTR, i, 1) If 0 < Asc(tmpCHR) Then CHRByteWidth = 0.5 If Asc(tmpCHR) < 0 Then CHRByteWidth = 1.0 If CHRNumonLine < CHRByteCounter + CHRByteWidth Then If tmpCHR = "。" Or tmpCHR = "、" Or tmpCHR = ")" Or tmpCHR = "」" Or tmpCHR = ">" Or tmpCHR = "." Or tmpCHR = "," Or tmpCHR = ")" Or tmpCHR = "]" Or tmpCHR = ">" Then If KinSokuFlag = True Then tmpKinSokuFlag = False Else tmpKinSokuFlag = True CHRByteCounter = CHRByteCounter - CHRByteWidth End If KinSokuFlag = tmpKinSokuFlag End If End If If CHRNumonLine < CHRByteCounter + CHRByteWidth Then WTS.WriteLine(OutLineSTR) OutLineSTR = tmpCHR CHRByteCounter = CHRByteWidth Else ' CHRByteCounter+CHRByteWidth