private void PrintTag(PrintQueue printQueue, PluginExecutionData executionData)
        {
            StringBuilder strFileContent = new StringBuilder();

            strFileContent.AppendLine();
            strFileContent.AppendLine();
            strFileContent.AppendLine($"UserName: {_userName}");
            strFileContent.AppendLine($"Session ID: {_sessionId}");
            strFileContent.AppendLine($"Actvity ID: {executionData.ActivityExecutionId}");
            strFileContent.AppendLine($"Date: {DateTime.Now.ToShortDateString()}");
            strFileContent.AppendLine($"Time: {DateTime.Now.ToShortTimeString()}");

            string tagfileName = Path.Combine(Path.GetTempPath(), $"{executionData.ActivityExecutionId}.txt");

            File.WriteAllText(tagfileName, strFileContent.ToString(), Encoding.ASCII);

            FilePrinter printer = FilePrinterFactory.Create(tagfileName);

            printer.Print(printQueue);

            File.Delete(tagfileName);
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            string fileName       = "shows.tv";
            string outputFileName = "storage.tv";

            IPrinter printer = new ConsolePrinter();

            printer.Print($"Reading data from file {fileName}");

            Episode[] episodes = TvUtilities.LoadEpisodesFromFile(fileName);
            Season    season   = new Season(1, episodes);

            printer.Print(season.ToString());
            for (int i = 0; i < season.Length; i++)
            {
                season[i].AddView(TvUtilities.GenerateRandomScore());
            }
            printer.Print(season.ToString());

            printer = new FilePrinter(outputFileName);
            printer.Print(season.ToString());
        }
Beispiel #3
0
        private static void PrintTag(PrintQueue printQueue, PluginExecutionData executionData)
        {
            StringBuilder strFileContent = new StringBuilder();

            strFileContent.AppendLine();
            strFileContent.AppendLine();
            strFileContent.AppendLine(string.Format("UserName: {0}", Environment.UserName));
            strFileContent.AppendLine(string.Format("Session ID: {0}", executionData.SessionId));
            strFileContent.AppendLine(string.Format("Activity ID:{0}", executionData.ActivityExecutionId));
            strFileContent.AppendLine(string.Format("Date: {0}", DateTime.Now.ToShortDateString()));
            strFileContent.AppendLine(string.Format("Time: {0}", DateTime.Now.ToShortTimeString()));

            string tagfileName = Path.Combine(Path.GetTempPath(), executionData.ActivityExecutionId + ".txt");

            File.WriteAllText(tagfileName, strFileContent.ToString(), Encoding.ASCII);

            FilePrinter printer = FilePrinterFactory.Create(tagfileName);

            printer.Print(printQueue);

            File.Delete(tagfileName);
        }
Beispiel #4
0
        static void Main(string[] args)
        {
            string   outputPath = "c:\\temp\\temp.txt";
            IPrinter printer;
            IWriter  fileWriter = new FileWriter(outputPath);

            printer = new ConsolePrinter();
            IShapes circle = new Circle(printer)
            {
                Radius = 5
            };

            circle.CalculateArea();

            printer = new FilePrinter(fileWriter);
            Triangle triangle = new Scalene(printer)
            {
                Base = 6, Height = 4
            };

            triangle.GetAllSides();
        }
Beispiel #5
0
        public static void Main(string[] args)
        {
            var sourceFile      = ConfigurationManager.AppSettings["sourceFile"];
            var destinationFile = ConfigurationManager.AppSettings["destinationFile"];

            try
            {
                using (var reader = new StreamReader(sourceFile))
                {
                    var fileReader  = new CustomReader(10);
                    var builder     = new SentenceBuilder();
                    var sentences   = new List <Sentence>(0);
                    var pageBuilder = new PageBuilder(5);
                    while (fileReader.Read(reader) != 0)
                    {
                        while (builder.ExtractSentence(fileReader))
                        {
                            sentences.Add(builder.Build());
                        }
                    }

                    var text        = new Text(sentences);
                    var concordance = new Concordance();
                    concordance.Fill(text, pageBuilder.Build(text));

                    IPrinter printer = new FilePrinter(destinationFile);
                    printer.Print(concordance);
                }
            }
            catch (FileNotFoundException e)
            {
                Logger.Error($"File {e.FileName} is not found: {e.Message}");
            }
            catch (ArgumentException e)
            {
                Logger.Error($"Wrong argument: {e.Message}");
            }
        }
