Zooflow: frmtest streams
This commit is contained in:
parent
635d5f5f94
commit
099d65ed70
@ -20,33 +20,34 @@ Public Class frmtest
|
|||||||
|
|
||||||
Private Async Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
|
Private Async Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
|
||||||
Try
|
Try
|
||||||
Dim oResult As Boolean
|
Dim oResult As Boolean = False
|
||||||
Dim oStream As New FileStream(txtFile2Import.Text, FileMode.Open)
|
|
||||||
Dim oContents(oStream.Length) As Byte
|
Using oStream As New FileStream(txtFile2Import.Text, FileMode.Open, FileAccess.Read)
|
||||||
'Dim oBytesRead = Await oStream.ReadAsync(oContents, 0, oStream.Length)
|
Dim oContents(oStream.Length) As Byte
|
||||||
|
oStream.Read(oContents, 0, oStream.Length)
|
||||||
|
|
||||||
|
oResult = Await _Client.ImportIDBFOAsync(oContents, My.Application.User.UserName, txtIDB_OBJ_ID.Text, 1, txtIDBFOPath.Text)
|
||||||
|
End Using
|
||||||
|
|
||||||
oResult = Await _Client.ImportIDBFOAsync(oContents, My.Application.User.UserName, txtIDB_OBJ_ID.Text, 1, txtIDBFOPath.Text)
|
|
||||||
If oResult = False Then
|
If oResult = False Then
|
||||||
MsgBox("Oh no error", MsgBoxStyle.Critical)
|
MsgBox("Oh no error", MsgBoxStyle.Critical)
|
||||||
Else
|
Else
|
||||||
MsgBox("#Nailedit")
|
MsgBox("#Nailedit")
|
||||||
|
|
||||||
End If
|
End If
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
MsgBox(ex.Message)
|
MsgBox(ex.Message)
|
||||||
End Try
|
End Try
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
|
Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
|
||||||
Dim memString As String = "Memory test string !!!"
|
Dim memString As String = "Memory test string !!!"
|
||||||
|
Dim buffer As Byte() = Encoding.UTF8.GetBytes(memString)
|
||||||
|
|
||||||
' convert string to stream
|
' convert string to stream
|
||||||
Dim buffer As Byte() = Encoding.ASCII.GetBytes(memString)
|
Using oMemoryStream As New MemoryStream(buffer)
|
||||||
Dim ms As New MemoryStream(buffer)
|
Using oFileStream As New FileStream("d:\file.txt", FileMode.Create, FileAccess.Write)
|
||||||
'write to file
|
oMemoryStream.WriteTo(oFileStream)
|
||||||
Dim file As New FileStream("d:\file.txt", FileMode.Create, FileAccess.Write)
|
End Using
|
||||||
ms.WriteTo(file)
|
End Using
|
||||||
file.Close()
|
|
||||||
ms.Close()
|
|
||||||
End Sub
|
End Sub
|
||||||
End Class
|
End Class
|
||||||
Loading…
x
Reference in New Issue
Block a user