예제 #1
0
        public void storeSession(string subnet, int i, string username)
        {
            NetworkScanner netScanr = new NetworkScanner();
            string         hostName = netScanr.getHostname(subnet, i);

            if (hostName != "")
            {
                Registry.CurrentUser.CreateSubKey(puttySessionsRegPath + "\\" + hostName);
                RegistryKey newSessionRegKey          = Registry.CurrentUser.OpenSubKey(puttySessionsRegPath + "\\" + hostName, true);
                RegistryKey puttySessionDefaultRegKey = Registry.CurrentUser.OpenSubKey(puttySessionDefaultRegKeyPath);
                foreach (var valueName in puttySessionDefaultRegKey.GetValueNames())
                {
                    newSessionRegKey.SetValue(valueName, puttySessionDefaultRegKey.GetValue(valueName));
                }
                newSessionRegKey.SetValue("HostName", hostName);
                newSessionRegKey.SetValue("UserName", username);
                newSessionRegKey.SetValue("Colour0", "131,148,150");
                newSessionRegKey.SetValue("Colour1", "147,161,161");
                newSessionRegKey.SetValue("Colour2", "0,43,54");
                newSessionRegKey.SetValue("Colour3", "7,54,66");
                newSessionRegKey.SetValue("Colour4", "0,43,54");
                newSessionRegKey.SetValue("Colour5", "238,232,213");
                newSessionRegKey.SetValue("Colour6", "7,54,66");
                newSessionRegKey.SetValue("Colour7", "0,43,56");
                newSessionRegKey.SetValue("Colour8", "220,50,47");
                newSessionRegKey.SetValue("Colour9", "203,75,22");
                newSessionRegKey.SetValue("Colour10", "133,153,0");
                newSessionRegKey.SetValue("Colour11", "88,110,117");
                newSessionRegKey.SetValue("Colour12", "181,137,0");
                newSessionRegKey.SetValue("Colour13", "101,123,131");
                newSessionRegKey.SetValue("Colour14", "38,139,210");
                newSessionRegKey.SetValue("Colour15", "131,148,150");
                newSessionRegKey.SetValue("Colour16", "211,54,130");
                newSessionRegKey.SetValue("Colour17", "108,113,196");
                newSessionRegKey.SetValue("Colour18", "42,161,152");
                newSessionRegKey.SetValue("Colour19", "147,161,161");
                newSessionRegKey.SetValue("Colour20", "238,232,213");
                newSessionRegKey.SetValue("Colour21", "253,246,227");
                newSessionRegKey.Close();
                puttySessionDefaultRegKey.Close();
                Console.WriteLine(String.Format("Added new Session for Host {0}", hostName));
            }
        }
예제 #2
0
 public void storeSession(string subnet, int i, string username)
 {
     NetworkScanner netScanr = new NetworkScanner();
     string hostName = netScanr.getHostname(subnet, i);
     if(hostName != "") {
         Registry.CurrentUser.CreateSubKey(puttySessionsRegPath + "\\" + hostName);
         RegistryKey newSessionRegKey = Registry.CurrentUser.OpenSubKey(puttySessionsRegPath + "\\" + hostName, true);
         RegistryKey puttySessionDefaultRegKey = Registry.CurrentUser.OpenSubKey(puttySessionDefaultRegKeyPath);
         foreach(var valueName in puttySessionDefaultRegKey.GetValueNames()) {
             newSessionRegKey.SetValue(valueName, puttySessionDefaultRegKey.GetValue(valueName));
         }
         newSessionRegKey.SetValue("HostName", hostName);
         newSessionRegKey.SetValue("UserName", username);
         newSessionRegKey.SetValue("Colour0", "131,148,150");
         newSessionRegKey.SetValue("Colour1", "147,161,161");
         newSessionRegKey.SetValue("Colour2", "0,43,54");
         newSessionRegKey.SetValue("Colour3", "7,54,66");
         newSessionRegKey.SetValue("Colour4", "0,43,54");
         newSessionRegKey.SetValue("Colour5", "238,232,213");
         newSessionRegKey.SetValue("Colour6", "7,54,66");
         newSessionRegKey.SetValue("Colour7", "0,43,56");
         newSessionRegKey.SetValue("Colour8", "220,50,47");
         newSessionRegKey.SetValue("Colour9", "203,75,22");
         newSessionRegKey.SetValue("Colour10", "133,153,0");
         newSessionRegKey.SetValue("Colour11", "88,110,117");
         newSessionRegKey.SetValue("Colour12", "181,137,0");
         newSessionRegKey.SetValue("Colour13", "101,123,131");
         newSessionRegKey.SetValue("Colour14", "38,139,210");
         newSessionRegKey.SetValue("Colour15", "131,148,150");
         newSessionRegKey.SetValue("Colour16", "211,54,130");
         newSessionRegKey.SetValue("Colour17", "108,113,196");
         newSessionRegKey.SetValue("Colour18", "42,161,152");
         newSessionRegKey.SetValue("Colour19", "147,161,161");
         newSessionRegKey.SetValue("Colour20", "238,232,213");
         newSessionRegKey.SetValue("Colour21", "253,246,227");
         newSessionRegKey.Close();
         puttySessionDefaultRegKey.Close();
         Console.WriteLine(String.Format("Added new Session for Host {0}", hostName));
     }
 }