Пример #1
0
        public override void Report(SearchProgress value)
        {
            if (value.Exception != null)
            {
                return;
            }

            switch (value.Kind)
            {
            case SearchProgressKind.SearchDirectory:
            {
                SearchedDirectoryCount++;
                break;
            }

            case SearchProgressKind.Directory:
            {
                DirectoryCount++;
                WriteProgress();
                break;
            }

            case SearchProgressKind.File:
            {
                FileCount++;
                WriteProgress();
                break;
            }

            default:
            {
                throw new InvalidOperationException($"Unknown enum value '{value.Kind}'.");
            }
            }
        }
Пример #2
0
        public override void Report(SearchProgress value)
        {
            if (value.Exception != null)
            {
                WriteError(value);
            }
            else
            {
                switch (value.Kind)
                {
                case SearchProgressKind.SearchDirectory:
                {
                    SearchedDirectoryCount++;

                    if (ConsoleReportMode == ProgressReportMode.Path)
                    {
                        WritePath(value.Path, value.Kind, Indent);
                    }
                    else if (FileReportMode == ProgressReportMode.Path)
                    {
                        WritePathToFile(value.Path, value.Kind);
                    }

                    break;
                }

                case SearchProgressKind.Directory:
                {
                    DirectoryCount++;
                    WritePath(value.Path, value.Kind);
                    break;
                }

                case SearchProgressKind.File:
                {
                    FileCount++;
                    WritePath(value.Path, value.Kind);
                    break;
                }

                default:
                {
                    throw new InvalidOperationException($"Unknown enum value '{value.Kind}'.");
                }
                }
            }
        }