Beispiel #1
0
 public network()
 {
     machines[0] = new machine("localhost", "127.0.0.1", new user("temp", "temp"));
     machines[0].user[1] = new user("Admin", "1234");
     for(int i = 1; i < machines.Length; i++)
     {
         machines[i] = new machine("PC-" + i, "192.168.0." + i, new user("Administrator", "1234"));
     }
     currentMachine = machines[0];
 }
Beispiel #2
0
 public void connect()
 {
     Console.Write("IP-Adresse: ");
     string newIP = Console.ReadLine();
     machine oldMachine = currentMachine;
     for(int i = 0; i < machines.Length; i++)
     {
         if(machines[i].ip == newIP)
         {
             machine newMachine = machines[i];
             Console.WriteLine("IP gefunden!");
             Console.WriteLine("Bitte wählen Sie einen Benutzer:");
             string[] localUser = new string[10];
             for(int j = 0; j < machines[i].user.Length; j++)
             {
                 if (machines[i].user[j] != null)
                 {
                     localUser[j] = newMachine.user[j].name;
                 }
             }
             int chosenUser = Program.menu(localUser);
             Console.WriteLine("Benutzer: " + machines[i].user[chosenUser].name);
             do
             {
                 string password = Program.enterPassword();
                 if (password == machines[i].user[chosenUser].password)
                 {
                     machines[i].activeUser = chosenUser;
                     break;
                 }
                 else
                 {
                     Console.WriteLine("Falsches Passwort!");
                 }
             } while (true);
             currentMachine = machines[i];
         }
     }
     if(oldMachine == currentMachine)
     {
         Console.WriteLine("IP nicht gefunden.");
     }
 }
Beispiel #3
0
 public static void sysInfo(machine _machine)
 {
     Console.WriteLine("Name");
     Console.SetCursorPosition(4, Console.CursorTop);
     Console.WriteLine(_machine.name);
     Console.WriteLine("IP-Adresse");
     Console.SetCursorPosition(4, Console.CursorTop);
     Console.WriteLine(_machine.ip);
     Console.WriteLine("Benutzer");
     for(int i = 0; i < _machine.user.Length; i++)
     {
         if(_machine.user[i] != null)
         {
             Console.SetCursorPosition(4, Console.CursorTop);
             Console.WriteLine(_machine.user[i].name);
         }
     }
     Console.WriteLine("Prozessor(en)");
     for(int i = 0; i < _machine.processor.Length; i++)
     {
         if(_machine.processor[i] != null)
         {
             Console.SetCursorPosition(4, Console.CursorTop);
             Console.WriteLine(_machine.processor[i].cores + "cores @" + _machine.processor[i].speed + "MHz");
         }
     }
     Console.WriteLine("Festplatte(n)");
     for (int i = 0; i < _machine.hdd.Length; i++)
     {
         if (_machine.hdd[i] != null)
         {
             Console.SetCursorPosition(4, Console.CursorTop);
             Console.WriteLine(_machine.hdd[i].size + "GB @" + _machine.hdd[i].speed + "MB/s");
         }
     }
     Console.WriteLine("Arbeitsspeicher");
     for (int i = 0; i < _machine.ram.Length; i++)
     {
         if (_machine.ram[i] != null)
         {
             Console.SetCursorPosition(4, Console.CursorTop);
             Console.WriteLine(_machine.ram[i].size + "MB @" + _machine.ram[i].speed + "MB/s");
         }
     }
     Console.WriteLine("Internet");
     Console.SetCursorPosition(4, Console.CursorTop);
     Console.WriteLine("Download: " + _machine.lan.down + "MB/s");
     Console.SetCursorPosition(4, Console.CursorTop);
     Console.WriteLine("Upload: " + _machine.lan.up + "MB/s");
 }
Beispiel #4
0
 public static void consoleInfo (user _user, machine _machine)
 {
     Console.Write(_user.name + "@" + _machine.ip + "(" + _machine.name + ")>");
 }