コード例 #1
0
        public CertificateProfileInfo GetProfileInfo(string profileName)
        {
            CertificateProfileInfo info = null;

            if (profileDic.Count == 0)
            {
                return(null);
            }

            profileDic.TryGetValue(profileName, out info);

            return(info);
        }
コード例 #2
0
        public bool LoadProfileXml(string profileFilePath,
                                   out Dictionary <string, CertificateProfileInfo> profileDic)
        {
            bool ret = true;

            profileDic = new Dictionary <string, CertificateProfileInfo>();

            XmlDocument xml = new XmlDocument();

            try
            {
                xml.Load(profileFilePath);
            }
            catch (Exception)
            {
                return(false);
            }

            XmlNodeList xnList = xml.SelectNodes("/profiles/profile");

            foreach (XmlNode xn in xnList)
            {
                CertificateProfileInfo certProfileInfo =
                    new CertificateProfileInfo();

                certProfileInfo.profileName = xn.Attributes["name"].Value;

                foreach (XmlNode xnProfileItem in xn.ChildNodes)
                {
                    CertificateProfileItem certProfileItem =
                        new CertificateProfileItem(
                            xnProfileItem.Attributes["key"].Value,
                            xnProfileItem.Attributes["password"].Value,
                            xnProfileItem.Attributes["distributor"].Value,
                            xnProfileItem.Attributes["ca"].Value,
                            xnProfileItem.Attributes["rootca"].Value);

                    certProfileInfo.profileItemDic.Add(
                        xnProfileItem.Attributes["distributor"].Value,
                        certProfileItem);
                }

                profileDic.Add(certProfileInfo.profileName, certProfileInfo);
            }

            XmlNode xnProfiles = xml.SelectSingleNode("/profiles");

            activeProfile = xnProfiles?.Attributes["active"]?.Value;

            return(ret);
        }
コード例 #3
0
        public override bool Equals(Object obj)
        {
            CertificateProfileInfo personObj = obj as CertificateProfileInfo;

            if (personObj == null)
            {
                return(false);
            }

            if (profileName.Equals(personObj.profileName) == false)
            {
                return(false);
            }

            foreach (var pair in profileItemDic)
            {
                if (!pair.Value.Equals(personObj.profileItemDic[pair.Key]))
                {
                    return(false);
                }
            }

            return(true);
        }