// Конструктор, которому передается хранилище данных, тип генерации и режим трассировки.
        public AbstractGraphManager(IResultStorage storage)
        {
            DataStorage = storage;

            Assembly = new ResultAssembly();
            GraphTables = new List<GraphTable>();
        }
 public RequestProcessor(IEnumerable <IAnalyzerRule> rules, INuGetPackageProvider packageProvider, IResultStorage storage, TextWriter writer)
 {
     _rules           = rules;
     _packageProvider = packageProvider;
     _storage         = storage;
     _writer          = writer;
 }
Esempio n. 3
0
 public ValueContentWriter(
     string input,
     ContentWriterOptions options = null,
     IResultStorage storage       = null,
     MatchOutputInfo outputInfo   = null) : this(input, ContentTextWriter.Default, options, storage, outputInfo)
 {
 }
Esempio n. 4
0
 public AskLineContentWriter(
     string input,
     ContentWriterOptions options = null,
     IResultStorage storage       = null) : base(input, options, storage)
 {
     Ask = true;
 }
Esempio n. 5
0
 public EmptyContentWriter(
     string input,
     ContentWriterOptions options,
     IResultStorage resultStorage = null) : base(input, options)
 {
     ResultStorage = resultStorage;
 }
Esempio n. 6
0
 public AllLinesContentWriter(
     string input,
     ContentTextWriter writer,
     ContentWriterOptions options = null,
     IResultStorage storage       = null) : base(input, writer, options)
 {
     ResultStorage = storage;
 }
Esempio n. 7
0
 public AskValueContentWriter(
     string input,
     ContentWriterOptions options = null,
     IResultStorage storage       = null,
     MatchOutputInfo outputInfo   = null) : base(input, options, storage, outputInfo)
 {
     Ask = true;
 }
        private void InitializeResultStorage()
        {
            _log.Info("Initializing Result Storage...");
            env.ResultsPath = Path.Combine(env.DataPath, "Results");

            resultStorage = new ResultStorage();
            ServiceProvider.SetService(resultStorage);
        }
Esempio n. 9
0
 public UnmatchedLineWriter(
     string input,
     ContentTextWriter writer,
     ContentWriterOptions options = null,
     IResultStorage storage       = null) : base(input, writer, options)
 {
     ResultStorage     = storage;
     MatchingLineCount = 0;
 }
Esempio n. 10
0
 public ValueContentWriter(
     string input,
     ContentTextWriter writer,
     ContentWriterOptions options = null,
     IResultStorage storage       = null,
     MatchOutputInfo outputInfo   = null) : base(input, writer, options)
 {
     ResultStorage = storage;
     OutputInfo    = outputInfo;
 }
Esempio n. 11
0
        public static ContentWriter CreateFind(
            ContentDisplayStyle contentDisplayStyle,
            string input,
            ContentWriterOptions options,
            IResultStorage storage,
            MatchOutputInfo outputInfo,
            ContentTextWriter writer,
            bool ask = false)
        {
            if (ask)
            {
                switch (contentDisplayStyle)
                {
                case ContentDisplayStyle.Value:
                case ContentDisplayStyle.ValueDetail:
                    return(new AskValueContentWriter(input, options, storage, outputInfo));

                case ContentDisplayStyle.Line:
                    return(new AskLineContentWriter(input, options, storage));

                case ContentDisplayStyle.UnmatchedLines:
                case ContentDisplayStyle.AllLines:
                    throw new InvalidOperationException();

                default:
                    throw new InvalidOperationException($"Unknown enum value '{contentDisplayStyle}'.");
                }
            }
            else
            {
                switch (contentDisplayStyle)
                {
                case ContentDisplayStyle.Value:
                case ContentDisplayStyle.ValueDetail:
                    return(new ValueContentWriter(input, writer, options, storage, outputInfo));

                case ContentDisplayStyle.Line:
                    return(new LineContentWriter(input, writer, options, storage));

                case ContentDisplayStyle.UnmatchedLines:
                    return(new UnmatchedLineWriter(input, writer, options, storage));

                case ContentDisplayStyle.AllLines:
                    return(new AllLinesContentWriter(input, writer, options, storage));

                default:
                    throw new InvalidOperationException($"Unknown enum value '{contentDisplayStyle}'.");
                }
            }
        }
Esempio n. 12
0
 public static ContentWriter CreateFind(
     ContentDisplayStyle contentDisplayStyle,
     string input,
     ContentWriterOptions options,
     IResultStorage storage,
     MatchOutputInfo outputInfo,
     bool ask = false)
 {
     return(CreateFind(contentDisplayStyle,
                       input,
                       options,
                       storage,
                       outputInfo,
                       ContentTextWriter.Default,
                       ask));
 }
Esempio n. 13
0
        protected override void ExecuteCore(SearchContext context)
        {
            bool aggregate = (Options.ModifyOptions.Functions & ModifyFunctions.ExceptIntersect) != 0 ||
                             (Options.ModifyOptions.Aggregate &&
                              (Options.ModifyOptions.Method != null ||
                               (Options.ModifyOptions.Functions & ModifyFunctions.Enumerable) != 0));

            if (aggregate)
            {
                _storage = new ListResultStorage();

                if ((Options.ModifyOptions.Functions & ModifyFunctions.ExceptIntersect) != 0)
                {
                    _storageIndexes = new List <int>();
                }
            }

            base.ExecuteCore(context);

            if (aggregate)
            {
                WriteAggregatedValues();
            }
        }
