Exemplo n.º 1
0
        void AddBasePropertyFormOther(string strName, string strOther)
        {
            NFILogicClass xOtherClass = GetElement(strOther);
            NFILogicClass xLogicClass = GetElement(strName);

            if (null != xLogicClass && null != xOtherClass)
            {
                NFIDataList xValue = xOtherClass.GetPropertyManager().GetPropertyList();
                for (int i = 0; i < xValue.Count(); ++i)
                {
                    NFIProperty xProperty = xOtherClass.GetPropertyManager().GetProperty(xValue.StringVal(i));
                    xLogicClass.GetPropertyManager().AddProperty(xValue.StringVal(i), xProperty.GetValue());
                }
            }
        }
Exemplo n.º 2
0
        public override bool Load()
        {
            mstrRootPath = "";
            ClearInstanceElement();

            Hashtable xTable = NFCLogicClassManager.Instance.GetElementList();

            foreach (DictionaryEntry de in xTable)
            {
                NFILogicClass xLogicClass = (NFILogicClass)de.Value;
                LoadInstanceElement(xLogicClass);
            }

            return(false);
        }
Exemplo n.º 3
0
        void InitRecord(NFIDENTID self, string strClassName)
        {
            NFILogicClass xLogicClass = NFCLogicClassManager.Instance.GetElement(strClassName);
            NFIDataList   xDataList   = xLogicClass.GetRecordManager().GetRecordList();

            for (int i = 0; i < xDataList.Count(); ++i)
            {
                string    strRecordyName = xDataList.StringVal(i);
                NFIRecord xRecord        = xLogicClass.GetRecordManager().GetRecord(strRecordyName);

                NFIObject        xObject        = GetObject(self);
                NFIRecordManager xRecordManager = xObject.GetRecordManager();

                xRecordManager.AddRecord(strRecordyName, xRecord.GetRows(), xRecord.GetColsData());
            }
        }
Exemplo n.º 4
0
        void InitProperty(NFIDENTID self, string strClassName)
        {
            NFILogicClass xLogicClass = NFCLogicClassManager.Instance.GetElement(strClassName);
            NFIDataList   xDataList   = xLogicClass.GetPropertyManager().GetPropertyList();

            for (int i = 0; i < xDataList.Count(); ++i)
            {
                string      strPropertyName = xDataList.StringVal(i);
                NFIProperty xProperty       = xLogicClass.GetPropertyManager().GetProperty(strPropertyName);

                NFIObject          xObject          = GetObject(self);
                NFIPropertyManager xPropertyManager = xObject.GetPropertyManager();

                xPropertyManager.AddProperty(strPropertyName, xProperty.GetValue());
            }
        }
