示例#1
0
        public static ScriptBootstrapActionConfigUnmarshaller GetInstance()
        {
            if (instance == null)
            {
                instance = new ScriptBootstrapActionConfigUnmarshaller();
            }

            return(instance);
        }
        public BootstrapActionConfig Unmarshall(UnmarshallerContext context)
        {
            BootstrapActionConfig bootstrapActionConfig = new BootstrapActionConfig();
            int originalDepth = context.CurrentDepth;
            int targetDepth   = originalDepth + 1;

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

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

                        continue;
                    }
                    if (context.TestExpression("ScriptBootstrapAction", targetDepth))
                    {
                        bootstrapActionConfig.ScriptBootstrapAction = ScriptBootstrapActionConfigUnmarshaller.GetInstance().Unmarshall(context);

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

            return(bootstrapActionConfig);
        }