1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124
|
// méthode de la classe CEquipementRéseau : Déconnecter
public string Deconnecter()
{
//commande 'logout' permettant de deconnecter la session
string commande = "logout";
//variable qui stockera les chaine du serveur
string str_retour;
//ecris la commande du textbox vers le serveur
TC.WriteLine(commande);
//recupere le retour du serveur ds une variable
str_retour = TC.Read();
//affiche dans une console pas obligatoire
Console.Write(str_retour);
return("Déconnection Réussie ");
}
//méthode de la classe CEquiepementRéseau : Exécuter Commande
public string Executer_Commande(string commande)
{
//variable qui stockera les chaine du serveur
string Retour;
//ecris la commande du parametre sur le serveur
TC.WriteLine(commande);
//recupere le retour du serveur dans une variable
Retour = TC.Read();
char[] v = Retour.ToCharArray();
// titre
string titre1 = null;
titre1 = Retour.Substring(180, 2);
string titre2 = null;
titre2 = Retour.Substring(183, 8);
string titre3 = null;
titre3 = Retour.Substring(192, 6);
string titre4 = null;
titre4 = Retour.Substring(199, 4);
string titre5 = null;
titre5 = Retour.Substring(330, 6);
string titre6 = null;
titre6 = Retour.Substring(339, 7);
string titre8 = null;
titre8 = Retour.Substring(347, 4);
string titre9 = null;
titre9 = Retour.Substring(394, 4);
string titre10 = null;
titre10 = Retour.Substring(399, 4);
//Statu and
string menu1 = null;
menu1 = Retour.Substring(429, 22);
string menu2 = null;
menu2 = Retour.Substring(470, 23);
//3;Console password
string menu3 = null;
menu3 = Retour.Substring(512, 20);
//4. Event Log
string menu4 = null;
menu4 = Retour.Substring(551, 12);
//5.Commande LIne
string menu5 = null;
menu5 = Retour.Substring(579, 15);
//6.Reboot switch
string menu6 = null;
menu6 = Retour.Substring(618, 16);
//7. DOWNLOAD OS
string menu7 = null;
menu7 = Retour.Substring(652, 14);
//8. RUN SETUP
string menu8 = null;
menu8 = Retour.Substring(684, 12);
//9.STACKING
string menu9 = null;
menu9 = Retour.Substring(714, 11);
//10 LOGOUT
string menu10 = null;
menu10 = Retour.Substring(746, 9);
return (titre1 + titre2 + titre3 + titre4 + titre5 + titre6 + titre8 + titre9 + titre10 + "\n" + "\n" + menu1 + "\n" + menu2 + "\n" + menu3 + "\n" + menu4 + "\n" + menu5 + "\n" + menu6 + "\n" + menu7
+ "\n" + menu8 + "\n" + menu9 + "\n" + menu10 + "\n");
//affiche ds une console pas obligatoire
//Console.Write(Retour);
}
}
} |
Partager