コード例 #1
0
        public LootContent_ItemsWithChance(LootContentSerializable serializable, Database.Loader loader)
            : base(serializable, loader)
        {
            Items = new ImmutableCollection <LootItem>(serializable.Items?.Select(item => LootItem.Create(item, loader)));

            OnDataDeserialized(serializable, loader);
        }
コード例 #2
0
        private RequiredFactions(FactionFilterSerializable serializable, Database.Loader loader)
        {
            Type = serializable.Type;
            List = new ImmutableCollection <Faction>(serializable.List?.Select(item => loader.GetFaction(new ItemId <Faction>(item), true)));

            OnDataDeserialized(serializable, loader);
        }
コード例 #3
0
 public SamlSubject(string nameFormat, string nameQualifier, string name, IEnumerable <string> confirmations, string confirmationData, SecurityKeyIdentifier securityKeyIdentifier)
 {
     this.confirmationMethods = new ImmutableCollection <string>();
     if (confirmations != null)
     {
         foreach (string str in confirmations)
         {
             if (string.IsNullOrEmpty(str))
             {
                 throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument(System.IdentityModel.SR.GetString("SAMLEntityCannotBeNullOrEmpty", new object[] { XD.SamlDictionary.SubjectConfirmationMethod.Value }));
             }
             this.confirmationMethods.Add(str);
         }
     }
     if ((this.confirmationMethods.Count == 0) && string.IsNullOrEmpty(name))
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument(System.IdentityModel.SR.GetString("SAMLSubjectRequiresNameIdentifierOrConfirmationMethod"));
     }
     if ((this.confirmationMethods.Count == 0) && ((confirmationData != null) || (securityKeyIdentifier != null)))
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument(System.IdentityModel.SR.GetString("SAMLSubjectRequiresConfirmationMethodWhenConfirmationDataOrKeyInfoIsSpecified"));
     }
     this.name                  = name;
     this.nameFormat            = nameFormat;
     this.nameQualifier         = nameQualifier;
     this.confirmationData      = confirmationData;
     this.securityKeyIdentifier = securityKeyIdentifier;
 }
コード例 #4
0
        public SamlAttribute(Claim claim)
        {
            this.attributeValues = new ImmutableCollection <string>();
            if (claim == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("claim");
            }
            if (!(claim.Resource is string))
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument(System.IdentityModel.SR.GetString("SamlAttributeClaimResourceShouldBeAString"));
            }
            if (claim.Right != Rights.PossessProperty)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument(System.IdentityModel.SR.GetString("SamlAttributeClaimRightShouldBePossessProperty"));
            }
            int length = claim.ClaimType.LastIndexOf('/');

            if (((length == -1) || (length == 0)) || (length == (claim.ClaimType.Length - 1)))
            {
                this.nameSpace = string.Empty;
                this.name      = claim.ClaimType;
            }
            else
            {
                this.nameSpace = claim.ClaimType.Substring(0, length);
                this.name      = claim.ClaimType.Substring(length + 1, claim.ClaimType.Length - (length + 1));
            }
            this.claimType = claim.ClaimType;
            this.attributeValues.Add(claim.Resource as string);
        }
コード例 #5
0
 public SamlAttribute(string attributeNamespace, string attributeName, IEnumerable<string> attributeValues)
 {
     this.attributeValues = new ImmutableCollection<string>();
     if (string.IsNullOrEmpty(attributeName))
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument(System.IdentityModel.SR.GetString("SAMLAttributeNameAttributeRequired"));
     }
     if (string.IsNullOrEmpty(attributeNamespace))
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument(System.IdentityModel.SR.GetString("SAMLAttributeNamespaceAttributeRequired"));
     }
     if (attributeValues == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("attributeValues");
     }
     this.name = attributeName;
     this.nameSpace = attributeNamespace;
     this.claimType = string.IsNullOrEmpty(this.nameSpace) ? this.name : (this.nameSpace + "/" + this.name);
     foreach (string str in attributeValues)
     {
         if (str == null)
         {
             throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument(System.IdentityModel.SR.GetString("SAMLAttributeValueCannotBeNull"));
         }
         this.attributeValues.Add(str);
     }
     if (this.attributeValues.Count == 0)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument(System.IdentityModel.SR.GetString("SAMLAttributeShouldHaveOneValue"));
     }
 }
