Esempio n. 1
0
        private string GetFullPath(string fileName)
        {
            Contract.Requires(!string.IsNullOrEmpty(Host));

            string fullPath = string.Format("ftp://{0}/%2F", Host);

            if (RemotePath != null)
            {
                if (RemotePath.StartsWith("/"))
                {
                    fullPath = string.Format("{0}/{1}", fullPath, RemotePath.Substring(1));
                }
                else
                {
                    fullPath = string.Format("{0}/{1}", fullPath, RemotePath);
                }
            }


            if (fileName == null)
            {
                return(fullPath);
            }
            else
            {
                return(string.Format("{0}/{1}", fullPath, fileName));
            }
        }
Esempio n. 2
0
        protected BaseSession(NameValueCollection query)
        {
            ID         = Guid.NewGuid().ToString();
            Name       = query["name"];
            RemotePath = query["path"];
            Type       = Utilities.ParseSessionType(query["type"]);
            IsWeb      = Boolean.Parse(query["web"]);

            if (RemotePath.StartsWith("[temp]"))
            {
                RemotePath = Path.Combine(Path.GetTempPath(), RemotePath.Substring(6));
            }

            RemotePath = RemotePath.Replace('\\', Path.DirectorySeparatorChar);
        }