ZooFlow: frmTest import/export works now with excel files!

This commit is contained in:
Jonathan Jenne 2021-04-12 10:58:46 +02:00
parent 45cc51e19f
commit 7680c6c95d
4 changed files with 63 additions and 20 deletions

View File

@ -36,6 +36,9 @@ Partial Class frmtest
Me.Button4 = New System.Windows.Forms.Button()
Me.Button5 = New System.Windows.Forms.Button()
Me.CheckBoxKeepExtension = New System.Windows.Forms.CheckBox()
Me.Button6 = New System.Windows.Forms.Button()
Me.OpenFileDialog1 = New System.Windows.Forms.OpenFileDialog()
Me.Button7 = New System.Windows.Forms.Button()
Me.SuspendLayout()
'
'txtFilestoreType
@ -99,7 +102,7 @@ Partial Class frmtest
'txtIDB_OBJ_ID
'
Me.txtIDB_OBJ_ID.DataBindings.Add(New System.Windows.Forms.Binding("Text", Global.DigitalData.GUIs.ZooFlow.Settings.Default, "IDBOBJID", True, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged))
Me.txtIDB_OBJ_ID.Location = New System.Drawing.Point(295, 12)
Me.txtIDB_OBJ_ID.Location = New System.Drawing.Point(295, 14)
Me.txtIDB_OBJ_ID.Name = "txtIDB_OBJ_ID"
Me.txtIDB_OBJ_ID.Size = New System.Drawing.Size(100, 20)
Me.txtIDB_OBJ_ID.TabIndex = 9
@ -118,7 +121,7 @@ Partial Class frmtest
'
Me.txtFile2Import.Location = New System.Drawing.Point(16, 162)
Me.txtFile2Import.Name = "txtFile2Import"
Me.txtFile2Import.Size = New System.Drawing.Size(631, 20)
Me.txtFile2Import.Size = New System.Drawing.Size(551, 20)
Me.txtFile2Import.TabIndex = 11
'
'Label1
@ -132,20 +135,20 @@ Partial Class frmtest
'
'Button4
'
Me.Button4.Location = New System.Drawing.Point(19, 234)
Me.Button4.Location = New System.Drawing.Point(16, 234)
Me.Button4.Name = "Button4"
Me.Button4.Size = New System.Drawing.Size(172, 23)
Me.Button4.Size = New System.Drawing.Size(286, 23)
Me.Button4.TabIndex = 13
Me.Button4.Text = "4. Reopen from AppServ"
Me.Button4.Text = "4A. Reopen from AppServ"
Me.Button4.UseVisualStyleBackColor = True
'
'Button5
'
Me.Button5.Location = New System.Drawing.Point(232, 234)
Me.Button5.Location = New System.Drawing.Point(16, 263)
Me.Button5.Name = "Button5"
Me.Button5.Size = New System.Drawing.Size(286, 23)
Me.Button5.TabIndex = 14
Me.Button5.Text = "Alternative stream/append"
Me.Button5.Text = "4B. Alternative stream/append"
Me.Button5.UseVisualStyleBackColor = True
'
'CheckBoxKeepExtension
@ -158,12 +161,36 @@ Partial Class frmtest
Me.CheckBoxKeepExtension.Text = "Keep Extension"
Me.CheckBoxKeepExtension.UseVisualStyleBackColor = True
'
'Button6
'
Me.Button6.Location = New System.Drawing.Point(572, 160)
Me.Button6.Name = "Button6"
Me.Button6.Size = New System.Drawing.Size(75, 23)
Me.Button6.TabIndex = 16
Me.Button6.Text = "Select File"
Me.Button6.UseVisualStyleBackColor = True
'
'OpenFileDialog1
'
Me.OpenFileDialog1.FileName = "OpenFileDialog1"
'
'Button7
'
Me.Button7.Location = New System.Drawing.Point(16, 292)
Me.Button7.Name = "Button7"
Me.Button7.Size = New System.Drawing.Size(286, 23)
Me.Button7.TabIndex = 14
Me.Button7.Text = "4C. Alternative"
Me.Button7.UseVisualStyleBackColor = True
'
'frmtest
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(800, 450)
Me.Controls.Add(Me.Button6)
Me.Controls.Add(Me.CheckBoxKeepExtension)
Me.Controls.Add(Me.Button7)
Me.Controls.Add(Me.Button5)
Me.Controls.Add(Me.Button4)
Me.Controls.Add(Me.Label1)
@ -197,4 +224,7 @@ Partial Class frmtest
Friend WithEvents Button4 As Button
Friend WithEvents Button5 As Button
Friend WithEvents CheckBoxKeepExtension As CheckBox
Friend WithEvents Button6 As Button
Friend WithEvents OpenFileDialog1 As OpenFileDialog
Friend WithEvents Button7 As Button
End Class

View File

@ -117,4 +117,7 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="OpenFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View File

@ -33,11 +33,11 @@ Public Class frmtest
Dim oResult As Boolean = False
Using oStream As New FileStream(txtFile2Import.Text, FileMode.Open, FileAccess.Read)
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)
Using oMemoryStream As New MemoryStream
oStream.CopyTo(oMemoryStream)
Dim oContents As Byte() = oMemoryStream.ToArray()
oResult = Await _Client.ImportIDBFOAsync(oContents, My.Application.User.UserName, txtIDB_OBJ_ID.Text, 1, txtIDBFOPath.Text)
End Using
End Using
If oResult = False Then
@ -55,13 +55,8 @@ Public Class frmtest
Dim oextension = Path.GetExtension(txtFile2Import.Text)
Dim oFile = $"E:\file{oextension}"
Using oInputStream As New FileStream(txtIDBFOPath.Text, FileMode.Open)
Dim oContents(oInputStream.Length) As Byte
oInputStream.Read(oContents, 0, oInputStream.Length)
' convert string to stream
Using oMemoryStream As New MemoryStream(oContents)
Using oFileStream As New FileStream(oFile, FileMode.Create, FileAccess.Write)
oMemoryStream.WriteTo(oFileStream)
End Using
Using oFileStream As New FileStream(oFile, FileMode.Create, FileAccess.Write)
oInputStream.CopyTo(oFileStream)
End Using
End Using
Dim oPAth = Path.GetDirectoryName(oFile)
@ -85,4 +80,17 @@ Public Class frmtest
MsgBox(ex.ToString)
End Try
End Sub
Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click
If OpenFileDialog1.ShowDialog() = DialogResult.OK Then
txtFile2Import.Text = OpenFileDialog1.FileName
End If
End Sub
Private Sub Button7_Click(sender As Object, e As EventArgs) Handles Button7.Click
Dim oExt = Path.GetExtension(txtFile2Import.Text)
Dim oFile = $"E:\file{oExt}"
File.Copy(txtIDBFOPath.Text, oFile)
End Sub
End Class

View File

@ -569,8 +569,10 @@ Public Class EDMIService
Dim EDMIPath = New EDMI.File.Path(LogConfig, oObjectStore.Path)
Try
_Logger.Info("ImportFile: Saving file to path [{0}]", Data.pIDBFilePath)
Using oStream = New FileStream(Data.pIDBFilePath, FileMode.Create, FileAccess.Write)
_Logger.Info("ImportFile: Saving file to path [{0}]", Data.pIDBFilePath)
_Logger.Info("ImportFile: Content Length: {0}", Data.Contents.Length)
oStream.Write(Data.Contents, 0, Data.Contents.Length)
oStream.Flush(True)
oStream.Close()