MessagePropertyFilter.cs 42 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159
  1. //------------------------------------------------------------------------------
  2. // <copyright file="MessagePropertyFilter.cs" company="Microsoft">
  3. // Copyright (c) Microsoft Corporation. All rights reserved.
  4. // </copyright>
  5. //------------------------------------------------------------------------------
  6. using System;
  7. using System.ComponentModel;
  8. namespace Experimental.System.Messaging
  9. {
  10. /// <include file='doc\MessagePropertyFilter.uex' path='docs/doc[@for="MessagePropertyFilter"]/*' />
  11. /// <devdoc>
  12. /// <para>
  13. /// Limits the
  14. /// properties retrieved when receiving messages from a queue.
  15. /// </para>
  16. /// </devdoc>
  17. [TypeConverter(typeof(ExpandableObjectConverter))]
  18. public class MessagePropertyFilter : ICloneable
  19. {
  20. internal const int ACKNOWLEDGEMENT = 1;
  21. internal const int ACKNOWLEDGE_TYPE = 1 << 2;
  22. internal const int ADMIN_QUEUE = 1 << 3;
  23. internal const int BODY = 1 << 4;
  24. internal const int LABEL = 1 << 5;
  25. internal const int ID = 1 << 6;
  26. internal const int USE_DEADLETTER_QUEUE = 1 << 7;
  27. internal const int RESPONSE_QUEUE = 1 << 8;
  28. internal const int MESSAGE_TYPE = 1 << 9;
  29. internal const int USE_JOURNALING = 1 << 10;
  30. internal const int LOOKUP_ID = 1 << 11;
  31. internal const int APP_SPECIFIC = 1;
  32. internal const int ARRIVED_TIME = 1 << 2;
  33. internal const int ATTACH_SENDER_ID = 1 << 3;
  34. internal const int AUTHENTICATED = 1 << 4;
  35. internal const int CONNECTOR_TYPE = 1 << 5;
  36. internal const int CORRELATION_ID = 1 << 6;
  37. internal const int CRYPTOGRAPHIC_PROVIDER_NAME = 1 << 7;
  38. internal const int CRYPTOGRAPHIC_PROVIDER_TYPE = 1 << 8;
  39. internal const int IS_RECOVERABLE = 1 << 9;
  40. internal const int DIGITAL_SIGNATURE = 1 << 10;
  41. internal const int ENCRYPTION_ALGORITHM = 1 << 11;
  42. internal const int EXTENSION = 1 << 12;
  43. internal const int FOREIGN_ADMIN_QUEUE = 1 << 13;
  44. internal const int HASH_ALGORITHM = 1 << 14;
  45. internal const int DESTINATION_QUEUE = 1 << 15;
  46. internal const int PRIORITY = 1 << 16;
  47. internal const int SECURITY_CONTEXT = 1 << 17;
  48. internal const int SENDER_CERTIFICATE = 1 << 18;
  49. internal const int SENDER_ID = 1 << 19;
  50. internal const int SENT_TIME = 1 << 20;
  51. internal const int SOURCE_MACHINE = 1 << 21;
  52. internal const int SYMMETRIC_KEY = 1 << 22;
  53. internal const int TIME_TO_BE_RECEIVED = 1 << 23;
  54. internal const int TIME_TO_REACH_QUEUE = 1 << 24;
  55. internal const int USE_AUTHENTICATION = 1 << 25;
  56. internal const int USE_ENCRYPTION = 1 << 26;
  57. internal const int USE_TRACING = 1 << 27;
  58. internal const int VERSION = 1 << 28;
  59. internal const int IS_FIRST_IN_TRANSACTION = 1 << 29;
  60. internal const int IS_LAST_IN_TRANSACTION = 1 << 30;
  61. internal const int TRANSACTION_ID = 1 << 31;
  62. internal int data1;
  63. internal int data2;
  64. private const int defaultBodySize = 1024;
  65. private const int defaultExtensionSize = 255;
  66. private const int defaultLabelSize = 255;
  67. internal int bodySize = defaultBodySize;
  68. internal int extensionSize = defaultExtensionSize;
  69. internal int labelSize = defaultLabelSize;
  70. /// <include file='doc\MessagePropertyFilter.uex' path='docs/doc[@for="MessagePropertyFilter.MessagePropertyFilter"]/*' />
  71. /// <devdoc>
  72. /// <para>
  73. /// Initializes a new instance of the <see cref='System.Messaging.MessagePropertyFilter'/>
  74. /// class
  75. /// and
  76. /// sets
  77. /// the
  78. /// most
  79. /// common
  80. /// filter
  81. /// properties
  82. /// to
  83. /// true.
  84. /// </para>
  85. /// </devdoc>
  86. public MessagePropertyFilter()
  87. {
  88. }
  89. /// <include file='doc\MessagePropertyFilter.uex' path='docs/doc[@for="MessagePropertyFilter.Acknowledgment"]/*' />
  90. /// <devdoc>
  91. /// <para>
  92. /// Gets or sets a value indicating whether to retrieve
  93. /// <see cref='System.Messaging.Message.Acknowledgment' qualify='true'/> property information when receiving or peeking
  94. /// a message.
  95. /// </para>
  96. /// </devdoc>
  97. [DefaultValueAttribute(true), MessagingDescription(Res.MsgAcknowledgement)]
  98. public bool Acknowledgment
  99. {
  100. get
  101. {
  102. return ((data1 & ACKNOWLEDGEMENT) != 0);
  103. }
  104. set
  105. {
  106. data1 = value ? data1 | ACKNOWLEDGEMENT : data1 & ~ACKNOWLEDGEMENT;
  107. }
  108. }
  109. /// <include file='doc\MessagePropertyFilter.uex' path='docs/doc[@for="MessagePropertyFilter.AcknowledgeType"]/*' />
  110. /// <devdoc>
  111. /// <para>
  112. /// Gets or sets a value indicating whether to retrieve <see cref='System.Messaging.Message.AcknowledgeType' qualify='true'/> property information when receiving or peeking
  113. /// a message.
  114. /// </para>
  115. /// </devdoc>
  116. [DefaultValueAttribute(true), MessagingDescription(Res.MsgAcknowledgeType)]
  117. public bool AcknowledgeType
  118. {
  119. get
  120. {
  121. return ((data1 & ACKNOWLEDGE_TYPE) != 0);
  122. }
  123. set
  124. {
  125. data1 = value ? data1 | ACKNOWLEDGE_TYPE : data1 & ~ACKNOWLEDGE_TYPE;
  126. }
  127. }
  128. /// <include file='doc\MessagePropertyFilter.uex' path='docs/doc[@for="MessagePropertyFilter.AdministrationQueue"]/*' />
  129. /// <devdoc>
  130. /// <para>
  131. /// Gets or sets a value indicating whether to retrieve <see cref='System.Messaging.Message.AdministrationQueue' qualify='true'/> property information when receiving or peeking
  132. /// a message.
  133. /// </para>
  134. /// </devdoc>
  135. [DefaultValueAttribute(true), MessagingDescription(Res.MsgAdministrationQueue)]
  136. public bool AdministrationQueue
  137. {
  138. get
  139. {
  140. return ((data1 & ADMIN_QUEUE) != 0);
  141. }
  142. set
  143. {
  144. data1 = value ? data1 | ADMIN_QUEUE : data1 & ~ADMIN_QUEUE;
  145. }
  146. }
  147. /// <include file='doc\MessagePropertyFilter.uex' path='docs/doc[@for="MessagePropertyFilter.AppSpecific"]/*' />
  148. /// <devdoc>
  149. /// <para>
  150. /// Gets or sets a value indicating whether to retrieve <see cref='System.Messaging.Message.AppSpecific' qualify='true'/> property information when receiving or peeking
  151. /// a message.
  152. /// </para>
  153. /// </devdoc>
  154. [DefaultValueAttribute(false), MessagingDescription(Res.MsgAppSpecific)]
  155. public bool AppSpecific
  156. {
  157. get
  158. {
  159. return ((data2 & APP_SPECIFIC) != 0);
  160. }
  161. set
  162. {
  163. data2 = value ? data2 | APP_SPECIFIC : data2 & ~APP_SPECIFIC;
  164. }
  165. }
  166. /// <include file='doc\MessagePropertyFilter.uex' path='docs/doc[@for="MessagePropertyFilter.ArrivedTime"]/*' />
  167. /// <devdoc>
  168. /// <para>
  169. /// Gets or sets a value indicating whether to retrieve <see cref='System.Messaging.Message.ArrivedTime' qualify='true'/> property information when receiving or peeking
  170. /// a message.
  171. /// </para>
  172. /// </devdoc>
  173. [DefaultValueAttribute(false), MessagingDescription(Res.MsgArrivedTime)]
  174. public bool ArrivedTime
  175. {
  176. get
  177. {
  178. return ((data2 & ARRIVED_TIME) != 0);
  179. }
  180. set
  181. {
  182. data2 = value ? data2 | ARRIVED_TIME : data2 & ~ARRIVED_TIME;
  183. }
  184. }
  185. /// <include file='doc\MessagePropertyFilter.uex' path='docs/doc[@for="MessagePropertyFilter.AttachSenderId"]/*' />
  186. /// <devdoc>
  187. /// <para>
  188. /// Gets or sets a value indicating whether to retrieve <see cref='System.Messaging.Message.AttachSenderId' qualify='true'/> property information when receiving or peeking
  189. /// a message.
  190. /// </para>
  191. /// </devdoc>
  192. [DefaultValueAttribute(false), MessagingDescription(Res.MsgAttachSenderId)]
  193. public bool AttachSenderId
  194. {
  195. get
  196. {
  197. return ((data2 & ATTACH_SENDER_ID) != 0);
  198. }
  199. set
  200. {
  201. data2 = value ? data2 | ATTACH_SENDER_ID : data2 & ~ATTACH_SENDER_ID;
  202. }
  203. }
  204. /// <include file='doc\MessagePropertyFilter.uex' path='docs/doc[@for="MessagePropertyFilter.Authenticated"]/*' />
  205. /// <devdoc>
  206. /// <para>
  207. /// Gets or sets a value indicating whether to retrieve <see cref='System.Messaging.Message.Authenticated' qualify='true'/> property information when receiving or peeking
  208. /// a message.
  209. /// </para>
  210. /// </devdoc>
  211. [DefaultValueAttribute(false), MessagingDescription(Res.MsgAuthenticated)]
  212. public bool Authenticated
  213. {
  214. get
  215. {
  216. return ((data2 & AUTHENTICATED) != 0);
  217. }
  218. set
  219. {
  220. data2 = value ? data2 | AUTHENTICATED : data2 & ~AUTHENTICATED;
  221. }
  222. }
  223. /// <include file='doc\MessagePropertyFilter.uex' path='docs/doc[@for="MessagePropertyFilter.AuthenticationProviderName"]/*' />
  224. /// <devdoc>
  225. /// <para>
  226. /// Gets or sets a value indicating whether to retrieve <see cref='System.Messaging.Message.AuthenticationProviderName' qualify='true'/> property information when receiving or peeking
  227. /// a message.
  228. /// </para>
  229. /// </devdoc>
  230. [DefaultValueAttribute(false), MessagingDescription(Res.MsgAuthenticationProviderName)]
  231. public bool AuthenticationProviderName
  232. {
  233. get
  234. {
  235. return ((data2 & CRYPTOGRAPHIC_PROVIDER_NAME) != 0);
  236. }
  237. set
  238. {
  239. data2 = value ? data2 | CRYPTOGRAPHIC_PROVIDER_NAME : data2 & ~CRYPTOGRAPHIC_PROVIDER_NAME;
  240. }
  241. }
  242. /// <include file='doc\MessagePropertyFilter.uex' path='docs/doc[@for="MessagePropertyFilter.AuthenticationProviderType"]/*' />
  243. /// <devdoc>
  244. /// <para>
  245. /// Gets or sets a value indicating whether to retrieve <see cref='System.Messaging.Message.AuthenticationProviderType' qualify='true'/> property information when receiving or peeking
  246. /// a message.
  247. /// </para>
  248. /// </devdoc>
  249. [DefaultValueAttribute(false), MessagingDescription(Res.MsgAuthenticationProviderType)]
  250. public bool AuthenticationProviderType
  251. {
  252. get
  253. {
  254. return ((data2 & CRYPTOGRAPHIC_PROVIDER_TYPE) != 0);
  255. }
  256. set
  257. {
  258. data2 = value ? data2 | CRYPTOGRAPHIC_PROVIDER_TYPE : data2 & ~CRYPTOGRAPHIC_PROVIDER_TYPE;
  259. }
  260. }
  261. /// <include file='doc\MessagePropertyFilter.uex' path='docs/doc[@for="MessagePropertyFilter.Body"]/*' />
  262. /// <devdoc>
  263. /// <para>
  264. /// Gets or sets a value indicating whether to retrieve <see cref='System.Messaging.Message.Body' qualify='true'/> property information when receiving or peeking
  265. /// a message.
  266. /// </para>
  267. /// </devdoc>
  268. [DefaultValueAttribute(true), MessagingDescription(Res.MsgBody)]
  269. public bool Body
  270. {
  271. get
  272. {
  273. return ((data1 & BODY) != 0);
  274. }
  275. set
  276. {
  277. data1 = value ? data1 | BODY : data1 & ~BODY;
  278. }
  279. }
  280. /// <include file='doc\MessagePropertyFilter.uex' path='docs/doc[@for="MessagePropertyFilter.ConnectorType"]/*' />
  281. /// <devdoc>
  282. /// <para>
  283. /// Gets or sets a value indicating whether to retrieve <see cref='System.Messaging.Message.ConnectorType' qualify='true'/> property information when receiving or peeking
  284. /// a message.
  285. /// </para>
  286. /// </devdoc>
  287. [DefaultValueAttribute(false), MessagingDescription(Res.MsgConnectorType)]
  288. public bool ConnectorType
  289. {
  290. get
  291. {
  292. return ((data2 & CONNECTOR_TYPE) != 0);
  293. }
  294. set
  295. {
  296. data2 = value ? data2 | CONNECTOR_TYPE : data2 & ~CONNECTOR_TYPE;
  297. }
  298. }
  299. /// <include file='doc\MessagePropertyFilter.uex' path='docs/doc[@for="MessagePropertyFilter.CorrelationId"]/*' />
  300. /// <devdoc>
  301. /// <para>
  302. /// Gets or sets a value indicating whether to retrieve <see cref='System.Messaging.Message.CorrelationId' qualify='true'/> property information when receiving or peeking
  303. /// a message.
  304. /// </para>
  305. /// </devdoc>
  306. [DefaultValueAttribute(false), MessagingDescription(Res.MsgCorrelationId)]
  307. public bool CorrelationId
  308. {
  309. get
  310. {
  311. return ((data2 & CORRELATION_ID) != 0);
  312. }
  313. set
  314. {
  315. data2 = value ? data2 | CORRELATION_ID : data2 & ~CORRELATION_ID;
  316. }
  317. }
  318. /// <include file='doc\MessagePropertyFilter.uex' path='docs/doc[@for="MessagePropertyFilter.DefaultBodySize"]/*' />
  319. /// <devdoc>
  320. /// <para>
  321. /// Gets
  322. /// or sets the size,
  323. /// in bytes, of the default body buffer.
  324. /// </para>
  325. /// </devdoc>
  326. [DefaultValueAttribute(MessagePropertyFilter.defaultBodySize), MessagingDescription(Res.MsgDefaultBodySize)]
  327. public int DefaultBodySize
  328. {
  329. get
  330. {
  331. return this.bodySize;
  332. }
  333. set
  334. {
  335. if (value < 0)
  336. throw new ArgumentException(Res.GetString(Res.DefaultSizeError));
  337. this.bodySize = value;
  338. }
  339. }
  340. /// <include file='doc\MessagePropertyFilter.uex' path='docs/doc[@for="MessagePropertyFilter.DefaultExtensionSize"]/*' />
  341. /// <devdoc>
  342. /// <para>
  343. /// Gets
  344. /// or sets the
  345. /// size, in bytes, of the default extension buffer.
  346. /// </para>
  347. /// </devdoc>
  348. [DefaultValueAttribute(MessagePropertyFilter.defaultExtensionSize), MessagingDescription(Res.MsgDefaultExtensionSize)]
  349. public int DefaultExtensionSize
  350. {
  351. get
  352. {
  353. return this.extensionSize;
  354. }
  355. set
  356. {
  357. if (value < 0)
  358. throw new ArgumentException(Res.GetString(Res.DefaultSizeError));
  359. this.extensionSize = value;
  360. }
  361. }
  362. /// <include file='doc\MessagePropertyFilter.uex' path='docs/doc[@for="MessagePropertyFilter.DefaultLabelSize"]/*' />
  363. /// <devdoc>
  364. /// <para>
  365. /// Gets
  366. /// or sets the size,
  367. /// in bytes, of the default label buffer.
  368. /// </para>
  369. /// </devdoc>
  370. [DefaultValueAttribute(MessagePropertyFilter.defaultLabelSize), MessagingDescription(Res.MsgDefaultLabelSize)]
  371. public int DefaultLabelSize
  372. {
  373. get
  374. {
  375. return this.labelSize;
  376. }
  377. set
  378. {
  379. if (value < 0)
  380. throw new ArgumentException(Res.GetString(Res.DefaultSizeError));
  381. this.labelSize = value;
  382. }
  383. }
  384. /// <include file='doc\MessagePropertyFilter.uex' path='docs/doc[@for="MessagePropertyFilter.DestinationQueue"]/*' />
  385. /// <devdoc>
  386. /// <para>
  387. /// Gets or sets a value indicating whether to retrieve <see cref='System.Messaging.Message.DestinationQueue' qualify='true'/> property information when receiving or peeking
  388. /// a message.
  389. /// </para>
  390. /// </devdoc>
  391. [DefaultValueAttribute(false), MessagingDescription(Res.MsgDestinationQueue)]
  392. public bool DestinationQueue
  393. {
  394. get
  395. {
  396. return ((data2 & DESTINATION_QUEUE) != 0);
  397. }
  398. set
  399. {
  400. data2 = value ? data2 | DESTINATION_QUEUE : data2 & ~DESTINATION_QUEUE;
  401. }
  402. }
  403. /// <include file='doc\MessagePropertyFilter.uex' path='docs/doc[@for="MessagePropertyFilter.DestinationSymmetricKey"]/*' />
  404. /// <devdoc>
  405. /// <para>
  406. /// Gets or sets a value indicating whether to retrieve
  407. /// <see cref='System.Messaging.Message.DestinationSymmetricKey' qualify='true'/> property information when receiving or peeking
  408. /// a message.
  409. /// </para>
  410. /// </devdoc>
  411. [DefaultValueAttribute(false), MessagingDescription(Res.MsgDestinationSymmetricKey)]
  412. public bool DestinationSymmetricKey
  413. {
  414. get
  415. {
  416. return ((data2 & SYMMETRIC_KEY) != 0);
  417. }
  418. set
  419. {
  420. data2 = value ? data2 | SYMMETRIC_KEY : data2 & ~SYMMETRIC_KEY;
  421. }
  422. }
  423. /// <include file='doc\MessagePropertyFilter.uex' path='docs/doc[@for="MessagePropertyFilter.DigitalSignature"]/*' />
  424. /// <devdoc>
  425. /// <para>
  426. /// Gets or sets a value indicating whether to retrieve <see cref='System.Messaging.Message.DigitalSignature' qualify='true'/> property information when receiving or peeking
  427. /// a message.
  428. /// </para>
  429. /// </devdoc>
  430. [DefaultValueAttribute(false), MessagingDescription(Res.MsgDigitalSignature)]
  431. public bool DigitalSignature
  432. {
  433. get
  434. {
  435. return ((data2 & DIGITAL_SIGNATURE) != 0);
  436. }
  437. set
  438. {
  439. data2 = value ? data2 | DIGITAL_SIGNATURE : data2 & ~DIGITAL_SIGNATURE;
  440. }
  441. }
  442. /// <include file='doc\MessagePropertyFilter.uex' path='docs/doc[@for="MessagePropertyFilter.EncryptionAlgorithm"]/*' />
  443. /// <devdoc>
  444. /// <para>
  445. /// Gets or sets a value indicating whether to retrieve <see cref='System.Messaging.Message.EncryptionAlgorithm' qualify='true'/> property information when receiving or peeking
  446. /// a message.
  447. /// </para>
  448. /// </devdoc>
  449. [DefaultValueAttribute(false), MessagingDescription(Res.MsgEncryptionAlgorithm)]
  450. public bool EncryptionAlgorithm
  451. {
  452. get
  453. {
  454. return ((data2 & ENCRYPTION_ALGORITHM) != 0);
  455. }
  456. set
  457. {
  458. data2 = value ? data2 | ENCRYPTION_ALGORITHM : data2 & ~ENCRYPTION_ALGORITHM;
  459. }
  460. }
  461. /// <include file='doc\MessagePropertyFilter.uex' path='docs/doc[@for="MessagePropertyFilter.Extension"]/*' />
  462. /// <devdoc>
  463. /// <para>
  464. /// Gets or sets a value indicating whether to retrieve <see cref='System.Messaging.Message.Extension' qualify='true'/> property information when receiving or peeking
  465. /// a message.
  466. /// </para>
  467. /// </devdoc>
  468. [DefaultValueAttribute(false), MessagingDescription(Res.MsgExtension)]
  469. public bool Extension
  470. {
  471. get
  472. {
  473. return ((data2 & EXTENSION) != 0);
  474. }
  475. set
  476. {
  477. data2 = value ? data2 | EXTENSION : data2 & ~EXTENSION;
  478. }
  479. }
  480. /// <include file='doc\MessagePropertyFilter.uex' path='docs/doc[@for="MessagePropertyFilter.HashAlgorithm"]/*' />
  481. /// <devdoc>
  482. /// <para>
  483. /// Gets or sets a value indicating whether to retrieve <see cref='System.Messaging.Message.HashAlgorithm' qualify='true'/> property information when receiving or peeking
  484. /// a message.
  485. /// </para>
  486. /// </devdoc>
  487. [DefaultValueAttribute(false), MessagingDescription(Res.MsgHashAlgorithm)]
  488. public bool HashAlgorithm
  489. {
  490. get
  491. {
  492. return ((data2 & HASH_ALGORITHM) != 0);
  493. }
  494. set
  495. {
  496. data2 = value ? data2 | HASH_ALGORITHM : data2 & ~HASH_ALGORITHM;
  497. }
  498. }
  499. /// <include file='doc\MessagePropertyFilter.uex' path='docs/doc[@for="MessagePropertyFilter.Id"]/*' />
  500. /// <devdoc>
  501. /// <para>
  502. /// Gets or sets a value indicating whether to retrieve <see cref='System.Messaging.Message.Id' qualify='true'/>
  503. /// property information when receiving or peeking a message.
  504. /// </para>
  505. /// </devdoc>
  506. [DefaultValueAttribute(true), MessagingDescription(Res.MsgId)]
  507. public bool Id
  508. {
  509. get
  510. {
  511. return ((data1 & ID) != 0);
  512. }
  513. set
  514. {
  515. data1 = value ? data1 | ID : data1 & ~ID;
  516. }
  517. }
  518. /// <include file='doc\MessagePropertyFilter.uex' path='docs/doc[@for="MessagePropertyFilter.IsFirstInTransaction"]/*' />
  519. /// <devdoc>
  520. /// <para>
  521. /// Gets or sets a value indicating whether to retrieve <see cref='System.Messaging.Message.IsFirstInTransaction' qualify='true'/> property information when receiving or peeking
  522. /// a message.
  523. /// </para>
  524. /// </devdoc>
  525. [DefaultValueAttribute(false), MessagingDescription(Res.MsgIsFirstInTransaction)]
  526. public bool IsFirstInTransaction
  527. {
  528. get
  529. {
  530. return ((data2 & IS_FIRST_IN_TRANSACTION) != 0);
  531. }
  532. set
  533. {
  534. data2 = value ? data2 | IS_FIRST_IN_TRANSACTION : data2 & ~IS_FIRST_IN_TRANSACTION;
  535. }
  536. }
  537. /// <include file='doc\MessagePropertyFilter.uex' path='docs/doc[@for="MessagePropertyFilter.IsLastInTransaction"]/*' />
  538. /// <devdoc>
  539. /// <para>
  540. /// Gets or sets a value indicating whether to retrieve <see cref='System.Messaging.Message.IsLastInTransaction' qualify='true'/> property information when receiving or peeking
  541. /// a message.
  542. /// </para>
  543. /// </devdoc>
  544. [DefaultValueAttribute(false), MessagingDescription(Res.MsgIsLastInTransaction)]
  545. public bool IsLastInTransaction
  546. {
  547. get
  548. {
  549. return ((data2 & IS_LAST_IN_TRANSACTION) != 0);
  550. }
  551. set
  552. {
  553. data2 = value ? data2 | IS_LAST_IN_TRANSACTION : data2 & ~IS_LAST_IN_TRANSACTION;
  554. }
  555. }
  556. /// <include file='doc\MessagePropertyFilter.uex' path='docs/doc[@for="MessagePropertyFilter.Label"]/*' />
  557. /// <devdoc>
  558. /// <para>
  559. /// Gets or sets a value indicating whether to retrieve <see cref='System.Messaging.Message.Label' qualify='true'/> property information when receiving or peeking
  560. /// a message.
  561. /// </para>
  562. /// </devdoc>
  563. [DefaultValueAttribute(true), MessagingDescription(Res.MsgLabel)]
  564. public bool Label
  565. {
  566. get
  567. {
  568. return ((data1 & LABEL) != 0);
  569. }
  570. set
  571. {
  572. data1 = value ? data1 | LABEL : data1 & ~LABEL;
  573. }
  574. }
  575. /// <include file='doc\MessagePropertyFilter.uex' path='docs/doc[@for="MessagePropertyFilter.LookupId"]/*' />
  576. /// <devdoc>
  577. /// <para>
  578. /// Gets or sets a value indicating whether to retrieve <see cref='System.Messaging.Message.LookupId' qualify='true'/> property information when receiving or peeking
  579. /// a message.
  580. /// </para>
  581. /// </devdoc>
  582. [DefaultValueAttribute(false), MessagingDescription(Res.MsgLookupId)]
  583. public bool LookupId
  584. {
  585. get
  586. {
  587. if (!MessageQueue.Msmq3OrNewer)
  588. throw new PlatformNotSupportedException(Res.GetString(Res.PlatformNotSupported));
  589. return ((data1 & LOOKUP_ID) != 0);
  590. }
  591. set
  592. {
  593. if (!MessageQueue.Msmq3OrNewer)
  594. throw new PlatformNotSupportedException(Res.GetString(Res.PlatformNotSupported));
  595. data1 = value ? data1 | LOOKUP_ID : data1 & ~LOOKUP_ID;
  596. }
  597. }
  598. /// <include file='doc\MessagePropertyFilter.uex' path='docs/doc[@for="MessagePropertyFilter.MessageType"]/*' />
  599. /// <devdoc>
  600. /// <para>
  601. /// Gets or sets a value indicating whether to retrieve <see cref='System.Messaging.Message.MessageType' qualify='true'/> property information when receiving or peeking
  602. /// a message.
  603. /// </para>
  604. /// </devdoc>
  605. [DefaultValueAttribute(true), MessagingDescription(Res.MsgMessageType)]
  606. public bool MessageType
  607. {
  608. get
  609. {
  610. return ((data1 & MESSAGE_TYPE) != 0);
  611. }
  612. set
  613. {
  614. data1 = value ? data1 | MESSAGE_TYPE : data1 & ~MESSAGE_TYPE;
  615. }
  616. }
  617. /// <include file='doc\MessagePropertyFilter.uex' path='docs/doc[@for="MessagePropertyFilter.Priority"]/*' />
  618. /// <devdoc>
  619. /// <para>
  620. /// Gets or sets a value indicating whether to retrieve <see cref='System.Messaging.Message.Priority' qualify='true'/> property information when receiving or peeking
  621. /// a message.
  622. /// </para>
  623. /// </devdoc>
  624. [DefaultValueAttribute(false), MessagingDescription(Res.MsgPriority)]
  625. public bool Priority
  626. {
  627. get
  628. {
  629. return ((data2 & PRIORITY) != 0);
  630. }
  631. set
  632. {
  633. data2 = value ? data2 | PRIORITY : data2 & ~PRIORITY;
  634. }
  635. }
  636. /// <include file='doc\MessagePropertyFilter.uex' path='docs/doc[@for="MessagePropertyFilter.Recoverable"]/*' />
  637. /// <devdoc>
  638. /// <para>
  639. /// Gets or sets a value indicating whether to retrieve <see cref='System.Messaging.Message.Recoverable' qualify='true'/> property information when receiving or peeking
  640. /// a message.
  641. /// </para>
  642. /// </devdoc>
  643. [DefaultValueAttribute(false), MessagingDescription(Res.MsgRecoverable)]
  644. public bool Recoverable
  645. {
  646. get
  647. {
  648. return ((data2 & IS_RECOVERABLE) != 0);
  649. }
  650. set
  651. {
  652. data2 = value ? data2 | IS_RECOVERABLE : data2 & ~IS_RECOVERABLE;
  653. }
  654. }
  655. /// <include file='doc\MessagePropertyFilter.uex' path='docs/doc[@for="MessagePropertyFilter.ResponseQueue"]/*' />
  656. /// <devdoc>
  657. /// <para>
  658. /// Gets or sets a value indicating whether to retrieve <see cref='System.Messaging.Message.ResponseQueue' qualify='true'/> property information when receiving or peeking
  659. /// a message.
  660. /// </para>
  661. /// </devdoc>
  662. [DefaultValueAttribute(true), MessagingDescription(Res.MsgResponseQueue)]
  663. public bool ResponseQueue
  664. {
  665. get
  666. {
  667. return ((data1 & RESPONSE_QUEUE) != 0);
  668. }
  669. set
  670. {
  671. data1 = value ? data1 | RESPONSE_QUEUE : data1 & ~RESPONSE_QUEUE;
  672. }
  673. }
  674. // SecurityContext is send-only property, so there's no point in
  675. // publicly exposing it in the filter
  676. internal bool SecurityContext
  677. {
  678. get
  679. {
  680. return ((data2 & SECURITY_CONTEXT) != 0);
  681. }
  682. set
  683. {
  684. data2 = value ? data2 | SECURITY_CONTEXT : data2 & ~SECURITY_CONTEXT;
  685. }
  686. }
  687. /// <include file='doc\MessagePropertyFilter.uex' path='docs/doc[@for="MessagePropertyFilter.SenderCertificate"]/*' />
  688. /// <devdoc>
  689. /// <para>
  690. /// Gets or sets a value indicating whether to retrieve <see cref='System.Messaging.Message.SenderCertificate' qualify='true'/> property information when receiving or peeking
  691. /// a message.
  692. /// </para>
  693. /// </devdoc>
  694. [DefaultValueAttribute(false), MessagingDescription(Res.MsgSenderCertificate)]
  695. public bool SenderCertificate
  696. {
  697. get
  698. {
  699. return ((data2 & SENDER_CERTIFICATE) != 0);
  700. }
  701. set
  702. {
  703. data2 = value ? data2 | SENDER_CERTIFICATE : data2 & ~SENDER_CERTIFICATE;
  704. }
  705. }
  706. /// <include file='doc\MessagePropertyFilter.uex' path='docs/doc[@for="MessagePropertyFilter.SenderId"]/*' />
  707. /// <devdoc>
  708. /// <para>
  709. /// Gets or sets a value indicating whether to retrieve <see cref='System.Messaging.Message.SenderId' qualify='true'/> property information when receiving or peeking
  710. /// a message.
  711. /// </para>
  712. /// </devdoc>
  713. [DefaultValueAttribute(false), MessagingDescription(Res.MsgSenderId)]
  714. public bool SenderId
  715. {
  716. get
  717. {
  718. return ((data2 & SENDER_ID) != 0);
  719. }
  720. set
  721. {
  722. data2 = value ? data2 | SENDER_ID : data2 & ~SENDER_ID;
  723. }
  724. }
  725. /// <include file='doc\MessagePropertyFilter.uex' path='docs/doc[@for="MessagePropertyFilter.SenderVersion"]/*' />
  726. /// <devdoc>
  727. /// <para>
  728. /// Gets or sets a value indicating whether to retrieve <see cref='System.Messaging.Message.SenderVersion' qualify='true'/> property information when receiving or peeking
  729. /// a message.
  730. /// </para>
  731. /// </devdoc>
  732. [DefaultValueAttribute(false), MessagingDescription(Res.MsgSenderVersion)]
  733. public bool SenderVersion
  734. {
  735. get
  736. {
  737. return ((data2 & VERSION) != 0);
  738. }
  739. set
  740. {
  741. data2 = value ? data2 | VERSION : data2 & ~VERSION;
  742. }
  743. }
  744. /// <include file='doc\MessagePropertyFilter.uex' path='docs/doc[@for="MessagePropertyFilter.SentTime"]/*' />
  745. /// <devdoc>
  746. /// <para>
  747. /// Gets or sets a value indicating whether to retrieve <see cref='System.Messaging.Message.SentTime' qualify='true'/> property information when receiving or peeking
  748. /// a message.
  749. /// </para>
  750. /// </devdoc>
  751. [DefaultValueAttribute(false), MessagingDescription(Res.MsgSentTime)]
  752. public bool SentTime
  753. {
  754. get
  755. {
  756. return ((data2 & SENT_TIME) != 0);
  757. }
  758. set
  759. {
  760. data2 = value ? data2 | SENT_TIME : data2 & ~SENT_TIME;
  761. }
  762. }
  763. /// <include file='doc\MessagePropertyFilter.uex' path='docs/doc[@for="MessagePropertyFilter.SourceMachine"]/*' />
  764. /// <devdoc>
  765. /// <para>
  766. /// Gets or sets a value indicating whether to retrieve <see cref='System.Messaging.Message.SourceMachine' qualify='true'/> property information when receiving or peeking
  767. /// a message.
  768. /// </para>
  769. /// </devdoc>
  770. [DefaultValueAttribute(false), MessagingDescription(Res.MsgSourceMachine)]
  771. public bool SourceMachine
  772. {
  773. get
  774. {
  775. return ((data2 & SOURCE_MACHINE) != 0);
  776. }
  777. set
  778. {
  779. data2 = value ? data2 | SOURCE_MACHINE : data2 & ~SOURCE_MACHINE;
  780. }
  781. }
  782. /// <include file='doc\MessagePropertyFilter.uex' path='docs/doc[@for="MessagePropertyFilter.TimeToBeReceived"]/*' />
  783. /// <devdoc>
  784. /// <para>
  785. /// Gets or sets a value indicating whether to retrieve <see cref='System.Messaging.Message.TimeToBeReceived' qualify='true'/> property information when receiving or peeking
  786. /// a message.
  787. /// </para>
  788. /// </devdoc>
  789. [DefaultValueAttribute(false), MessagingDescription(Res.MsgTimeToBeReceived)]
  790. public bool TimeToBeReceived
  791. {
  792. get
  793. {
  794. return ((data2 & TIME_TO_BE_RECEIVED) != 0);
  795. }
  796. set
  797. {
  798. data2 = value ? data2 | TIME_TO_BE_RECEIVED : data2 & ~TIME_TO_BE_RECEIVED;
  799. }
  800. }
  801. /// <include file='doc\MessagePropertyFilter.uex' path='docs/doc[@for="MessagePropertyFilter.TimeToReachQueue"]/*' />
  802. /// <devdoc>
  803. /// <para>
  804. /// Gets or sets a value indicating whether to retrieve <see cref='System.Messaging.Message.TimeToReachQueue' qualify='true'/> property information when receiving or peeking
  805. /// a message.
  806. /// </para>
  807. /// </devdoc>
  808. [DefaultValueAttribute(false), MessagingDescription(Res.MsgTimeToReachQueue)]
  809. public bool TimeToReachQueue
  810. {
  811. get
  812. {
  813. return ((data2 & TIME_TO_REACH_QUEUE) != 0);
  814. }
  815. set
  816. {
  817. data2 = value ? data2 | TIME_TO_REACH_QUEUE : data2 & ~TIME_TO_REACH_QUEUE;
  818. }
  819. }
  820. /// <include file='doc\MessagePropertyFilter.uex' path='docs/doc[@for="MessagePropertyFilter.TransactionId"]/*' />
  821. /// <devdoc>
  822. /// <para>
  823. /// Gets or sets a value indicating whether to retrieve <see cref='System.Messaging.Message.TransactionId' qualify='true'/> property information when receiving or peeking
  824. /// a message.
  825. /// </para>
  826. /// </devdoc>
  827. [DefaultValueAttribute(false), MessagingDescription(Res.MsgTransactionId)]
  828. public bool TransactionId
  829. {
  830. get
  831. {
  832. return ((data2 & TRANSACTION_ID) != 0);
  833. }
  834. set
  835. {
  836. data2 = value ? data2 | TRANSACTION_ID : data2 & ~TRANSACTION_ID;
  837. }
  838. }
  839. /// <include file='doc\MessagePropertyFilter.uex' path='docs/doc[@for="MessagePropertyFilter.TransactionStatusQueue"]/*' />
  840. /// <devdoc>
  841. /// <para>
  842. /// Gets or sets a value indicating whether to retrieve <see cref='System.Messaging.Message.TransactionStatusQueue' qualify='true'/> property information when receiving or peeking
  843. /// a message.
  844. /// </para>
  845. /// </devdoc>
  846. [DefaultValueAttribute(false), MessagingDescription(Res.MsgTransactionStatusQueue)]
  847. public bool TransactionStatusQueue
  848. {
  849. get
  850. {
  851. return ((data2 & FOREIGN_ADMIN_QUEUE) != 0);
  852. }
  853. set
  854. {
  855. data2 = value ? data2 | FOREIGN_ADMIN_QUEUE : data2 & ~FOREIGN_ADMIN_QUEUE;
  856. }
  857. }
  858. /// <include file='doc\MessagePropertyFilter.uex' path='docs/doc[@for="MessagePropertyFilter.UseAuthentication"]/*' />
  859. /// <devdoc>
  860. /// <para>
  861. /// Gets or sets a value indicating whether to retrieve <see cref='System.Messaging.Message.UseAuthentication' qualify='true'/> property information when receiving or peeking
  862. /// a message.
  863. /// </para>
  864. /// </devdoc>
  865. [DefaultValueAttribute(false), MessagingDescription(Res.MsgUseAuthentication)]
  866. public bool UseAuthentication
  867. {
  868. get
  869. {
  870. return ((data2 & USE_AUTHENTICATION) != 0);
  871. }
  872. set
  873. {
  874. data2 = value ? data2 | USE_AUTHENTICATION : data2 & ~USE_AUTHENTICATION;
  875. }
  876. }
  877. /// <include file='doc\MessagePropertyFilter.uex' path='docs/doc[@for="MessagePropertyFilter.UseDeadLetterQueue"]/*' />
  878. /// <devdoc>
  879. /// <para>
  880. /// Gets or sets a value indicating whether to retrieve <see cref='System.Messaging.Message.UseDeadLetterQueue' qualify='true'/> property information when receiving or peeking
  881. /// a message.
  882. /// </para>
  883. /// </devdoc>
  884. [DefaultValueAttribute(true), MessagingDescription(Res.MsgUseDeadLetterQueue)]
  885. public bool UseDeadLetterQueue
  886. {
  887. get
  888. {
  889. return ((data1 & USE_DEADLETTER_QUEUE) != 0);
  890. }
  891. set
  892. {
  893. data1 = value ? data1 | USE_DEADLETTER_QUEUE : data1 & ~USE_DEADLETTER_QUEUE;
  894. }
  895. }
  896. /// <include file='doc\MessagePropertyFilter.uex' path='docs/doc[@for="MessagePropertyFilter.UseEncryption"]/*' />
  897. /// <devdoc>
  898. /// <para>
  899. /// Gets or sets a value indicating whether to retrieve <see cref='System.Messaging.Message.UseEncryption' qualify='true'/> property information when receiving or peeking
  900. /// a message.
  901. /// </para>
  902. /// </devdoc>
  903. [DefaultValueAttribute(false), MessagingDescription(Res.MsgUseEncryption)]
  904. public bool UseEncryption
  905. {
  906. get
  907. {
  908. return ((data2 & USE_ENCRYPTION) != 0);
  909. }
  910. set
  911. {
  912. data2 = value ? data2 | USE_ENCRYPTION : data2 & ~USE_ENCRYPTION;
  913. }
  914. }
  915. /// <include file='doc\MessagePropertyFilter.uex' path='docs/doc[@for="MessagePropertyFilter.UseJournalQueue"]/*' />
  916. /// <devdoc>
  917. /// <para>
  918. /// Gets or sets a value indicating whether to retrieve <see cref='System.Messaging.Message.UseJournalQueue' qualify='true'/> property information when receiving or peeking
  919. /// a message.
  920. /// </para>
  921. /// </devdoc>
  922. [DefaultValueAttribute(true), MessagingDescription(Res.MsgUseJournalQueue)]
  923. public bool UseJournalQueue
  924. {
  925. get
  926. {
  927. return ((data1 & USE_JOURNALING) != 0);
  928. }
  929. set
  930. {
  931. data1 = value ? data1 | USE_JOURNALING : data2 & ~USE_JOURNALING;
  932. }
  933. }
  934. /// <include file='doc\MessagePropertyFilter.uex' path='docs/doc[@for="MessagePropertyFilter.UseTracing"]/*' />
  935. /// <devdoc>
  936. /// <para>
  937. /// Gets or sets a value indicating whether to retrieve <see cref='System.Messaging.Message.UseTracing' qualify='true'/> property information when receiving or peeking
  938. /// a message.
  939. /// </para>
  940. /// </devdoc>
  941. [DefaultValueAttribute(false), MessagingDescription(Res.MsgUseTracing)]
  942. public bool UseTracing
  943. {
  944. get
  945. {
  946. return ((data2 & USE_TRACING) != 0);
  947. }
  948. set
  949. {
  950. data2 = value ? data2 | USE_TRACING : data2 & ~USE_TRACING;
  951. }
  952. }
  953. /// <include file='doc\MessagePropertyFilter.uex' path='docs/doc[@for="MessagePropertyFilter.ClearAll"]/*' />
  954. /// <devdoc>
  955. /// <para>
  956. /// Specifies not to retrieve
  957. /// any message properties when receiving a message.
  958. /// </para>
  959. /// </devdoc>
  960. public void ClearAll()
  961. {
  962. data1 = 0;
  963. data2 = 0;
  964. }
  965. /// <include file='doc\MessagePropertyFilter.uex' path='docs/doc[@for="MessagePropertyFilter.SetDefaults"]/*' />
  966. /// <devdoc>
  967. /// <para>
  968. /// Filters on the message properties that the
  969. /// constructor sets to <see langword='true'/>
  970. /// .
  971. /// </para>
  972. /// </devdoc>
  973. public void SetDefaults()
  974. {
  975. data1 = ACKNOWLEDGEMENT |
  976. ACKNOWLEDGE_TYPE |
  977. ADMIN_QUEUE |
  978. BODY |
  979. ID |
  980. LABEL |
  981. USE_DEADLETTER_QUEUE |
  982. RESPONSE_QUEUE |
  983. MESSAGE_TYPE |
  984. USE_JOURNALING |
  985. LOOKUP_ID;
  986. data2 = 0;
  987. DefaultBodySize = defaultBodySize;
  988. DefaultExtensionSize = defaultExtensionSize;
  989. DefaultLabelSize = defaultLabelSize;
  990. }
  991. /// <include file='doc\MessagePropertyFilter.uex' path='docs/doc[@for="MessagePropertyFilter.SetAll"]/*' />
  992. /// <devdoc>
  993. /// <para>
  994. /// Specifies to retrieve all
  995. /// message properties when receiving a message.
  996. /// </para>
  997. /// </devdoc>
  998. public void SetAll()
  999. {
  1000. data1 = ACKNOWLEDGEMENT |
  1001. ACKNOWLEDGE_TYPE |
  1002. ADMIN_QUEUE |
  1003. BODY |
  1004. ID |
  1005. LABEL |
  1006. USE_DEADLETTER_QUEUE |
  1007. RESPONSE_QUEUE |
  1008. MESSAGE_TYPE |
  1009. USE_JOURNALING |
  1010. LOOKUP_ID;
  1011. data2 = APP_SPECIFIC |
  1012. ARRIVED_TIME |
  1013. ATTACH_SENDER_ID |
  1014. AUTHENTICATED |
  1015. CONNECTOR_TYPE |
  1016. CORRELATION_ID |
  1017. CRYPTOGRAPHIC_PROVIDER_NAME |
  1018. CRYPTOGRAPHIC_PROVIDER_TYPE |
  1019. IS_RECOVERABLE |
  1020. DESTINATION_QUEUE |
  1021. DIGITAL_SIGNATURE |
  1022. ENCRYPTION_ALGORITHM |
  1023. EXTENSION |
  1024. FOREIGN_ADMIN_QUEUE |
  1025. HASH_ALGORITHM |
  1026. PRIORITY |
  1027. SECURITY_CONTEXT |
  1028. SENDER_CERTIFICATE |
  1029. SENDER_ID |
  1030. SENT_TIME |
  1031. SOURCE_MACHINE |
  1032. SYMMETRIC_KEY |
  1033. TIME_TO_BE_RECEIVED |
  1034. TIME_TO_REACH_QUEUE |
  1035. USE_AUTHENTICATION |
  1036. USE_ENCRYPTION |
  1037. USE_TRACING |
  1038. VERSION |
  1039. IS_FIRST_IN_TRANSACTION |
  1040. IS_LAST_IN_TRANSACTION |
  1041. TRANSACTION_ID;
  1042. }
  1043. public virtual object Clone()
  1044. {
  1045. return this.MemberwiseClone();
  1046. }
  1047. }
  1048. }