コード例 #6
0
 public SamlAttribute(Claim claim)
 {
     this.attributeValues = new ImmutableCollection<string>();
     if (claim == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("claim");
     }
     if (!(claim.Resource is string))
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument(System.IdentityModel.SR.GetString("SamlAttributeClaimResourceShouldBeAString"));
     }
     if (claim.Right != Rights.PossessProperty)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument(System.IdentityModel.SR.GetString("SamlAttributeClaimRightShouldBePossessProperty"));
     }
     int length = claim.ClaimType.LastIndexOf('/');
     if (((length == -1) || (length == 0)) || (length == (claim.ClaimType.Length - 1)))
     {
         this.nameSpace = string.Empty;
         this.name = claim.ClaimType;
     }
     else
     {
         this.nameSpace = claim.ClaimType.Substring(0, length);
         this.name = claim.ClaimType.Substring(length + 1, claim.ClaimType.Length - (length + 1));
     }
     this.claimType = claim.ClaimType;
     this.attributeValues.Add(claim.Resource as string);
 }
コード例 #7
0
 public SamlSubject(string nameFormat, string nameQualifier, string name, IEnumerable<string> confirmations, string confirmationData, SecurityKeyIdentifier securityKeyIdentifier)
 {
     this.confirmationMethods = new ImmutableCollection<string>();
     if (confirmations != null)
     {
         foreach (string str in confirmations)
         {
             if (string.IsNullOrEmpty(str))
             {
                 throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument(System.IdentityModel.SR.GetString("SAMLEntityCannotBeNullOrEmpty", new object[] { XD.SamlDictionary.SubjectConfirmationMethod.Value }));
             }
             this.confirmationMethods.Add(str);
         }
     }
     if ((this.confirmationMethods.Count == 0) && string.IsNullOrEmpty(name))
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument(System.IdentityModel.SR.GetString("SAMLSubjectRequiresNameIdentifierOrConfirmationMethod"));
     }
     if ((this.confirmationMethods.Count == 0) && ((confirmationData != null) || (securityKeyIdentifier != null)))
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument(System.IdentityModel.SR.GetString("SAMLSubjectRequiresConfirmationMethodWhenConfirmationDataOrKeyInfoIsSpecified"));
     }
     this.name = name;
     this.nameFormat = nameFormat;
     this.nameQualifier = nameQualifier;
     this.confirmationData = confirmationData;
     this.securityKeyIdentifier = securityKeyIdentifier;
 }
コード例 #8
0
 public SamlAttribute(string attributeNamespace, string attributeName, IEnumerable <string> attributeValues)
 {
     this.attributeValues = new ImmutableCollection <string>();
     if (string.IsNullOrEmpty(attributeName))
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument(System.IdentityModel.SR.GetString("SAMLAttributeNameAttributeRequired"));
     }
     if (string.IsNullOrEmpty(attributeNamespace))
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument(System.IdentityModel.SR.GetString("SAMLAttributeNamespaceAttributeRequired"));
     }
     if (attributeValues == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("attributeValues");
     }
     this.name      = attributeName;
     this.nameSpace = attributeNamespace;
     this.claimType = string.IsNullOrEmpty(this.nameSpace) ? this.name : (this.nameSpace + "/" + this.name);
     foreach (string str in attributeValues)
     {
         if (str == null)
         {
             throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument(System.IdentityModel.SR.GetString("SAMLAttributeValueCannotBeNull"));
         }
         this.attributeValues.Add(str);
     }
     if (this.attributeValues.Count == 0)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument(System.IdentityModel.SR.GetString("SAMLAttributeShouldHaveOneValue"));
     }
 }
