Beispiel #1
0
        /// <summary>
        /// Начать обработку файла.
        /// </summary>
        public void Process()
        {
            lock (processLocker)
            {
                if (_processThread != null)
                {
                    if (_processThread.ThreadState == ThreadState.Stopped)
                    {
                        throw new FileIsAlreadyProcessedException();
                    }
                    else
                    {
                        throw new ProcessIsAlreadyRunningException();
                    }
                }

                _processThread = new Thread(() =>
                {
                    try
                    {
                        using (var pngProcessor = new PngProcessor())
                        {
                            pngProcessor.ProgressChanged += (double progress) => { Progress = progress; };
                            pngProcessor.Process(_filePath);
                        }
                    }
                    finally
                    {
                        ProcessedEvent?.Invoke(this);
                    }
                });
                _processThread.Start();
            }
        }
        private static void ParseEvents(string eventFile, string outputFolder)
        {
            using (StreamReader reader = new StreamReader(eventFile))
            {
                RawEvents       rawEvents       = RawEvents.FromJson(reader.ReadToEnd());
                ProcessedEvents processedEvents = new ProcessedEvents();

                foreach (RawEvent rawEvent in rawEvents.Events)
                {
                    if (int.Parse(rawEvent.Price) < 0)
                    {
                        continue;
                    }

                    if (IsIgnoredEvent(rawEvent.Name))
                    {
                        continue;
                    }

                    if (HasVariablePrice(rawEvent.Name))
                    {
                        rawEvent.Price = "Varies";
                    }

                    ProcessedEvent processedEvent = ProcessedEvent.FromRawEvent(rawEvent);
                    processedEvents.Events.Add(processedEvent);
                }

                string outputFileEvents = Path.Combine(outputFolder, "StoreEvents.json");

                GenerateEventsOutput(processedEvents, outputFileEvents);
            }
        }
Beispiel #3
0
 private void Initialize(ProcessedEvent processedEvent, string testName, string stepCommand, int stepNumber, int elementNumber, int expectedResponseNumber)
 {
     Event                  = processedEvent;
     TestName               = testName;
     StepAction             = stepCommand;
     StepNumber             = stepNumber;
     ElementNumber          = elementNumber;
     ExpectedResponseNumber = expectedResponseNumber;
 }
Beispiel #4
0
        public async Task MarkAsProcessed(Guid eventId)
        {
            var processedEvent = new ProcessedEvent
            {
                EventId = eventId
            };

            _context.ProcessedEvents.Add(processedEvent);
            await _context.SaveChangesAsync();
        }
        private async Task PersistEventAsync(ResolvedEvent evnt)
        {
            var processed = new ProcessedEvent(evnt.Event.EventId,
                                               evnt.OriginalStreamId,
                                               evnt.Event.EventStreamId,
                                               evnt.OriginalEventNumber,
                                               evnt.OriginalPosition?.CommitPosition,
                                               evnt.OriginalPosition?.PreparePosition,
                                               evnt.Event.Created);

            processedEventRepo.Add(processed);
            await uow.SaveEntitiesAsync();
        }
 public void Add(ProcessedEvent evnt)
 {
     context.ProcessedEvents.Add(evnt);
 }
Beispiel #7
0
 /// <summary>
 /// Use this attribute to denote the method is to be attached to all instances of a given test class level. Either at the step response, response element, or expected response levels.
 /// </summary>
 /// <param name="ProcessedEvent">event type to attach the delegate to</param>
 public ResponseProcessedAttribute(ProcessedEvent processedEvent)
 {
     Initialize(processedEvent, "", "", -1, -1, -1);
 }