Exemplo n.º 1
0
        public NbtPrintClientConfig()
        {
            printers = new PrinterSetupDataCollection();

            //hardcoding the NBT seed into the print client, because [3/5/2014] Steven Salter: just use the same seed and provide it in your app
            encryptor = new CswEncryption("52978");

            logMessages = string.Empty;
        }
 public void LoadFromReg(PrinterSetupDataCollection me, RegistryKey regKey)
 {
     me.Clear();
     foreach (string keyName in regKey.GetSubKeyNames())
     {
         PrinterSetupData aprinter = new PrinterSetupData();
         RegistryKey      akey     = regKey.OpenSubKey(keyName);
         aprinter.LoadFromReg(akey);
         me.Add(aprinter);
     }
 }
        public void SaveToReg(PrinterSetupDataCollection me, RegistryKey regKey)
        {
            int idx = 0;

            string[] keys = regKey.GetSubKeyNames();
            foreach (string akey in keys)
            {
                regKey.DeleteSubKey(akey);
            }

            foreach (PrinterSetupData aprinter in me)
            {
                RegistryKey akey = regKey.CreateSubKey(idx.ToString());
                aprinter.SaveToReg(akey);
                ++idx;
            }
        }