Advertisement
Guest User

Untitled

a guest
Jun 29th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.78 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4.  
  5. namespace conHOSTSEditor
  6. {
  7.     class Program
  8.     {
  9.         static void Main(string[] args)
  10.         {
  11.             string defaultPath = @"C:\WINDOWS\System32\drivers\etc\Hosts";
  12.  
  13.             string Content;
  14.             string[] LineContent;
  15.  
  16.             StreamReader reader = new StreamReader(defaultPath);
  17.             Content = reader.ReadToEnd();
  18.  
  19.             LineContent = Content.Split('\n');
  20.  
  21.             foreach (string Line in LineContent)
  22.             {
  23.                 if(Line.Contains("127.0.0.1"))
  24.                 {
  25.                     Line.Replace('\t', ' ');
  26.                     Console.WriteLine(Line);
  27.                 }
  28.             }
  29.  
  30.             Console.ReadLine();
  31.         }
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement