XmlFormatter.cs 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. using System;
  2. using System.IO;
  3. using System.Xml;
  4. namespace System.Runtime.Serialization
  5. {
  6. public sealed class XmlFormatter : IFormatter
  7. {
  8. StreamingContext context;
  9. SerializationMode mode;
  10. KnownTypeCollection knownTypes;
  11. IDataContractSurrogate surrogate;
  12. int maxItems;
  13. public XmlFormatter ()
  14. {
  15. }
  16. public XmlFormatter (SerializationMode mode)
  17. {
  18. }
  19. public XmlFormatter (StreamingContext context)
  20. {
  21. }
  22. public XmlFormatter (SerializationMode mode,
  23. StreamingContext context)
  24. {
  25. }
  26. public XmlFormatter (SerializationMode mode,
  27. StreamingContext context, KnownTypeCollection knownTypes)
  28. {
  29. }
  30. SerializationBinder IFormatter.Binder {
  31. get { throw new NotImplementedException (); }
  32. set { throw new NotImplementedException (); }
  33. }
  34. ISurrogateSelector IFormatter.SurrogateSelector {
  35. get { throw new NotImplementedException (); }
  36. set { throw new NotImplementedException (); }
  37. }
  38. public StreamingContext Context {
  39. get { return context; }
  40. set { context = value; }
  41. }
  42. public IDataContractSurrogate DataContractSurrogate {
  43. get { return surrogate; }
  44. set { surrogate = value; }
  45. }
  46. public KnownTypeCollection KnownTypes {
  47. get { return knownTypes; }
  48. }
  49. public int MaxItemsInObjectGraph {
  50. get { return maxItems; }
  51. set { maxItems= value; }
  52. }
  53. public SerializationMode Mode {
  54. get { return mode; }
  55. }
  56. object IFormatter.Deserialize (Stream stream)
  57. {
  58. return Deserialize (stream, null);
  59. }
  60. public object Deserialize (Stream stream, Type type)
  61. {
  62. return Deserialize (XmlReader.Create (stream), type);
  63. }
  64. public object Deserialize (XmlReader reader, Type type)
  65. {
  66. return Deserialize (reader, type, false);
  67. }
  68. public object Deserialize (XmlReader reader, Type type, bool readContentOnly)
  69. {
  70. throw new NotImplementedException ();
  71. }
  72. public T Deserialize<T> (Stream stream)
  73. {
  74. return (T) Deserialize (XmlReader.Create (stream), typeof (T));
  75. }
  76. public T Deserialize<T> (XmlReader reader)
  77. {
  78. return (T) Deserialize (reader, typeof (T), false);
  79. }
  80. public T Deserialize<T> (XmlReader reader, bool readContentOnly)
  81. {
  82. return (T) Deserialize (reader, typeof (T), readContentOnly);
  83. }
  84. public void Serialize (Stream stream, object graph)
  85. {
  86. Serialize (XmlWriter.Create (stream), graph);
  87. }
  88. public void Serialize (XmlWriter writer, object graph)
  89. {
  90. Serialize (writer, graph, null, true, false, true);
  91. }
  92. public void Serialize (XmlWriter writer, object graph,
  93. Type rootType, bool preserveObjectReferences,
  94. bool writeContentOnly,
  95. bool ignoreUnknownSerializationData)
  96. {
  97. throw new NotImplementedException ();
  98. }
  99. }
  100. }