Hi all,
i am working on a converter and i need to place a header on each file generated by the script below.
i only need a standard first line
Thanks in advance,
i am working on a converter and i need to place a header on each file generated by the script below.
i only need a standard first line
Code:
"<Start of file>"
Dim sFileName As String = ordername.Text
Dim sFolder As String = RootFolder.Text & "\"
Dim cFolder As String = ConvertedFolder.Text & "\"
Dim sText As String = System.IO.File.ReadAllText(sFolder & "Temp.xml")
Dim iFileNumber As Int32 = 1
Dim sFilePath As String = sFolder & iFileNumber.ToString & ".xml"
Dim sArray As String() = Strings.Split(sText, Constants.vbNewLine)
Dim iProductIndex As Int32 = -1
For i As Int32 = 0 To sArray.GetUpperBound(0)
If sArray(i).Trim = "Product" Then
iProductIndex = i
iFileNumber += 1
End If
If i >= iProductIndex + 4 Or iProductIndex < 0 Then
Using myWriter As New System.IO.StreamWriter(cFolder & sFileName & "_0" & iFileNumber.ToString & ".xml", True)
myWriter.WriteLine(sArray(i))
myWriter.Close()
myWriter.Dispose()
End Using
End If
Next
Thanks in advance,