private void ReadApprovedLoadSheetRowsFromFile() { _ApprovedLoadSheetRows = new LinkedList <ApprovedLoadSheetRow>(); if (File.Exists(_ApprovalHistoryFilePath)) { try { string[] lines = File.ReadAllLines(_ApprovalHistoryFilePath); foreach (string line in lines) { List <string> valuesFromHistoryFile = line.Split('*').ToList(); if (valuesFromHistoryFile.Count == 7) { ApprovedLoadSheetRow approvedLSR = new ApprovedLoadSheetRow(valuesFromHistoryFile); if (approvedLSR.IsValid) { _ApprovedLoadSheetRows.AddLast(approvedLSR); //Add to END of list } } } } catch (Exception) { } } }
public AudioFileOption CheckManualOptions(ApprovedLoadSheetRow approvedLSR) { foreach (AudioFileOption manualOption in _ManualOptions.GetAudioFileOptions) { AudioLibraryFile libraryFile = manualOption.LibraryFile; if (libraryFile.FullPath == approvedLSR.SourceFilePath) //Same source file path { if (libraryFile.FullPath.Length < Globals.MaxPathLenth) //Check if path length is too long to be able to get a modified date / filesize { if (libraryFile.ModifiedDate == approvedLSR.SourceFileModifiedDate) //Same source file modified date { if (libraryFile.FileSize == approvedLSR.SourceFileSize) //Same source file filesize { return(manualOption); } } } else //long path, we can't check modified date / filesize { return(manualOption); } } } return(null); }
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 bool IsHistoricallyApproved(ApprovedLoadSheetRow approvedLSR) { //Same LSRHash Approval---------------------------------------------------------------- if (_LoadSheetRowHash == approvedLSR.LoadSheetRowHash) { AudioFileOption manualOption = _SearchCollection.CheckManualOptions(approvedLSR); if (manualOption != null) { AssignSuggestedAudioFileFromManualApproval(manualOption); return(true); } } //Same Source File Approval------------------------------------------------------------ if (_SuggestedAudioFile.FullPath != approvedLSR.SourceFilePath) { return(false); } if (_SuggestedAudioFile.FullPath.Length < Globals.MaxPathLenth) { if (_SuggestedAudioFile.ModifiedDate != approvedLSR.SourceFileModifiedDate) { return(false); } if (_SuggestedAudioFile.FileSize != approvedLSR.SourceFileSize) { return(false); } } if (_LoadSheetRowHash == approvedLSR.LoadSheetRowHash) { return(true); //Matching identical hashes is a valid re-approval } if (_SuggestedAudioFile.AccuracyScore < approvedLSR.AccuracyScore) { return(false); } if (_SuggestedAudioFile.TotalPoints < approvedLSR.TotalPoints) { return(false); } if (_SuggestedAudioFile.IsPossiblyWrongCycle) { return(false); } if (_SuggestedAudioFile.AccuracyType == AccuracyType.HighRisk) { return(false); } if (approvedLSR.AccuracyType == AccuracyType.HighRisk) { return(false); } if (approvedLSR.LoadSheetRowHash.Contains(_TrackNumberTrackHash)) { return(true); //If LSR hashes are not identical, it can be re-approved with same or better accuracy scores and total points and the same _TrackNumberTrackHash, as long as it does not think it is from the wrong cycle or is a 'High Risk' Accuracy type } return(false); //Matching source file, but no other qualities we are looking for match what we want }