Beispiel #6
0
        static void Main(string[] args)
        {
            // Assume that the number of rows in the text file is always at least 10.
            // Assume a valid input file.
            string fileName       = "shows.tv";
            string outputFileName = "storage.tv";

            IPrinter printer = new ConsolePrinter();

            printer.Print($"Reading data from file {fileName}");

            Episode[] episodes = TvUtilities.LoadEpisodesFromFile(fileName);
            Season    season   = new Season(1, episodes);

            printer.Print(season.ToString());
            for (int i = 0; i < season.Length; i++)
            {
                season[i].AddView(TvUtilities.GenerateRandomScore());
            }
            printer.Print(season.ToString());

            printer = new FilePrinter(outputFileName);
            printer.Print(season.ToString());
        }
        public void PrintCoupon(Data.SalesTransactionItemDetails clsDetails, string CouponRemarks)
        {
            Cursor.Current = Cursors.WaitCursor;
            try
            {
                msbToPrint.Clear(); // reset the transaction to print in POSPrinter
                msbToPrint = new StringBuilder(); // reset the transaction to print in POSPrinter

                mclsFilePrinter = new FilePrinter();
                mclsFilePrinter.FileName = mclsSalesTransactionDetails.TransactionNo + "_cpn_" + clsDetails.ItemNo;

                CouponRemarks = CouponRemarks.Replace("{DateNow}", DateTime.Now.ToString("MMM dd, yyyy"));
                CouponRemarks = CouponRemarks.Replace("{Amount}", clsDetails.Amount.ToString("#,##0.#0"));
                CouponRemarks = CouponRemarks.Replace("{TrxAmount}", mclsSalesTransactionDetails.SubTotal.ToString("#,##0.#0"));
                CouponRemarks = CouponRemarks.Replace("{ORNo}", mclsSalesTransactionDetails.ORNo);
                CouponRemarks = CouponRemarks.Replace("{CustomerName}", mclsSalesTransactionDetails.CustomerName);
                CouponRemarks = CouponRemarks.Replace("{CheckCounter}", Int64.Parse(mclsSalesTransactionDetails.TransactionNo).ToString());
                CouponRemarks = CouponRemarks.Replace("{SupplierName}", clsDetails.SupplierName);
                CouponRemarks = CouponRemarks.Replace("{ProductGroup}", clsDetails.ProductGroup);
                CouponRemarks = CouponRemarks.Replace("{ProductSubGroup}", clsDetails.ProductSubGroup);

                msbToPrint.Append(Environment.NewLine);
                msbToPrint.Append(Environment.NewLine);
                msbToPrint.Append(CouponRemarks);
                msbToPrint.Append(Environment.NewLine);
                msbToPrint.Append(Environment.NewLine);

                this.bgwPOSPrinter.RunWorkerAsync();

                // Wait for the BackgroundWorker to finish the download.
                while (this.bgwPOSPrinter.IsBusy)
                {
                    Application.DoEvents();
                }

                msbToPrint.Clear(); // reset the transaction to print in POSPrinter
                msbToPrint = new StringBuilder(); // reset the transaction to print in POSPrinter

                InsertAuditLog(AccessTypes.Disburse, "Print Coupon: " + CouponRemarks + " Trx#: " + mclsSalesTransactionDetails.TransactionNo + " @ Branch: " + mclsTerminalDetails.BranchDetails.BranchCode);
            }
            catch (Exception ex)
            {
                InsertErrorLogToFile(ex, "ERROR!!! Printing coupon data. Err Description: ");
                Cursor.Current = Cursors.Default;
                throw ex;
            }
            Cursor.Current = Cursors.Default;
        }
        public void PrintReportHeaderSection(bool IsReceipt, DateTime OverRidingPrintDate, bool WillUseCompanyCodeForCredit = false)
        {
            //PosExplorer posExplorer = new PosExplorer();
            //DeviceInfo deviceInfo = posExplorer.GetDevice(DeviceType.PosPrinter, mclsTerminalDetails.PrinterName);
            //m_Printer = (PosPrinter) posExplorer.CreateInstance(deviceInfo);

            //m_Printer.Open();
            ////Then the device is disable from other application
            //m_Printer.Claim(1000);
            ////Enable the device.
            //m_Printer.DeviceEnabled = true;

            ////'Output by the high quality mode

            //m_Printer.RecLetterQuality = true;

            ////'Release the exclusive control right

            //m_Printer.Release();

            ////m_Printer.SetBitmap(1, PrinterStation.Receipt, strFilePath, PosPrinter.PrinterBitmapAsIs, PosPrinter.PrinterBitmapCenter);

            msbToPrint.Clear(); // reset the transaction to print in POSPrinter
            msbToPrint = new StringBuilder(); // reset the transaction to print in POSPrinter

            Reports.Receipt clsReceipt = new Reports.Receipt(mConnection, mTransaction);
            Reports.ReceiptDetails clsReceiptDetails;

            clsReceiptDetails = clsReceipt.Details(ReportFormatModule.ReportHeaderSpacer);

            // print Report Header Spacer
            for (int i = 0; i < Convert.ToInt32(clsReceiptDetails.Value); i++)
            { msbToPrint.Append(Environment.NewLine); }

            mclsFilePrinter = new FilePrinter();
            
            if (string.IsNullOrEmpty(mclsSalesTransactionDetails.TransactionNo) || mclsSalesTransactionDetails.TransactionNo == "READY..." || mclsSalesTransactionDetails.TransactionNo == mclsFilePrinter.FileName)
                    mclsFilePrinter.FileName = DateTime.Now.ToString("yyyyMMddhhmmss");
            else if (!IsReceipt)
                mclsFilePrinter.FileName = mclsSalesTransactionDetails.TransactionNo + "_" + DateTime.Now.ToString("yyyyMMddhhmmss");
            else
                mclsFilePrinter.FileName = mclsSalesTransactionDetails.TransactionNo;

            if (WillUseCompanyCodeForCredit && !string.IsNullOrEmpty(CompanyDetails.CompanyCodeForCredit))
            {
                if (mclsTerminalDetails.IsPrinterDotMatrix) msbToPrint.Append(CenterString(CompanyDetails.CompanyCodeForCredit, mclsTerminalDetails.MaxReceiptWidth) + Environment.NewLine);
                else msbToPrint.Append(RawPrinterHelper.escBoldHWOn + RawPrinterHelper.escAlignCenter + CompanyDetails.CompanyCodeForCredit + RawPrinterHelper.escAlignDef + RawPrinterHelper.escBoldHWOff + Environment.NewLine);
            }
            else
            {
                if (mclsTerminalDetails.IsPrinterDotMatrix) msbToPrint.Append(CenterString(CompanyDetails.CompanyCode, mclsTerminalDetails.MaxReceiptWidth) + Environment.NewLine);
                else msbToPrint.Append(RawPrinterHelper.escBoldHWOn + RawPrinterHelper.escAlignCenter + CompanyDetails.CompanyCode + RawPrinterHelper.escAlignDef + RawPrinterHelper.escBoldHWOff + Environment.NewLine);
            }

            // print Report Header
            int iCtr = 0;
            string stModule = "";
            for (iCtr = 1; iCtr <= 10; iCtr++)
            {
                stModule = "ReportHeader" + iCtr;
                clsReceiptDetails = clsReceipt.Details(stModule);

                PrintReportValue(clsReceiptDetails, IsReceipt, OverRidingPrintDate);
            }
            clsReceipt.CommitAndDispose();
        }
        public void PrintOrderSlipHeader(OrderSlipPrinter OrderSlipPrinter, bool WillReprintAll)
        {
            // no need if it's a non-applicable
            if (OrderSlipPrinter == RetailPlus.OrderSlipPrinter.NotApplicable) return;

            switch (OrderSlipPrinter)
            {
                case RetailPlus.OrderSlipPrinter.RetailPlusOSPrinter1:
                    mclsFPRetailPlusOSPrinter1 = new FilePrinter();
                    msbToPrintFP1.Clear();
                    msbToPrintFP1 = new StringBuilder();

                    if (string.IsNullOrEmpty(mclsSalesTransactionDetails.TransactionNo) || mclsSalesTransactionDetails.TransactionNo == "READY..." || mclsSalesTransactionDetails.TransactionNo == mclsFPRetailPlusOSPrinter1.FileName)
                            mclsFPRetailPlusOSPrinter1.FileName = DateTime.Now.ToString("yyyyMMddhhmmss");
                    else
                        mclsFPRetailPlusOSPrinter1.FileName = mclsSalesTransactionDetails.TransactionNo + "OS1";
                    
                    break;
                case RetailPlus.OrderSlipPrinter.RetailPlusOSPrinter2:
                    mclsFPRetailPlusOSPrinter2 = new FilePrinter();
                    msbToPrintFP2.Clear();
                    msbToPrintFP2 = new StringBuilder();

                    if (string.IsNullOrEmpty(mclsSalesTransactionDetails.TransactionNo) || mclsSalesTransactionDetails.TransactionNo == "READY..." || mclsSalesTransactionDetails.TransactionNo == mclsFPRetailPlusOSPrinter2.FileName)
                        mclsFPRetailPlusOSPrinter2.FileName = DateTime.Now.ToString("yyyyMMddhhmmss");
                    else
                        mclsFPRetailPlusOSPrinter2.FileName = mclsSalesTransactionDetails.TransactionNo + "OS2";

                    break;
                case RetailPlus.OrderSlipPrinter.RetailPlusOSPrinter3:
                    mclsFPRetailPlusOSPrinter3 = new FilePrinter();
                    msbToPrintFP3.Clear();
                    msbToPrintFP3 = new StringBuilder();

                    if (string.IsNullOrEmpty(mclsSalesTransactionDetails.TransactionNo) || mclsSalesTransactionDetails.TransactionNo == "READY..." || mclsSalesTransactionDetails.TransactionNo == mclsFPRetailPlusOSPrinter3.FileName)
                        mclsFPRetailPlusOSPrinter3.FileName = DateTime.Now.ToString("yyyyMMddhhmmss");
                    else
                        mclsFPRetailPlusOSPrinter3.FileName = mclsSalesTransactionDetails.TransactionNo + "OS3";

                    break;
                case RetailPlus.OrderSlipPrinter.RetailPlusOSPrinter4:
                    mclsFPRetailPlusOSPrinter4 = new FilePrinter();
                    msbToPrintFP4.Clear();
                    msbToPrintFP4 = new StringBuilder();

                    if (string.IsNullOrEmpty(mclsSalesTransactionDetails.TransactionNo) || mclsSalesTransactionDetails.TransactionNo == "READY..." || mclsSalesTransactionDetails.TransactionNo == mclsFPRetailPlusOSPrinter4.FileName)
                        mclsFPRetailPlusOSPrinter4.FileName = DateTime.Now.ToString("yyyyMMddhhmmss");
                    else
                        mclsFPRetailPlusOSPrinter4.FileName = mclsSalesTransactionDetails.TransactionNo + "OS4";
                    break;
                case RetailPlus.OrderSlipPrinter.RetailPlusOSPrinter5:
                    mclsFPRetailPlusOSPrinter5 = new FilePrinter();

                    msbToPrintFP5.Clear();
                    msbToPrintFP5 = new StringBuilder();

                    if (string.IsNullOrEmpty(mclsSalesTransactionDetails.TransactionNo) || mclsSalesTransactionDetails.TransactionNo == "READY..." || mclsSalesTransactionDetails.TransactionNo == mclsFPRetailPlusOSPrinter5.FileName)
                            mclsFPRetailPlusOSPrinter5.FileName = DateTime.Now.ToString("yyyyMMddhhmmss");
                    else
                        mclsFPRetailPlusOSPrinter5.FileName = mclsSalesTransactionDetails.TransactionNo + "OS5";
                    break;
            }

            // print page header spacer
            for (int i = 0; i < 3; i++)
            {
                SendOrderSlipToPrinter(Environment.NewLine, OrderSlipPrinter);
            }

            SendOrderSlipToPrinter(CenterString("Trx #: " + mclsSalesTransactionDetails.TransactionNo, mclsTerminalDetails.MaxReceiptWidth) + Environment.NewLine, OrderSlipPrinter);
            SendOrderSlipToPrinter(CenterString(DateTime.Now.ToString("MM/dd/yyyy hh:mm tt"), mclsTerminalDetails.MaxReceiptWidth) + Environment.NewLine, OrderSlipPrinter);
            if (mclsTerminalDetails.IsPrinterDotMatrix)
            { SendOrderSlipToPrinter(CenterString("ORDER SLIP", mclsTerminalDetails.MaxReceiptWidth) + Environment.NewLine, OrderSlipPrinter); }
            else { SendOrderSlipToPrinter(RawPrinterHelper.escFontHeightX2On + CenterString("ORDER SLIP", mclsTerminalDetails.MaxReceiptWidth) + RawPrinterHelper.escFontHeightX2Off + Environment.NewLine, OrderSlipPrinter); }

            //
            if (WillReprintAll)
            { SendOrderSlipToPrinter(CenterString("-reprinted: check if already prepared-", mclsTerminalDetails.MaxReceiptWidth) + Environment.NewLine, OrderSlipPrinter); }

            SendOrderSlipToPrinter(Environment.NewLine, OrderSlipPrinter);
            SendOrderSlipToPrinter("-".PadRight(mclsTerminalDetails.MaxReceiptWidth, '-') + Environment.NewLine, OrderSlipPrinter);
            SendOrderSlipToPrinter("Customer : " + mclsSalesTransactionDetails.CustomerName + Environment.NewLine, OrderSlipPrinter);
            SendOrderSlipToPrinter("-".PadRight(mclsTerminalDetails.MaxReceiptWidth, '-') + Environment.NewLine, OrderSlipPrinter);
            SendOrderSlipToPrinter("DESC".PadRight(mclsTerminalDetails.MaxReceiptWidth - 12), OrderSlipPrinter);
            SendOrderSlipToPrinter("UNIT".PadRight(6), OrderSlipPrinter);
            SendOrderSlipToPrinter("QTY".PadLeft(6), OrderSlipPrinter);
            SendOrderSlipToPrinter(Environment.NewLine, OrderSlipPrinter);
            SendOrderSlipToPrinter("-".PadRight(mclsTerminalDetails.MaxReceiptWidth, '-') + Environment.NewLine, OrderSlipPrinter);

        }
        public static byte[] TestLargeByteArrays(ICommandEmitter e)
        {
            var kitten         = e.PrintImage(File.ReadAllBytes("images/kitten.jpg"), true, true, 500);
            var cube           = e.PrintImage(File.ReadAllBytes("images/Portal_Companion_Cube.jpg"), true, true, 500);
            var expectedResult = ByteSplicer.Combine(
                e.CenterAlign(),
                kitten,
                cube,
                kitten,
                cube,
                kitten,
                cube,
                kitten,
                cube,
                kitten,
                cube,
                kitten,
                cube,
                kitten,
                cube,
                kitten,
                cube,
                kitten,
                cube,
                kitten,
                cube
                );
            MemoryPrinter mp = new MemoryPrinter();

            mp.Write(expectedResult);
            var  response  = mp.GetAllData();
            bool hasErrors = false;

            if (expectedResult.Length != response.Length)
            {
                Console.WriteLine($"Error: MemoryPrinter length mismatch - ${response.Length}, expected ${expectedResult.Length}");
                hasErrors = true;
            }
            else
            {
                for (int i = 0; i < expectedResult.Length; i++)
                {
                    if (expectedResult[i] != response[i])
                    {
                        Console.WriteLine($"Error: MemoryPrinter data mismatch - ${expectedResult[i]}, expected ${response[i]}, at location ${i}");
                        hasErrors = true;
                    }
                }
            }
            if (!hasErrors)
            {
                Console.WriteLine("MemoryPrinter: ALL OK!");
            }
            else
            {
                Console.WriteLine("MemoryPrinter: Errors occured during testing, aborting!");
                throw new ArgumentException();
            }

            Random r        = new Random();
            var    filename = $"{r.NextDouble().ToString()}.tmp";

            using (FilePrinter fp = new FilePrinter(filename, true))
            {
                fp.Write(expectedResult);
            }
            response  = File.ReadAllBytes(filename);
            hasErrors = false;
            if (expectedResult.Length != response.Length)
            {
                Console.WriteLine($"Error: FilePrinter length mismatch - ${response.Length}, expected ${expectedResult.Length}");
                hasErrors = true;
            }
            else
            {
                for (int i = 0; i < expectedResult.Length; i++)
                {
                    if (expectedResult[i] != response[i])
                    {
                        Console.WriteLine($"Error: FilePrinter data mismatch - ${expectedResult[i]}, expected ${response[i]}, at location ${i}");
                        hasErrors = true;
                    }
                }
            }

            if (!hasErrors)
            {
                Console.WriteLine("FilePrinter: ALL OK!");
            }
            else
            {
                Console.WriteLine("FilePrinter: Errors occured during testing, aborting!");
                throw new ArgumentException();
            }

            return(expectedResult);
        }
        public static void Main(string[] args)
        {
            var buildConfig = BuildConfiguration();
            var config      = buildConfig.GetSection(nameof(AppConfiguration));

            var dataPath         = config["data"];
            var resultPath       = config["results"];
            var graphEdges       = System.IO.Path.Combine(dataPath, config["graphEdges"]);
            var graphCoordinates = System.IO.Path.Combine(dataPath, config["graphCoordinates"]);

            var dataLoader = new GraphLoader(graphEdges, 100);
            var graph      = dataLoader.Load();

            var calculationStrategies = new ISimilarityCalculationStrategy[]
            { new EdgeSimillarityStrategy(), new NodeSimilarityStrategy() };

            var simpleSolver      = new TspSolver(graph);
            var localSearchSolver = new TspLocalSearchSolver(graph);
            var edgeFinder        = new GraspEdgeFinder(3);

            var evolutinarySolver = new EvolutionarySolver(graph,
                                                           new Recombinator(new SimilarityFinder(calculationStrategies), Steps, graph),
                                                           new Selector(), 41000);
            var localSearch = new LocalSearchAlgorithm(Steps, edgeFinder);

            var stats = new BasicSolverStatistics();

            var bestCost = int.MaxValue;
            ISolverStatistics bestStatistics = new BasicSolverStatistics();

            for (var i = 0; i < 10; i++)
            {
                var generatedPaths = simpleSolver.Solve(new RandomPathAlgorithm(Steps, edgeFinder));
                generatedPaths = localSearchSolver.Solve(localSearch, generatedPaths);

                evolutinarySolver.Solve(localSearch, generatedPaths);

                if (evolutinarySolver.SolvingStatistics.BestPath.Cost < bestCost)
                {
                    bestCost       = evolutinarySolver.SolvingStatistics.BestPath.Cost;
                    bestStatistics = evolutinarySolver.SolvingStatistics;
                }

                stats.UpdateSolvingResults(evolutinarySolver.SolvingStatistics.BestPath, evolutinarySolver.SolvingStatistics.MeanSolvingTime);
            }

            var statsPrinter = new FilePrinter(resultPath, "evo_stats.res");

            statsPrinter.Print(stats.ToString());

            var output = new StringBuilder();

            output.AppendLine($"{"Id".PadRight(4)}\tCost\tTime");
            for (var i = 0; i < bestStatistics.Costs.Count; i++)
            {
                output.AppendLine($"{i.ToString().PadRight(4)}\t{bestStatistics.Costs[i].ToString().PadRight(4)}\t{bestStatistics.SolvingTimes[i].Milliseconds:D}");
            }

            var evoResultsPrinter = new FilePrinter(resultPath, "evolutionary_results.res");

            evoResultsPrinter.Print(output.ToString());

            Console.WriteLine("Evolutionary solver ended his work!");
            //SimilaritySolver(resultPath, graph, calculationStrategies, edgeFinder);
        }
