示例#1
0
 public FileManagerController()
 {
     _drive = new LocalDrive("./", new DriveConfig {
         Operation = new OperationConfig {
             PreventNameCollision = true
         }
     });
 }
 public DynamicFoldersController()
 {
     _drive = new LocalDrive("./", new DriveConfig {
         Operation = new OperationConfig {
             PreventNameCollision = true
         }
     });
 }
示例#3
0
        public void Calling_refreshusercontent_will_create_folder_structure()
        {
            var connector = new LocalDrive(RequestHelper.CurrentDataRepository, RootFolder, MemberAlias);

            connector.CurrentMember =
                RequestHelper.CurrentDataRepository.Queryable <Member>().FirstOrDefault(m => m.Id == 3);
            var result       = connector.RefreshFolderContent().ToList();
            var folderName   = string.Format("Members/{0}/Internal/Fotos", MemberAlias);
            var folderExists = Directory.Exists(folderName);

            Assert.IsTrue(folderExists, "Der Ordner wurde nicht erzeugt");
            Directory.Delete("Members", true);
        }
示例#4
0
        public override int GetHashCode()
        {
            // Once we have a hash code we'll never change it
            if (_oldHashCode.HasValue)
            {
                return(_oldHashCode.Value);
            }

            // Use the [LocalDrive|Text].GetHashCode() and remember it, so an instance can NEVER change its hash code.
            _oldHashCode = string.IsNullOrEmpty(LocalDrive)
                                ? Text.GetHashCode()
                                : LocalDrive.GetHashCode();
            return(_oldHashCode.Value);
        }
示例#5
0
        public void Calling_refreshusercontent_with_existing_foto_will_create_folder_all_pitures()
        {
            var connector = new LocalDrive(RequestHelper.CurrentDataRepository, RootFolder, MemberAlias);

            connector.CurrentMember =
                RequestHelper.CurrentDataRepository.Queryable <Member>().Include(m => m.Options).FirstOrDefault(m => m.Id == 3);

            var result = connector.RefreshFolderContent().ToList();


            var image      = Resources.full;
            var folderName = string.Format("Members/{0}/ToPublish", MemberAlias);

            image.Save(folderName + "//newFoto.jpg");

            result = connector.RefreshFolderContent().ToList();

            Assert.IsTrue(result.Count > 0, "Es wurden keine Fotos erzeugt");
            Directory.Delete("Members", true);
        }
示例#6
0
        internal IConnector CurrentConnector(Member member)
        {
            if (member == null || member.StorageAccesses.Count == 0)
            {
                return(null);
            }

            IConnector connector;

            switch (member.StorageAccessType)
            {
            case StorageProviderType.Dropbox:
                connector = new DropboxConnector(DataRepository);
                break;

            case StorageProviderType.GoogleDrive:
                connector = new GoogleDrive(DataRepository);
                break;

            case StorageProviderType.OneDrive:
                connector = new Connector.OneDrive.OneDrive(DataRepository);
                break;

            case StorageProviderType.LocalDrive:
                connector = new LocalDrive(DataRepository,
                                           string.Format("{0}://{1}", Request.RequestUri.Scheme, Request.RequestUri.Authority),
                                           member.Alias);
                break;

            default:
                throw new NotImplementedException("Der Connector ist noch nicht implementiert!");
            }
            var access = member.StorageAccesses.First(s => s.Type == member.StorageAccessType);

            connector.RedirectUrl   = RedirectUrl;
            connector.CurrentMember = member;
            connector.Connect(access);

            return(connector);
        }
示例#7
0
 public UnixLocalFile(LocalDrive drive, FileSystemInfo file)
     : base(drive, file)
 {
 }
        /// <summary>
        /// Check out the files from Backup/Restored SVN repository for particular date, here we had used commandprompt command to do so
        /// Input: User details username, password, backup/restored date and Backup/Restored svn server url
        /// Output: Checking out the files from Backup/Restored SVN repository
        /// </summary>
        public void mtdChkBack()
        {
            try
            {
                System.Diagnostics.Process          chkBackup      = new System.Diagnostics.Process();
                System.Diagnostics.ProcessStartInfo startChkBackup = new System.Diagnostics.ProcessStartInfo();
                startChkBackup.CreateNoWindow = true;
                startChkBackup.WindowStyle    = System.Diagnostics.ProcessWindowStyle.Hidden;
                startChkBackup.FileName       = "cmd.exe";
                startChkBackup.Arguments      = "/C svn co " + BackupURL.Trim() + " \"" + LocalDrive.Trim() + "\\svn-compare\\Backup\" --username " + UserName.Trim() + " --password " + Password.Trim();
                chkBackup.StartInfo           = startChkBackup;

                chkBackup.StartInfo.RedirectStandardOutput = true;
                chkBackup.StartInfo.UseShellExecute        = false;
                chkBackup.Start();

                StringBuilder chkb = new StringBuilder();
                while (!chkBackup.HasExited)
                {
                    chkb.Append(chkBackup.StandardOutput.ReadToEnd());
                }
                ChkBackCmd = "\n" + startChkBackup.Arguments.Replace(" --password " + Password, " --password *******");
                ChkBack    = "\n" + chkb.ToString().Trim();

                backVersion   = FindVersion(ChkBack).ToString().Split(' ').Last().Replace(".", "");
                totalBackFile = TotalFiles(ChkBack).ToString();

                startChkBackup = null;
                chkBackup      = null;
            }
            catch (Exception chkback)
            {
                Error = chkback.Message.ToString();
            }
        }
        /// <summary>
        /// Check out the files from Live SVN repository for particular date, here we had used commandprompt command to do so
        /// Input: User details username, password, backup/restored date and live svn server url
        /// Output: Checking out the files from Live SVN repository
        /// </summary>
        public void mtdChkLive()
        {
            try
            {
                System.Diagnostics.Process          process   = new System.Diagnostics.Process();
                System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
                startInfo.CreateNoWindow = true;
                startInfo.WindowStyle    = System.Diagnostics.ProcessWindowStyle.Hidden;
                startInfo.FileName       = "cmd.exe";
                startInfo.Arguments      = "/C svn co -r {\"" + BackupDate + " 23:59:59\"} " + LiveURL.Trim() + " \"" + LocalDrive.Trim() + "\\svn-compare\\checkout\" --username " + UserName.Trim() + " --password " + Password.Trim();
                process.StartInfo        = startInfo;

                process.StartInfo.RedirectStandardOutput = true;
                process.StartInfo.UseShellExecute        = false;
                process.Start();


                StringBuilder proc = new StringBuilder();
                while (!process.HasExited)
                {
                    proc.Append(process.StandardOutput.ReadToEnd());
                }

                ChkLiveCmd = "\n" + startInfo.Arguments.Replace(" --password " + Password, " --password *******");
                ChkLive    = "\n" + proc.ToString().Trim();

                liveVersion   = FindVersion(ChkLive).ToString().Split(' ').Last().Replace(".", "");
                totalLiveFile = TotalFiles(ChkLive).ToString();

                startInfo = null;
                process   = null;
            }
            catch (Exception chklive)
            {
                Error = chklive.Message.ToString();
            }
        }