Example #1
0
        public static void RemoveCertificate(GitCertificate certificate)
        {
            if (certificate == null)
                throw new ArgumentNullException("certificate");

            _certificates.Remove(certificate.Path);
        }
Example #2
0
        public static void AddCertificate(GitCertificate certificate)
        {
            if (certificate == null)
                throw new ArgumentNullException("certificate");

            _certificates[certificate.Path] = certificate;
        }
Example #3
0
        public void StoreCertificate(GitCertificate item)
        {
            // Ensure the certificate doesn't exist yet.

            RemoveCertificate(item.Path);

            // Add the new one.

            int largestIndex = 0;

            using (RegistryKey rk = OpenHKCUKey("Certificates"))
            {
                foreach (string name in rk.GetValueNames())
                {
                    int index;

                    if (int.TryParse(name, out index))
                        largestIndex = Math.Max(largestIndex, index);
                }

                rk.SetValue((largestIndex + 1).ToString(), item.Path);
            }

            // Update the SharpGit registrations.

            RegisterCertificates();
        }