public static void RemoveCertificate(GitCertificate certificate) { if (certificate == null) throw new ArgumentNullException("certificate"); _certificates.Remove(certificate.Path); }
public static void AddCertificate(GitCertificate certificate) { if (certificate == null) throw new ArgumentNullException("certificate"); _certificates[certificate.Path] = certificate; }
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(); }