void ProcessNewDriveConfigAsAnalystsWorkstation() { // we allow two drives to be connected, a central repository and a field drive to import data from ( and merge the data // into the central repository) string centralDriveBeforePoll = m_CentralRepositoryDrive; string centralDrive = null; string fieldDrive = null; DRIVE_CHANGE_EVENT e = new DRIVE_CHANGE_EVENT(); string[] drives = GetAllFirstEvidenceDrives(); foreach (string drive in drives) { if (IsCentralRepository(drive) && centralDrive == null) // stop at the first one found, if more than one exists we have problems { centralDrive = drive; } else if (! IsCentralRepository(drive) && fieldDrive == null)// stop at the first one found, if more than one exists we have problems { fieldDrive = drive; } } // do we have a Central repository attached? lock (singleton) { if (centralDrive != m_CentralRepositoryDrive) { if (m_CentralRepositoryDrive != null & centralDrive == null) { // we lost a central repos drive e = DRIVE_CHANGE_EVENT.LOST_PRIMARY_DRIVE; { m_CentralRepositoryDrive = centralDrive; } } else if (m_CentralRepositoryDrive == null & centralDrive != null) { // we gained a centrl repo drive e = DRIVE_CHANGE_EVENT.NEWDRIVE; { m_CentralRepositoryDrive = centralDrive; } } else { // we changed from one central to another e = DRIVE_CHANGE_EVENT.NEWDRIVE; { m_CentralRepositoryDrive = centralDrive; } } } // do we have a field drive attached? if (fieldDrive != m_FieldDrive) { if (m_FieldDrive != null & fieldDrive == null) { // we lost a central repos drive e = DRIVE_CHANGE_EVENT.LOST_PRIMARY_DRIVE; { m_FieldDrive = fieldDrive; } // if we do not have a central repos, then the field drive becomes the primary drive { if (m_CentralRepositoryDrive == null) { m_CentralRepositoryDrive = m_FieldDrive; m_FieldDrive = null; } } } else if (m_FieldDrive == null & fieldDrive != null) { // we gained a centrl repo drive { m_FieldDrive = fieldDrive; } // if we do not have a central repos, then the field drive becomes the primary drive { if (m_CentralRepositoryDrive == null) { m_CentralRepositoryDrive = m_FieldDrive; m_FieldDrive = null; } } } else { // we changed from one central to another { m_FieldDrive = fieldDrive; } // if we do not have a central repos, then the field drive becomes the primary drive { if (m_CentralRepositoryDrive == null) { m_CentralRepositoryDrive = m_FieldDrive; m_FieldDrive = null; } } } } // do we have No drives at all? if (m_CentralRepositoryDrive == null) { // then use the default user data path for storage m_CentralRepositoryDrive = Application.UserAppDataPath + "\\"; } m_SelectedDrive = m_CentralRepositoryDrive; if (centralDriveBeforePoll != m_CentralRepositoryDrive) { if (m_CentralRepositoryDrive == null) e = DRIVE_CHANGE_EVENT.LOST_PRIMARY_DRIVE; else e = DRIVE_CHANGE_EVENT.NEWDRIVE; OnDriveChange(m_CentralRepositoryDrive, m_CentralRepositoryDrive, e); } } }
void ProcessNewDriveConfigAsAnalystsWorkstation() { // we allow two drives to be connected, a central repository and a field drive to import data from ( and merge the data // into the central repository) string centralDriveBeforePoll = m_CentralRepositoryDrive; string centralDrive = null; string fieldDrive = null; DRIVE_CHANGE_EVENT e = new DRIVE_CHANGE_EVENT(); string[] drives = GetAllFirstEvidenceDrives(); foreach (string drive in drives) { if (IsCentralRepository(drive) && centralDrive == null) // stop at the first one found, if more than one exists we have problems { centralDrive = drive; } else if (!IsCentralRepository(drive) && fieldDrive == null) // stop at the first one found, if more than one exists we have problems { fieldDrive = drive; } } // do we have a Central repository attached? lock (singleton) { if (centralDrive != m_CentralRepositoryDrive) { if (m_CentralRepositoryDrive != null & centralDrive == null) { // we lost a central repos drive e = DRIVE_CHANGE_EVENT.LOST_PRIMARY_DRIVE; { m_CentralRepositoryDrive = centralDrive; } } else if (m_CentralRepositoryDrive == null & centralDrive != null) { // we gained a centrl repo drive e = DRIVE_CHANGE_EVENT.NEWDRIVE; { m_CentralRepositoryDrive = centralDrive; } } else { // we changed from one central to another e = DRIVE_CHANGE_EVENT.NEWDRIVE; { m_CentralRepositoryDrive = centralDrive; } } } // do we have a field drive attached? if (fieldDrive != m_FieldDrive) { if (m_FieldDrive != null & fieldDrive == null) { // we lost a central repos drive e = DRIVE_CHANGE_EVENT.LOST_PRIMARY_DRIVE; { m_FieldDrive = fieldDrive; } // if we do not have a central repos, then the field drive becomes the primary drive { if (m_CentralRepositoryDrive == null) { m_CentralRepositoryDrive = m_FieldDrive; m_FieldDrive = null; } } } else if (m_FieldDrive == null & fieldDrive != null) { // we gained a centrl repo drive { m_FieldDrive = fieldDrive; } // if we do not have a central repos, then the field drive becomes the primary drive { if (m_CentralRepositoryDrive == null) { m_CentralRepositoryDrive = m_FieldDrive; m_FieldDrive = null; } } } else { // we changed from one central to another { m_FieldDrive = fieldDrive; } // if we do not have a central repos, then the field drive becomes the primary drive { if (m_CentralRepositoryDrive == null) { m_CentralRepositoryDrive = m_FieldDrive; m_FieldDrive = null; } } } } // do we have No drives at all? if (m_CentralRepositoryDrive == null) { // then use the default user data path for storage m_CentralRepositoryDrive = Application.UserAppDataPath + "\\"; } m_SelectedDrive = m_CentralRepositoryDrive; if (centralDriveBeforePoll != m_CentralRepositoryDrive) { if (m_CentralRepositoryDrive == null) { e = DRIVE_CHANGE_EVENT.LOST_PRIMARY_DRIVE; } else { e = DRIVE_CHANGE_EVENT.NEWDRIVE; } OnDriveChange(m_CentralRepositoryDrive, m_CentralRepositoryDrive, e); } } }