// This class supports serialization compatibility.
//
-#if NET_2_0
[Serializable]
private sealed class MLangEncoder : ISerializable, IObjectReference
{
return this.realObject;
}
}
-#else
- private sealed class MLangEncoder
- {
- private MLangEncoder ()
- {
- }
- }
-#endif
//
// .NET Framework 1.x uses this class for internal decoders.
// This class supports serialization compatibility.
//
-#if NET_2_0
[Serializable]
private sealed class MLangDecoder : ISerializable, IObjectReference
{
return this.realObject;
}
}
-#else
- private sealed class MLangDecoder
- {
- private MLangDecoder ()
- {
- }
- }
-#endif
private int codePage;
-#if NET_2_0
private bool isReadOnly;
private EncoderFallback encoderFallback;
private DecoderFallback decoderFallback;
-#endif
private Encoding realObject;
private MLangCodePageEncoding (SerializationInfo info, StreamingContext context)
this.codePage = (int) info.GetValue ("m_codePage", typeof (int));
-#if NET_2_0
try {
this.isReadOnly = (bool) info.GetValue ("m_isReadOnly", typeof (bool));
this.encoderFallback = (EncoderFallback) info.GetValue ("encoderFallback", typeof (EncoderFallback));
// .NET Framework 1.x has no fallbacks
this.isReadOnly = true;
}
-#endif
}
public void GetObjectData (SerializationInfo info, StreamingContext context)
if (this.realObject == null) {
Encoding encoding = Encoding.GetEncoding (this.codePage);
-#if NET_2_0
if (!this.isReadOnly) {
encoding = (Encoding) encoding.Clone ();
encoding.EncoderFallback = this.encoderFallback;
encoding.DecoderFallback = this.decoderFallback;
}
-#endif
-
this.realObject = encoding;
}