Private Sub Command1_Click()
CommonDialog1.ShowOpen
Text1.Text = CommonDialog1.FileName
End Sub
Private Sub Command2_Click()
CommonDialog1.ShowSave
Text2.Text = CommonDialog1.FileName
End Sub
Private Sub Command3_Click()
Dim strInput As String
Dim strOutput As String
Dim lngInputDepth As Long
Dim lngSibling(10000) As Long
Dim lngMore(10000) As Long
Dim L As Long
Dim LFile As Long
Dim LFileLen As Long
Dim LIn As Long
Dim LInLen As Long
Dim LOut As Long
Dim LOutLen As Long
Dim chrIn As Byte
Dim chrIn1 As Byte
Dim chrIn2 As Byte
Dim bufIn() As Byte
Dim bufOut() As Byte
Dim intFlag As Integer
Dim blHot As Boolean
Open Text1.Text For Binary As #1
Open Text2.Text For Binary As #2
ReDim bufIn(LOF(1) * 2) As Byte
ReDim bufOut(LOF(1) * 2) As Byte
LIn = 0
LFile = 0
While LFile < LOF(1)
Get #1, , chrIn
LFile = LFile + 1
If chrIn = 13 Then
Get #1, , chrIn
LFile = LFile + 1
If chrIn <> 10 Then
bufIn(LIn) = 13
LIn = LIn + 1
bufIn(LIn) = chrIn
LIn = LIn + 1
End If
ElseIf chrIn = 32 Or chrIn = 9 Then
Else
bufIn(LIn) = chrIn
LIn = LIn + 1
End If
Wend
LInLen = LIn
lngInputDepth = 0
lngSibling(lngInputDepth) = 0
lngMore(lngInputDepth) = 0
blHot = False
LIn = 0
LOut = 0
While LIn < LInLen
chrIn = bufIn(LIn)
If chrIn = 59 _
And (bufIn(LIn + 1) = 66 Or bufIn(LIn + 1) = 87) _
And bufIn(LIn + 2) = 91 _
And blHot = True Then
blHot = False
lngMore(lngInputDepth) = lngMore(lngInputDepth) + 1
bufOut(LOut) = 40
LOut = LOut + 1
bufOut(LOut) = bufIn(LIn)
LOut = LOut + 1
LIn = LIn + 1
ElseIf chrIn = 40 Then
lngInputDepth = lngInputDepth + 1
lngSibling(lngInputDepth) = 0
lngMore(lngInputDepth) = 0
blHot = False
bufOut(LOut) = bufIn(LIn)
LOut = LOut + 1
LIn = LIn + 1
ElseIf chrIn = 41 Then
lngInputDepth = lngInputDepth - 1
lngSibling(lngInputDepth) = lngSibling(lngInputDepth) + 1
blHot = True
bufOut(LOut) = bufIn(LIn)
LOut = LOut + 1
LIn = LIn + 1
For L = 0 To lngMore(lngInputDepth + 1) - 1
bufOut(LOut) = 41
LOut = LOut + 1
Next L
Else
bufOut(LOut) = bufIn(LIn)
LIn = LIn + 1
LOut = LOut + 1
End If
Wend
LOutLen = LOut
For LOut = 0 To LOutLen - 1
Put #2, , bufOut(LOut)
Next LOut