Ejemplo n.º 1
0
        public S3CommanderFile ResolvePath(string path)
        {
            S3CommanderFile file = null;

            if (path == null)
            {
                return(file);
            }

            var parts = path.TrimEnd('\\').Split('\\');
            var depth = parts.Length - 1;

            //root
            if (depth <= 0)
            {
                return(this);
            }

            //parent directory
            if (parts[depth] == "..")
            {
                return(file);
            }

            var accountName = parts[1];
            var bucketName  = 2 <= depth ? parts[2] : null;

            //accounts
            if (depth == 1)
            {
                if (RS.Settings.Equals(accountName, StringComparison.CurrentCultureIgnoreCase))
                {
                    file = new ConfigurationFile();
                }
                else if (RS.NewAccount.Equals(accountName, StringComparison.CurrentCultureIgnoreCase))
                {
                    file = new NewAccount(accountManager);
                }
                else
                {
                    file = new Account(accountManager, accountName);
                }
            }
            //buckets
            else if (depth == 2)
            {
                if (RS.NewBucket.Equals(bucketName, StringComparison.CurrentCultureIgnoreCase))
                {
                    file = new NewBucket();
                }
                else
                {
                    file = new Bucket(bucketName);
                }
            }
            //amazon s3 folder or file
            else
            {
                file = new Entry(bucketName, string.Join("/", parts, 3, depth - 2));
            }

            file.Initialize(Context, s3ServiceProvider.GetS3Service(accountName));
            return(file);
        }
Ejemplo n.º 2
0
 public virtual FileOperationResult CopyTo(S3CommanderFile dest, bool overwrite, bool move, RemoteInfo info)
 {
     return(FileOperationResult.Default);
 }