示例#1
0
        public static bool MoveSourceToStorage(Assignment prof, IProgress <long> sizeFromHell, object _lock, CancellationToken ct)
        {
            string sourceDir = prof.Source.FullName;
            string targetDir = prof.Target.FullName;// + @"\" + prof.Source.Name;

            Console.WriteLine("Moving " + sourceDir + " to " + targetDir + " started");
            bool returnStatus = false;

            try
            {
                returnStatus = CopyFolders(prof, sizeFromHell, _lock, ct);
                if (returnStatus == false)
                {
                    return(returnStatus);
                }
                else
                {
                    DirectoryInfo deletableDirInfo = prof.Source;
                    deletableDirInfo.Delete(true);
                    Console.WriteLine("Deleted " + sourceDir);
                    if (!AnalyzeFolders.ExistsAsDirectory(sourceDir))
                    {
                        JunctionPoint.Create(@sourceDir, @targetDir, false);
                        Console.WriteLine("Created Link");
                    }
                }
            }

            catch (Exception exp)
            {
                MessageBox.Show(exp.Message);
            }
            Console.WriteLine("Moving " + sourceDir + " to " + targetDir + " finished with " + returnStatus);
            return(returnStatus);
        }
示例#2
0
        public static bool LinkStorageToSource(Assignment prof)
        {
            bool returnStatus = false;

            try
            {
                string sourceDir = prof.Source.FullName;
                string targetDir = prof.Target.FullName;// + @"\" + prof.Source.Name;
                if (!AnalyzeFolders.ExistsAsDirectory(targetDir))
                {
                    JunctionPoint.Create(@targetDir, @sourceDir, false);
                    returnStatus = true;
                }
                else
                {
                    returnStatus = false;
                }
            }
            catch (Exception exp)
            {
                MessageBox.Show(exp.Message);
                returnStatus = false;
            }
            return(returnStatus);
        }