字幕时间修改软件

VERSION 5.00
Begin VB.Form Form1
   Caption         =   "Form1"
   ClientHeight    =   5715
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   9015
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   ScaleHeight     =   5715
   ScaleWidth      =   9015
   StartUpPosition =   3  '窗口缺省
   Begin VB.ListBox List3
      Height          =   3660
      Left            =   4080
      MultiSelect     =   2  'Extended
      TabIndex        =   7
      Top             =   2040
      Width           =   4935
   End
   Begin VB.ListBox List2
      Height          =   3660
      Left            =   960
      MultiSelect     =   2  'Extended
      TabIndex        =   6
      Top             =   2040
      Width           =   3135
   End
   Begin VB.ListBox List1
      Height          =   3660
      Left            =   0
      MultiSelect     =   2  'Extended
      TabIndex        =   5
      Top             =   2040
      Width           =   975
   End
   Begin VB.TextBox Text2
      Height          =   375
      Left            =   1080
      TabIndex        =   3
      Text            =   "20"
      Top             =   720
      Width           =   1335
   End
   Begin VB.TextBox Text1
      Height          =   375
      Left            =   1080
      TabIndex        =   1
      Text            =   "20"
      Top             =   120
      Width           =   1335
   End
   Begin VB.CommandButton Command1
      Caption         =   "修改"
      Height          =   495
      Left            =   2760
      TabIndex        =   0
      Top             =   240
      Width           =   1095
   End
   Begin VB.Label Label2
      Caption         =   "滞后:"
      Height          =   375
      Left            =   240
      TabIndex        =   4
      Top             =   720
      Width           =   615
   End
   Begin VB.Label Label1
      Caption         =   "提前:"
      Height          =   375
      Left            =   240
      TabIndex        =   2
      Top             =   120
      Width           =   615
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim nextZiMu As Integer
Dim lateorfast As Boolean
Dim readNull As Boolean
Dim nextModify As Boolean
Private Sub Command1_Click()
  While (Not EOF(1))
        Line Input #1, oneLine
        If Trim(oneLine) Like "??:??:??,??? --> ??:??:??,???" Then
           List2.AddItem oneLine
           If nextModify Then
              Oneline1 = oneLine
              oneLine = Modify_Time(oneLine)
           End If
        End If
        If readNull And some_line(oneLine) Then
           nextModify = True
          Else
           nextModify = False
        End If
        If Len(oneLine) = 0 Then
           readNull = True
          Else
           readNull = False
        End If
        tempStr = tempStr + oneLine + vbCrLf
    Wend
    Print #2, tempStr
  Close #1
  Close #2
End Sub

Private Sub Form_Load()
   lateorfast = True
   readNull = False
   nextModify = False
   nextZiMu = 1
   Dim oneLine As String
   Dim tempStr As String
   Open "g:/2.srt" For Output As #2
   Open "g:/1.srt" For Input As #1
End Sub
Private Function some_line(ByVal numStr As String)
   If Trim(numStr) Like "[1-9][ 0-9][ 0-9]" Then
      List1.AddItem numStr
      If CInt(Trim(numStr)) = 2 Then
         some_line = True
         Exit Function
      End If
   End If
   someline = False
End Function
Private Function Modify_Time(ByVal oneLine As String)
  Dim tempA
  Dim i As Integer
  Dim rStr As String
  tempA = Split(oneLine, "-->")
  For i = 0 To 1
    If i = 0 Then
      rStr = modify_time1(Trim(tempA(i)))
     Else
      rStr = rStr + " --> " + modify_time1(Trim(tempA(i)))
    End If
  Next i
  Modify_Time = rStr
End Function
Private Function modify_time1(ByVal tempA As String)
  Dim i As Integer
  Dim tempB
  Dim rest As String
  Dim timeM As Integer
  Dim iTempb0 As Integer
  Dim iTempb1 As Integer
  Dim iTempb2 As Integer
  rest = Right(tempA, 4)
  tempA = Left(tempA, Len(tempA) - 4)
  tempB = Split(tempA, ":")
  iTempb0 = CInt(tempB(0))
  iTempb1 = CInt(tempB(1))
  iTempb2 = CInt(tempB(2))
  If lateorfast Then '提前
     timeM = CInt(Text1.Text)
     iTempb2 = iTempb2 + timeM
     If iTempb2 >= 60 Then
        iTempb2 = iTempb2 - 60
        iTempb1 = iTempb1 + 1
        If iTempb1 = 60 Then
           iTempb1 = iTempb1 - 60
           iTempb0 = iTempb0 + 1
        End If
    End If
    Else
     timeM = CInt(Text2.Text)
  End If
  tempB(0) = CStr(iTempb0)
  If Len(tempB(0)) = 1 Then
     tempB(0) = "0" + tempB(0)
  End If
  tempB(1) = CStr(iTempb1)
  If Len(tempB(1)) = 1 Then
     tempB(1) = "0" + tempB(1)
  End If
  tempB(2) = CStr(iTempb2)
  If Len(tempB(2)) = 1 Then
     tempB(2) = "0" + tempB(2)
  End If
  modify_time1 = tempB(0) + ":" + tempB(1) + ":" + tempB(2) + rest
End Function

Private Sub Form_Unload(Cancel As Integer)
  
End Sub

Private Sub Label2_Click()

End Sub

你可能感兴趣的:(技术)