コード例 #1
0
 /// <include file='..\..\doc\MessageQueueEnumerator.uex' path='docs/doc[@for="MessageQueueEnumerator.MessageQueueEnumerator"]/*' />
 /// <internalonly/>
 internal MessageQueueEnumerator(MessageQueueCriteria criteria)
 {
     this.criteria      = criteria;
     this.checkSecurity = true;
 }
コード例 #2
0
 /// <include file='..\..\doc\MessageQueueEnumerator.uex' path='docs/doc[@for="MessageQueueEnumerator.MessageQueueEnumerator1"]/*' />
 /// <internalonly/>
 internal MessageQueueEnumerator(MessageQueueCriteria criteria, bool checkSecurity)
 {
     this.criteria      = criteria;
     this.checkSecurity = checkSecurity;
 }
コード例 #3
0
        internal void ResolveFormatNames()
        {
            if (this.resolvedFormatNames == null)
            {
                this.resolvedFormatNames = new Hashtable(GetComparer());
                IEnumerator enumerator = this.PermissionEntries.GetEnumerator();
                while (enumerator.MoveNext())
                {
                    MessageQueuePermissionEntry entry = (MessageQueuePermissionEntry)enumerator.Current;
                    if (entry.Path != null)
                    {
                        if (entry.Path == Any)
                        {
                            this.resolvedFormatNames.Add(Any, entry.PermissionAccess);
                        }
                        else
                        {
                            try
                            {
                                MessageQueue queue = new MessageQueue(entry.Path);
                                this.resolvedFormatNames.Add(queue.FormatName, entry.PermissionAccess);
                            }
                            catch
                            {
                                //if the format name cannot be resolved, it won't be added to the list
                                //permissions won't be granted.
                            }
                        }
                    }
                    else
                    {
                        try
                        {
                            MessageQueueCriteria criteria = new MessageQueueCriteria();
                            if (entry.MachineName != null)
                            {
                                criteria.MachineName = entry.MachineName;
                            }

                            if (entry.Category != null)
                            {
                                criteria.Category = new Guid(entry.Category);
                            }

                            if (entry.Label != null)
                            {
                                criteria.Label = entry.Label;
                            }

                            IEnumerator messageQueues = MessageQueue.GetMessageQueueEnumerator(criteria, false);
                            while (messageQueues.MoveNext())
                            {
                                MessageQueue queue = (MessageQueue)messageQueues.Current;
                                this.resolvedFormatNames.Add(queue.FormatName, entry.PermissionAccess);
                            }
                        }
                        catch
                        {
                            //if the criteria cannot be resolved, nothing will be added to the list
                            //permissions won't be granted.
                        }
                    }
                }
            }
        }