16,722
社区成员




Public Function outputFile(ByVal strFilePath As String, ByVal str As String) As Boolean
Dim strPath As String = strFilePath
Dim strmFile As Stream
Dim ecdgSJIS As System.Text.Encoding = System.Text.Encoding.GetEncoding("shift_jis")
Dim strmwriWriter As StreamWriter
Dim intByteCnt As Integer = 0
Dim strMsg As String
Dim strFile As String = ""
Dim intCnt As Integer
Try
strmFile = New FileStream(strPath, FileMode.OpenOrCreate, FileAccess.Read, FileShare.ReadWrite)
If (File.GetAttributes(strPath) And FileAttributes.ReadOnly) = FileAttributes.ReadOnly Then
strMsg = MessageManager.GetString("E000028", CommonSyori.MsgPath, strPath, "", "", "")
MessageBox.Show(strMsg, CommonSyori.MsgTitle, MessageBoxButtons.OK, MessageBoxIcon.Hand)
strmFile.Close()
Return False
Else
Try
strmFile = New FileStream(strPath, FileMode.Truncate, FileAccess.ReadWrite)
Catch ex As Exception
strMsg = MessageManager.GetString("E000027", CommonSyori.MsgPath, strPath, "", "", "")
MessageBox.Show(strMsg, CommonSyori.MsgTitle, MessageBoxButtons.OK, MessageBoxIcon.Hand)
strmFile.Close()
strmFile.Dispose()
GC.Collect()
Return False
End Try
End If
If Me.setRenFileData(str) = False Then
strmFile.Close()
strmFile.Dispose()
GC.Collect()
Throw New Exception()
End If
strmwriWriter = New StreamWriter(strmFile, ecdgSJIS)
For intCnt = 0 To arrlKjFile.Count - 1
strmwriWriter.WriteLine(arrlKjFile(intCnt))
Next
strmwriWriter.Flush()
strmwriWriter.Close()
strmFile.Close()
strmFile.Dispose()
GC.Collect()
Catch ex As Exception
Return False
End Try
Return True
End Function
If Not outputFile(strOptRenPath, strOptNm) Then
strMsg = MessageManager.GetString("E000014", CommonSyori.MsgPath, "****文件生成", "", "", "")
MessageBox.Show(strMsg, CommonSyori.MsgTitle, MessageBoxButtons.OK, MessageBoxIcon.Hand)
End If