public static DhcpConfigurationUnmarshaller GetInstance()
        {
            if (instance == null)
            {
                instance = new DhcpConfigurationUnmarshaller();
            }

            return(instance);
        }
Example #2
0
        public DhcpOptions Unmarshall(XmlUnmarshallerContext context)
        {
            DhcpOptions dhcpOptions   = new DhcpOptions();
            int         originalDepth = context.CurrentDepth;
            int         targetDepth   = originalDepth + 1;

            if (context.IsStartOfDocument)
            {
                targetDepth += 1;
            }

            while (context.Read())
            {
                if (context.IsStartElement || context.IsAttribute)
                {
                    if (context.TestExpression("dhcpOptionsId", targetDepth))
                    {
                        dhcpOptions.DhcpOptionsId = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("dhcpConfigurationSet/item", targetDepth))
                    {
                        dhcpOptions.DhcpConfigurations.Add(DhcpConfigurationUnmarshaller.GetInstance().Unmarshall(context));

                        continue;
                    }
                    if (context.TestExpression("tagSet/item", targetDepth))
                    {
                        dhcpOptions.Tags.Add(TagUnmarshaller.GetInstance().Unmarshall(context));

                        continue;
                    }
                }
                else if (context.IsEndElement && context.CurrentDepth < originalDepth)
                {
                    return(dhcpOptions);
                }
            }



            return(dhcpOptions);
        }