Esempio n. 1
0
        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}");
                }
            }
        }