public static void ReadHostInfo(TargInfo t) { string filePath = string.Format( @"\\{0}\c$\windows\system32\targinfo.txt", t.host.connection.HostIP); //Read targinfo.txt from host //Contains: Current User, Host Name, Time if (ValidationCheck.FileExists(filePath)) { StreamReader reader = new StreamReader(filePath); t.host.user.CurrentUser = reader.ReadLine(); t.host.connection.HostName = reader.ReadLine(); t.host.removalTask.HostTime = reader.ReadLine(); //Match local time with host time //Used later to calculate time difference //between connection and granting rights. //see Tools.FormatDateTime() t.local.LocalTime = DateTime.Now; reader.Close(); } }