示例#1
0
        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 WriteWorkbook(IWorkbook workbook, int cursorLeft)
        {
            if (!File.Exists(_Config.AODLoadSheetFilePath))
            {
                ConsolePrintHelpers.PrintRedText("\n\n  ERROR  Missing AOD Loadsheet:  ");
                ConsolePrintHelpers.PrintWhiteText(_Config.AODLoadSheetFilePath);
                ConsolePrintHelpers.PressAnyKeyToExit();
            }

            try
            {
                using (FileStream fsWrite = new FileStream(_Config.AODLoadSheetFilePath, FileMode.Create, FileAccess.Write, FileShare.ReadWrite))
                {
                    workbook.Write(fsWrite);
                    fsWrite.Close();
                }

                workbook.Close();

                Console.CursorLeft = cursorLeft;
                ConsolePrintHelpers.PrintYellowText("Updated");
            }
            catch (Exception)
            {
                Console.WriteLine("\n\n");
                ConsolePrintHelpers.PrintRedText("  ERROR: Unable To Update AOD Loadsheet Already Open In Excel\n\n\n");
                ConsolePrintHelpers.PrintRedText("  This Software Will Continue Once The Open Loadsheet Is Closed :  ");
                ConsolePrintHelpers.PrintWhiteText(_Config.AODLoadSheetFilePath);
                Console.WriteLine("\n\n");

                bool updateSuccessful = false;

                while (!updateSuccessful)
                {
                    try
                    {
                        using (FileStream fsWrite = new FileStream(_Config.AODLoadSheetFilePath, FileMode.Create, FileAccess.Write, FileShare.ReadWrite))
                        {
                            workbook.Write(fsWrite);
                            fsWrite.Close();
                        }

                        workbook.Close();

                        Console.CursorTop -= 9;
                        Console.CursorLeft = cursorLeft;
                        ConsolePrintHelpers.PrintYellowText("Updated");
                        Console.CursorTop += 9;

                        updateSuccessful = true;
                    }
                    catch (Exception)
                    {
                        ConsolePrintHelpers.Retry();
                    }
                }
            }

            IncrementalLoadSheetBackup();
        }
示例#3
0
        private void PrintUpdatedEncodingStats()
        {
            Console.CursorTop -= 6;
            Console.CursorLeft = Globals.CursorsLeft[0];
            ConsolePrintHelpers.PrintCyanText(_ActiveEncodings.Count.ToString().PadLeft(Globals.EncodingStatsCounterPadding, '0'));

            Console.CursorTop += 1;
            Console.CursorLeft = Globals.CursorsLeft[0];
            ConsolePrintHelpers.PrintCyanText(_FinishedEncodings.Count.ToString().PadLeft(Globals.EncodingStatsCounterPadding, '0'));

            Console.CursorTop += 1;
            Console.CursorLeft = Globals.CursorsLeft[0];
            ConsolePrintHelpers.PrintCyanText(_EncodedFilesCount.ToString().PadLeft(Globals.EncodingStatsCounterPadding, '0'));

            Console.CursorTop += 1;
            Console.CursorLeft = Globals.CursorsLeft[0];
            ConsolePrintHelpers.PrintCyanText(_CopiedFilesCount.ToString().PadLeft(Globals.EncodingStatsCounterPadding, '0'));

            Console.CursorTop += 1;
            Console.CursorLeft = Globals.CursorsLeft[0];
            ConsolePrintHelpers.PrintCyanText(_History.GetAlreadyEncodedFilesCount().ToString().PadLeft(Globals.EncodingStatsCounterPadding, '0'));

            Console.CursorTop += 1;
            Console.CursorLeft = Globals.CursorsLeft[0];
            ConsolePrintHelpers.PrintCyanText(_EncodingQueues.SkippedQueue.Count.ToString().PadLeft(Globals.EncodingStatsCounterPadding, '0'));

            Console.CursorTop += 1;
            Console.CursorLeft = Globals.CursorsLeft[0];
            ConsolePrintHelpers.PrintCyanText(_EncodingQueues.EncodingQueue.Count.ToString().PadLeft(Globals.EncodingStatsCounterPadding, '0'));
        }
        public void PrintAudioFileOptionsStatistics(string statsHeaderToPrint)
        {
            ConsolePrintHelpers.PrintWhiteText("  ____________________________");
            ConsolePrintHelpers.PrintWhiteText("\n  " + statsHeaderToPrint);
            Console.WriteLine();

            ConsolePrintHelpers.PrintWhiteText("     -Best Accuracy Score      :");
            Console.CursorLeft = Globals.CursorsLeft[0];
            ConsolePrintHelpers.PrintCyanText(_BestAccuracyScore.ToString());
            Console.WriteLine();

            ConsolePrintHelpers.PrintWhiteText("     -Best Total Points        :");
            Console.CursorLeft = Globals.CursorsLeft[0];
            ConsolePrintHelpers.PrintCyanText(_BestTotalPoints.ToString());
            Console.WriteLine();

            ConsolePrintHelpers.PrintWhiteText("     -Best Artist/Album Points :");
            Console.CursorLeft = Globals.CursorsLeft[0];
            ConsolePrintHelpers.PrintCyanText(_BestArtistAlbumPoints.ToString());
            Console.WriteLine();

            ConsolePrintHelpers.PrintWhiteText("     -Best Track Points        :");
            Console.CursorLeft = Globals.CursorsLeft[0];
            ConsolePrintHelpers.PrintCyanText(_BestTrackPoints.ToString());

            Console.WriteLine();
        }
        public void ReadHistoryFromFiles()
        {
            ConsolePrintHelpers.PrintYellowText("\n\n\n  Reading And Validating History Files");
            ConsolePrintHelpers.PrintWhiteText(" ► ");

            bool cancelProgressTicker = false;

            Task ticker = Task.Run(() => ConsolePrintHelpers.PrintProgressTicker(ref cancelProgressTicker));

            List <Task> readingTasks = new List <Task>();

            readingTasks.Add(Task.Run(() => ReadApprovedLoadSheetRowsFromFile()));
            readingTasks.Add(Task.Run(() => ReadAlreadyEncodedFilesFromFile()));

            Task.WaitAll(readingTasks.ToArray());

            DeleteSeveredAlreadyEncodedFiles();

            GC.Collect();

            cancelProgressTicker = true;

            ticker.Wait();

            ConsolePrintHelpers.PrintYellowText("Done");
        }