コード例 #9
0
        /// <summary>
        ///		Constructs a Base32 value from a byte array.
        /// </summary>
        /// <param name="bytes">
        ///		Source bytes for the Base32 value.
        /// </param>
        /// <param name="format">
        ///		Specifies the Base32 encoding format.
        /// </param>
        public Base32(IList <byte> bytes, Base32Format format = Base32Format.RFC4648)
        {
            Bytes = bytes as ImmutableCollection <byte> ?? new ImmutableCollection <byte>(bytes);

            Value  = Base32Encoder.Encode(bytes, format);
            Format = format;
        }
コード例 #10
0
ファイル: ApplyResult.cs プロジェクト: thisiscam/formula
        internal ApplyResult(
            ModuleData transform,
            Map <string, FactSet> modelInputs,
            Map <string, Term> valueInputs,
            ImmutableCollection <Id> outputNames,
            TermIndex index,
            ExecuterStatistics stats,
            bool keepDers,
            CancellationToken cancel)
        {
            Contract.Requires(transform != null);
            Contract.Requires(transform.Reduced.Node.NodeKind == NodeKind.Transform || transform.Reduced.Node.NodeKind == NodeKind.TSystem);
            Contract.Requires(modelInputs != null && valueInputs != null && outputNames != null);
            Contract.Requires(index != null);

            this.cancel      = cancel;
            this.stats       = stats;
            this.index       = index;
            this.modelInputs = modelInputs;
            this.valueInputs = valueInputs;

            applyTarget     = transform;
            KeepDerivations = keepDers;
            OutputNames     = outputNames;
        }
コード例 #11
0
 internal EventBuffer(TId aggregateId, int offset, int committed, ImmutableCollection buffer)
 {
     AggregateId      = aggregateId;
     CommittedVersion = committed;
     this.offset      = offset;
     this.buffer      = buffer;
 }
コード例 #12
0
 public SamlEvidence(IEnumerable<string> assertionIdReferences, IEnumerable<SamlAssertion> assertions)
 {
     this.assertionIdReferences = new ImmutableCollection<string>();
     this.assertions = new ImmutableCollection<SamlAssertion>();
     if ((assertionIdReferences == null) && (assertions == null))
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument(System.IdentityModel.SR.GetString("SAMLEvidenceShouldHaveOneAssertion"));
     }
     if (assertionIdReferences != null)
     {
         foreach (string str in assertionIdReferences)
         {
             if (string.IsNullOrEmpty(str))
             {
                 throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument(System.IdentityModel.SR.GetString("SAMLEntityCannotBeNullOrEmpty", new object[] { XD.SamlDictionary.AssertionIdReference.Value }));
             }
             this.assertionIdReferences.Add(str);
         }
     }
     if (assertions != null)
     {
         foreach (SamlAssertion assertion in assertions)
         {
             if (assertion == null)
             {
                 throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument(System.IdentityModel.SR.GetString("SAMLEntityCannotBeNullOrEmpty", new object[] { XD.SamlDictionary.Assertion.Value }));
             }
             this.assertions.Add(assertion);
         }
     }
 }
