BinaryServerFormatterSinkProvider.cs 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. //
  2. // System.Runtime.Remoting.Channels.BinaryServerFormatterSinkProvider.cs
  3. //
  4. // Author: Rodrigo Moya ([email protected])
  5. // Lluis Sanchez Gual ([email protected])
  6. //
  7. // 2002 (C) Copyright, Ximian, Inc.
  8. //
  9. using System.Collections;
  10. using System.Runtime.Serialization.Formatters;
  11. namespace System.Runtime.Remoting.Channels
  12. {
  13. public class BinaryServerFormatterSinkProvider :
  14. IServerFormatterSinkProvider, IServerChannelSinkProvider
  15. {
  16. IServerChannelSinkProvider next = null;
  17. BinaryCore _binaryCore;
  18. IDictionary _properties;
  19. #if NET_1_0
  20. static string[] allowedProperties = new string [] { "includeVersions", "strictBinding" };
  21. #else
  22. static string[] allowedProperties = new string [] { "includeVersions", "strictBinding", "typeFilterLevel" };
  23. #endif
  24. public BinaryServerFormatterSinkProvider ()
  25. {
  26. _binaryCore = BinaryCore.DefaultInstance;
  27. }
  28. public BinaryServerFormatterSinkProvider (IDictionary properties,
  29. ICollection providerData)
  30. {
  31. _properties = properties;
  32. _binaryCore = new BinaryCore (this, properties, allowedProperties);
  33. }
  34. public IServerChannelSinkProvider Next
  35. {
  36. get {
  37. return next;
  38. }
  39. set {
  40. next = value;
  41. }
  42. }
  43. #if NET_1_1
  44. public TypeFilterLevel TypeFilterLevel
  45. {
  46. get { return _binaryCore.TypeFilterLevel; }
  47. set
  48. {
  49. if (_properties == null) _properties = new Hashtable ();
  50. _properties ["typeFilterLevel"] = value;
  51. _binaryCore = new BinaryCore (this, _properties, allowedProperties);
  52. }
  53. }
  54. #endif
  55. public IServerChannelSink CreateSink (IChannelReceiver channel)
  56. {
  57. IServerChannelSink next_sink = null;
  58. BinaryServerFormatterSink result;
  59. if (next != null)
  60. next_sink = next.CreateSink (channel);
  61. result = new BinaryServerFormatterSink (BinaryServerFormatterSink.Protocol.Other,
  62. next_sink, channel);
  63. result.BinaryCore = _binaryCore;
  64. return result;
  65. }
  66. public void GetChannelData (IChannelDataStore channelData)
  67. {
  68. // Nothing to add here
  69. }
  70. }
  71. }