Example #1
0
        /// <summary>
        /// Default constructor.
        /// </summary>
        /// <param name="identity">The identity for this character</param>
        /// <param name="guid">The unique identifier.</param>
        /// <exception cref="System.ArgumentNullException">identity</exception>
        protected Character(CharacterIdentity identity, Guid guid)
        {
            identity.ThrowIfNull(nameof(identity));

            CharacterID = identity.CharacterID;
            m_name      = identity.CharacterName;

            Identity = identity;
            Guid     = guid;

            Corporation = new Corporation(this);

            SkillGroups = new SkillGroupCollection(this);
            Skills      = new SkillCollection(this);

            UpdateAccountStatus();

            EmploymentHistory     = new EmploymentRecordCollection(this);
            ImplantSets           = new ImplantSetCollection(this);
            Plans                 = new PlanCollection(this);
            CertificateCategories = new CertificateCategoryCollection(this);
            CertificateClasses    = new CertificateClassCollection(this);
            Certificates          = new CertificateCollection(this);
            MasteryShips          = new MasteryShipCollection(this);

            for (int i = 0; i < m_attributes.Length; i++)
            {
                m_attributes[i] = new CharacterAttribute(this, (EveAttribute)i);
            }

            UISettings = new CharacterUISettings();
        }
Example #2
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="VCard" /> class.
        /// </summary>
        public VCard()
        {
            // Per Microsoft best practices, string properties should
            // never return null.  String properties should always
            // return String.Empty.

            _additionalNames = string.Empty;
            _department      = string.Empty;
            _displayName     = string.Empty;
            _familyName      = string.Empty;
            _formattedName   = string.Empty;
            _givenName       = string.Empty;
            _mailer          = string.Empty;
            _namePrefix      = string.Empty;
            _nameSuffix      = string.Empty;
            _office          = string.Empty;
            _organization    = string.Empty;
            _productId       = string.Empty;
            _role            = string.Empty;
            _timeZone        = string.Empty;
            _title           = string.Empty;
            _uniqueId        = string.Empty;

            Categories        = new StringCollection();
            Certificates      = new CertificateCollection();
            DeliveryAddresses = new DeliveryAddressCollection();
            DeliveryLabels    = new DeliveryLabelCollection();
            EmailAddresses    = new EmailAddressCollection();
            _nicknames        = new StringCollection();
            _notes            = new NoteCollection();
            Phones            = new PhoneCollection();
            _photos           = new PhotoCollection();
            Sources           = new SourceCollection();
            Websites          = new WebsiteCollection();
        }
Example #3
0
        /// <summary>
        /// Returns the certificates and asymmetric keys from master for encryption
        /// </summary>
        public List <BackupEncryptor> GetBackupEncryptors()
        {
            List <BackupEncryptor> encryptors = new List <BackupEncryptor>();

            if (this.dataContainer.Server.Databases.Contains("master"))
            {
                CertificateCollection certificates = this.dataContainer.Server.Databases["master"].Certificates;
                DateTime currentUtcDateTime        = DateTime.UtcNow;
                foreach (Certificate item in certificates)
                {
                    if ((item.Name.StartsWith("##", StringComparison.InvariantCulture) && item.Name.EndsWith("##", StringComparison.InvariantCulture)) ||
                        DateTime.Compare(item.ExpirationDate, currentUtcDateTime) < 0)
                    {
                        continue;
                    }
                    encryptors.Add(new BackupEncryptor((int)BackupEncryptorType.ServerCertificate, item.Name));
                }
                AsymmetricKeyCollection keys = this.dataContainer.Server.Databases["master"].AsymmetricKeys;
                foreach (AsymmetricKey item in keys)
                {
                    if (item.KeyEncryptionAlgorithm == AsymmetricKeyEncryptionAlgorithm.CryptographicProviderDefined)
                    {
                        encryptors.Add(new BackupEncryptor((int)BackupEncryptorType.ServerAsymmetricKey, item.Name));
                    }
                }
            }
            return(encryptors);
        }
