Ejemplo n.º 1
0
        public bool Purge(string file)
        {
            string path = XTPath.NormalizePath(file);

            //string fullPath = Path.Combine(path, file);
            return(sm_caches.Remove(path));
        }
Ejemplo n.º 2
0
        public XTSimpleXMLSection Open(string file, bool create, Encoding enc)
        {
            XTSimpleXMLSection sect = null;

            file = XTPath.NormalizePath(file);
            string fullPath = System.IO.Path.Combine(this.m_root, file);

            if (sm_caches.ContainsKey(fullPath))
            {
                sect = sm_caches[fullPath];
            }
            if (sect == null)
            {
                string text = "";
                if (File.Exists(fullPath))
                {
                    StreamReader reader = new StreamReader(fullPath, enc);
                    text = reader.ReadToEnd();
                    reader.Close();
                }
                else if (create)
                {
                    string path = Path.GetDirectoryName(fullPath);
                    Directory.CreateDirectory(path);
                }
                else
                {
                    throw new System.IO.FileNotFoundException(
                              string.Format("xml file '{0}' is not exist!", file));
                }
                sect = Explain(fullPath, text);
                sm_caches[fullPath] = sect;
            }
            return(sect);
        }
Ejemplo n.º 3
0
 public XTSimpleXML(string root)
 {
     this.m_root = XTPath.NormalizePath(root);
 }