COMP/FTP.cs

(完整代码) 1KB

using System;
using System.IO;
using System.Configuration;

namespace COCOWO.COMP
{
    /// <summary>
    /// 部分FTP类代码来自网络.版式权归原作者所有
    /// </summary>
    public class FTP
    {
        public FTP()
        {

        }
        public static string getParentDirectory()
        {
            System.Web.HttpContext context = System.Web.HttpContext.Current;
            string path = context.Session["Path"].ToString();
            if (path == "./")
                return ("../");	
            else if (path == "/")
                return (ConfigurationSettings.AppSettings["rootPath"].ToString());	
            else
            {
                if (path.LastIndexOf("/") == path.Length - 1)
                {
                    path = path.Remove(path.LastIndexOf("/"), (path.Length - path.LastIndexOf("/")));
                }
                try
                {
                    
                    //path = path.Remove(path.LastIndexOf("/"), (path.Length - path.LastIndexOf("/")));
                    return (path + "/");
                }
                catch
                {
                    return (ConfigurationSettings.AppSettings["rootPath"]);	// default to root;
                }
            }

        }

        public static void ReportError(string problem, string tech, string suggestion)
        {            
            System.Web.HttpContext context = System.Web.HttpContext.Current;
            string output = "<font color=red><BIG>Problem:</BIG> " + problem + "</font><hr>";
            output += "Suggestion: " + suggestion + "<hr>";
            output += "<small>Technical details: " + tech + "</small><hr>";
            context.Response.Write(output);
        }
    }
}

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读 AI

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。