예제 #1
0
        /// <summary></summary>
        /// <param name=""></param>
        private void ExecuteCompare(BackgroundMessage UserInterfaceMessage)
        {
            List <PairOfFiles> ltKnownPairs = new List <PairOfFiles>();
            Drive SourceDrive = UserInterfaceMessage.PairProperty.SourceDrive;

            _quReturn.Enqueue(new BackgroundMessage(BackgroundMessage.nType.UserMessage, BackgroundMessage.nReturnCode.StartCompare));

            // first, find out as quickly as possible how many directories and files there are
            switch (SourceDrive.eEncryptionType)
            {
            case Drive.nEncryptionType.DirectoryUnencrypted: ReadSourceDirectories(UserInterfaceMessage.PairProperty, ltKnownPairs); break;
            }

            switch (UserInterfaceMessage.PairProperty.DestinationDrive.eEncryptionType)
            {
            case Drive.nEncryptionType.DirectoryUnencrypted: ReadDestinationDirectories(UserInterfaceMessage.PairProperty, ltKnownPairs); break;
            }

            if (_eState == nState.Working)
            {
                // now we know how many directories and files there are and can set up the progress bar
                _quReturn.Enqueue(new BackgroundMessage(BackgroundMessage.nType.SetupProgress, 0, ltKnownPairs.Count()));

                foreach (PairOfFiles FileInfoPair in ltKnownPairs)
                {
                    if (_eState == nState.Working)
                    {                                                                                            // we can report progess to the user, now do the time-consuming reading of the file size, attributes and dates:
                        FileInfoPair.ReadProperties();
                        _quReturn.Enqueue(new BackgroundMessage(BackgroundMessage.nType.NewPair, FileInfoPair)); // send the PairOfFiles to the MainViewModel
                    }
                }
            }
            _quReturn.Enqueue(new BackgroundMessage(BackgroundMessage.nType.UserMessage, BackgroundMessage.nReturnCode.FinishCompare));
        }
예제 #2
0
        /// <summary></summary>
        /// <param name=""></param>
        private void ExecuteSynchronize(BackgroundMessage UserInterfaceMessage)
        {
            if (UserInterfaceMessage.PairProperty.eComparison != PairOfFiles.nComparison.Identical)
            {
                UserInterfaceMessage.eType = BackgroundMessage.nType.Status;
                _quReturn.Enqueue(UserInterfaceMessage);
            }

            switch (UserInterfaceMessage.PairProperty.eComparison)
            {
            case PairOfFiles.nComparison.SourceOnly:
            case PairOfFiles.nComparison.SourceNewer: Copy(UserInterfaceMessage.PairProperty); break;

            case PairOfFiles.nComparison.DestinationOnly: DestinationOnly(UserInterfaceMessage.PairProperty); break;

            case PairOfFiles.nComparison.DestinationNewer: DestinationNewer(UserInterfaceMessage.PairProperty); break;

            case PairOfFiles.nComparison.Identical: UserInterfaceMessage.PairProperty.DestinationDrive.AddPair(UserInterfaceMessage.PairProperty); break;
            }
        }
예제 #3
0
 /// <summary></summary>
 /// <param name=""></param>
 public bool Start(BackgroundMessage BackgroundMessage)
 {
     _quCommands.Enqueue(BackgroundMessage);
     return(Start());
 }
예제 #4
0
 /// <summary></summary>
 /// <param name=""></param>
 public void Enqueue(BackgroundMessage BackgroundMessage)
 {
     _quCommands.Enqueue(BackgroundMessage);
 }