Example #1
0
 public void Visit(Node visitee)
 {
     if (visitee.OutputEdges.Count == 0)
     {
         _outputHandler.Write("WARNING: Node " + visitee.Name + " is not connected to next nodes!");
     }
 }
Example #2
0
        public List <String> GetLines(String pathString)
        {
            try
            {
                if (!pathString.Equals("") && File.Exists(pathString))
                {
                    output.Write("Path is: " + pathString);
                    if (pathString.ToLower().EndsWith(".txt"))
                    {
                        output.Write("Found the file!");
                        return(GetFile(pathString));
                    }
                    else
                    {
                        output.Write("Filepath is not a .txt file");
                    }
                }
                else
                {
                    output.Write("File does not exist");
                }
            }
            catch (IOException e)
            {
                Console.Write(e.StackTrace);
            }

            return(null);
        }
 public void Visit(Circuit visitee)
 {
     _outputHandler.Write("Circuit completed in: "
                          + _cumulativeDelay
                          + " nanoseconds with a total of: "
                          + (visitee.EndTime - visitee.StartTime)
                          + " nanoseconds to console log!");
 }
Example #4
0
 public void ShowSymbols(IEnumerable <IEnumerable <Symbol> > symbols)
 {
     foreach (var row in symbols)
     {
         outputHandler.WriteLine();
         foreach (var symbol in row)
         {
             outputHandler.Write(symbol.Sign);
         }
     }
     outputHandler.WriteLine();
 }
Example #5
0
        private static void PerformCommand <T>(CommonOptions options, IOutputHandler outputHandler, string action, Func <IList <T> > fileList, Func <CommonOptions, IOutputHandler, T, byte[], long> operation)
        {
            outputHandler.Write("{0} started", action);

            var sw = Stopwatch.StartNew();

            var files = fileList();

            if (files == null || files.Count == 0)
            {
                outputHandler.WriteLine(" (no files found)");
                return;
            }

            outputHandler.WriteVerboseOrNormalLine("", " ({0} files)", files.Count);
            var totalSize = files.Sum(o => operation(options, outputHandler, o, options.BinaryKey));

            sw.Stop();

            if (totalSize != 0)
            {
                if (options.Verbose)
                {
                    var avgSpeed    = "--";
                    var elapsedSecs = sw.ElapsedMilliseconds / 1000;
                    totalSize = totalSize / (1024 * 1024);

                    if (totalSize != 0 && elapsedSecs != 0)
                    {
                        avgSpeed = (totalSize / elapsedSecs).ToString(CultureInfo.InvariantCulture);
                    }

                    outputHandler.WriteVerboseLine("{0} of {1} files complete ({2}MB in {3:hh\\:mm\\:ss}, avg {4}MB/s)", action, files.Count, totalSize, sw.Elapsed, avgSpeed);
                }
                else
                {
                    outputHandler.WriteLine("{0} of {1} files complete", action, files.Count);
                }
            }
        }
 public void Visit(Component visitee)
 {
     _outputHandler.Write("Component has no edges");
 }
Example #7
0
 public static void CalculateAndWriteResults(IInputHandler inputHandler, IOutputHandler outputHandler, IFibonacciCalculator calculator)
 {
     var number = inputHandler.GetNumber();
     var result = calculator.Calculate(number);
     outputHandler.Write(result);
 }