コード例 #13
0
        private Component(ComponentSerializable serializable, Database.Loader loader)
        {
            Id = new ItemId <Component>(serializable.Id);
            loader.AddComponent(serializable.Id, this);

            Name            = serializable.Name;
            Description     = serializable.Description;
            DisplayCategory = serializable.DisplayCategory;
            Availability    = serializable.Availability;
            Stats           = loader.GetComponentStats(new ItemId <ComponentStats>(serializable.ComponentStatsId));
            if (Stats == null)
            {
                throw new DatabaseException(this.GetType().Name + ".Stats cannot be null - " + serializable.ComponentStatsId);
            }
            Faction               = loader.GetFaction(new ItemId <Faction>(serializable.Faction));
            Level                 = UnityEngine.Mathf.Clamp(serializable.Level, 0, 1000);
            Icon                  = new SpriteId(serializable.Icon, SpriteId.Type.Component);
            Color                 = new ColorData(serializable.Color);
            Layout                = new Layout(serializable.Layout);
            _cellType             = serializable.CellType;
            Device                = loader.GetDevice(new ItemId <Device>(serializable.DeviceId));
            Weapon                = loader.GetWeapon(new ItemId <Weapon>(serializable.WeaponId));
            Ammunition            = loader.GetAmmunition(new ItemId <Ammunition>(serializable.AmmunitionId));
            AmmunitionObsolete    = loader.GetAmmunitionObsolete(new ItemId <AmmunitionObsolete>(serializable.AmmunitionId));
            _weaponSlotType       = serializable.WeaponSlotType;
            DroneBay              = loader.GetDroneBay(new ItemId <DroneBay>(serializable.DroneBayId));
            Drone                 = loader.GetShipBuild(new ItemId <ShipBuild>(serializable.DroneId));
            Restrictions          = ComponentRestrictions.Create(serializable.Restrictions, loader);
            PossibleModifications = new ImmutableCollection <ComponentMod>(serializable.PossibleModifications?.Select(item => loader.GetComponentMod(new ItemId <ComponentMod>(item), true)));

            OnDataDeserialized(serializable, loader);
        }
コード例 #14
0
 /// <summary>
 /// This constructor is for parsing data terms and rules.
 /// </summary>
 internal ParseResult()
 {
     Name      = new API.ProgramName("dummy.4ml");
     Program   = new ASTConcr <Program>(new Program(Name), false);
     Flags     = new ImmutableCollection <Flag>(flags);
     Succeeded = true;
 }
コード例 #15
0
 internal ParseResult(Program program)
 {
     Name      = program.Name;
     Program   = new ASTConcr <Program>(program, false);
     Flags     = new ImmutableCollection <Flag>(flags);
     Succeeded = true;
 }
コード例 #16
0
ファイル: Machine.cs プロジェクト: thisiscam/formula
        internal Machine(Span span, string name)
            : base(span)
        {
            Contract.Requires(!string.IsNullOrWhiteSpace(name));
            stateDomains = new LinkedList <ModRef>();
            StateDomains = new ImmutableCollection <ModRef>(stateDomains);

            Name   = name;
            Config = new Config(span);

            inputs = new LinkedList <Param>();
            Inputs = new ImmutableCollection <Param>(inputs);

            bootSeq      = new LinkedList <Step>();
            BootSequence = new ImmutableCollection <Step>(bootSeq);

            initials = new LinkedList <Update>();
            Initials = new ImmutableCollection <Update>(initials);

            nexts = new LinkedList <Update>();
            Nexts = new ImmutableCollection <Update>(nexts);

            properties = new LinkedList <Property>();
            Properties = new ImmutableCollection <Property>(properties);
        }
コード例 #17
0
        private GalaxySettings(GalaxySettingsSerializable serializable, Database.Loader loader)
        {
            AbandonedStarbaseFaction = loader.GetFaction(new ItemId <Faction>(serializable.AbandonedStarbaseFaction));
            StartingShipBuilds       = new ImmutableCollection <ShipBuild>(serializable.StartingShipBuilds?.Select(item => loader.GetShipBuild(new ItemId <ShipBuild>(item), true)));

            OnDataDeserialized(serializable, loader);
        }
コード例 #18
0
 /// <summary>
 /// DO NOT use directly: Only called by parser.
 /// </summary>
 internal Step(Span span)
     : base(span)
 {
     lhs = new LinkedList <Id>();
     Lhs = new ImmutableCollection <Id>(lhs);
     Rhs = new ModApply(span, new ModRef(span, "?", null, null));
 }