示例#6
0
        public void SearchForSourceAudioFiles(AudioLibrary audioLibrary)
        {
            Stopwatch stopwatch = ConsolePrintHelpers.PrintHeaderAndStartStopWatch();

            ConsolePrintHelpers.PrintWhiteText("  Searching For Source Audio Files...\n\n\n");

            _ActiveSearches.Clear();

            _SearchRowsRemaining = _LoadSheet.GetAODLoadSheetRows.Count;

            ConsolePrintHelpers.PrintWhiteText("  Search Pass 1...\n\n");

            PrintSearchStatsHeaders();

            Search_Pass1(audioLibrary);

            ConsolePrintHelpers.PrintWhiteText("\n\n  Search Pass 2...\n\n");

            PrintSearchStatsHeaders();

            Search_Pass2(audioLibrary);

            ConsolePrintHelpers.PrintWhiteText("\n\n  Search Pass 3...\n\n");

            PrintSearchStatsHeaders();

            Search_Pass3(audioLibrary);

            ConsolePrintHelpers.PrintDurationAndWait(stopwatch, "Search");
        }
示例#7
0
        public void PrintPendingCopyOrEncodeStats()
        {
            int encodeCount = 0;
            int copyCount   = 0;

            foreach (AudioFileEncoding encoding in _EncodingQueue)
            {
                if (encoding.TryToCopyAlreadyEncodedFile == false)
                {
                    encodeCount++;
                }
                else
                {
                    copyCount++;
                }
            }

            Console.WriteLine("\n\n");

            ConsolePrintHelpers.PrintGreenText("  Pending File Encodes  ");
            ConsolePrintHelpers.PrintWhiteText(":  ");
            ConsolePrintHelpers.PrintCyanText(encodeCount.ToString().PadLeft(Globals.EncodingStatsCounterPadding, '0'));
            Console.WriteLine();

            ConsolePrintHelpers.PrintGreenText("  Pending File Copies   ");
            ConsolePrintHelpers.PrintWhiteText(":  ");
            ConsolePrintHelpers.PrintCyanText(copyCount.ToString().PadLeft(Globals.EncodingStatsCounterPadding, '0'));
            Console.WriteLine();

            ConsolePrintHelpers.PrintGreenText("  Skipped Encodings     ");
            ConsolePrintHelpers.PrintWhiteText(":  ");
            ConsolePrintHelpers.PrintCyanText(_SkippedQueue.Count.ToString().PadLeft(Globals.EncodingStatsCounterPadding, '0'));
        }
        public void PrintApprovedLoadSheetRows_DEBUG()
        {
            ConsolePrintHelpers.PrintHeader();

            ConsolePrintHelpers.PrintWhiteText("  Printing Approved Load Sheet Rows...");

            Console.WriteLine("\n\n");
            ConsolePrintHelpers.PrintWhiteText("  Approved Load Sheet Rows Count :  ");
            ConsolePrintHelpers.PrintCyanText(_ApprovedLoadSheetRows.Count.ToString());

            ConsolePrintHelpers.Wait();

            if (_ApprovedLoadSheetRows.Count > 0)
            {
                Console.WriteLine("\n\n");
            }

            foreach (ApprovedLoadSheetRow approvedLSR in _ApprovedLoadSheetRows)
            {
                ConsolePrintHelpers.PrintFullWidthLine();

                ConsolePrintHelpers.PrintWhiteText("  Is Valid?         :  ");
                if (approvedLSR.ReCheckIfValid())
                {
                    ConsolePrintHelpers.PrintYellowText(approvedLSR.IsValid.ToString());
                }
                else
                {
                    ConsolePrintHelpers.PrintRedText(approvedLSR.IsValid.ToString());
                }
                Console.WriteLine();

                ConsolePrintHelpers.PrintWhiteText("  Source File Path  :  ");
                ConsolePrintHelpers.PrintCyanText(approvedLSR.SourceFilePath);
                Console.WriteLine();

                ConsolePrintHelpers.PrintWhiteText("  Source File Date  :  ");
                ConsolePrintHelpers.PrintCyanText(approvedLSR.SourceFileModifiedDate);
                Console.WriteLine();

                ConsolePrintHelpers.PrintWhiteText("  Source File Size  :  ");
                ConsolePrintHelpers.PrintCyanText((approvedLSR.SourceFileSize / 1024 / 1024).ToString() + " MB");
                Console.WriteLine("\n");

                ConsolePrintHelpers.PrintWhiteText("  LSR Hash          :  ");
                ConsolePrintHelpers.PrintCyanText(approvedLSR.LoadSheetRowHash);
                Console.WriteLine();

                ConsolePrintHelpers.PrintWhiteText("  Accuracy Score    :  ");
                ConsolePrintHelpers.PrintCyanText(approvedLSR.AccuracyScore.ToString());
                Console.WriteLine();

                ConsolePrintHelpers.PrintWhiteText("  Accuracy Type     :  ");
                ConsolePrintHelpers.PrintCyanText(approvedLSR.AccuracyType.ToString());
                Console.WriteLine();
            }

            ConsolePrintHelpers.PressAnyKeyToContinue();
        }
        public void WriteEncodingHistoryToFile(bool printProgress)
        {
            bool cancelProgressTicker = false;
            Task ticker = null;

            if (printProgress)
            {
                ConsolePrintHelpers.PrintYellowText("\n\n\n  [DO NOT CLOSE CONSOLE WINDOW]  Updating Encoding History File");
                ConsolePrintHelpers.PrintWhiteText(" ► ");

                int cursorLeft = Console.CursorLeft;

                Console.WriteLine("\n\n");
                Console.CursorTop -= 3;
                Console.CursorLeft = cursorLeft;

                ticker = Task.Run(() => ConsolePrintHelpers.PrintProgressTicker(ref cancelProgressTicker));
            }

            foreach (AlreadyEncodedFile file in _AlreadyEncodedFiles.Skip(Globals.MaximumLinesForHistoryFiles))  //If history is too large, delete oldest files (end of list)
            {
                DeleteAlreadyEncodedFile(file);
            }

            List <string> linesList = new List <string>();

            foreach (AlreadyEncodedFile file in _AlreadyEncodedFiles.Take(Globals.MaximumLinesForHistoryFiles)) //If history is too large, only keep records of newest files (front of list)
            {
                if (file.IsValid)                                                                               //No Re-checkIfValid() because when lines are read back in from file they are re-checked.
                {
                    string line = file.EncodedFilePath + "*" +
                                  file.EncodedFileModifiedDate + "*" +
                                  file.EncodedFileSize.ToString() + "*" +
                                  file.SourceFilePath + "*" +
                                  file.SourceFileModifiedDate + "*" +
                                  file.SourceFileSize.ToString() + "*" +
                                  file.EncodedStatus;

                    linesList.Add(line);
                }
            }

            try
            {
                File.WriteAllLines(_EncodingHistoryFilePath, linesList);
            }
            catch (Exception) { }

            if (printProgress)
            {
                cancelProgressTicker = true;

                ticker.Wait();

                ConsolePrintHelpers.PrintYellowText("Updated");
            }
        }