Example #4
0
        /// <summary>
        /// Default constructor.
        /// </summary>
        /// <param name="identity">The identitiy for this character</param>
        /// <param name="guid">The unique identifier.</param>
        /// <exception cref="System.ArgumentNullException">identity</exception>
        protected Character(CharacterIdentity identity, Guid guid)
        {
            identity.ThrowIfNull(nameof(identity));

            CharacterID = identity.CharacterID;
            m_name = identity.CharacterName;
            CorporationID = identity.CorporationID;
            CorporationName = identity.CorporationName;

            Identity = identity;
            Guid = guid;

            Corporation = new Corporation(this);

            SkillGroups = new SkillGroupCollection(this);
            Skills = new SkillCollection(this);

            EmploymentHistory = new EmploymentRecordCollection(this);
            ImplantSets = new ImplantSetCollection(this);
            Plans = new PlanCollection(this);
            CertificateCategories = new CertificateCategoryCollection(this);
            CertificateClasses = new CertificateClassCollection(this);
            Certificates = new CertificateCollection(this);
            MasteryShips = new MasteryShipCollection(this);

            for (int i = 0; i < m_attributes.Length; i++)
            {
                m_attributes[i] = new CharacterAttribute(this, (EveAttribute)i);
            }

            UISettings = new CharacterUISettings();
        }
 public SSBICertificateCollection(CertificateCollection c)
 {
     foreach (Certificate cert in c)
     {
         if (!cert.Name.Contains("#"))
         {
             this.Add(cert);
         }
     }
 }
        public void ConstructorTest()
        {
            // Arrange

            // Act
            var sut = new CertificateCollection();

            // Assert
            sut.Should().NotBeNull("Object must be returned.");
            sut.TotalNumberOfCertificates.Should().Be(0);
            sut.TotalNumberOfCommittedCertificates.Should().Be(0);
            sut.TotalRemainingBalance.Should().Be(0);
        }
Example #7
0
        private CertificateCollection FindAllRecipientCertificatesFor(MailMessage message)
        {
            var results = new CertificateCollection();

            var certStore = new CertificateStore(CertificateStore.OtherPeople, CertStoreType.System, null);

            foreach (var recipient in message.To.Concat(message.CC).Concat(message.BCC))
            {
                foreach (Certificate cert in certStore.FindCertificates(recipient.Address, CertificateFields.EmailAddress))
                {
                    results.Add(cert);
                }
            }

            return(results);
        }
Example #8
0
        public async Task <Response <CertificateCollection> > ListAsync(string subscriptionId, string resourceGroupName, string managedEnvironmentName, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId));
            Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName));
            Argument.AssertNotNullOrEmpty(managedEnvironmentName, nameof(managedEnvironmentName));

            using var message = CreateListRequest(subscriptionId, resourceGroupName, managedEnvironmentName);
            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);

            switch (message.Response.Status)
            {
            case 200:
            {
                CertificateCollection value = default;
                using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);

                value = CertificateCollection.DeserializeCertificateCollection(document.RootElement);
                return(Response.FromValue(value, message.Response));
            }
        public void Add_WhenCalled_ThenAllTotalsAreCalculated()
        {
            // arrange
            var          sut          = new CertificateCollection();
            ICertificate certificate1 = MockCertificate(numberOfCertificatesHeld: 2, numberOfCommittedCertificates: 5, remainingBalance: 3);
            ICertificate certificate2 = MockCertificate(numberOfCertificatesHeld: 1, numberOfCommittedCertificates: 5, remainingBalance: 1);

            // act
            sut.Add(certificate1);
            sut.Add(certificate2);

            // assert
            sut.TotalNumberOfCertificates.Should().Be(3);
            certificate1.TotalNumberOfCertificates.Should().Be(3);
            certificate2.TotalNumberOfCertificates.Should().Be(3);

            sut.TotalNumberOfCommittedCertificates.Should().Be(10);
            certificate1.TotalNumberOfCommittedCertificates.Should().Be(10);
            certificate2.TotalNumberOfCommittedCertificates.Should().Be(10);

            sut.TotalRemainingBalance.Should().Be(4);
        }
Example #10
0
        /// <summary>
        /// Default constructor
        /// </summary>
        /// <param name="identity">The identitiy for this character</param>
        /// <param name="guid"></param>
        protected Character(CharacterIdentity identity, Guid guid)
        {
            m_characterID = identity.CharacterID;
            m_name = identity.Name;
            m_identity = identity;
            m_guid = guid;

            m_skillGroups = new SkillGroupCollection(this);
            m_skills = new SkillCollection(this);

            m_certificateCategories = new CertificateCategoryCollection(this);
            m_certificateClasses = new CertificateClassCollection(this);
            m_certificates = new CertificateCollection(this);
            m_implants = new ImplantSetCollection(this);
            m_plans = new PlanCollection(this);

            for (int i = 0; i < m_attributes.Length; i++)
            {
                m_attributes[i] = new CharacterAttribute(this, (EveAttribute)i);
            }

            m_uiSettings = new CharacterUISettings();
        }
 public SSBICertificateCollection(CertificateCollection c)
 {
     foreach (Certificate cert in c)
     if(!cert.Name.Contains("#"))
       this.Add(cert);
 }