コード例 #19
0
        private Ship(ShipSerializable serializable, Database.Loader loader)
        {
            Id = new ItemId <Ship>(serializable.Id);
            loader.AddShip(serializable.Id, this);

            ShipCategory       = serializable.ShipCategory;
            Name               = serializable.Name;
            Faction            = loader.GetFaction(new ItemId <Faction>(serializable.Faction));
            SizeClass          = serializable.SizeClass;
            IconImage          = new SpriteId(serializable.IconImage, SpriteId.Type.ShipIcon);
            IconScale          = UnityEngine.Mathf.Clamp(serializable.IconScale, 0.1f, 100f);
            ModelImage         = new SpriteId(serializable.ModelImage, SpriteId.Type.Ship);
            ModelScale         = UnityEngine.Mathf.Clamp(serializable.ModelScale, 0.1f, 100f);
            _enginePosition    = serializable.EnginePosition;
            EngineColor        = new ColorData(serializable.EngineColor);
            _engineSize        = UnityEngine.Mathf.Clamp(serializable.EngineSize, 0f, 1f);
            Engines            = new ImmutableCollection <Engine>(serializable.Engines?.Select(item => Engine.Create(item, loader)));
            EnergyResistance   = UnityEngine.Mathf.Clamp(serializable.EnergyResistance, -100f, 100f);
            KineticResistance  = UnityEngine.Mathf.Clamp(serializable.KineticResistance, -100f, 100f);
            HeatResistance     = UnityEngine.Mathf.Clamp(serializable.HeatResistance, -100f, 100f);
            Regeneration       = serializable.Regeneration;
            BaseWeightModifier = UnityEngine.Mathf.Clamp(serializable.BaseWeightModifier, -0.9f, 1000f);
            BuiltinDevices     = new ImmutableCollection <Device>(serializable.BuiltinDevices?.Select(item => loader.GetDevice(new ItemId <Device>(item), true)));
            Layout             = new Layout(serializable.Layout);
            Barrels            = new ImmutableCollection <Barrel>(serializable.Barrels?.Select(item => Barrel.Create(item, loader)));

            OnDataDeserialized(serializable, loader);
        }
コード例 #20
0
 public SamlAuthenticationStatement(SamlSubject samlSubject, string authenticationMethod, DateTime authenticationInstant, string dnsAddress, string ipAddress, IEnumerable <SamlAuthorityBinding> authorityBindings) : base(samlSubject)
 {
     this.authenticationInstant = DateTime.UtcNow.ToUniversalTime();
     this.authenticationMethod  = XD.SamlDictionary.UnspecifiedAuthenticationMethod.Value;
     this.authorityBindings     = new ImmutableCollection <SamlAuthorityBinding>();
     if (string.IsNullOrEmpty(authenticationMethod))
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("authenticationMethod", System.IdentityModel.SR.GetString("SAMLAuthenticationStatementMissingAuthenticationMethod"));
     }
     this.authenticationMethod  = authenticationMethod;
     this.authenticationInstant = authenticationInstant.ToUniversalTime();
     this.dnsAddress            = dnsAddress;
     this.ipAddress             = ipAddress;
     if (authorityBindings != null)
     {
         foreach (SamlAuthorityBinding binding in authorityBindings)
         {
             if (binding == null)
             {
                 throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument(System.IdentityModel.SR.GetString("SAMLEntityCannotBeNullOrEmpty", new object[] { XD.SamlDictionary.Assertion.Value }));
             }
             this.authorityBindings.Add(binding);
         }
     }
     this.CheckObjectValidity();
 }
コード例 #21
0
 internal FuncTerm(Span span, OpKind op)
     : base(span)
 {
     Function = op;
     args     = new LinkedList <Node>();
     Args     = new ImmutableCollection <Node>(args);
 }
コード例 #22
0
        public Requirement_None(RequirementSerializable serializable, Database.Loader loader)
            : base(serializable, loader)
        {
            Requirements = new ImmutableCollection <Requirement>(serializable.Requirements?.Select(item => Requirement.Create(item, loader)));

            OnDataDeserialized(serializable, loader);
        }
