private IActionMatrix BuildActionMatrix(IPolicy policy, bool readOnly) { ActionMatrix actionMatrix = new ObjectModel.ActionMatrix(readOnly); TestHelpers.BuildActionMatrix(policy, actionMatrix, BuildActionGroup()); return actionMatrix; }
private void m_SummaryControl_OnDeleteSelectedPolicy(object sender, IPolicy policy) { DeletePolicyState state = StateMachine.GetState(StateTypeEnum.DeletePolicy) as DeletePolicyState; state.Policy = policy; state.PolicySet = m_policySet; StateMachine.SetState(state); }
public PolicySummary(IPolicy policy) { m_policy = policy; foreach( IPolicyObject po in m_policy.Conditions ) { //why do we have ConditionGroups within ConditionGroups? IConditionGroup grp = po as IConditionGroup; m_logic = grp.Logic; if (null != grp) { foreach (IPolicyObject subObject in grp.Conditions) { m_conditionSummaryList.Add(new ConditionSummary(subObject, policy.PolicySet.PolicyType)); } } } foreach (IPolicyChannel channel in m_policy.Channels) { m_channelSummaryList.Add(new ChannelSummary(channel)); } }
public void RegisterPolicy(IPolicy policy) { if (!_policies.Contains(policy)) { _policies.Add(policy); } }
private void ApplyConditions(IPolicy policy) { IPolicyObjectCollection<IPolicyObject> policyObjects = policy.Conditions; foreach (IPolicyObject po in policyObjects) { ApplyConditionGroup(po); } }
public List<IPolicyChannel> GetChannels(IPolicy policy) { List<IPolicyChannel> channels = new List<IPolicyChannel>(); foreach (IPolicyChannel channel in policy.Channels) channels.Add(channel); return channels; }
public PolicyRule(IPolicyStore policyStore, IPolicy policy, Guid guid, string name, RuleStatus status, bool readOnly) : base(guid, name, status, readOnly) { if (policyStore == null) throw new Workshare.Policy.Exceptions.ArgumentNullException("policyStore", "Input policy store is null", null); m_store = policyStore; SetPolicy(policy); }
public PolicyRule(IPolicyStore policyStore, IPolicy policy, IRule rule, bool readOnly) : base(rule, readOnly) { if (policyStore == null) throw new Workshare.Policy.Exceptions.ArgumentNullException("policyStore", "Input policy store is null", null); m_store = policyStore; SetPolicy(policy); }
private void WritePolicy(System.IO.StreamWriter writer, IPolicy policy) { System.Text.StringBuilder outText = new System.Text.StringBuilder(); outText.Append("Policy: "); outText.Append(policy.Name.Value); writer.WriteLine(outText.ToString()); WriteConditions(writer, policy.Conditions); writer.WriteLine("------------------------------------------------------------------------"); }
public ActionMatrixEventArgs(IPolicy policy, IPolicyChannel channel, IRoutingItemCollection senderCollection, IRoutingItemCollection recipientCollection, Workshare.Policy.ObjectModel.IAction action) { m_policy = policy; m_channel = channel; m_senderCollection = senderCollection; m_recipientCollection = recipientCollection; m_action = action; }
private void DoDeleteSelectedPolicy(IPolicy policy) { if (OnDeleteSelectedPolicy != null) { if (policy != null) { OnDeleteSelectedPolicy(this, policy); } } }
private void DoEditSelectedPolicy(IPolicy policy) { if (OnEditSelectedPolicy != null) { if (policy != null) { OnEditSelectedPolicy(this, policy); } } }
public static bool Validate(IPolicy policy) { //Todo if (policy.LoginId == 0) { return false; } return true; }
private void ValidateRule1(IPolicy policyRule) { Assert.AreEqual("Privacy", policyRule.Name.Value); Assert.AreEqual(1, policyRule.Conditions.Count); IConditionGroup conditionGroup = policyRule.Conditions[0] as IConditionGroup; Assert.IsNotNull(conditionGroup); Assert.AreEqual("Profanity", conditionGroup.Name.Value); Assert.AreEqual(1, conditionGroup.Conditions.Count); ICondition condition = conditionGroup.Conditions[0] as ICondition; Assert.AreEqual(OperatorType.GreaterThan, condition.Operator); }
private void Initialise(EnhancementStarted e) { _targetGrade = e.Grade + 1; _enumerator = RandomGenerator.Generate(Id).GetEnumerator(); _policy = new JustEnhancePolicy(e.Item, _targetGrade) { TrackNumberOfAttempts = true }; _state = new EnhancementState(e.Failstack); _state.Items[_targetGrade - 1] = int.MaxValue; }
internal void ReloadPolicy() { if (!m_Initialized) { // If we haven't initialized yet, no need to make any changes now; they'll // happen in LazyInitialize later. return; } m_Brain?.Dispose(); m_Brain = m_PolicyFactory.GeneratePolicy(Heuristic); }
public void SetFactors(bool requireKnowledge, bool requirePossession, bool requireInherence) { _loadedAdvancedServicePolicy = new FactorsPolicy( fences: _loadedAdvancedServicePolicy.Fences, requireKnowledgeFactor: requireKnowledge, requireInherenceFactor: requireInherence, requirePossessionFactor: requirePossession, denyEmulatorSimulator: _loadedAdvancedServicePolicy.DenyEmulatorSimulator, denyRootedJailbroken: _loadedAdvancedServicePolicy.DenyRootedJailbroken ); }
/// <inheritdoc /> public async Task <IPolicy> CreateAuthorizationServerPolicyAsync(IPolicy policy, string authServerId, CancellationToken cancellationToken = default(CancellationToken)) => await PostAsync <Policy>(new HttpRequest { Uri = "/api/v1/authorizationServers/{authServerId}/policies", Verb = HttpVerb.Post, Payload = policy, PathParameters = new Dictionary <string, object>() { ["authServerId"] = authServerId, }, }, cancellationToken).ConfigureAwait(false);
/// <inheritdoc /> public async Task <IPolicy> UpdatePolicyAsync(IPolicy policy, string policyId, CancellationToken cancellationToken = default(CancellationToken)) => await PutAsync <Policy>(new HttpRequest { Uri = "/api/v1/policies/{policyId}", Verb = HttpVerb.Put, Payload = policy, PathParameters = new Dictionary <string, object>() { ["policyId"] = policyId, }, }, cancellationToken).ConfigureAwait(false);
public static Task WrapAsync(this IPolicy policy, Func <Task> action) { Func <Task <bool> > wrappedAction = async() => { await action(); return(true); }; return(policy.WrapAsync(wrappedAction)); }
/// <summary> /// 创建对象池 /// </summary> /// <param name="policy">策略</param> public ObjectPool(IPolicy <T> policy) { Policy = policy; AppDomain.CurrentDomain.ProcessExit += (s1, e1) => { running = false; }; Console.CancelKeyPress += (s1, e1) => { running = false; }; }
/// <summary> /// Creates a new instance of the policy violation exception /// </summary> public PolicyViolationException(IPolicy policy, PolicyDecisionOutcomeType outcome) { if (policy == null) { throw new ArgumentNullException(nameof(policy)); } this.Policy = policy; this.PolicyId = policy.Oid; this.PolicyDecision = outcome; }
public void WhenISetDeny_Rooted_JailbrokenOnThePolicyToTrue() { policy = new FactorsPolicy( fences: (policy as FactorsPolicy).Fences, requireInherenceFactor: (policy as FactorsPolicy).RequireInherenceFactor, requireKnowledgeFactor: (policy as FactorsPolicy).RequireKnowledgeFactor, requirePossessionFactor: (policy as FactorsPolicy).RequirePossessionFactor, denyEmulatorSimulator: policy.DenyEmulatorSimulator, denyRootedJailbroken: true ); }
public void SetAmountOnMethodAmountPolicy(int amount) { IPolicy currentPolicy = _loadedAdvancedServicePolicy; _loadedAdvancedServicePolicy = new MethodAmountPolicy( fences: currentPolicy.Fences, amount: amount, denyRootedJailbroken: currentPolicy.DenyRootedJailbroken, denyEmulatorSimulator: currentPolicy.DenyEmulatorSimulator ); }
/// <inheritdoc /> public async Task <IPolicy> CreatePolicyAsync(IPolicy policy, bool?activate = true, CancellationToken cancellationToken = default(CancellationToken)) => await PostAsync <Policy>(new HttpRequest { Uri = "/api/v1/policies", Verb = HttpVerb.Post, Payload = policy, QueryParameters = new Dictionary <string, object>() { ["activate"] = activate, }, }, cancellationToken).ConfigureAwait(false);
public PhpChannelRewriter(TreeContext treeContext, ITokenComposer tokenComposer, ISourceTokenProvider sourceTokenProvider, BasicNodesFactory fac, IPolicy policy, List <Channel> inputChannels, List <Channel> outputChannels, List <Channel> sanitizeChannels, SecurityLevel level, bool isOriginalProgram = false) : base(treeContext, tokenComposer, sourceTokenProvider) { _factory = fac; _policy = policy; _inputChannels = inputChannels; _minInputLevel = _inputChannels.Min(ic => ic.Label.Level); //determine lowest ordinal value for all input channels _outputChannels = outputChannels; _sanitizeChannels = sanitizeChannels; _securityLevel = level; _isOriginalProgram = isOriginalProgram; }
public PolicyTests() { var from = new DateTime(2025, 1, 1, 12, 0, 0); var till = from.AddMonths(6); var risks = new List <RiskData> { new RiskData(new Risk("1", 5M), from, till, 15M), new RiskData(new Risk("2", 6M), from, till, 25M) }; _policy = new Policy("obj", from, till, risks); }
private IPolicy CreatePolicy(XAccessor xPolicy) { IReadOnlyDictionary <string, Type> dict = _cfg.LoadCustomizedPolicies(); IPolicy policy = null; //Note:check build-in first switch (xPolicy.LocalName) { case "singleton": policy = new SingletonPolicy(); policy.Initialize(xPolicy); break; case "factory": policy = new FactoryPolicy(); policy.Initialize(xPolicy); break; case "instance": policy = new InstancePolicy(); policy.Initialize(xPolicy); break; case "stateless": policy = new StatelessPolicy(); policy.Initialize(xPolicy); break; case "activator": policy = new ActivatorPolicy(); policy.Initialize(xPolicy); break; case "setter": policy = new SetterPolicy(); policy.Initialize(xPolicy); break; default: if (dict.ContainsKey(xPolicy.LocalName)) { policy = Activator.CreateInstance(dict[xPolicy.LocalName]) as IPolicy; policy.Initialize(xPolicy); } break; } if (policy == null) { throw new UnknownPolicyException(string.Format("Unknown policy:[{0}].", xPolicy.LocalName)); } return(policy); }
/// <summary> /// Register this policy for object pool safety /// </summary> /// <param name="policy"></param> /// <typeparam name="T"></typeparam> public static void SafeRegister <T>(this IPolicy <T> policy) { if (policy is null) { return; } if (ObjectPoolManager.Contains <T>()) { return; } ObjectPoolManager.Create(policy); }
/// <summary> /// Register this policy for object pool safety /// </summary> /// <param name="policy"></param> public static void SafeRegister(this IPolicy policy) { if (policy is null) { return; } if (ObjectPoolManager.Contains(policy.BindingType)) { return; } ObjectPoolManager.Create(policy); }
/// <summary> /// Apply a policy to an entity to create a resource. /// </summary> /// <typeparam name="T">Type of entity being converted.</typeparam> /// <param name="entity">Entity being converted.</param> /// <param name="policy">Policy to apply</param> /// <returns>Resource that was created.</returns> private static Resource <T> ApplyPolicy <T>(T entity, IPolicy policy) where T : class { var resource = new Resource <T>(entity) { Type = policy.ResourceType(entity), Id = policy.ResourceIdentity(entity), Links = (Links)policy.ResourceLinks(entity), Meta = (Meta)policy.ResourceMeta(entity) }; return(resource); }
private void ValidateRule3(IPolicy policyRule) { Assert.AreEqual("Financial Disclosure", policyRule.Name.Value); Assert.AreEqual(2, policyRule.Conditions.Count); ICondition condition = policyRule.Conditions[0] as ICondition; Assert.IsNotNull(condition); Assert.AreEqual(OperatorType.GreaterThan, condition.Operator); condition = policyRule.Conditions[1] as ICondition; Assert.IsNotNull(condition); Assert.AreEqual(OperatorType.GreaterThanOrEqualTo, condition.Operator); }
public Rater Create(IPolicy policy, ILogger logger) { try { return((Rater)Activator.CreateInstance( Type.GetType($"AutomaticRatingMechanism.PolicyRater.{policy.Type}PolicyRater"), new object[] { logger })); } catch { return(new UnknownPolicyRater(logger)); } }
/// <summary> /// Intialize the cache. /// </summary> /// <param name="policy"></param> /// <param name="dataStore"></param> /// <param name="cacheSize"></param> public Cache(IPolicy policy, IDataStore dataStore, int cacheSize) { if (cacheSize <= 0) { throw new InvalidOperationException("Cahche size must be positive number."); } this.Policy = policy; this.cacheSize = cacheSize; this.KeyValue = new Dictionary <string, string>(); this.KeyScore = new Dictionary <string, DateTime>(); this.DataStore = dataStore; }
/// <summary> /// Init /// </summary> /// <param name="policyResponse"></param> /// <param name="policy"></param> public PolicyService(IPolicyResponse policyResponse, IPolicy policy) { if (policyResponse == null) { throw new ArgumentNullException(nameof(policyResponse)); } if (policy == null) { throw new ArgumentNullException(nameof(policy)); } _policyResponse = policyResponse; _policy = policy; }
public PolicyResponse(PolicyDbContext dbContext, IPolicy policy) { if (dbContext == null) { throw new ArgumentNullException(nameof(dbContext)); } if (policy == null) { throw new ArgumentNullException(nameof(policy)); } _dbContext = dbContext; _policy = policy; }
public Checkout(IPolicy policy, IProductService productService) { if (policy == null) { throw new ArgumentNullException("policy"); } if (productService == null) { throw new ArgumentNullException("productService"); } this.policy = policy; this.productService = productService; }
private static bool Validate(IPolicy policy) { if (policy.LoginId == 0) { return false; } const string sql = "SELECT * FROM auth.has_access(config.get_user_id_by_login_id(@0), @1, @2);"; string entity = policy.ObjectNamespace + "." + policy.ObjectName; int type = (int) policy.AccessType; bool result = Factory.Scalar<bool>(policy.Catalog, sql, policy.LoginId, entity, type); return result; }
/// <summary> /// Initializes a new instance of the <see cref="Solver"/> class. /// </summary> /// <param name="policy">The solver policy.</param> /// <param name="pool">The pool contains repositories that provide packages.</param> /// <param name="installed">The installed packages repository.</param> /// <param name="io">The input/output instance.</param> public Solver(IPolicy policy, Pool pool, IRepository installed, IIO io) { this.installed = installed; this.io = io; this.policy = policy; this.pool = pool; ruleSetGenerator = new RuleSetGenerator(pool); installedMap = new Dictionary <int, IPackage>(); updateMap = new HashSet <int>(); problems = new List <Problem>(); stopwatch = new Stopwatch(); learnedWhy = new Dictionary <int, int>(); learnedPool = new List <LinkedList <Rule> >(); branches = new List <Branch>(); }
public static bool Validate(IPolicy policy) { if (policy.LoginId == 0) { return(false); } const string sql = "SELECT * FROM policy.has_access(audit.get_user_id_by_login_id(@0), @1, @2);"; var entity = policy.ObjectNamespace + "." + policy.ObjectName; int type = (int)policy.AccessType; bool result = Factory.Scalar <bool>(policy.Catalog, sql, policy.LoginId, entity, type); return(result); }
/// <summary> /// Initializes a new instance of the <see cref="PackageEventArgs"/> class. /// </summary> public PackageEventArgs( string eventName, Bucket bucket, IIO io, bool devMode, IPolicy policy, Pool pool, RepositoryComposite repositoryInstalled, Request request, IOperation[] operations, IOperation operation) : base(eventName, bucket, io, devMode, policy, pool, repositoryInstalled, request, operations) { this.operation = operation; }
/// <summary> /// Initializes a new instance of the <see cref="LicenseValidator"/> class. /// </summary> /// <param name="policy"> /// The policy. /// </param> /// <param name="deviceLimiter"> /// The device limiter. /// </param> /// <param name="callback"> /// The callback. /// </param> /// <param name="nonce"> /// The nonce. /// </param> /// <param name="packageName"> /// The package name. /// </param> /// <param name="versionCode"> /// The version code. /// </param> internal LicenseValidator( IPolicy policy, IDeviceLimiter deviceLimiter, ILicenseCheckerCallback callback, int nonce, string packageName, string versionCode) { this.policy = policy; this.deviceLimiter = deviceLimiter; this.licenseCheckerCallback = callback; this.numberUsedOnce = nonce; this.packageName = packageName; this.versionCode = versionCode; }
/// <summary> /// Initializes a new instance of the <see cref="LicenseChecker"/> class. /// The license checker. /// </summary> /// <param name="context"> /// a Context /// </param> /// <param name="policy"> /// implementation of IPolicy /// </param> /// <param name="encodedPublicKey"> /// Base64-encoded RSA public key /// </param> /// <exception cref="ArgumentException"> /// if encodedPublicKey is invalid /// </exception> public LicenseChecker(Context context, IPolicy policy, string encodedPublicKey) { this.locker = new object(); this.checksInProgress = new HashSet <LicenseValidator>(); this.pendingChecks = new Queue <LicenseValidator>(); this.context = context; this.policy = policy; this.publicKey = GeneratePublicKey(encodedPublicKey); this.packageName = this.context.PackageName; this.versionCode = GetVersionCode(context, this.packageName); var handlerThread = new HandlerThread("background thread"); handlerThread.Start(); this.handler = new Handler(handlerThread.Looper); }
public ConditionalGeoFencePolicy( IPolicy inside, IPolicy outside, bool?denyRootedJailbroken = false, bool?denyEmulatorSimulator = false, List <IFence> fences = null ) { DenyRootedJailbroken = denyRootedJailbroken; DenyEmulatorSimulator = denyEmulatorSimulator; Fences = fences ?? new List <IFence>(); Inside = inside; Outside = outside; Type = "COND_GEO"; }
public void WhenISetTheFactorsTo(string factors) { bool requireKnowledge = factors.ToLower().Contains("knowledge"); bool requirePossession = factors.ToLower().Contains("possession"); bool requireInherence = factors.ToLower().Contains("inherence"); policy = new FactorsPolicy( fences: (policy as FactorsPolicy).Fences, requireInherenceFactor: requireInherence, requireKnowledgeFactor: requireKnowledge, requirePossessionFactor: requirePossession, denyEmulatorSimulator: policy.DenyEmulatorSimulator, denyRootedJailbroken: policy.DenyRootedJailbroken ); }
private static async Task <bool> FromStore(IPolicy policy) { if (policy.LoginId == 0) { return(false); } string sql = FrapidDbServer.GetProcedureCommand(policy.Tenant, "auth.has_access", new[] { "@0", "@1", "@2" }); string entity = policy.ObjectNamespace + "." + policy.ObjectName; int type = (int)policy.AccessType; bool result = await Factory.ScalarAsync <bool>(policy.Tenant, sql, policy.LoginId, entity, type).ConfigureAwait(false); return(result); }
/// <summary> /// Initializes the AI policy to use. /// </summary> private void Start() { switch(mode) { case Enums.AIModes.ApproachShoot: policy = new ApproachShoot(); break; case Enums.AIModes.RangerBot: policy = new RangerBot(); break; } foreach (Controller controller in GameManager.instance.AllPlayers) { if (controller != this) { opponent = controller; break; } } base.Start(); }
public void Initialise(IPolicy policy, IPolicyChannel channel, IActionGroup group) { //if the action group has changed, don't bother trying to select the //same action that was selected prior to this call if (group != m_actionGroup) { m_selectedActionIndex = -1; } m_policy = policy; m_channel = channel; m_actionGroup = group; FillCatalogActions(); FillAssignedActions(); this.actiongroupNameTextBox.Focus(); }
private void ValidateRule2(IPolicy policyRule) { Assert.AreEqual("Global", policyRule.Name.Value); Assert.AreEqual(1, policyRule.Conditions.Count); IConditionGroup discriminationConditionGroup = policyRule.Conditions[0] as IConditionGroup; Assert.IsNotNull(discriminationConditionGroup); Assert.AreEqual("Discrimination", discriminationConditionGroup.Name.Value); Assert.AreEqual(2, discriminationConditionGroup.Conditions.Count, "Expected the condition group to have a condition group and a condition"); IConditionGroup profanityConditionGroup = discriminationConditionGroup.Conditions[0] as IConditionGroup; Assert.IsNotNull(profanityConditionGroup); Assert.AreEqual("Profanity", profanityConditionGroup.Name.Value); Assert.AreEqual(1, profanityConditionGroup.Conditions.Count, "Expected profanity to have one condition"); ICondition testCondition1 = profanityConditionGroup.Conditions[0] as ICondition; Assert.AreEqual("Test condition 1", testCondition1.Name.Value); ICondition testCondition2 = discriminationConditionGroup.Conditions[1] as ICondition; Assert.AreEqual("Test condition 2", testCondition2.Name.Value); }
private IPolicy FilterPolicy(IPolicy policy) { if (null == policy) return null; IPolicyObjectCollection<IPolicyObject> conditions = FilterConditions(ConditionLogic.OR, policy.Conditions); if (0 == conditions.Count) return null; P5Policy reducedPolicy = new P5Policy(m_reducedPolicySet, Guid.NewGuid(), policy.Name, policy.Status); Dictionary<string, IPolicyLanguageItem>.Enumerator enumerator = policy.GetAttributeEnumerator(); while (enumerator.MoveNext()) { reducedPolicy[enumerator.Current.Key] = enumerator.Current.Value; } reducedPolicy.Conditions = conditions; reducedPolicy.Channels = policy.Channels; return reducedPolicy; }
private static async Task<bool> ValidateAsync(IPolicy policy) { if(policy.LoginId == 0) { return false; } string sql = FrapidDbServer.GetProcedureCommand ( policy.Database, "auth.has_access", new[] { "@0", "@1", "@2" }); string entity = policy.ObjectNamespace + "." + policy.ObjectName; int type = (int)policy.AccessType; bool result = await Factory.ScalarAsync<bool>(policy.Database, sql, policy.LoginId, entity, type).ConfigureAwait(false); return result; }
void m_conditionsPanel_Actions_Show(object sender, IPolicy policy) { ShowChannelState state = StateMachine.GetState(StateTypeEnum.ShowChannel) as ShowChannelState; state.Policy = m_policy; foreach (Channel channel in m_policy.Channels) { if (channel.Type == ChannelType.SMTP) { state.Channel = (IPolicyChannel)channel; break; } } StateMachine.SetState(state); }
public static void BuildActionMatrix(IPolicy policy, ActionMatrix actionMatrix, ActionGroup actionGroup) { ConditionGroup conditionGroup = new ConditionGroup(new Guid("{661EDD6F-D750-493A-9932-E56C8C22E2CF}"), new TranslateableLanguageItem("Test condition group"), ConditionLogic.AND, false); policy.Conditions.Add(conditionGroup); PolicyCataloguesCache policyCataloguesCache = PolicyCataloguesCache.Instance(); IRoutingItemCollection senders1 = policyCataloguesCache.LocationsCollections[new Guid("{A81631A6-6AA3-45F7-AADD-4853447E5BD6}")]; IRoutingItemCollection senders2 = policyCataloguesCache.LocationsCollections[new Guid("{0DAACC5C-6167-42C7-AED0-55D1D9CC5096}")]; IRoutingItemCollection recipients1 = policyCataloguesCache.LocationsCollections[new Guid("{FA13BE82-9EB1-407E-9DD5-8005F3E840E4}")]; IRoutingItemCollection recipients2 = policyCataloguesCache.LocationsCollections[new Guid("{13A8EBE5-8B1E-4919-82E2-8A860DE4043E}")]; ActionMatrixCell actionMatrixCell1 = new ActionMatrixCell(senders1, recipients1); actionMatrixCell1.AddActionCondition(conditionGroup, actionGroup, false); ActionMatrixCell actionMatrixCell2 = new ActionMatrixCell(senders1, recipients2); actionMatrixCell1.AddActionCondition(conditionGroup, actionGroup, false); actionMatrix[senders1, recipients1] = actionMatrixCell1; actionMatrix[senders1, recipients2] = actionMatrixCell2; ConditionGroup conditionGroup2 = new ConditionGroup(new Guid("{D64056E5-A19D-4B29-8F4A-A70337B42A19}"), new TranslateableLanguageItem("Test condition group 2"), ConditionLogic.AND, false); policy.Conditions.Add(conditionGroup2); ActionMatrixCell actionMatrixCell3 = new ActionMatrixCell(senders2, recipients2); actionMatrixCell3.AddActionCondition(conditionGroup2, actionGroup, false); ActionMatrixCell actionMatrixCell4 = new ActionMatrixCell(senders2, recipients1); actionMatrixCell4.AddActionCondition(conditionGroup2, actionGroup, false); actionMatrix[senders2, recipients2] = actionMatrixCell3; actionMatrix[senders2, recipients1] = actionMatrixCell4; }
/// <summary> /// Removes a policy from a policy set's master catalogue /// </summary> /// <param name="policySet">The policy set from whose catalogue we will remove the policy</param> /// <param name="policy">The policy to remove</param> private static void RemovePolicy(IPolicySet policySet, IPolicy policy) { if (null == policySet || null == policy) { return; } foreach(IPolicyObject conditionOrGroup in policy.Conditions) { if (conditionOrGroup is ICondition) { RemoveCondition(policySet, conditionOrGroup as ICondition); } else { RemoveConditionGroup(policySet, conditionOrGroup as IConditionGroup); } } foreach(IPolicyChannel channel in policy.Channels) { RemoveChannel(policySet, channel); } policySet.MasterCatalogue.CataloguePolicies.Remove(policy); }
public void AddPolicy(IPolicy policy) { _policies.Add(policy); }
private void AddPolicyToTree(DevComponents.Tree.Node policies, IPolicy policy) { /*DevComponents.Tree.Node policyrootnode = new DevComponents.Tree.Node(); policyrootnode.Text = policy.Name; policies.Nodes.Add(policyrootnode);*/ List<CustomGXNode> conditions = new List<CustomGXNode>(); List<CustomGXNode> channels = new List<CustomGXNode>(); List<IPolicyChannel> policychannels = new List<IPolicyChannel>(); foreach (IPolicyRule rule in policy.Rules) { CustomGXNode rulenode = new CustomGXNode(rule.Name, rule); rulenode.Style = DevComponents.Tree.NodeStyles.Blue; policies.Nodes.Add(rulenode); CustomGXNode conditionsnode = new CustomGXNode("Conditions", rule.Conditions); conditionsnode.Style = DevComponents.Tree.NodeStyles.Yellow; rulenode.Nodes.Add(conditionsnode); CustomGXNode channelsnode = new CustomGXNode("Channels", rule.Channels); channelsnode.Style = DevComponents.Tree.NodeStyles.PurpleMist; rulenode.Nodes.Add(channelsnode); foreach (IPolicyChannel channel in rule.Channels) { AddChannel(channel, channels, policychannels); } foreach (IPolicyObject policyobject in rule.Conditions) { AddExpressions(policyobject, conditionsnode); } foreach (CustomGXNode node in channels) { channelsnode.Nodes.Add(node); } } }
public void RemovePolicy(IPolicy policy) { _policies.Remove(policy); }
/// <summary> /// Initializes the AI policy to use. /// </summary> private new void Start() { policy = new ApproachShoot(); base.Start(); }
/// <summary> /// Event handler for the conditions panel show policy event /// </summary> /// <param name="sender"></param> /// <param name="policy"></param> void m_conditionsPanel_Policy_Show(object sender, IPolicy policy) { ShowPolicyState state = StateMachine.GetState(StateTypeEnum.ShowPolicy) as ShowPolicyState; state.Policy = m_policy; StateMachine.SetState(state); }