コード例 #1
0
        public override string QueryPropertyString(string strConfigName, string strPropertyName)
        {
            AFIElement xElement = GetElement(strConfigName);

            if (null != xElement)
            {
                return(xElement.QueryString(strPropertyName));
            }

            return("");
        }
コード例 #2
0
        public override double QueryPropertyDouble(string strConfigName, string strPropertyName)
        {
            AFIElement xElement = GetElement(strConfigName);

            if (null != xElement)
            {
                xElement.QueryDouble(strPropertyName);
            }

            return(0);
        }
コード例 #3
0
        public override float QueryPropertyFloat(string strConfigName, string strPropertyName)
        {
            AFIElement xElement = GetElement(strConfigName);

            if (null != xElement)
            {
                return(xElement.QueryFloat(strPropertyName));
            }

            return(0);
        }
コード例 #4
0
        public override bool AddElement(string strName, AFIElement xElement)
        {
            if (!mhtObject.ContainsKey(strName))
            {
                mhtObject.Add(strName, xElement);

                return(true);
            }

            return(false);
        }
コード例 #5
0
 public abstract bool AddElement(string strName, AFIElement xElement);
コード例 #6
0
        private void LoadInstanceElement(AFILogicClass xLogicClass)
        {
            string strLogicPath = mstrRootPath;

            strLogicPath += xLogicClass.GetInstance();

            XmlDocument xmldoc = new XmlDocument();

            xmldoc.Load(strLogicPath);
            /////////////////////////////////////////////////////////////////

            XmlNode xRoot = xmldoc.SelectSingleNode("XML");

            XmlNodeList xNodeList = xRoot.SelectNodes("Entry");

            for (int i = 0; i < xNodeList.Count; ++i)
            {
                //AFCLog.Instance.Log("Class:" + xLogicClass.GetName());

                XmlNode      xNodeClass = xNodeList.Item(i);
                XmlAttribute strID      = xNodeClass.Attributes["Id"];

                //AFCLog.Instance.Log("ClassID:" + strID.Value);

                AFIElement xElement = GetElement(strID.Value);
                if (null == xElement)
                {
                    xElement = new AFCElement();
                    AddElement(strID.Value, xElement);
                    xLogicClass.AddConfigName(strID.Value);

                    XmlAttributeCollection xCollection = xNodeClass.Attributes;
                    for (int j = 0; j < xCollection.Count; ++j)
                    {
                        XmlAttribute xAttribute = xCollection[j];
                        AFIProperty  xProperty  = xLogicClass.GetPropertyManager().GetProperty(xAttribute.Name);
                        if (null != xProperty)
                        {
                            AFIDataList.VARIANT_TYPE eType = xProperty.GetDataType();
                            switch (eType)
                            {
                            case AFIDataList.VARIANT_TYPE.VTYPE_INT:
                            {
                                AFIDataList xValue = new AFCDataList();
                                xValue.AddInt64(int.Parse(xAttribute.Value));
                                xElement.GetPropertyManager().AddProperty(xAttribute.Name, xValue);
                            }
                            break;

                            case AFIDataList.VARIANT_TYPE.VTYPE_FLOAT:
                            {
                                AFIDataList xValue = new AFCDataList();
                                xValue.AddFloat(float.Parse(xAttribute.Value));
                                xElement.GetPropertyManager().AddProperty(xAttribute.Name, xValue);
                            }
                            break;

                            case AFIDataList.VARIANT_TYPE.VTYPE_DOUBLE:
                            {
                                AFIDataList xValue = new AFCDataList();
                                xValue.AddDouble(double.Parse(xAttribute.Value));
                                xElement.GetPropertyManager().AddProperty(xAttribute.Name, xValue);
                            }
                            break;

                            case AFIDataList.VARIANT_TYPE.VTYPE_STRING:
                            {
                                AFIDataList xValue = new AFCDataList();
                                xValue.AddString(xAttribute.Value);
                                AFIProperty xTestProperty = xElement.GetPropertyManager().AddProperty(xAttribute.Name, xValue);
                            }
                            break;

                            case AFIDataList.VARIANT_TYPE.VTYPE_OBJECT:
                            {
                                AFIDataList xValue = new AFCDataList();
                                xValue.AddObject(new AFIDENTID(0, int.Parse(xAttribute.Value)));
                                xElement.GetPropertyManager().AddProperty(xAttribute.Name, xValue);
                            }
                            break;

                            default:
                                break;
                            }
                        }
                    }
                }
            }
        }