コード例 #23
0
ファイル: ContractItem.cs プロジェクト: thisiscam/formula
 internal ContractItem(Span span, ContractKind contractKind)
     : base(span)
 {
     ContractKind  = contractKind;
     specification = new LinkedList <Node>();
     Specification = new ImmutableCollection <Node>(specification);
 }
 public SamlAuthenticationStatement(SamlSubject samlSubject, string authenticationMethod, DateTime authenticationInstant, string dnsAddress, string ipAddress, IEnumerable<SamlAuthorityBinding> authorityBindings) : base(samlSubject)
 {
     this.authenticationInstant = DateTime.UtcNow.ToUniversalTime();
     this.authenticationMethod = XD.SamlDictionary.UnspecifiedAuthenticationMethod.Value;
     this.authorityBindings = new ImmutableCollection<SamlAuthorityBinding>();
     if (string.IsNullOrEmpty(authenticationMethod))
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("authenticationMethod", System.IdentityModel.SR.GetString("SAMLAuthenticationStatementMissingAuthenticationMethod"));
     }
     this.authenticationMethod = authenticationMethod;
     this.authenticationInstant = authenticationInstant.ToUniversalTime();
     this.dnsAddress = dnsAddress;
     this.ipAddress = ipAddress;
     if (authorityBindings != null)
     {
         foreach (SamlAuthorityBinding binding in authorityBindings)
         {
             if (binding == null)
             {
                 throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument(System.IdentityModel.SR.GetString("SAMLEntityCannotBeNullOrEmpty", new object[] { XD.SamlDictionary.Assertion.Value }));
             }
             this.authorityBindings.Add(binding);
         }
     }
     this.CheckObjectValidity();
 }
コード例 #25
0
 public SamlAdvice(IEnumerable <string> references, IEnumerable <SamlAssertion> assertions)
 {
     this.assertionIdReferences = new ImmutableCollection <string>();
     this.assertions            = new ImmutableCollection <SamlAssertion>();
     if (references != null)
     {
         foreach (string str in references)
         {
             if (string.IsNullOrEmpty(str))
             {
                 throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument(System.IdentityModel.SR.GetString("SAMLEntityCannotBeNullOrEmpty", new object[] { XD.SamlDictionary.AssertionIdReference.Value }));
             }
             this.assertionIdReferences.Add(str);
         }
     }
     if (assertions != null)
     {
         foreach (SamlAssertion assertion in assertions)
         {
             if (assertion == null)
             {
                 throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument(System.IdentityModel.SR.GetString("SAMLEntityCannotBeNullOrEmpty", new object[] { XD.SamlDictionary.Assertion.Value }));
             }
             this.assertions.Add(assertion);
         }
     }
 }
コード例 #26
0
 /// <summary>
 /// Determines whether the specified collection is empty.
 /// </summary>
 /// <param name="collection">The collection to test.</param>
 /// <returns>True iff the specified collection is empty.</returns>
 /// <exception cref="ArgumentNullException">
 /// When <paramref name="collection"/> is null.
 /// </exception>
 public static bool IsEmpty(this ImmutableCollection collection)
 {
     if (collection == null)
     {
         throw new ArgumentNullException(nameof(collection));
     }
     return(collection.Count == 0);
 }
コード例 #27
0
 internal Step(Span span, ModApply rhs)
     : base(span)
 {
     Contract.Requires(rhs != null);
     Rhs = rhs;
     lhs = new LinkedList <Id>();
     Lhs = new ImmutableCollection <Id>(lhs);
 }
コード例 #28
0
 internal ModApply(Span span, ModRef modref)
     : base(span)
 {
     Contract.Requires(modref != null);
     Module = modref;
     args   = new LinkedList <Node>();
     Args   = new ImmutableCollection <Node>(args);
 }
コード例 #29
0
        public Node_Condition(NodeSerializable serializable, Database.Loader loader)
            : base(serializable, loader)
        {
            Message     = serializable.Message;
            Transitions = new ImmutableCollection <NodeTransition>(serializable.Transitions?.Select(item => NodeTransition.Create(item, loader)));

            OnDataDeserialized(serializable, loader);
        }
コード例 #30
0
        internal Update(Span span)
            : base(span)
        {
            choices = new LinkedList <ModApply>();
            Choices = new ImmutableCollection <ModApply>(choices);

            states = new LinkedList <Id>();
            States = new ImmutableCollection <Id>(states);
        }
