private static void DetectDiffProgram() { if (_diffProgramFlag != DiffPrograms.DiffProgram.AutoDetect) { if (_diffProgram == null) { _diffProgram = _programTypes[_diffProgramFlag]; if (!_diffProgram.IsDetected()) { _diffProgramFlag = DiffPrograms.DiffProgram.AutoDetect; _diffProgram = null; } } else { var diffProgram = _programTypes[_diffProgramFlag]; if (_diffProgram != diffProgram) { _diffProgramFlag = DiffPrograms.DiffProgram.AutoDetect; _diffProgram = null; } } } if (_diffProgramFlag == DiffPrograms.DiffProgram.AutoDetect) { // Find first detected program foreach (var diffProgram in _programTypes.Keys) { _diffProgram = _programTypes[diffProgram]; if (_diffProgram.IsDetected()) { _diffProgramFlag = diffProgram; break; } _diffProgram = null; } } if (_diffProgramFlag == DiffPrograms.DiffProgram.AutoDetect) { MessageBox.Show("Could not detect a Diff program to use.", "No Diff program found"); } }
public static bool IsDetected(DiffPrograms.DiffProgram diffProgram) { var program = _programTypes[diffProgram]; return(program.IsDetected()); }