Beispiel #12
0
        static void Main(string[] args)
        {
            //Episode ep1, ep2;
            //ep1 = new Episode();
            //ep2 = new Episode(10, 64.39, 8.7);
            //int viewers = 10;

            //for (int i = 0; i < viewers; i++)
            //{
            //    ep1.AddView(TvUtilities.GenerateRandomScore());
            //    Console.WriteLine(ep1.GetMaxScore());
            //}
            //if (ep1.GetAverageScore() > ep2.GetAverageScore())
            //{
            //    Console.WriteLine($"Viewers: {ep1.GetViewerCount()}");
            //}
            //else
            //{
            //    Console.WriteLine($"Viewers: {ep2.GetViewerCount()}");
            //}



            //Description description = new Description(1, TimeSpan.FromMinutes(45), "Pilot");
            //Console.WriteLine(description);
            //Episode episode = new Episode(10, 88.64, 9.78, description);
            //Console.WriteLine(episode);

            //// Assume that the number of rows in the text file is always at least 10.
            //// Assume a valid input file.
            //string fileName = "shows.tv";
            //string[] episodesInputs = File.ReadAllLines(fileName);
            //Episode[] episodes = new Episode[episodesInputs.Length];
            //for (int i = 0; i < episodes.Length; i++)
            //{
            //    episodes[i] = TvUtilities.Parse(episodesInputs[i]);
            //}

            //Console.WriteLine("Episodes:");
            //Console.WriteLine(string.Join<Episode>(Environment.NewLine, episodes));
            //TvUtilities.Sort(episodes);
            //Console.WriteLine("Sorted episodes:");
            //string sortedEpisodesOutput = string.Join<Episode>(Environment.NewLine, episodes);
            //Console.WriteLine(sortedEpisodesOutput);
            //File.WriteAllText("sorted.tv", sortedEpisodesOutput);



            // Assume that the number of rows in the text file is always at least 10.
            // Assume a valid input file.

            string fileName       = "shows.tv";     // u TvUtilities i FilePrinter se dodaje ekstenzija .txt na fileName i outputFileName
            string outputFileName = "storage.tv";

            IPrinter printer = new ConsolePrinter();

            printer.Print($"Reading data from file {fileName}");

            Episode[] episodes = TvUtilities.LoadEpisodesFromFile(fileName);
            Season    season   = new Season(1, episodes);

            printer.Print(season.ToString());
            for (int i = 0; i < season.Length; i++)
            {
                season[i].AddView(TvUtilities.GenerateRandomScore());
            }
            printer.Print(season.ToString());

            printer = new FilePrinter(outputFileName);
            printer.Print(season.ToString());
        }