コード例 #31
0
        internal Program(ProgramName name)
        {
            Contract.Requires(name != null);

            Name    = name;
            Config  = new Config(default(Span));
            modules = new LinkedList <Node>();
            Modules = new ImmutableCollection <Node>(modules);
        }
コード例 #32
0
        public Node_Random(NodeSerializable serializable, Database.Loader loader)
            : base(serializable, loader)
        {
            Message           = serializable.Message;
            DefaultTransition = UnityEngine.Mathf.Clamp(serializable.DefaultTransition, 0, 1000);
            Transitions       = new ImmutableCollection <NodeTransition>(serializable.Transitions?.Select(item => NodeTransition.Create(item, loader)));

            OnDataDeserialized(serializable, loader);
        }
コード例 #33
0
ファイル: Rule.cs プロジェクト: thisiscam/formula
        internal Rule(Span span)
            : base(span)
        {
            heads = new LinkedList <Node>();
            Heads = new ImmutableCollection <Node>(heads);

            bodies = new LinkedList <Body>();
            Bodies = new ImmutableCollection <Body>(bodies);
        }
コード例 #34
0
 /// <summary>Initializes a new instance of the <see cref="Collection"/> class.</summary>
 public Collection(IEnumerable items, ImmutableCollection predecessor)
     : base(predecessor)
 {
     Items = new();
     foreach (var item in items)
     {
         Items.Add(item);
     }
 }
コード例 #35
0
        private VisualEffect(VisualEffectSerializable serializable, Database.Loader loader)
        {
            Id = new ItemId <VisualEffect>(serializable.Id);
            loader.AddVisualEffect(serializable.Id, this);

            Elements = new ImmutableCollection <VisualEffectElement>(serializable.Elements?.Select(item => VisualEffectElement.Create(item, loader)));

            OnDataDeserialized(serializable, loader);
        }
 public SamlAttributeStatement(SamlSubject samlSubject, IEnumerable<SamlAttribute> attributes) : base(samlSubject)
 {
     this.attributes = new ImmutableCollection<SamlAttribute>();
     if (attributes == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("attributes"));
     }
     foreach (SamlAttribute attribute in attributes)
     {
         if (attribute == null)
         {
             throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument(System.IdentityModel.SR.GetString("SAMLEntityCannotBeNullOrEmpty", new object[] { XD.SamlDictionary.Attribute.Value }));
         }
         this.attributes.Add(attribute);
     }
     this.CheckObjectValidity();
 }
 public SamlAudienceRestrictionCondition(IEnumerable<Uri> audiences)
 {
     this.audiences = new ImmutableCollection<Uri>();
     if (audiences == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("audiences"));
     }
     foreach (Uri uri in audiences)
     {
         if (uri == null)
         {
             throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument(System.IdentityModel.SR.GetString("SAMLEntityCannotBeNullOrEmpty", new object[] { XD.SamlDictionary.Audience.Value }));
         }
         this.audiences.Add(uri);
     }
     this.CheckObjectValidity();
 }
コード例 #38
0
 public SamlConditions(DateTime notBefore, DateTime notOnOrAfter, IEnumerable<SamlCondition> conditions)
 {
     this.conditions = new ImmutableCollection<SamlCondition>();
     this.notBefore = System.IdentityModel.SecurityUtils.MinUtcDateTime;
     this.notOnOrAfter = System.IdentityModel.SecurityUtils.MaxUtcDateTime;
     this.notBefore = notBefore.ToUniversalTime();
     this.notOnOrAfter = notOnOrAfter.ToUniversalTime();
     if (conditions != null)
     {
         foreach (SamlCondition condition in conditions)
         {
             if (condition == null)
             {
                 throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument(System.IdentityModel.SR.GetString("SAMLEntityCannotBeNullOrEmpty", new object[] { XD.SamlDictionary.Condition.Value }));
             }
             this.conditions.Add(condition);
         }
     }
 }
 public SamlAuthorizationDecisionStatement(SamlSubject samlSubject, string resource, SamlAccessDecision accessDecision, IEnumerable<SamlAction> samlActions, SamlEvidence samlEvidence) : base(samlSubject)
 {
     this.actions = new ImmutableCollection<SamlAction>();
     if (samlActions == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("samlActions"));
     }
     foreach (SamlAction action in samlActions)
     {
         if (action == null)
         {
             throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument(System.IdentityModel.SR.GetString("SAMLEntityCannotBeNullOrEmpty", new object[] { XD.SamlDictionary.Action.Value }));
         }
         this.actions.Add(action);
     }
     this.evidence = samlEvidence;
     this.accessDecision = accessDecision;
     this.resource = resource;
     this.CheckObjectValidity();
 }
