Public feed #603243

None01

public text v1 · immutable
Raw Edit
·published 2007-07-04 17:17 UTC
rendered paste body
Imports System
Imports System.IO

Module Module1
    Sub Main()
        Dim HostsText As String = Nothing
        Dim CheckHostsFile As String = "No"

        Using read As StreamReader = New StreamReader("C:\windows\system32\drivers\etc\hosts")
            Do Until read.EndOfStream
                HostsText = read.ReadLine().Trim()
                Console.WriteLine(HostsText.StartsWith("#"))
                If HostsText.StartsWith("#") = False OrElse String.IsNullOrEmpty(HostsText) = False Then
                    If HostsText.Contains("127.0.0.1") = False AndAlso HostsText.ToLower.Contains("localhost") = False Then
                        'Console.WriteLine(HostsText)
                        'Console.ReadLine()
                        CheckHostsFile = "Yes"
                    End If
                End If
            Loop
            read.Close()
        End Using
        Console.WriteLine("Has the hosts file more then the localhost entry? " & CheckHostsFile)
        Console.ReadLine()
    End Sub

End Module