protected internal virtual SerializationConfig ParseSerialization(XmlNode node) { var serializationConfig = new SerializationConfig(); foreach (XmlNode child in node.ChildNodes) { string name = CleanNodeName(child); switch (name) { case "portable-version": serializationConfig.SetPortableVersion(GetIntegerValue(name, GetTextContent(child), 0)); break; case "check-class-def-errors": serializationConfig.SetCheckClassDefErrors(CheckTrue(GetTextContent(child))); break; case "use-native-byte-order": serializationConfig.SetUseNativeByteOrder(CheckTrue(GetTextContent(child))); break; case "byte-order": string bigEndian = GetTextContent(child); ByteOrder byteOrder = ByteOrder.GetByteOrder(bigEndian); serializationConfig.SetByteOrder(byteOrder); break; case "enable-compression": serializationConfig.SetEnableCompression(CheckTrue(GetTextContent(child))); break; case "enable-shared-object": serializationConfig.SetEnableSharedObject(CheckTrue(GetTextContent(child))); break; case "data-serializable-factories": FillDataSerializableFactories(child, serializationConfig); break; case "portable-factories": FillPortableFactories(child, serializationConfig); break; case "serializers": FillSerializers(child, serializationConfig); break; } } return(serializationConfig); }
private static void HandleSerialization(this SerializationConfig serializationConfig, XmlNode node) { foreach (XmlNode child in node.ChildNodes) { var name = CleanNodeName(child); switch (name) { case "portable-version": serializationConfig.PortableVersion = GetIntegerValue(name, GetTextContent(child), 0); break; case "check-class-def-errors": serializationConfig.CheckClassDefErrors = CheckTrue(GetTextContent(child)); break; case "use-native-byte-order": serializationConfig.UseNativeByteOrder = CheckTrue(GetTextContent(child)); break; case "byte-order": var bigEndian = GetTextContent(child); var byteOrder = ByteOrder.GetByteOrder(bigEndian); serializationConfig.ByteOrder = byteOrder; break; case "data-serializable-factories": serializationConfig.FillDataSerializableFactories(child); break; case "portable-factories": serializationConfig.FillPortableFactories(child); break; case "serializers": serializationConfig.FillSerializers(child); break; default: throw new InvalidConfigurationException($"Not supported xml tag {name}"); } } }