コード例 #40
0
 public SamlAssertion(string assertionId, string issuer, DateTime issueInstant, SamlConditions samlConditions, SamlAdvice samlAdvice, IEnumerable<SamlStatement> samlStatements)
 {
     this.assertionId = "SamlSecurityToken-" + Guid.NewGuid().ToString();
     this.issueInstant = DateTime.UtcNow.ToUniversalTime();
     this.statements = new ImmutableCollection<SamlStatement>();
     if (string.IsNullOrEmpty(assertionId))
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument(System.IdentityModel.SR.GetString("SAMLAssertionIdRequired"));
     }
     if (!this.IsAssertionIdValid(assertionId))
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument(System.IdentityModel.SR.GetString("SAMLAssertionIDIsInvalid", new object[] { assertionId }));
     }
     if (string.IsNullOrEmpty(issuer))
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument(System.IdentityModel.SR.GetString("SAMLAssertionIssuerRequired"));
     }
     if (samlStatements == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("samlStatements");
     }
     this.assertionId = assertionId;
     this.issuer = issuer;
     this.issueInstant = issueInstant.ToUniversalTime();
     this.conditions = samlConditions;
     this.advice = samlAdvice;
     foreach (SamlStatement statement in samlStatements)
     {
         if (statement == null)
         {
             throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument(System.IdentityModel.SR.GetString("SAMLEntityCannotBeNullOrEmpty", new object[] { XD.SamlDictionary.Statement.Value }));
         }
         this.statements.Add(statement);
     }
     if (this.statements.Count == 0)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument(System.IdentityModel.SR.GetString("SAMLAssertionRequireOneStatement"));
     }
 }
コード例 #41
0
 public SamlConditions()
 {
     this.conditions = new ImmutableCollection<SamlCondition>();
     this.notBefore = System.IdentityModel.SecurityUtils.MinUtcDateTime;
     this.notOnOrAfter = System.IdentityModel.SecurityUtils.MaxUtcDateTime;
 }
コード例 #42
0
 public SamlAttribute()
 {
     this.attributeValues = new ImmutableCollection<string>();
 }
コード例 #43
0
 public SamlSubject()
 {
     this.confirmationMethods = new ImmutableCollection<string>();
 }
 public SamlAudienceRestrictionCondition()
 {
     this.audiences = new ImmutableCollection<Uri>();
 }
 public SamlAuthorizationDecisionStatement()
 {
     this.actions = new ImmutableCollection<SamlAction>();
 }
コード例 #46
0
 public SamlEvidence()
 {
     this.assertionIdReferences = new ImmutableCollection<string>();
     this.assertions = new ImmutableCollection<SamlAssertion>();
 }
コード例 #47
0
 public SamlAssertion()
 {
     this.assertionId = "SamlSecurityToken-" + Guid.NewGuid().ToString();
     this.issueInstant = DateTime.UtcNow.ToUniversalTime();
     this.statements = new ImmutableCollection<SamlStatement>();
 }
 public SamlAttributeStatement()
 {
     this.attributes = new ImmutableCollection<SamlAttribute>();
 }
 public SamlAuthenticationStatement()
 {
     this.authenticationInstant = DateTime.UtcNow.ToUniversalTime();
     this.authenticationMethod = XD.SamlDictionary.UnspecifiedAuthenticationMethod.Value;
     this.authorityBindings = new ImmutableCollection<SamlAuthorityBinding>();
 }