コード例 #1
0
        /// <summary>
        /// Creates a new instance of the evaluaion context.
        /// </summary>
        /// <param name="engine">The engine instance.</param>
        /// <param name="policyDocument">The policy document instance.</param>
        /// <param name="contextDocument">The context document instance.</param>
        public EvaluationContext(EvaluationEngine engine, PolicyDocument policyDocument, ContextDocument contextDocument)
            : this()
        {
            var attributes = new AttributeReadWriteCollection();
            foreach (AttributeElementReadWrite attribute in contextDocument.Request.Resources[0].Attributes)
            {
                attributes.Add(new AttributeElementReadWrite(attribute));
            }

            ResourceContentElement resourceContent = null;
            if (contextDocument.Request.Resources[0].ResourceContent != null)
            {
                resourceContent = new ResourceContentElement(
                        contextDocument.Request.Resources[0].ResourceContent.XmlDocument,
                        contextDocument.Request.Resources[0].ResourceContent.SchemaVersion);
            }

            _engine = engine;
            _policyDocument = policyDocument;
            _contextDocument = contextDocument;
            CurrentResource = new ResourceElementReadWrite(
                resourceContent,
                contextDocument.Request.Resources[0].ResourceScopeValue,
                attributes,
                contextDocument.Request.Resources[0].SchemaVersion);
        }
コード例 #2
0
 /// <summary>
 /// Adds an object to the end of the CollectionBase.
 /// </summary>
 /// <param name="value">The Object to be added to the end of the CollectionBase. </param>
 /// <returns>The CollectionBase index at which the value has been added.</returns>
 public override sealed int Add(ResourceElementReadWrite value)
 {
     if (value == null) throw new ArgumentNullException("value");
     ResourceContentElement resourceContent = null;
     if (value.ResourceContent != null)
     {
         resourceContent = new ResourceContentElement(value.ResourceContent.XmlDocument, value.ResourceContent.SchemaVersion);
     }
     return (List.Add(new ResourceElement(resourceContent, value.ResourceScopeValue, new AttributeCollection(value.Attributes), value.SchemaVersion)));
 }
コード例 #3
0
 /// <summary>
 /// Gets the index of the given ResourceElementReadWrite in the collection
 /// </summary>
 /// <param name="resource"></param>
 /// <returns></returns>
 public int GetIndex(ResourceElementReadWrite resource)
 {
     for (int i = 0; i < this.Count; i++)
     {
         if (this.List[i] == resource)
         {
             return(i);
         }
     }
     return(-1);
 }
コード例 #4
0
 /// <summary>
 /// Gets the index of the given ResourceElementReadWrite in the collection
 /// </summary>
 /// <param name="resource"></param>
 /// <returns></returns>
 public int GetIndex(ResourceElementReadWrite resource)
 {
     for (int i = 0; i < this.Count; i++)
     {
         if (this.List[i] == resource)
         {
             return i;
         }
     }
     return -1;
 }
コード例 #5
0
ファイル: Resource.cs プロジェクト: zszqwe/anycmd
        /// <summary>
        ///
        /// </summary>
        /// <param name="resource"></param>
        public Resource(con.ResourceElementReadWrite resource)
        {
            // This call is required by the Windows.Forms Form Designer.
            InitializeComponent();

            _resource = resource;

            if (_resource.ResourceContent != null)
            {
                txtContent.Text = _resource.ResourceContent.XmlDocument.InnerXml;
            }
        }
コード例 #6
0
ファイル: Resource.cs プロジェクト: mingkongbin/anycmd
        /// <summary>
        /// 
        /// </summary>
        /// <param name="resource"></param>
        public Resource( con.ResourceElementReadWrite resource )
        {
            // This call is required by the Windows.Forms Form Designer.
            InitializeComponent();

            _resource = resource;

            if( _resource.ResourceContent != null )
            {
                txtContent.Text = _resource.ResourceContent.XmlDocument.InnerXml;
            }
        }
コード例 #7
0
ファイル: Resource.cs プロジェクト: zszqwe/anycmd
        /// <summary>
        ///
        /// </summary>
        /// <param name="resource"></param>
        public Resource(con.ResourceElementReadWrite resource)
        {
            _resource = resource;

            this.Text = "Resource";
            this.SelectedImageIndex = 2;
            this.ImageIndex         = 2;

            foreach (con.AttributeElementReadWrite attr in _resource.Attributes)
            {
                this.Nodes.Add(new Attribute(attr));
            }
        }
コード例 #8
0
ファイル: Resource.cs プロジェクト: mingkongbin/anycmd
        /// <summary>
        /// 
        /// </summary>
        /// <param name="resource"></param>
        public Resource( con.ResourceElementReadWrite resource )
        {
            _resource = resource;

            this.Text = "Resource";
            this.SelectedImageIndex = 2;
            this.ImageIndex = 2;

            foreach( con.AttributeElementReadWrite attr in _resource.Attributes )
            {
                this.Nodes.Add( new Attribute( attr ) );
            }
        }
コード例 #9
0
        /// <summary>
        /// Adds an object to the end of the CollectionBase.
        /// </summary>
        /// <param name="value">The Object to be added to the end of the CollectionBase. </param>
        /// <returns>The CollectionBase index at which the value has been added.</returns>
        public override sealed int Add(ResourceElementReadWrite value)
        {
            if (value == null)
            {
                throw new ArgumentNullException("value");
            }
            ResourceContentElement resourceContent = null;

            if (value.ResourceContent != null)
            {
                resourceContent = new ResourceContentElement(value.ResourceContent.XmlDocument, value.ResourceContent.SchemaVersion);
            }
            return(List.Add(new ResourceElement(resourceContent, value.ResourceScopeValue, new AttributeCollection(value.Attributes), value.SchemaVersion)));
        }
コード例 #10
0
 /// <summary>
 /// Adds an object to the end of the CollectionBase.
 /// </summary>
 /// <param name="value">The Object to be added to the end of the CollectionBase. </param>
 /// <returns>The CollectionBase index at which the value has been added.</returns>
 public virtual int Add(ResourceElementReadWrite value)
 {
     return(List.Add(value));
 }
コード例 #11
0
 /// <summary>
 /// Adds an object to the end of the CollectionBase.
 /// </summary>
 /// <param name="value">The Object to be added to the end of the CollectionBase. </param>
 /// <returns>The CollectionBase index at which the value has been added.</returns>
 public virtual int Add(ResourceElementReadWrite value)
 {
     return (List.Add(value));
 }