Exemplo n.º 5
0
        private void LoadInstanceElement(NFILogicClass xLogicClass)
        {
            string strLogicPath = mstrRootPath;
            strLogicPath += xLogicClass.GetInstance();

            XmlDocument xmldoc = new XmlDocument();
            //xmldoc.Load(strLogicPath);
            ///////////////////////////////////////////////////////////////////////////////////////
            StreamReader cepherReader = new StreamReader(strLogicPath); ;
            string strContent = cepherReader.ReadToEnd();
            cepherReader.Close();

            byte[] data = Convert.FromBase64String(strContent);

            MemoryStream stream = new MemoryStream(data);
            XmlReader x = XmlReader.Create(stream);
            x.MoveToContent();
            string res = x.ReadOuterXml();

            xmldoc.LoadXml(res);
            /////////////////////////////////////////////////////////////////

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

            XmlNodeList xNodeList = xRoot.SelectNodes("Object");
            for (int i = 0; i < xNodeList.Count; ++i)
            {
                //NFCLog.Instance.Log("Class:" + xLogicClass.GetName());

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

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

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

                    XmlAttributeCollection xCollection = xNodeClass.Attributes;
                    for (int j = 0; j < xCollection.Count; ++j)
                    {
                        XmlAttribute xAttribute = xCollection[j];
                        NFIProperty xProperty = xLogicClass.GetPropertyManager().GetProperty(xAttribute.Name);
                        if (null != xProperty)
                        {
                            NFIDataList.VARIANT_TYPE eType = xProperty.GetType();
                            switch (eType)
                            {
                                case NFIDataList.VARIANT_TYPE.VTYPE_INT:
                                    {
                                        NFIDataList xValue = new NFCDataList();
                                        xValue.AddInt(int.Parse(xAttribute.Value));
                                        xElement.GetPropertyManager().AddProperty(xAttribute.Name, xValue);
                                    }
                                    break;
                                case NFIDataList.VARIANT_TYPE.VTYPE_FLOAT:
                                    {
                                        NFIDataList xValue = new NFCDataList();
                                        xValue.AddFloat(float.Parse(xAttribute.Value));
                                        xElement.GetPropertyManager().AddProperty(xAttribute.Name, xValue);
                                    }
                                    break;
                                case NFIDataList.VARIANT_TYPE.VTYPE_DOUBLE:
                                    {
                                        NFIDataList xValue = new NFCDataList();
                                        xValue.AddDouble(double.Parse(xAttribute.Value));
                                        xElement.GetPropertyManager().AddProperty(xAttribute.Name, xValue);
                                    }
                                    break;
                                case NFIDataList.VARIANT_TYPE.VTYPE_STRING:
                                    {
                                        NFIDataList xValue = new NFCDataList();
                                        xValue.AddString(xAttribute.Value);
                                        NFIProperty xTestProperty = xElement.GetPropertyManager().AddProperty(xAttribute.Name, xValue);
                                    }
                                    break;
                                case NFIDataList.VARIANT_TYPE.VTYPE_OBJECT:
                                    {
                                        NFIDataList xValue = new NFCDataList();
                                        xValue.AddObject(new NFIDENTID(0, int.Parse(xAttribute.Value)));
                                        xElement.GetPropertyManager().AddProperty(xAttribute.Name, xValue);
                                    }
                                    break;
                                default:
                                    break;
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 6
0
        private void LoadLogicClassRecord(string strName)
        {
            NFILogicClass xLogicClass = GetElement(strName);

            if (null != xLogicClass)
            {
                string strLogicPath = mstrRootPath + xLogicClass.GetPath();

                XmlDocument xmldoc = new XmlDocument();
                ///////////////////////////////////////////////////////////////////////////////////////
                if (mbCepher)
                {
                    StreamReader cepherReader = new StreamReader(strLogicPath);;
                    string       strContent   = cepherReader.ReadToEnd();
                    cepherReader.Close();

                    byte[] data = Convert.FromBase64String(strContent);

                    MemoryStream stream = new MemoryStream(data);
                    XmlReader    x      = XmlReader.Create(stream);
                    x.MoveToContent();
                    string res = x.ReadOuterXml();

                    xmldoc.LoadXml(res);
                }
                else
                {
                    xmldoc.Load(strLogicPath);
                }
                /////////////////////////////////////////////////////////////////
                XmlNode xRoot          = xmldoc.SelectSingleNode("XML");
                XmlNode xNodePropertys = xRoot.SelectSingleNode("Records");
                if (null != xNodePropertys)
                {
                    XmlNodeList xNodeList = xNodePropertys.SelectNodes("Record");
                    if (null != xNodeList)
                    {
                        for (int i = 0; i < xNodeList.Count; ++i)
                        {
                            XmlNode xRecordNode = xNodeList.Item(i);

                            string      strID  = xRecordNode.Attributes["Id"].Value;
                            string      strRow = xRecordNode.Attributes["Row"].Value;
                            NFIDataList xValue = new NFCDataList();

                            XmlNodeList xTagNodeList = xRecordNode.SelectNodes("Col");
                            for (int j = 0; j < xTagNodeList.Count; ++j)
                            {
                                XmlNode xColTagNode = xTagNodeList.Item(j);

                                XmlAttribute strTagID   = xColTagNode.Attributes["Tag"];
                                XmlAttribute strTagType = xColTagNode.Attributes["Type"];


                                switch (strTagType.Value)
                                {
                                case "int":
                                {
                                    xValue.AddInt(0);
                                }
                                break;

                                case "float":
                                {
                                    xValue.AddFloat(0.0f);
                                }
                                break;

                                case "double":
                                {
                                    xValue.AddDouble(0.0f);
                                }
                                break;

                                case "string":
                                {
                                    xValue.AddString("");
                                }
                                break;

                                case "object":
                                {
                                    xValue.AddObject(new NFIDENTID(0, 0));
                                }
                                break;

                                default:
                                    break;
                                }
                            }

                            xLogicClass.GetRecordManager().AddRecord(strID, int.Parse(strRow), xValue);
                        }
                    }
                }
            }
        }
Exemplo n.º 7
0
        private void LoadInstanceElement(NFILogicClass xLogicClass)
        {
            string strLogicPath = mstrRootPath;

            strLogicPath += xLogicClass.GetInstance();

            XmlDocument xmldoc = new XmlDocument();

            ///////////////////////////////////////////////////////////////////////////////////////
            if (NFCLogicClassManager.Instance.GetCepher())
            {
                StreamReader cepherReader = new StreamReader(strLogicPath);;
                string       strContent   = cepherReader.ReadToEnd();
                cepherReader.Close();

                byte[] data = Convert.FromBase64String(strContent);

                MemoryStream stream = new MemoryStream(data);
                XmlReader    x      = XmlReader.Create(stream);
                x.MoveToContent();
                string res = x.ReadOuterXml();

                xmldoc.LoadXml(res);
            }
            else
            {
                xmldoc.Load(strLogicPath);
            }
            /////////////////////////////////////////////////////////////////

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

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

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

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

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

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

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

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

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

                            case NFIDataList.VARIANT_TYPE.VTYPE_STRING:
                            {
                                NFIDataList xValue = new NFCDataList();
                                xValue.AddString(xAttribute.Value);
                                NFIProperty xTestProperty = xElement.GetPropertyManager().AddProperty(xAttribute.Name, xValue);
                            }
                            break;

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

                            default:
                                break;
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 8
0
        private void LoadLogicClassRecord(string strName)
        {
            NFILogicClass xLogicClass = GetElement(strName);

            if (null != xLogicClass)
            {
                string strLogicPath = xLogicClass.GetPath();

                XmlDocument xmldoc = new XmlDocument();

                xmldoc.Load(strLogicPath);
                XmlNode xRoot          = xmldoc.SelectSingleNode("XML");
                XmlNode xNodePropertys = xRoot.SelectSingleNode("Records");
                if (null != xNodePropertys)
                {
                    XmlNodeList xNodeList = xNodePropertys.SelectNodes("Record");
                    if (null != xNodeList)
                    {
                        for (int i = 0; i < xNodeList.Count; ++i)
                        {
                            XmlNode xRecordNode = xNodeList.Item(i);

                            string      strID  = xRecordNode.Attributes["Id"].Value;
                            string      strRow = xRecordNode.Attributes["Row"].Value;
                            NFIDataList xValue = new NFCDataList();

                            XmlNodeList xTagNodeList = xRecordNode.SelectNodes("Col");
                            for (int j = 0; j < xTagNodeList.Count; ++j)
                            {
                                XmlNode xColTagNode = xTagNodeList.Item(j);

                                XmlAttribute strTagID   = xColTagNode.Attributes["Tag"];
                                XmlAttribute strTagType = xColTagNode.Attributes["Type"];


                                switch (strTagType.Value)
                                {
                                case "int":
                                {
                                    xValue.AddInt(0);
                                }
                                break;

                                case "float":
                                {
                                    xValue.AddFloat(0.0f);
                                }
                                break;

                                case "double":
                                {
                                    xValue.AddDouble(0.0f);
                                }
                                break;

                                case "string":
                                {
                                    xValue.AddString("");
                                }
                                break;

                                case "object":
                                {
                                    xValue.AddObject(new NFIDENTID(0, 0));
                                }
                                break;

                                default:
                                    break;
                                }
                            }

                            xLogicClass.GetRecordManager().AddRecord(strID, int.Parse(strRow), xValue);
                        }
                    }
                }
            }
        }
Exemplo n.º 9
0
        private void LoadLogicClassProperty(string strName)
        {
            NFILogicClass xLogicClass = GetElement(strName);

            if (null != xLogicClass)
            {
                string strLogicPath = xLogicClass.GetPath();

                XmlDocument xmldoc = new XmlDocument();

                xmldoc.Load(strLogicPath);
                XmlNode     xRoot          = xmldoc.SelectSingleNode("XML");
                XmlNode     xNodePropertys = xRoot.SelectSingleNode("Propertys");
                XmlNodeList xNodeList      = xNodePropertys.SelectNodes("Property");
                for (int i = 0; i < xNodeList.Count; ++i)
                {
                    XmlNode      xPropertyNode = xNodeList.Item(i);
                    XmlAttribute strID         = xPropertyNode.Attributes["Id"];
                    XmlAttribute strType       = xPropertyNode.Attributes["Type"];

                    switch (strType.Value)
                    {
                    case "int":
                    {
                        NFIDataList xValue = new NFCDataList();
                        xValue.AddInt(0);
                        xLogicClass.GetPropertyManager().AddProperty(strID.Value, xValue);
                    }
                    break;

                    case "float":
                    {
                        NFIDataList xValue = new NFCDataList();
                        xValue.AddFloat(0.0f);
                        xLogicClass.GetPropertyManager().AddProperty(strID.Value, xValue);
                    }
                    break;

                    case "double":
                    {
                        NFIDataList xValue = new NFCDataList();
                        xValue.AddDouble(0.0f);
                        xLogicClass.GetPropertyManager().AddProperty(strID.Value, xValue);
                    }
                    break;

                    case "string":
                    {
                        NFIDataList xValue = new NFCDataList();
                        xValue.AddString("");
                        xLogicClass.GetPropertyManager().AddProperty(strID.Value, xValue);
                    }
                    break;

                    case "object":
                    {
                        NFIDataList xValue = new NFCDataList();
                        xValue.AddObject(new NFIDENTID(0, 0));
                        xLogicClass.GetPropertyManager().AddProperty(strID.Value, xValue);
                    }
                    break;

                    default:
                        break;
                    }
                }
            }
        }
Exemplo n.º 10
0
        private void LoadInstanceElement(NFILogicClass xLogicClass)
        {
            string strLogicPath = mstrRootPath;

            strLogicPath += xLogicClass.GetInstance();

            XmlDocument xmldoc = new XmlDocument();

            xmldoc.Load(strLogicPath);

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

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

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

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

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

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

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

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

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

                            case NFIDataList.VARIANT_TYPE.VTYPE_STRING:
                            {
                                NFIDataList xValue = new NFCDataList();
                                xValue.AddString(xAttribute.Value);
                                NFIProperty xTestProperty = xElement.GetPropertyManager().AddProperty(xAttribute.Name, xValue);
                            }
                            break;

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

                            default:
                                break;
                            }
                        }
                    }
                }
            }
        }
        private void LoadLogicClassProperty(string strName)
        {
            NFILogicClass xLogicClass = GetElement(strName);

            if (null != xLogicClass)
            {
                string strLogicPath = xLogicClass.GetPath();

                XmlDocument xmldoc = new XmlDocument();

                //xmldoc.Load(strLogicPath);
                ///////////////////////////////////////////////////////////////////////////////////////
                StreamReader cepherReader = new StreamReader(strLogicPath);;
                string       strContent   = cepherReader.ReadToEnd();
                cepherReader.Close();

                byte[] data = Convert.FromBase64String(strContent);

                MemoryStream stream = new MemoryStream(data);
                XmlReader    x      = XmlReader.Create(stream);
                x.MoveToContent();
                string res = x.ReadOuterXml();

                xmldoc.LoadXml(res);
                /////////////////////////////////////////////////////////////////

                XmlNode     xRoot          = xmldoc.SelectSingleNode("XML");
                XmlNode     xNodePropertys = xRoot.SelectSingleNode("Propertys");
                XmlNodeList xNodeList      = xNodePropertys.SelectNodes("Property");
                for (int i = 0; i < xNodeList.Count; ++i)
                {
                    XmlNode      xPropertyNode = xNodeList.Item(i);
                    XmlAttribute strID         = xPropertyNode.Attributes["Id"];
                    XmlAttribute strType       = xPropertyNode.Attributes["Type"];

                    switch (strType.Value)
                    {
                    case "int":
                    {
                        NFIDataList xValue = new NFCDataList();
                        xValue.AddInt(0);
                        xLogicClass.GetPropertyManager().AddProperty(strID.Value, xValue);
                    }
                    break;

                    case "float":
                    {
                        NFIDataList xValue = new NFCDataList();
                        xValue.AddFloat(0.0f);
                        xLogicClass.GetPropertyManager().AddProperty(strID.Value, xValue);
                    }
                    break;

                    case "double":
                    {
                        NFIDataList xValue = new NFCDataList();
                        xValue.AddDouble(0.0f);
                        xLogicClass.GetPropertyManager().AddProperty(strID.Value, xValue);
                    }
                    break;

                    case "string":
                    {
                        NFIDataList xValue = new NFCDataList();
                        xValue.AddString("");
                        xLogicClass.GetPropertyManager().AddProperty(strID.Value, xValue);
                    }
                    break;

                    case "object":
                    {
                        NFIDataList xValue = new NFCDataList();
                        xValue.AddObject(new NFIDENTID(0, 0));
                        xLogicClass.GetPropertyManager().AddProperty(strID.Value, xValue);
                    }
                    break;

                    default:
                        break;
                    }
                }
            }
        }