Beispiel #1
0
 public ShellKeys()
 {
     try
     {
         //create a new list of shellkeys
         _shellKeys = new ShellKey[6];
         int iCnt = 0;
         foreach (string sKeyVal in keyID)
         {
             ShellKey sk = new ShellKey();
             sk.loadKey(sKeyVal, ref sk);
             if (sk.exists)
             {
                 _shellKeys[iCnt] = sk;
                 System.Diagnostics.Debug.WriteLine(sk.dumpShellKey());
                 iCnt++;
             }
         }
     }
     catch (Exception ex)
     {
     }
 }
Beispiel #2
0
 /// <summary>
 /// read key from registry
 /// </summary>
 /// <param name="sKeyVal"></param>
 /// <returns></returns>
 public ShellKey loadKey(string sKeyVal, ref ShellKey sk)
 {
     //RegistryKey rKey = null;
     if (existsShellKey(sKeyVal))
     {
         try
         {
             rKey.OpenSubKey(sSubKey + @"\" + sKeyVal, true);
             sk.exists = true;
             sk.@default = readString("");
             sk.Flags = readInt("Flags");
             sk.ResetCmd = readString("ResetCmd");
             sk.Icon = readString("Icon");
             sk.keyVal = Convert.ToInt32(sKeyVal, 16);
             sk.Name = readString("Name");
             //rKey.Close();
         }
         catch (Exception) { }
         finally
         {
             rKey.Close();
         }
     }
     else
     {
         sk.exists = false;
     }
     return sk;
 }
Beispiel #3
0
 public ShellKey addKey(string sKeyVal)
 {
     List<string> keyVals = new List<string>(keyID);
     if (!keyVals.Contains(sKeyVal))
         return null;
     ShellKey sk = new ShellKey(sKeyVal);
     if (existsShellKey(sKeyVal))
         return loadKey(sKeyVal, ref sk);
     else
     {
         sk.saveKey();
         return sk;
     }
 }