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. using System.Runtime.InteropServices;
  12. namespace System.Runtime.Remoting.Channels
  13. {
  14. public class BinaryServerFormatterSinkProvider :
  15. IServerFormatterSinkProvider, IServerChannelSinkProvider
  16. {
  17. IServerChannelSinkProvider next = null;
  18. BinaryCore _binaryCore;
  19. #if NET_1_0
  20. internal static string[] AllowedProperties = new string [] { "includeVersions", "strictBinding" };
  21. #else
  22. internal 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. _binaryCore = new BinaryCore (this, properties, AllowedProperties);
  32. }
  33. public IServerChannelSinkProvider Next
  34. {
  35. get {
  36. return next;
  37. }
  38. set {
  39. next = value;
  40. }
  41. }
  42. #if NET_1_1
  43. [ComVisible(false)]
  44. public TypeFilterLevel TypeFilterLevel
  45. {
  46. get { return _binaryCore.TypeFilterLevel; }
  47. set
  48. {
  49. IDictionary props = (IDictionary) ((ICloneable)_binaryCore.Properties).Clone ();
  50. props ["typeFilterLevel"] = value;
  51. _binaryCore = new BinaryCore (this, props, 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. }