示例#10
0
        private void PrintUpdatedSearchStats()
        {
            Console.CursorTop  -= 1;
            Console.CursorLeft -= Globals.EncodingStatsCounterPadding;
            ConsolePrintHelpers.PrintCyanText(_ActiveSearches.Count.ToString().PadLeft(Globals.EncodingStatsCounterPadding, '0'));

            Console.CursorTop  += 1;
            Console.CursorLeft -= Globals.EncodingStatsCounterPadding;
            ConsolePrintHelpers.PrintCyanText(_SearchRowsRemaining.ToString().PadLeft(Globals.EncodingStatsCounterPadding, '0'));
        }
示例#11
0
 private void PrintSearchStatsHeaders()
 {
     ConsolePrintHelpers.PrintGreenText("  Active Searches ");
     ConsolePrintHelpers.PrintWhiteText(":  ");
     ConsolePrintHelpers.PrintCyanText("000000");
     Console.WriteLine();
     ConsolePrintHelpers.PrintGreenText("  Remaining Rows  ");
     ConsolePrintHelpers.PrintWhiteText(":  ");
     ConsolePrintHelpers.PrintCyanText("000000");
 }
示例#12
0
        private bool PromptToViewSkippedEncodings()
        {
            ConsolePrintHelpers.PrintWhiteText("\n\n\n  Please Select...\n\n");

            ConsolePrintHelpers.PrintGreenText("    1");
            ConsolePrintHelpers.PrintWhiteText(" ► Exit Application\n\n");

            ConsolePrintHelpers.PrintGreenText("    2");
            ConsolePrintHelpers.PrintWhiteText(" ► View Skipped Encodings\n\n");

            Console.WriteLine("\n\n");
            Console.CursorTop -= 3;

            ConsolePrintHelpers.PrintWhiteText("  Choice ►");

            ConsolePrintHelpers.PrintGreenText(" ");

            while (true)
            {
                int cursorLeft = Console.CursorLeft;

                while (Console.KeyAvailable)
                {
                    ConsoleKeyInfo key = Console.ReadKey(true);  //flush keyboard buffer
                }

                ConsoleKeyInfo keyPressed = Console.ReadKey();

                Thread.Sleep(500);

                if (keyPressed.KeyChar != '1' && keyPressed.KeyChar != '2')
                {
                    Console.CursorLeft = cursorLeft + 1; //in case user presses "enter"
                    ConsolePrintHelpers.PrintYellowText("  Incorrect Key Pressed!");
                    Thread.Sleep(1000);
                    Console.CursorLeft = cursorLeft;
                    ConsolePrintHelpers.PrintGreenText("                         ");
                    Console.CursorLeft = cursorLeft;
                }
                else
                {
                    if (keyPressed.KeyChar == '1')
                    {
                        return(true);
                    }

                    if (keyPressed.KeyChar == '2')
                    {
                        return(false);
                    }
                }
            }
        }
        public void PrintHistoryStats()
        {
            Console.WriteLine("\n");
            ConsolePrintHelpers.PrintGreenText("  History Approved Rows ");
            ConsolePrintHelpers.PrintWhiteText(":  ");
            ConsolePrintHelpers.PrintCyanText(_ApprovedLoadSheetRows.Count.ToString().PadLeft(Globals.EncodingStatsCounterPadding, '0'));

            Console.WriteLine();
            ConsolePrintHelpers.PrintGreenText("  History Encoded Files ");
            ConsolePrintHelpers.PrintWhiteText(":  ");
            ConsolePrintHelpers.PrintCyanText(_AlreadyEncodedFiles.Count.ToString().PadLeft(Globals.EncodingStatsCounterPadding, '0'));
        }
        private void AssignCycle()
        {
            string loadSheetFileName = Path.GetFileNameWithoutExtension(_AODLoadSheetFilePath);

            _Cycle = Regex.Match(loadSheetFileName, @"\d{4}$").ToString();  //Grab cycle digits at end of AOD Loadsheet filename

            if (!loadSheetFileName.EndsWith(_Cycle) || !CycleValidator.Validate4DigitCycle(_Cycle))
            {
                ConsolePrintHelpers.PrintRedText("\n  ERROR: Invalid Loadsheet cycle number at end of filename:  " + _Cycle);
                ConsolePrintHelpers.PressAnyKeyToExit();
            }
        }
        public void PrintAudioFileOptions(AudioFileOption bestOption, string headerToPrint)
        {
            ConsolePrintHelpers.PrintWhiteText("\n  " + headerToPrint + " Option(s) :  ");

            int longestPathLength = 0;
            int currentPathLength;

            foreach (AudioFileOption option in _AudioFileOptions)
            {
                currentPathLength = Globals.CursorsLeft[0] + option.LibraryFile.FullPath.Length;

                if (currentPathLength > longestPathLength)
                {
                    longestPathLength = currentPathLength;
                }
            }

            foreach (AudioFileOption option in _AudioFileOptions)
            {
                Console.CursorLeft = Globals.CursorsLeft[0];

                if (option.LibraryFile.FullPath == bestOption.LibraryFile.FullPath)
                {
                    ConsolePrintHelpers.PrintGrayText(option.LibraryFile.FullPath);
                }
                else
                {
                    ConsolePrintHelpers.PrintDarkGrayText(option.LibraryFile.FullPath);
                }

                Console.CursorLeft = longestPathLength;

                ConsolePrintHelpers.PrintWhiteText("     [");
                ConsolePrintHelpers.PrintGrayText("S: ");
                ConsolePrintHelpers.PrintCyanText(option.AccuracyScore.ToString().PadLeft(4));
                ConsolePrintHelpers.PrintGrayText(",  T: ");
                ConsolePrintHelpers.PrintYellowText(option.GetTotalPoints().ToString().PadLeft(3));
                ConsolePrintHelpers.PrintGrayText(",  A/A: " + option.ArtistAlbumPoints.ToString().PadLeft(3) + ",  Tr: " + option.TrackPoints.ToString().PadLeft(3) + ", Size: " + option.LibraryFile.FileSize + " bytes");
                ConsolePrintHelpers.PrintWhiteText("]\n");
            }

            if (_AudioFileOptionsOriginalCount > _AudioFileOptions.Count)
            {
                Console.CursorLeft = Globals.CursorsLeft[0];
                ConsolePrintHelpers.PrintWhiteText((_AudioFileOptionsOriginalCount - _AudioFileOptions.Count).ToString());
                ConsolePrintHelpers.PrintDarkGrayText(" Remaining Files Not Printed...\n");
            }

            Console.WriteLine();
        }
