5 // Peter Van Isacker (sclytrack@planetinternet.be)
6 // Rafael Teixeira (rafaelteixeirabr@hotmail.com)
8 // (C) 2003 Peter Van Isacker, Rafael Teixeira
12 // Permission is hereby granted, free of charge, to any person obtaining
13 // a copy of this software and associated documentation files (the
14 // "Software"), to deal in the Software without restriction, including
15 // without limitation the rights to use, copy, modify, merge, publish,
16 // distribute, sublicense, and/or sell copies of the Software, and to
17 // permit persons to whom the Software is furnished to do so, subject to
18 // the following conditions:
20 // The above copyright notice and this permission notice shall be
21 // included in all copies or substantial portions of the Software.
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
33 namespace System.Messaging
35 public class MessageQueueCriteria
37 public MessageQueueCriteria()
42 private bool setCategory;
43 private Guid category;
49 throw new InvalidOperationException();
59 private bool setCreatedAfter;
60 private DateTime createdAfter;
61 public DateTime CreatedAfter
66 throw new InvalidOperationException();
72 setCreatedAfter = true;
76 private bool setCreatedBefore;
77 private DateTime createdBefore;
78 public DateTime CreatedBefore
82 if (!setCreatedBefore)
83 throw new InvalidOperationException();
88 createdBefore = value;
89 setCreatedBefore = true;
93 private bool setLabel;
100 throw new InvalidOperationException();
111 private bool invalidMachineName(string name)
116 private bool setMachineName;
117 private string machineName;
118 public string MachineName
123 throw new InvalidOperationException();
128 if (invalidMachineName(value))
129 throw new InvalidOperationException();
131 setMachineName = true;
135 private bool setModifiedAfter;
136 private DateTime modifiedAfter;
137 public DateTime ModifiedAfter
141 if (!setModifiedAfter)
142 throw new InvalidOperationException();
143 return modifiedAfter;
147 modifiedAfter = value;
148 setModifiedAfter = true;
152 private bool setModifiedBefore;
153 private DateTime modifiedBefore;
154 public DateTime ModifiedBefore
158 if (!setModifiedBefore)
159 throw new InvalidOperationException();
160 return modifiedBefore;
164 modifiedBefore = value;
165 setModifiedBefore = true;
169 public void ClearAll()
172 setCreatedAfter = false;
173 setCreatedBefore = false;
175 setMachineName = false;
176 setModifiedAfter = false;
177 setModifiedBefore = false;
180 // To be called by the MessageQueue.GetPublicQueues(MessageQueueCriteria criteria) method
188 if (setCategory && this.category != category)
190 if (setCreatedAfter && created < createdAfter)
192 if (setCreatedBefore && created > createdBefore)
194 if (setLabel && this.label != label)
196 if (setMachineName && this.machineName != machineName)
198 if (setModifiedAfter && modified < modifiedAfter)
200 if (setModifiedBefore && modified > modifiedBefore)