示例#1
0
        public override void LoadConfig(FXmlNode config)
        {
            FXmlNodes nodes = config.Nodes;

            if (nodes != null)
            {
                foreach (FXmlNode node in nodes)
                {
                    string flag = node[PTY_FLAG];
                    if (!RString.IsEmpty(flag))
                    {
                        if ("0".EndsWith(flag))
                        {
                            //_object0 = CreateObject(node);
                        }
                        else if ("1".EndsWith(flag))
                        {
                            //_object1 = CreateObject(node);
                        }
                        else
                        {
                            throw new FFatalException("Unknown flag. {0}", config.Dump());
                        }
                    }
                }
            }
        }
示例#2
0
        public override void LoadConfig(FXmlNode config)
        {
            // Id
            _id = config[PTY_ID];
            // Face
            _faceName = config[PTY_FACE];
            // Type
            _typeName = config[PTY_TYPE];
            // Scope
            string scope = config[PTY_SCOPE];

            if (!RString.IsEmpty(scope))
            {
                _scope = REnum.ToValue <EScope>(scope);
            }
            // Load config
            if (config.HasNode())
            {
                foreach (FXmlNode node in config.Nodes)
                {
                    if (node.IsName(XAopConstructor.TAG))
                    {
                        // Constructor
                        if (_constructor != null)
                        {
                            throw new FFatalException("Constructor can't be duplicate.\n{1}", config.Dump());
                        }
                        _constructor = new XAopConstructor();
                        _constructor.LoadConfig(node);
                    }
                    else if (node.IsName(XAopProperty.TAG))
                    {
                        // Properties
                        XAopProperty property = new XAopProperty();
                        property.LoadConfig(node);
                        _properties.Push(property);
                    }
                    else if (node.IsName(XAopInitialize.TAG))
                    {
                        // Initializes
                        XAopInitialize method = new XAopInitialize();
                        method.LoadConfig(node);
                        _initializes.Push(method);
                    }
                    else if (node.IsName(XAopRelease.TAG))
                    {
                        // Releases
                        XAopRelease method = new XAopRelease();
                        method.LoadConfig(node);
                        _releases.Push(method);
                    }
                }
            }
        }