Esempio n. 14
0
 public HomeController(IOperationStorage operationService, IResultStorage storage, IOperationLogger logger)
 {
     _operationService = operationService;
     _storage          = storage;
     _logger           = logger;
 }
 // Утилиты.
 // Перевод информации с одного хранилища данных на другое.
 private void TransferData(IResultStorage from, IResultStorage into)
 {
     try
     {
         List<Guid> intoResultsGUIDs = new List<Guid>();
         foreach (ResultAssembly item in into.LoadAllAssemblies())
         {
             intoResultsGUIDs.Add(item.ID);
         }
         foreach (ResultAssembly resultID in from.LoadAllAssemblies())
         {
             if (!intoResultsGUIDs.Contains(resultID.ID))
             {
                 into.Save(from.Load(resultID.ID));
             }
         }
         MessageBox.Show("Data transfer succeed.", "Success");
     }
     catch (Exception)
     {
         MessageBox.Show("Data transfer failed.", "Failed");
     }
 }
 public DistributedGraphManager(IResultStorage storage)
     : base(storage)
 {
     // Construct InstanceContext to handle messages on callback interface
     InstanceContext instanceContext = new InstanceContext(new CallbackHandler(this));
     /*
     IList<EndpointDiscoveryMetadata> serviceInfos = ServiceDiscoveryManager.SelectedServices;
     if (serviceInfos.Count == 0)
     {
         serviceInfos = ServiceDiscoveryManager.GetServices();
     }
     foreach (var item in serviceInfos)
     {
         services.Add(new HelpService(instanceContext, item));
     }
     */
     services.Add(new HelpService(instanceContext, null));
 }
Esempio n. 17
0
 public UnmatchedLineWriter(
     string input,
     ContentWriterOptions options = null,
     IResultStorage storage       = null) : this(input, ContentTextWriter.Default, options, storage)
 {
 }
Esempio n. 18
0
        private void WriteMatches(
            string input,
            Match match,
            ContentWriterOptions writerOptions,
            SearchContext context)
        {
            SearchTelemetry telemetry = context.Telemetry;

            ContentWriter  contentWriter = null;
            List <Capture> captures      = null;

            try
            {
                captures = ListCache <Capture> .GetInstance();

                GetCaptures(match, writerOptions.GroupNumber, context, isPathWritten: !Options.OmitPath, predicate: ContentFilter.Predicate, captures: captures);

                bool hasAnyFunction = Options.ModifyOptions.HasAnyFunction;

                if (hasAnyFunction ||
                    Options.AskMode == AskMode.Value ||
                    ShouldLog(Verbosity.Normal))
                {
                    if (hasAnyFunction)
                    {
                        if (_fileValues == null)
                        {
                            _fileValues = new List <string>();
                        }
                        else
                        {
                            _fileValues.Clear();
                        }

                        if (_fileStorage == null)
                        {
                            _fileStorage = new ListResultStorage(_fileValues);
                        }
                    }

                    contentWriter = ContentWriter.CreateFind(
                        contentDisplayStyle: Options.ContentDisplayStyle,
                        input: input,
                        options: writerOptions,
                        storage: (hasAnyFunction) ? _fileStorage : _storage,
                        outputInfo: Options.CreateOutputInfo(input, match),
                        writer: (hasAnyFunction) ? null : ContentTextWriter.Default,
                        ask: _askMode == AskMode.Value);
                }
                else
                {
                    contentWriter = new EmptyContentWriter(null, writerOptions);
                }

                WriteMatches(contentWriter, captures, context);

                if (hasAnyFunction)
                {
                    ConsoleColors colors         = (Options.HighlightMatch) ? Colors.Match : default;
                    ConsoleColors boundaryColors = (Options.HighlightBoundary) ? Colors.MatchBoundary : default;

                    var valueWriter = new ValueWriter(ContentTextWriter.Default, writerOptions.Indent, includeEndingIndent: false);

                    foreach (string value in _fileValues.Modify(Options.ModifyOptions))
                    {
                        Write(writerOptions.Indent, Verbosity.Normal);
                        valueWriter.Write(value, Symbols, colors, boundaryColors);
                        WriteLine(Verbosity.Normal);

                        _storage?.Add(value);
                        telemetry.MatchCount++;
                    }

                    _storageIndexes?.Add(_storage !.Count);
                }
                else
                {
                    telemetry.MatchCount += contentWriter.MatchCount;

                    if (contentWriter.MatchingLineCount >= 0)
                    {
                        if (telemetry.MatchingLineCount == -1)
                        {
                            telemetry.MatchingLineCount = 0;
                        }

                        telemetry.MatchingLineCount += contentWriter.MatchingLineCount;
                    }
                }

                if (_askMode == AskMode.Value)
                {
                    if (contentWriter is AskValueContentWriter askValueContentWriter)
                    {
                        if (!askValueContentWriter.Ask)
                        {
                            _askMode = AskMode.None;
                        }
                    }
                    else if (contentWriter is AskLineContentWriter askLineContentWriter)
                    {
                        if (!askLineContentWriter.Ask)
                        {
                            _askMode = AskMode.None;
                        }
                    }
                }
            }
            finally
            {
                contentWriter?.Dispose();

                if (captures != null)
                {
                    ListCache <Capture> .Free(captures);
                }
            }
        }
 public MultiThreadGraphManager(IResultStorage storage)
     : base(storage)
 {
     log.Info("Called constructor of MultiTreadGraphManager");
 }
 public AnalyzerController(IRequestQueue queue, IResultStorage storage)
 {
     _queue   = queue;
     _storage = storage;
 }