|
1 | | -Module Program |
| 1 | +Imports System |
| 2 | +Imports System.IO |
| 3 | +Imports System.Linq |
| 4 | +Imports System.Text |
| 5 | +Imports CommandLine |
2 | 6 |
|
3 | | - Sub Main() |
| 7 | +Module Program |
| 8 | + |
| 9 | + Sub Main(ByVal sArgs() As String) |
4 | 10 |
|
5 | 11 | End Sub
|
6 | 12 |
|
| 13 | + Private Function ReadLines(fileName As String, fromTop As Boolean, count As Integer) As String |
| 14 | + |
| 15 | + Dim lines = File.ReadAllLines(fileName) |
| 16 | + If (fromTop) Then |
| 17 | + Return String.Join(Environment.NewLine, lines.Take(count)) |
| 18 | + End If |
| 19 | + |
| 20 | + Return String.Join(Environment.NewLine, lines.Reverse().Take(count)) |
| 21 | + |
| 22 | + End Function |
| 23 | + |
| 24 | + Private Function ReadBytes(fileName As String, fromTop As Boolean, count As Integer) As String |
| 25 | + |
| 26 | + Dim bytes = File.ReadAllBytes(fileName) |
| 27 | + If (fromTop) Then |
| 28 | + Return Encoding.UTF8.GetString(bytes, 0, count) |
| 29 | + End If |
| 30 | + |
| 31 | + Return Encoding.UTF8.GetString(bytes, bytes.Length - count, count) |
| 32 | + |
| 33 | + End Function |
| 34 | + |
7 | 35 | End Module
|
0 commit comments