GetPath() public abstract méthode

public abstract GetPath ( ) : string
Résultat string
Exemple #1
0
        private void LoadLogicClassRecord(string strName)
        {
            NFILogicClass xLogicClass = GetElement(strName);

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

                XmlDocument xmldoc = new XmlDocument();

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

                    byte[] data = Convert.FromBase64String(strContent);
                    string res  = System.Text.ASCIIEncoding.Default.GetString(data);

                    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;
                            string      strUpload = xRecordNode.Attributes["Upload"].Value;
                            bool        bUpload   = strUpload.Equals("1");
                            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.0);
                                }
                                break;

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

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

                                default:
                                    break;
                                }
                            }
                            NFIRecord xRecord = xLogicClass.GetRecordManager().AddRecord(strID, int.Parse(strRow), xValue);
                            xRecord.SetUpload(bUpload);
                        }
                    }
                }
            }
        }
        private void LoadLogicClassProperty(string strName)
        {
            NFILogicClass xLogicClass = GetElement(strName);

            if (null != xLogicClass)
            {
                string strLogicPath = mstrPath + 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();
                string res = System.Text.ASCIIEncoding.Default.GetString(data);

                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 NFGUID(0, 0));
                        xLogicClass.GetPropertyManager().AddProperty(strID.Value, xValue);
                    }
                    break;

                    default:
                        break;
                    }
                }
            }
        }