Public Function GetPartOfTextFile(ByVal path As String, ByVal StartMarkerLine As UInteger, ByVal EndMarkerLine As UInteger) As String
Dim szbTemp As New System.Text.StringBuilder
If StartMarkerLine > EndMarkerLine Then
Throw New Exception("Erreur dans les marqueurs de lignes début et/ou fin.")
End If
If System.IO.File.Exists(path) Then
Using fs As System.IO.FileStream = System.IO.File.OpenRead(path)
Using sr As New System.IO.StreamReader(fs)
Dim uiMarker As UInteger = 0
Dim sReadLine As String = String.Empty
Do While sr.EndOfStream = False
sReadLine = sr.ReadLine()
uiMarker += 1
If (StartMarkerLine <= uiMarker) AndAlso (EndMarkerLine >= uiMarker) Then
szbTemp.AppendLine(sReadLine)
ElseIf EndMarkerLine < uiMarker Then
Exit Do
End If
Loop
End Using
End Using
Else
Throw New System.IO.IOException(String.Format("Le fichier {0} n'existe pas", path))
End If
Return szbTemp.ToString()
End Function