Exemplo n.º 1
0
        private int genPageFile(string url, string file)
        {
            string webPath  = string.Format("{0}{1}", this.tbWebRootPath.Text.Trim(), url.Trim());
            string filePath = string.Format("{0}{1}", this.tbRootPath.Text.Trim(), file);
            string context  = "";

            try
            {
                context = NetClientUtil.doGet(webPath);
            }catch (Exception ex) {
                return(0);
            }
            FileInfo fileInfo = new FileInfo(filePath);

            string dirPath = fileInfo.Directory.ToString();

            FileUtil.CreateFolder(dirPath);
            if (FileUtil.WriteFile(filePath, context))
            {
                return(1);
            }
            else
            {
                return(0);
            }
        }
Exemplo n.º 2
0
        protected static XmlDocument GetDoc(string path)
        {
            XmlDocument doc = new XmlDocument();

            if (CACHE_DOC.ContainsKey(path))
            {
                doc = CACHE_DOC[path];
            }
            else
            {
                string context = NetClientUtil.doGet(path);
                doc.LoadXml(context);
                CACHE_DOC.Add(path, doc);
            }
            return(doc);
        }