示例#16
0
        private bool PromptToManuallyAssignSkippedEncodings()
        {
            ConsolePrintHelpers.PrintWhiteText("\n\n\n  Please Select...\n\n");

            ConsolePrintHelpers.PrintGreenText("    1");
            ConsolePrintHelpers.PrintWhiteText(" ► Manually Assign Source Files For Skipped Encodings\n\n");

            ConsolePrintHelpers.PrintGreenText("    2");
            ConsolePrintHelpers.PrintWhiteText(" ► Continue With Skipped Encodings\n\n");

            ConsolePrintHelpers.PrintWhiteText("  Choice ►");
            ConsolePrintHelpers.PrintGreenText(" ");

            while (true)
            {
                int cursorLeft = Console.CursorLeft;

                while (Console.KeyAvailable)
                {
                    ConsoleKeyInfo key = Console.ReadKey(true);  //flush keyboard buffer
                }

                ConsoleKeyInfo keyPressed = Console.ReadKey();

                Thread.Sleep(500);

                if (keyPressed.KeyChar != '1' && keyPressed.KeyChar != '2')
                {
                    Console.CursorLeft = cursorLeft + 1; //in case user presses "enter"
                    ConsolePrintHelpers.PrintYellowText("  Incorrect Key Pressed!");
                    Thread.Sleep(1000);
                    Console.CursorLeft = cursorLeft;
                    ConsolePrintHelpers.PrintGreenText("                         ");
                    Console.CursorLeft = cursorLeft;
                }
                else
                {
                    if (keyPressed.KeyChar == '1')
                    {
                        return(true);
                    }

                    if (keyPressed.KeyChar == '2')
                    {
                        return(false);
                    }
                }
            }
        }
        private void ValidateLoadSheet()
        {
            ConsolePrintHelpers.PrintWhiteText("  Path:  ");

            if (File.Exists(_Config.AODLoadSheetFilePath))
            {
                ConsolePrintHelpers.PrintGreenText(_Config.AODLoadSheetFilePath + "\n\n");
            }
            else
            {
                ConsolePrintHelpers.PrintRedText(_Config.AODLoadSheetFilePath);
                ConsolePrintHelpers.PrintWhiteText("   ERROR: Missing Loadsheet at this path");
                ConsolePrintHelpers.PressAnyKeyToExit();
            }
        }
        private void AssignLoadSheet()
        {
            _AODLoadSheetFilePath = @"None";

            DirectoryInfo di = new DirectoryInfo(_AODLoadSheetDirectoryPath);

            IEnumerable <FileInfo> finfo = di.GetFiles("*.xlsx");

            if (finfo.Count() > 2)
            {
                ConsolePrintHelpers.PrintRedText("\n\n  ERROR  More Than 1 AOD Loadsheet Found In Directory:  ");
                ConsolePrintHelpers.PrintWhiteText(_AODLoadSheetDirectoryPath);
                ConsolePrintHelpers.PressAnyKeyToExit();
            }
            else if (finfo.Count() == 2)  //Might have a hidden temporary file "~$file.xlsx"
            {
                bool foundTempFile = false;

                foreach (FileInfo fi in finfo)
                {
                    if (fi.Name.Contains(@"~$"))
                    {
                        foundTempFile = true;
                    }
                    else
                    {
                        _AODLoadSheetFilePath = fi.FullName;
                    }
                }

                if (!foundTempFile)
                {
                    ConsolePrintHelpers.PrintRedText("\n\n  ERROR  More Than 1 AOD Loadsheet Found In Directory:  ");
                    ConsolePrintHelpers.PrintWhiteText(_AODLoadSheetDirectoryPath);
                    ConsolePrintHelpers.PressAnyKeyToExit();
                }
            }
            else if (finfo.Count() == 0)
            {
                ConsolePrintHelpers.PrintRedText("\n\n  ERROR  Missing AOD Loadsheet In Directory:  ");
                ConsolePrintHelpers.PrintWhiteText(_AODLoadSheetDirectoryPath);
                ConsolePrintHelpers.PressAnyKeyToExit();
            }
            else //only 1 .xlsx file found
            {
                _AODLoadSheetFilePath = finfo.First().FullName;
            }
        }
        public void WriteApprovalHistoryToFile(bool printProgress)
        {
            bool cancelProgressTicker = false;
            Task ticker = null;

            if (printProgress)
            {
                ConsolePrintHelpers.PrintYellowText("\n\n\n  [DO NOT CLOSE CONSOLE WINDOW]  Updating Approval History File");
                ConsolePrintHelpers.PrintWhiteText(" ► ");

                ticker = Task.Run(() => ConsolePrintHelpers.PrintProgressTicker(ref cancelProgressTicker));
            }

            List <string> linesList = new List <string>();

            foreach (ApprovedLoadSheetRow approvedLSR in _ApprovedLoadSheetRows.Take(Globals.MaximumLinesForHistoryFiles)) //Trim history if too large (long term performance concerns)
            {
                if (approvedLSR.IsValid)                                                                                   //No Re-checkIfValid() because when lines are read back in from file they are re-checked.
                {
                    string line = approvedLSR.SourceFilePath + "*" +
                                  approvedLSR.SourceFileModifiedDate + "*" +
                                  approvedLSR.SourceFileSize.ToString() + "*" +
                                  approvedLSR.LoadSheetRowHash + "*" +
                                  approvedLSR.TotalPoints + "*" +
                                  approvedLSR.AccuracyScore.ToString() + "*" +
                                  approvedLSR.AccuracyType.ToString();

                    linesList.Add(line);
                }
            }

            try
            {
                File.WriteAllLines(_ApprovalHistoryFilePath, linesList);
            }
            catch (Exception) { }

            if (printProgress)
            {
                cancelProgressTicker = true;

                ticker.Wait();

                ConsolePrintHelpers.PrintYellowText("Updated");
            }
        }
