@@ -385,7 +385,8 @@ Module modMain
385385 Dim i As Integer
386386 Dim strTemp As String
387387 Dim intTemp As Integer
388- Dim lngFFile As Integer
388+ Dim srSrmRdr As System.IO.StreamReader = Nothing
389+ Dim swSrmWtr As System.IO.StreamWriter = Nothing
389390
390391 If Right(My.Application.Info.DirectoryPath, 1 ) = "\" Then
391392
@@ -421,46 +422,43 @@ Module modMain
421422 'UPGRADE_WARNING: Dir に新しい動作が指定されています。 詳細については、'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="9B7D5ADD-D8FE-4819-A36C-6DEDAF088CC7"' をクリックしてください。
422423 If Dir(g_strAppDir & "bmse_viewer.ini" , FileAttribute.Normal) = vbNullString Then
423424
424- lngFFile = FreeFile()
425-
426- FileOpen(lngFFile, g_strAppDir & "bmse_viewer.ini" , OpenMode.Output)
427-
428- PrintLine(lngFFile, "mBMplay" )
429- PrintLine(lngFFile, "..\mBMplay\mBMplay.exe" )
430- PrintLine(lngFFile, "<filename>" )
431- PrintLine(lngFFile, "-s <measure> <filename>" )
432- PrintLine(lngFFile, "-t" )
433- PrintLine(lngFFile)
434- PrintLine(lngFFile, "uBMplay" )
435- PrintLine(lngFFile, "..\uBMplay\uBMplay.exe" )
436- PrintLine(lngFFile, "-P -N0 <filename>" )
437- PrintLine(lngFFile, "-P -N<measure> <filename>" )
438- PrintLine(lngFFile, "-S" )
439- PrintLine(lngFFile)
440- PrintLine(lngFFile, "beatoraja" )
441- PrintLine(lngFFile, "..\beatoraja-jre\beatoraja.exe" )
442- PrintLine(lngFFile, "-a <filename>" )
443- PrintLine(lngFFile, "-p <filename>" )
444- PrintLine(lngFFile, "" )
445- PrintLine(lngFFile)
446- PrintLine(lngFFile, "LR2" )
447- PrintLine(lngFFile, "..\LR2\LR2body.exe" )
448- PrintLine(lngFFile, "-a <filename>" )
449- PrintLine(lngFFile, "-a <filename>" )
450- PrintLine(lngFFile, "" )
451-
452- FileClose(lngFFile)
425+ swSrmWtr = My.Computer.FileSystem.OpenTextFileWriter(g_strAppDir & "bmse_viewer.ini" , False , System.Text.Encoding.GetEncoding( "UTF-8" ))
426+
427+ swSrmWtr.WriteLine( "mBMplay" )
428+ swSrmWtr.WriteLine( "..\mBMplay\mBMplay.exe" )
429+ swSrmWtr.WriteLine( "<filename>" )
430+ swSrmWtr.WriteLine( "-s <measure> <filename>" )
431+ swSrmWtr.WriteLine( "-t" )
432+ swSrmWtr.WriteLine()
433+ swSrmWtr.WriteLine( "uBMplay" )
434+ swSrmWtr.WriteLine( "..\uBMplay\uBMplay.exe" )
435+ swSrmWtr.WriteLine( "-P -N0 <filename>" )
436+ swSrmWtr.WriteLine( "-P -N<measure> <filename>" )
437+ swSrmWtr.WriteLine( "-S" )
438+ swSrmWtr.WriteLine()
439+ swSrmWtr.WriteLine( "beatoraja" )
440+ swSrmWtr.WriteLine( "..\beatoraja-jre\beatoraja.exe" )
441+ swSrmWtr.WriteLine( "-a <filename>" )
442+ swSrmWtr.WriteLine( "-p <filename>" )
443+ swSrmWtr.WriteLine( "" )
444+ swSrmWtr.WriteLine()
445+ swSrmWtr.WriteLine( "LR2" )
446+ swSrmWtr.WriteLine( "..\LR2\LR2body.exe" )
447+ swSrmWtr.WriteLine( "-a <filename>" )
448+ swSrmWtr.WriteLine( "-a <filename>" )
449+ swSrmWtr.WriteLine( "" )
450+
451+ swSrmWtr.Close()
453452
454453 End If
455454
456455 i = 0
457- lngFFile = FreeFile()
458456
459- FileOpen(lngFFile, g_strAppDir & "bmse_viewer.ini" , OpenMode.Input )
457+ srSrmRdr = My.Computer.FileSystem.OpenTextFileReader( g_strAppDir & "bmse_viewer.ini" , System.Text.Encoding.GetEncoding( "UTF-8" ) )
460458
461- Do While Not EOF(lngFFile )
459+ Do Until (srSrmRdr.Peek = - 1 )
462460
463- strTemp = LineInput(lngFFile)
461+ strTemp = srSrmRdr.ReadLine
464462
465463 Select Case i Mod 6
466464
@@ -495,7 +493,7 @@ Module modMain
495493
496494 Loop
497495
498- FileClose(lngFFile )
496+ srSrmRdr.Close( )
499497
500498 ReDim Preserve g_Viewer(frmMain.cboViewer.Items.Count)
501499
@@ -827,14 +825,15 @@ Module modMain
827825 Public Sub DebugOutput( ByVal lngErrNum As Integer , ByRef strErrDescription As String , ByRef strErrProcedure As String , Optional ByVal blnCleanUp As Boolean = False )
828826 Dim lngFFile As Integer
829827 Dim strError As String = ""
828+ Dim swSrmWtr As System.IO.StreamWriter = Nothing
830829
831830 lngFFile = FreeFile()
832831
833- FileOpen(lngFFile, g_strAppDir & "error.txt" , OpenMode.Append )
832+ swSrmWtr = My.Computer.FileSystem.OpenTextFileWriter( g_strAppDir & "error.txt" , True , System.Text.Encoding.GetEncoding( "UTF-8" ) )
834833
835- PrintLine(lngFFile, Today & TimeOfDay & "ErrorNo." & lngErrNum & " " & strErrDescription & "@" & strErrProcedure & "/BMSE_" & My.Application.Info.Version.Major & "." & My.Application.Info.Version.Minor & "." & My.Application.Info.Version.Revision)
834+ swSrmWtr.WriteLine( Today & TimeOfDay & "ErrorNo." & lngErrNum & " " & strErrDescription & "@" & strErrProcedure & "/BMSE_" & My.Application.Info.Version.Major & "." & My.Application.Info.Version.Minor & "." & My.Application.Info.Version.Revision)
836835
837- FileClose(lngFFile )
836+ swSrmWtr.Close( )
838837
839838 strError = strError & "ErrorNo." & lngErrNum & " " & strErrDescription & "@" & strErrProcedure
840839
0 commit comments