private void Search_Pass2(AudioLibrary audioLibrary) { AODLoadSheetRow previousLSR = new AODLoadSheetRow(); foreach (AODLoadSheetRow currentLSR in _LoadSheet.GetAODLoadSheetRows) { if (!currentLSR.IsSuggestedAudioFileAssigned) { currentLSR.QuickSearchForSuggestedAudioFile(audioLibrary, previousLSR, _LoadSheet); if (currentLSR.IsSuggestedAudioFileAssigned) { _SearchRowsRemaining--; PrintUpdatedSearchStats(); } else if (previousLSR.AirlineAlbumAudioTypeHash != currentLSR.AirlineAlbumAudioTypeHash) { AddNewFullSearchThread(audioLibrary, currentLSR); CheckForFinishedSearches(Globals.MaxDegreeOfParallelism); } } previousLSR = currentLSR; } CheckForFinishedSearches(1); }
public void PrintAndEmptySkippedQueue() { bool choice = PromptToViewSkippedEncodings(); if (choice) { Environment.Exit(0); } ConsolePrintHelpers.PrintHeader(); ConsolePrintHelpers.PrintWhiteText(" Printing Skipped Load Sheet Rows..."); ConsolePrintHelpers.Wait(); int skippedQueueCount = _SkippedQueue.Count; for (int i = 0; i < skippedQueueCount; i++) { AODLoadSheetRow skippedLSR = _SkippedQueue.Dequeue(); skippedLSR.PrintAllLSRInfo(); ConsolePrintHelpers.PressAnyKeyToContinue(); } }
private void AddNewFullSearchThread(AudioLibrary audioLibrary, AODLoadSheetRow currentLSR) { currentLSR.FullSearchForSuggestedAudioFile_Async(audioLibrary); _ActiveSearches.Add(currentLSR); PrintUpdatedSearchStats(); }
public ApprovedLoadSheetRow(AODLoadSheetRow lsr) { _SourceFilePath = lsr.SuggestedAudioFile.FullPath; _LoadSheetRowHash = lsr.LoadSheetRowHash; _TotalPoints = lsr.SuggestedAudioFile.TotalPoints; _AccuracyScore = lsr.SuggestedAudioFile.AccuracyScore; _AccuracyType = lsr.SuggestedAudioFile.AccuracyType; _IsApproved = lsr.IsApproved; CheckIfValid(); }
public AudioFileEncoding(AODLoadSheetRow lsr, int encodingID, bool tryToCopyAlreadyEncodedFile) { _LSR = lsr; _EncodingID = encodingID; _TryToCopyAlreadyEncodedFile = tryToCopyAlreadyEncodedFile; _TranscodeTempDirectoryThisEncoding = _LSR.Config.TranscodeTempDirectory + "\\" + _EncodingID.ToString(); _FileToCopy = null; _IsWaiting = false; _HasFinished = false; }
public AlreadyEncodedFile GetAlreadyEncodedFile(AODLoadSheetRow lsr) { foreach (AlreadyEncodedFile file in _AlreadyEncodedFiles) { if (lsr.IsLSREncodingEligibleForCopying(file)) { if (file.IsValid) //No re-check if valid (occurs during AudioFileEncodingQueues building) { return(file); } } } return(null); //Not Found }
private bool IsLSREligibleForEncodingOrCopying(AODLoadSheetRow lsr) { _Controller.History.CheckApprovalHistory(lsr); //If not already approved, check to see if it was historically approved. If so, re-approve it! if (lsr.SuggestedAudioFile.AccuracyType == AccuracyType.Accurate || lsr.IsApproved) { return(true); //Eligible to Encode or Copy } else { lsr.EncodingResult = Globals.Skipped; return(false); //NOT Eligible, will be put in _SkippedQueue } }
private bool CheckApprovalHistoryAgain(AODLoadSheetRow skippedLSR) { if (IsLSREligibleForEncodingOrCopying(skippedLSR)) //recheck approval history (new manual approvals might approve upcoming skippedLSRs with identical LSR Hashes or qualified characteristics) { if (skippedLSR.IsApproved) { _TempEncodingOrCopyList.Add(skippedLSR); _TempSkippedList.Remove(skippedLSR); return(true); } } return(false); }
public AudioFileSearchCollection(AODLoadSheetRow lsr) { _AODLoadSheetRow = lsr; _ForwardsFinalPass = null; _BackwardsFinalPass = null; _ForwardsFinalPassCount = 0; _BackwardsFinalPassCount = 0; _ChosenFinalPassCount = 0; _ManualOptions = new AudioFileOptions(); _IsUsingManualOptions = false; _IsCollectionFinished = false; }
public TokensCollection(AODLoadSheetRow lsr) { _LSR = lsr; _ShipTo = NormalizeText(_LSR.ShipTo); _CycleTokens = new Tokens(_LSR.Cycle, _LSR.Airline, TokenType.Cycle); _AirlineTokens = new Tokens(_LSR.Airline, TokenType.Airline); _ArtistTokens = new Tokens(_LSR.Artist, TokenType.Artist, _CycleTokens, _LSR.Airline); _AlbumTokens = new Tokens(_LSR.Album, TokenType.Album, _CycleTokens, _LSR.Airline); _TrackNumberTokens = new Tokens(_LSR.TrackNumber, TokenType.TrackNumber); _TrackTokens = new Tokens(_LSR.Track, TokenType.Track, _CycleTokens, _LSR.Airline); SetArtistAlbumPotentialPoints(); SetOriginalSearchStrategy(); }
private void Search_Pass1(AudioLibrary audioLibrary) { AODLoadSheetRow previousLSR = new AODLoadSheetRow(); foreach (AODLoadSheetRow currentLSR in _LoadSheet.GetAODLoadSheetRows) { if (previousLSR.AirlineAudioTypeHash != currentLSR.AirlineAudioTypeHash) { AddNewFullSearchThread(audioLibrary, currentLSR); CheckForFinishedSearches(Globals.MaxDegreeOfParallelism); } previousLSR = currentLSR; } CheckForFinishedSearches(1); }
public void CheckApprovalHistory(AODLoadSheetRow lsr) { if (lsr.IsSuggestedAudioFileAssigned && lsr.SuggestedAudioFile.AccuracyType != AccuracyType.Accurate && !lsr.IsApproved) //Inaccurate and NOT already manually 'Approved' { foreach (ApprovedLoadSheetRow approvedLSR in _ApprovedLoadSheetRows) { if (lsr.IsHistoricallyApproved(approvedLSR)) //Was it approved in the past? { if (approvedLSR.IsValid) //No Re-checkIfValid() because everything was just previously validated just before CheckApprovalHistory() is called. { lsr.IsApproved = true; lsr.SuggestedAudioFile.AccuracyNote = Globals.HistoricalApprovalNote; return; } } } } }
public AlreadyEncodedFile(AODLoadSheetRow lsr, bool checkIfValid) { _LoadSheetRowNumber = lsr.LoadSheetRowNumber; _EncodedFilePath = lsr.DestinationPath; _SourceFilePath = lsr.SuggestedAudioFile.FullPath; _SourceFileModifiedDate = lsr.SuggestedAudioFile.ModifiedDate; _SourceFileSize = lsr.SuggestedAudioFile.FileSize; _EncodedStatus = lsr.EncodingResult; _EncodedFileExtension = Path.GetExtension(_EncodedFilePath).ToLower(); if (checkIfValid) { CheckIfValid(); //Slower as it has to go out to disk } else { _IsValid = false; //Faster for Queue Building } }
public void AddNewApprovedLoadSheetRow(AODLoadSheetRow lsr) { ConsolePrintHelpers.PrintYellowText("\n\n Adding New Approved Row To History"); ConsolePrintHelpers.PrintWhiteText(" ► "); if (lsr.IsSuggestedAudioFileAssigned && lsr.SuggestedAudioFile.AccuracyType != AccuracyType.Accurate && lsr.IsApproved) //Inaccurate and already manually 'Approved' { ApprovedLoadSheetRow approvedLSR = new ApprovedLoadSheetRow(lsr); if (approvedLSR.IsValid) //No check on unique lsr hashes, as they would all be unique at this point (would be already re-approved) { _ApprovedLoadSheetRows.AddFirst(approvedLSR); //Add to BEGINNING of list (most recent NEW approvedLSRs first) ConsolePrintHelpers.PrintYellowText("Added"); return; } } ConsolePrintHelpers.PrintRedText("Not Added"); }
public AODLoadSheetRow GetMostRecentAssignedRow(AODLoadSheetRow searchingRow) { AODLoadSheetRow mostRecentAssignedRow = null; int rowNumberToBeginChecking = searchingRow.LoadSheetRowNumber - Globals.MaxDegreeOfParallelism; foreach (AODLoadSheetRow lsr in _AODLoadSheetRows) { if (lsr.LoadSheetRowNumber >= rowNumberToBeginChecking) { if (lsr.LoadSheetRowNumber >= searchingRow.LoadSheetRowNumber) { break; } if (lsr.IsSuggestedAudioFileAssigned && lsr.AirlineAlbumAudioTypeHash == searchingRow.AirlineAlbumAudioTypeHash) { mostRecentAssignedRow = lsr; } } } return(mostRecentAssignedRow); }
public static AudioFileSearchCollection GetBestSearchCollection(AudioLibrary audioLibrary, AODLoadSheetRow lsr) { if (lsr.OriginalSearchStrategy != lsr.Tokens.SearchStrategy) { lsr.Tokens.SetOriginalSearchStrategy(); } AudioFileSearchCollection collection_1 = GetSearchCollection(audioLibrary, lsr); //SearchStrategyType defined by loadsheet (Original Search Strategy) AudioFileOption candidateOption_1 = collection_1.BestOption; if (collection_1.IsOptionQuickSearchElligible(candidateOption_1, SearchMethodType.Both, Globals.AccurateThreshold)) //[Prefered result] Accurate scoring and not too many options in final pool (skip alternative strategy search for performance) { return(collection_1); } if (lsr.Tokens.SearchStrategy == SearchStrategyType.CD) { lsr.Tokens.ConfigureSearchStrategy_OTHER(true); } else if (lsr.Tokens.SearchStrategy == SearchStrategyType.OTHER) { lsr.Tokens.ConfigureSearchStrategy_CD(true); } AudioFileSearchCollection collection_2 = GetSearchCollection(audioLibrary, lsr); //Alternative SearchStrategyType if needed AudioFileOption candidateOption_2 = collection_2.BestOption; SuggestedAudioFile suggestedOption_1 = new SuggestedAudioFile(collection_1); SuggestedAudioFile suggestedOption_2 = new SuggestedAudioFile(collection_2); if (suggestedOption_1.AccuracyType == AccuracyType.Accurate && suggestedOption_2.AccuracyType != AccuracyType.Accurate) { if (suggestedOption_1.AccuracyScore >= suggestedOption_2.AccuracyScore) { lsr.Tokens.SetOriginalSearchStrategy(); return(collection_1); } } if (suggestedOption_1.AccuracyType != AccuracyType.Accurate && suggestedOption_2.AccuracyType == AccuracyType.Accurate) { if (suggestedOption_1.AccuracyScore <= suggestedOption_2.AccuracyScore) { return(collection_2); } } //Suggested Files (1 and 2) are either both accurate, or both inaccurate if (suggestedOption_1.AccuracyScore >= (suggestedOption_2.AccuracyScore - Globals.SearchStrategySwitchThreshold)) //Preference is given to the original search strategy { lsr.Tokens.SetOriginalSearchStrategy(); return(collection_1); } else { return(collection_2); } }
public void UpdateLoadSheetFinishedEncodings(List <AudioFileEncoding> finishedEncodings) { if (finishedEncodings.Count == 0) { ConsolePrintHelpers.PrintYellowText("\n\n\n AODLoadsheet Is Current..."); return; } finishedEncodings = finishedEncodings.OrderBy(encoding => encoding.LSR.LoadSheetRowNumber).ToList(); ConsolePrintHelpers.PrintYellowText("\n\n\n [DO NOT CLOSE CONSOLE WINDOW] Updating AODLoadsheet Rows. Range: "); ConsolePrintHelpers.PrintWhiteText((finishedEncodings.First().LSR.LoadSheetRowNumber + 1).ToString() + " thru " + (finishedEncodings.Last().LSR.LoadSheetRowNumber + 1).ToString() + " ► "); int cursorLeft = Console.CursorLeft; Console.WriteLine("\n\n"); Console.CursorTop -= 3; IWorkbook workbook = ReadWorkBook(); ISheet sheet = workbook.GetSheet(_Config.AODLoadSheetWorkSheetName); IRow row; ICell cell; XSSFCellStyle green = (XSSFCellStyle)workbook.CreateCellStyle(); byte[] rgb = new byte[3] { 0, 176, 80 }; green.SetFillForegroundColor(new XSSFColor(rgb)); green.FillPattern = FillPattern.SolidForeground; green.BorderTop = BorderStyle.Thin; green.BorderBottom = BorderStyle.Thin; green.BorderLeft = BorderStyle.Thin; green.BorderRight = BorderStyle.Thin; green.Alignment = HorizontalAlignment.Left; green.VerticalAlignment = VerticalAlignment.Center; ICellStyle yellow = workbook.CreateCellStyle(); yellow.FillForegroundColor = NPOI.HSSF.Util.HSSFColor.LightYellow.Index; yellow.FillPattern = FillPattern.SolidForeground; yellow.BorderTop = BorderStyle.Thin; yellow.BorderBottom = BorderStyle.Thin; yellow.BorderLeft = BorderStyle.Thin; yellow.BorderRight = BorderStyle.Thin; yellow.Alignment = HorizontalAlignment.Left; yellow.VerticalAlignment = VerticalAlignment.Center; ICellStyle red = workbook.CreateCellStyle(); red.FillForegroundColor = NPOI.HSSF.Util.HSSFColor.Red.Index; red.FillPattern = FillPattern.SolidForeground; red.BorderTop = BorderStyle.Thin; red.BorderBottom = BorderStyle.Thin; red.BorderLeft = BorderStyle.Thin; red.BorderRight = BorderStyle.Thin; red.Alignment = HorizontalAlignment.Left; red.VerticalAlignment = VerticalAlignment.Center; ICellStyle blue = workbook.CreateCellStyle(); blue.FillForegroundColor = NPOI.HSSF.Util.HSSFColor.LightBlue.Index; blue.FillPattern = FillPattern.SolidForeground; blue.BorderTop = BorderStyle.Thin; blue.BorderBottom = BorderStyle.Thin; blue.BorderLeft = BorderStyle.Thin; blue.BorderRight = BorderStyle.Thin; blue.Alignment = HorizontalAlignment.Left; blue.VerticalAlignment = VerticalAlignment.Center; foreach (AudioFileEncoding finishedEncoding in finishedEncodings) { AODLoadSheetRow lsr = finishedEncoding.LSR; row = sheet.GetRow(lsr.LoadSheetRowNumber) ?? sheet.CreateRow(lsr.LoadSheetRowNumber); if ((lsr.SuggestedAudioFile.AccuracyType == AccuracyType.Accurate || lsr.IsApproved) && (lsr.EncodingResult == Globals.Encoded || lsr.EncodingResult == Globals.Copied)) { foreach (int colNum in _Config.AODLoadSheetColumnNumsWrite) { cell = row.GetCell(colNum) ?? row.CreateCell(colNum); if (colNum == _Config.AODLoadSheetColumnNumsWrite[0]) { cell.SetCellValue(lsr.SuggestedAudioFile.FullPath); cell.CellStyle = green; } else if (colNum == _Config.AODLoadSheetColumnNumsWrite[1]) { cell.SetCellValue(lsr.SuggestedAudioFile.AccuracyScore); cell.CellStyle = green; } else if (colNum == _Config.AODLoadSheetColumnNumsWrite[2]) { cell.SetCellValue(lsr.SuggestedAudioFile.AccuracyNote); if (lsr.SuggestedAudioFile.AccuracyNote != Globals.HistoricalApprovalNote) { cell.CellStyle = green; } else { cell.CellStyle = blue; } } else if (colNum == _Config.AODLoadSheetColumnNumsWrite[3]) { cell.SetCellValue(lsr.EncodingResult); cell.CellStyle = green; } else if (colNum == _Config.AODLoadSheetColumnNumsWrite[4]) { cell.SetCellValue(lsr.DestinationPath); cell.CellStyle = green; } else if (colNum == _Config.AODLoadSheetColumnNumsWrite[5]) { cell.SetCellValue(lsr.EncodedFileDurationPretty); cell.CellStyle = green; } else if (colNum == _Config.AODLoadSheetColumnNumsWrite[6]) { cell.SetCellValue(lsr.EncodedFileDurationSeconds); cell.CellStyle = green; } } } else if (lsr.SuggestedAudioFile.AccuracyType == AccuracyType.Questionable && lsr.EncodingResult == Globals.Skipped) { foreach (int colNum in _Config.AODLoadSheetColumnNumsWrite) { cell = row.GetCell(colNum) ?? row.CreateCell(colNum); if (colNum == _Config.AODLoadSheetColumnNumsWrite[0]) { cell.SetCellValue(lsr.SuggestedAudioFile.FullPath); cell.CellStyle = yellow; } else if (colNum == _Config.AODLoadSheetColumnNumsWrite[1]) { cell.SetCellValue(lsr.SuggestedAudioFile.AccuracyScore); cell.CellStyle = yellow; } else if (colNum == _Config.AODLoadSheetColumnNumsWrite[2]) { cell.SetCellValue(lsr.SuggestedAudioFile.AccuracyNote); if (lsr.SuggestedAudioFile.AccuracyNote != Globals.HistoricalApprovalNote) { cell.CellStyle = yellow; } else { cell.CellStyle = blue; } } else if (colNum == _Config.AODLoadSheetColumnNumsWrite[3]) { cell.SetCellValue(lsr.EncodingResult); cell.CellStyle = yellow; } else if (colNum == _Config.AODLoadSheetColumnNumsWrite[4]) { cell.SetCellValue(lsr.DestinationPath); cell.CellStyle = yellow; } else if (colNum == _Config.AODLoadSheetColumnNumsWrite[5]) { cell.SetCellValue(Globals.Skipped); cell.CellStyle = yellow; } else if (colNum == _Config.AODLoadSheetColumnNumsWrite[6]) { cell.SetCellValue(Globals.Skipped); cell.CellStyle = yellow; } } } else //AccuracyType.HighRisk or EncodingResult == "Failed: ..." { foreach (int colNum in _Config.AODLoadSheetColumnNumsWrite) { cell = row.GetCell(colNum) ?? row.CreateCell(colNum); if (colNum == _Config.AODLoadSheetColumnNumsWrite[0]) { cell.SetCellValue(lsr.SuggestedAudioFile.FullPath); cell.CellStyle = red; } else if (colNum == _Config.AODLoadSheetColumnNumsWrite[1]) { cell.SetCellValue(lsr.SuggestedAudioFile.AccuracyScore); cell.CellStyle = red; } else if (colNum == _Config.AODLoadSheetColumnNumsWrite[2]) { cell.SetCellValue(lsr.SuggestedAudioFile.AccuracyNote); if (lsr.SuggestedAudioFile.AccuracyNote != Globals.HistoricalApprovalNote) { cell.CellStyle = red; } else { cell.CellStyle = blue; } } else if (colNum == _Config.AODLoadSheetColumnNumsWrite[3]) { cell.SetCellValue(lsr.EncodingResult); cell.CellStyle = red; } else if (colNum == _Config.AODLoadSheetColumnNumsWrite[4]) { cell.SetCellValue(lsr.DestinationPath); cell.CellStyle = red; } else if (colNum == _Config.AODLoadSheetColumnNumsWrite[5]) { if (lsr.EncodingResult == Globals.Skipped) { cell.SetCellValue(Globals.Skipped); cell.CellStyle = red; } else { cell.SetCellValue(Globals.Failed); cell.CellStyle = red; } } else if (colNum == _Config.AODLoadSheetColumnNumsWrite[6]) { if (lsr.EncodingResult == Globals.Skipped) { cell.SetCellValue(Globals.Skipped); cell.CellStyle = red; } else { cell.SetCellValue(Globals.Failed); cell.CellStyle = red; } } } } } WriteWorkbook(workbook, cursorLeft); }
public void QuickSearchForSuggestedAudioFile(AudioLibrary audioLibrary, AODLoadSheetRow previousLSR, AODLoadSheet parentLoadsheet) { //quick search 1st attempt (lookup if any prior row had identical qualities (aka hash) and shortcut to past results) foreach (AODLoadSheetRow pastLSR in parentLoadsheet.GetAODLoadSheetRows) { if (pastLSR.LoadSheetRowNumber >= _LoadSheetRowNumber) { if (_QuickSearchNotePastLSR == "None") { _QuickSearchNotePastLSR = "No Hash Matches"; } break; } if (_LoadSheetRowHash == pastLSR.LoadSheetRowHash) //identical past loadsheet row (exact replica repeat row) { if (pastLSR.IsSuggestedAudioFileAssigned) { _IsQuickSearchActive = true; _QuickSearchNotePastLSR = "Replica Match"; _Tokens = pastLSR.Tokens; _SearchCollection = pastLSR.SearchCollection; AssignSuggestedAudioFile(); return; } else { _QuickSearchNotePastLSR = "Past Suggested File Not Assigned"; } } } //quick search 2nd attempt (scan previous row's parent directory) if (!previousLSR.IsSuggestedAudioFileAssigned) { AODLoadSheetRow mostRecentAssignedRow = parentLoadsheet.GetMostRecentAssignedRow(this); if (mostRecentAssignedRow != null) { previousLSR = mostRecentAssignedRow; } } if (previousLSR.IsSuggestedAudioFileAssigned) { string previousLSRSubDirPath = previousLSR.SuggestedAudioFile.SubDirectoriesPath; AudioLibrary quickSearchLibrary = audioLibrary.GetQuickAudioLibrarySubset(previousLSRSubDirPath); _SearchCollection = AudioFileSearch.GetBestSearchCollection(quickSearchLibrary, this); if (_SearchCollection.IsOptionQuickSearchElligible(_SearchCollection.BestOption, SearchMethodType.Both, Globals.HighAccuracyThreshold)) //high scoring and not too many options in final pool { _IsQuickSearchActive = true; _QuickSearchNotePreviousLSR = "Met HighAccuracyThreshold"; AssignSuggestedAudioFile(); return; } else { if (_SearchCollection.BestOption.AccuracyScore < Globals.HighAccuracyThreshold) { _QuickSearchNotePreviousLSR = "Missed HighAccuracyThreshold"; } else if (_SearchCollection.ChosenFinalPassCount > 1) { _QuickSearchNotePreviousLSR = "Missed TooManyFinalOptionsThreshold"; } _SearchCollection = null; return; } } else { _QuickSearchNotePreviousLSR = "Previous Suggested File Not Assigned"; } }
private int SelectManualOption(AODLoadSheetRow skippedLSR) { List <char> acceptableSelections = new List <char>(); int manualOptionsCount = skippedLSR.SearchCollection.GetManualOptionsCount(); for (int i = 0; i < manualOptionsCount; i++) { acceptableSelections.Add(i.ToString().First()); } acceptableSelections.Add('s'); acceptableSelections.Add('x'); skippedLSR.SearchCollection.PrintManualOptions(true); int cursorLeftChoice = Console.CursorLeft; Console.WriteLine("\n\n\n\n\n\n"); ConsolePrintHelpers.PrintFullWidthLine(); ConsolePrintHelpers.PrintGreenText(""); //restore text color to green Console.CursorTop -= 8; Console.CursorLeft = cursorLeftChoice; while (true) { while (Console.KeyAvailable) { ConsoleKeyInfo key = Console.ReadKey(true); //flush keyboard buffer } Console.CursorVisible = false; char ChoiceKeyPressed = char.ToLower(Console.ReadKey().KeyChar); if (!acceptableSelections.Any(selection => selection == ChoiceKeyPressed)) { Console.CursorLeft = cursorLeftChoice + 1; //in case user presses "enter" ConsolePrintHelpers.PrintYellowText(" Incorrect Key Pressed!"); Thread.Sleep(1000); Console.CursorLeft = cursorLeftChoice; ConsolePrintHelpers.PrintGreenText(" "); Console.CursorLeft = cursorLeftChoice; } else { AudioFileOption optionToConfirm = null; int cursorTopBeforeRefresh = Console.CursorTop; int cursorLeftBeforeRefresh = Console.CursorLeft; if (ChoiceKeyPressed != 's' && ChoiceKeyPressed != 'x') { int selection = Convert.ToInt32(ChoiceKeyPressed.ToString()); optionToConfirm = skippedLSR.SearchCollection.GetSelectedOption(selection); skippedLSR.SearchCollection.PrintManualOptionsConfirmation(optionToConfirm, ManualSelectionType.Confirm, true); } else if (ChoiceKeyPressed == 's') { skippedLSR.SearchCollection.PrintManualOptionsConfirmation(optionToConfirm, ManualSelectionType.SkipConfirm, true); } else if (ChoiceKeyPressed == 'x') { skippedLSR.SearchCollection.PrintManualOptionsConfirmation(optionToConfirm, ManualSelectionType.SkipAllConfirm, true); } Console.CursorTop = cursorTopBeforeRefresh; Console.CursorLeft = cursorLeftBeforeRefresh; ConsolePrintHelpers.PrintWhiteText(" Confirm ►"); ConsolePrintHelpers.PrintGreenText(" "); int cursorTopConfirm = Console.CursorTop; int cursorLeftConfirm = Console.CursorLeft; Thread.Sleep(250); while (Console.KeyAvailable) { ConsoleKeyInfo key = Console.ReadKey(true); //flush keyboard buffer } Console.CursorVisible = false; char ConfirmKeyPressed = char.ToLower(Console.ReadKey().KeyChar); if (ChoiceKeyPressed == ConfirmKeyPressed) { if (ChoiceKeyPressed == 's') { skippedLSR.SearchCollection.PrintManualOptionsConfirmation(optionToConfirm, ManualSelectionType.SkipSelected, true); return(-1); } if (ChoiceKeyPressed == 'x') { skippedLSR.SearchCollection.PrintManualOptionsConfirmation(optionToConfirm, ManualSelectionType.SkipAllSelected, true); return(-2); } skippedLSR.SearchCollection.PrintManualOptionsConfirmation(optionToConfirm, ManualSelectionType.Selected, true); Console.CursorTop = cursorTopConfirm; Console.WriteLine(); return(Convert.ToInt32(ChoiceKeyPressed.ToString())); } else { Console.CursorLeft = cursorLeftConfirm + 1; //in case user presses "enter" ConsolePrintHelpers.PrintYellowText(" Not Confirmed!"); Thread.Sleep(1000); Console.CursorLeft = cursorLeftChoice; ConsolePrintHelpers.PrintGreenText(" "); Console.CursorLeft = cursorLeftChoice; } } } }
private static AudioFileSearchCollection GetSearchCollection(AudioLibrary audioLibrary, AODLoadSheetRow lsr) { AudioFileSearchCollection searchCollection = new AudioFileSearchCollection(lsr); searchCollection = ForwardsSearch(searchCollection, audioLibrary, lsr.Tokens); AudioFileOption candidateOption_1 = searchCollection.ForwardsFinalPass.GetCandidateOption(); searchCollection = BackwardsSearch(searchCollection, audioLibrary, lsr.Tokens); AudioFileOption candidateOption_2 = searchCollection.BackwardsFinalPass.GetCandidateOption(); int bestCandidateOption = ChooseBestCandidateOption(candidateOption_1, candidateOption_2); if (bestCandidateOption == 1) //CandidateOption_1 { searchCollection.FinishCollection(SearchMethodType.Forwards); return(searchCollection); } else //CandidateOption_2 { searchCollection.FinishCollection(SearchMethodType.Backwards); return(searchCollection); } }