示例#20
0
        private void PrepareEncodingHistory()
        {
            Stopwatch stopwatch = ConsolePrintHelpers.PrintHeaderAndStartStopWatch();

            ConsolePrintHelpers.PrintWhiteText("  Preparing Encoding History...");

            _History = new AudioEncoderHistory(this);

            _History.ReadHistoryFromFiles();

            ConsolePrintHelpers.PrintDuration(stopwatch, "Preparing History");

            Console.WriteLine();

            _History.PrintHistoryStats();

            ConsolePrintHelpers.Wait();
        }
示例#21
0
        public void BuildEncodingQueue()
        {
            _EncodingQueue = new Queue <AudioFileEncoding>();
            _SkippedQueue  = new Queue <AODLoadSheetRow>();

            _TempEncodingOrCopyList = new List <AODLoadSheetRow>();
            _TempSkippedList        = new List <AODLoadSheetRow>();

            ConsolePrintHelpers.PrintHeader();

            ConsolePrintHelpers.PrintWhiteText("  Building Encoding Queue...");

            DetermineSkippedLoadsheetRows();

            ManuallyAssignSkippedEncodings();

            FinishEncodingQueue();
        }
        static void Main()
        {
            AudioEncoderConfig config = new AudioEncoderConfig();


            AudioLibrary audioLibrary = new AudioLibrary(config);

            audioLibrary.ScanAudioLibrary();
            //DEBUG Methods------------------------------------------
            //audioLibrary.PrintAudioLibraryFileInfo_DEBUG();
            //audioLibrary.PrintUniqueTrackNumberPatterns_DEBUG();
            //audioLibrary.PrintUniqueFileExtensions_DEBUG();
            //-------------------------------------------------------


            AODLoadSheet loadSheet = new AODLoadSheet(config);

            loadSheet.ReadLoadSheet();
            //DEBUG Methods------------------------------------------
            //loadSheet.PrintAODLoadSheetPretty_DEBUG();
            //loadSheet.PrintCharactersFoundList_DEBUG();
            //loadSheet.PrintTokensPerRowAllRows_DEBUG();
            //loadSheet.SortAODLoadSheetByLSRCharCount_DEBUG();
            //-------------------------------------------------------


            AudioEncoderController controller = new AudioEncoderController(loadSheet);

            controller.SearchForSourceAudioFiles(audioLibrary);
            //DEBUG Methods------------------------------------------
            //controller.PrintApprovedLoadSheetRows_DEBUG();
            //controller.PrintAlreadyEncodedFiles_DEBUG();
            //controller.PrintEncodingQueue_DEBUG();
            //-------------------------------------------------------


            DropAudioLibrary(ref audioLibrary);

            controller.EncodeAudioFiles();

            DropRemainingReferences(ref config, ref loadSheet, ref controller);

            ConsolePrintHelpers.PressAnyKeyToExit();
        }
        public void WriteHistoryToFiles()
        {
            ConsolePrintHelpers.PrintYellowText("\n\n\n  [DO NOT CLOSE CONSOLE WINDOW]  Updating All History Files");
            ConsolePrintHelpers.PrintWhiteText(" ► ");
            int cursorLeft = Console.CursorLeft;

            Console.WriteLine("\n\n");
            Console.CursorTop -= 3;

            List <Task> writingTasks = new List <Task>();

            writingTasks.Add(Task.Run(() => WriteApprovalHistoryToFile(false)));
            writingTasks.Add(Task.Run(() => WriteEncodingHistoryToFile(false)));

            Task.WaitAll(writingTasks.ToArray());

            Console.CursorLeft = cursorLeft;
            ConsolePrintHelpers.PrintYellowText("Updated");
        }
        public void AssignSuggestedAudioFileFromManualApproval(AudioFileOption bestOption)
        {
            if (_SearchCollection != null)
            {
                _SearchCollection.AssignBestOptionFromManualOptions(bestOption);

                AssignSuggestedAudioFile();

                _IsApproved = true;

                _SuggestedAudioFile.AccuracyNote = Globals.WasApprovedNote;
            }
            else
            {
                ConsolePrintHelpers.PrintRedText("\n\n  ERROR  Trying To Assign Suggested Audio File With Null Search Collection at LSR #:  ");
                ConsolePrintHelpers.PrintWhiteText((_LoadSheetRowNumber + 1).ToString());
                ConsolePrintHelpers.PressAnyKeyToExit();
            }
        }
        private IWorkbook ReadWorkBook()
        {
            if (!File.Exists(_Config.AODLoadSheetFilePath))
            {
                ConsolePrintHelpers.PrintRedText("\n\n  ERROR  Missing AOD Loadsheet:  ");
                ConsolePrintHelpers.PrintWhiteText(_Config.AODLoadSheetFilePath);
                ConsolePrintHelpers.PressAnyKeyToExit();
            }

            IWorkbook workbook;

            using (FileStream fsRead = new FileStream(_Config.AODLoadSheetFilePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
            {
                workbook = WorkbookFactory.Create(fsRead);

                fsRead.Close();
            }

            return(workbook);
        }
示例#26
0
        public bool CompareBoth()
        {
            Thread.Sleep(10000);
            bool matchFound = false;

            foreach (Guid id1 in list1)
            {
                foreach (Guid id2 in list2)
                {
                    //Console.WriteLine("NO match:  " + id1.ToString() + "   " + id2.ToString());

                    if (id1.ToString() == id2.ToString())
                    {
                        matchFound = true;
                        ConsolePrintHelpers.PrintCyanText("match:  " + id1.ToString() + "   " + id2.ToString());
                    }
                }
            }

            return(matchFound);
        }
        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 void PrintProductionLSRInfo()
        {
            Console.CursorVisible = false;

            Console.WriteLine();
            ConsolePrintHelpers.PrintFullWidthLine();
            Console.CursorTop -= 2;

            PrintBasicLSRInfo();

            if (_IsApproved)
            {
                _SuggestedAudioFile.PrintSuggestedAudioFileInfo(true);
            }
            else
            {
                _SuggestedAudioFile.PrintSuggestedAudioFileInfo(false);
            }

            Console.WriteLine("\n");
        }
示例#29
0
        private void PrintEncodingStatsHeaders()
        {
            ConsolePrintHelpers.PrintGreenText("  Active Encodings             ");
            ConsolePrintHelpers.PrintWhiteText(":  ");
            ConsolePrintHelpers.PrintCyanText("000000");
            Console.WriteLine();

            ConsolePrintHelpers.PrintGreenText("  Pending LS Row Updates       ");
            ConsolePrintHelpers.PrintWhiteText(":  ");
            ConsolePrintHelpers.PrintCyanText("000000");
            Console.WriteLine();

            ConsolePrintHelpers.PrintGreenText("  New Encoded Files            ");
            ConsolePrintHelpers.PrintWhiteText(":  ");
            ConsolePrintHelpers.PrintCyanText("000000");
            Console.WriteLine();

            ConsolePrintHelpers.PrintGreenText("  New Copied Files             ");
            ConsolePrintHelpers.PrintWhiteText(":  ");
            ConsolePrintHelpers.PrintCyanText("000000");
            Console.WriteLine();

            ConsolePrintHelpers.PrintGreenText("  History Encoded Files        ");
            ConsolePrintHelpers.PrintWhiteText(":  ");
            ConsolePrintHelpers.PrintCyanText("000000");
            Console.WriteLine();

            ConsolePrintHelpers.PrintGreenText("  Skipped Encodings            ");
            ConsolePrintHelpers.PrintWhiteText(":  ");
            ConsolePrintHelpers.PrintCyanText("000000");
            Console.WriteLine();

            ConsolePrintHelpers.PrintGreenText("  Remaining Encodings          ");
            ConsolePrintHelpers.PrintWhiteText(":  ");
            ConsolePrintHelpers.PrintCyanText("000000");
            Console.WriteLine("\n\n");

            Console.CursorTop -= 3;
        }
        public void PrintUniqueFileExtensions_DEBUG()
        {
            ConsolePrintHelpers.PrintHeader();

            ConsolePrintHelpers.PrintWhiteText("  Printing File Extensions Found in Audio Library...");

            ConsolePrintHelpers.Wait();

            Console.WriteLine("\n\n");

            List <string> uniqueFileExtensions = new List <string>();

            foreach (AudioLibraryFile file in _AudioLibraryFiles)
            {
                string extension = Path.GetExtension(file.FullPath);

                if (!uniqueFileExtensions.Contains(extension))
                {
                    uniqueFileExtensions.Add(extension);
                }
            }

            uniqueFileExtensions.Sort();

            int counter    = 1;
            int cursorLeft = 18;

            foreach (string ext in uniqueFileExtensions)
            {
                ConsolePrintHelpers.PrintWhiteText("  Extension " + counter + ":  ");
                Console.CursorLeft = cursorLeft;
                ConsolePrintHelpers.PrintCyanText(ext);
                Console.WriteLine("\n");
                counter++;
            }

            ConsolePrintHelpers.PressAnyKeyToContinue();
        }