Esempio n. 1
0
 protected override void Process(ProcessingContext context)
 {
     if (IsEnabled)
     {
         if (!_isEnabled || _interval != Interval)
         {
             _isEnabled = true;
             _interval = Interval;
             _disposable.Dispose();
             _disposable = new NewThreadScheduler(start => new Thread(start) {IsBackground = true}).SchedulePeriodic(Interval, TimerCallback);
             context.DoNotPulseFurther = true;
         }
         else
         {
             if (_needUpdate)
             {
                 Output = Input;
                 _needUpdate = false;
             }
             else
             {
                 context.DoNotPulseFurther = true;
             }
         }
     }
     else if (_isEnabled)
     {
         _isEnabled = false;
         _disposable.Dispose();
         context.DoNotPulseFurther = true;
     }
 }
Esempio n. 2
0
        protected override void Process(ProcessingContext context)
        {
            using (var httpClient = new HttpClient())
            {
                try
                {
                    Result = httpClient.GetStringAsync(Uri).Result;
                }
                catch (Exception)
                {

                }
            }
        }
Esempio n. 3
0
        public IProcessingContextCollection GenerateProcessingContexts(KraftGlobalConfigurationSettings kraftGlobalConfigurationSettings, string kraftRequestFlagsKey, ISecurityModel securityModel = null)
        {
            InputModelParameters inputModelParameters = new InputModelParameters();

            inputModelParameters.KraftGlobalConfigurationSettings = kraftGlobalConfigurationSettings;
            inputModelParameters.SecurityModel    = securityModel;
            inputModelParameters.Module           = _InputModel.Module;
            inputModelParameters.Nodeset          = _InputModel.Nodeset;
            inputModelParameters.Nodepath         = _InputModel.Nodepath;
            inputModelParameters.IsWriteOperation = _InputModel.IsWriteOperation;
            inputModelParameters.QueryCollection  = _InputModel.QueryCollection;
            inputModelParameters.Data             = _InputModel.Data;
            inputModelParameters.LoaderType       = ELoaderType.DataLoader;

            IProcessingContext processingContext = new ProcessingContext(this);

            processingContext.InputModel = new InputModel(inputModelParameters);
            List <IProcessingContext> processingContexts = new List <IProcessingContext>(1);

            processingContexts.Add(processingContext);
            return(new ProcessingContextCollection(processingContexts));
        }
Esempio n. 4
0
        public async Task ProcessAsync(ProcessingContext context)
        {
            _logger.LogDebug(
                $"Collecting expired data from collection [{_options.PublishedCollection}].");

            var publishedCollection = _database.GetCollection <CapPublishedMessage>(_options.PublishedCollection);
            var receivedCollection  = _database.GetCollection <CapReceivedMessage>(_options.ReceivedCollection);

            await publishedCollection.BulkWriteAsync(new[]
            {
                new DeleteManyModel <CapPublishedMessage>(
                    Builders <CapPublishedMessage> .Filter.Lt(x => x.ExpiresAt, DateTime.Now))
            });

            await receivedCollection.BulkWriteAsync(new[]
            {
                new DeleteManyModel <CapReceivedMessage>(
                    Builders <CapReceivedMessage> .Filter.Lt(x => x.ExpiresAt, DateTime.Now))
            });

            await context.WaitAsync(_waitingInterval);
        }
Esempio n. 5
0
        public override IProcessingContextCollection GenerateProcessingContexts(KraftGlobalConfigurationSettings kraftGlobalConfigurationSettings, string kraftRequestFlagsKey, ISecurityModel securityModel = null)
        {
            if (securityModel == null)
            {
                if (kraftGlobalConfigurationSettings.GeneralSettings.AuthorizationSection.RequireAuthorization)
                {
                    securityModel = new SecurityModel(_HttpContext);
                }
                else
                {
                    securityModel = new SecurityModelMock(kraftGlobalConfigurationSettings.GeneralSettings.AuthorizationSection);
                }
            }
            InputModelParameters inputModelParameters = CreateBaseInputModelParameters(kraftGlobalConfigurationSettings, securityModel);

            inputModelParameters                = ExtendInputModelParameters(inputModelParameters);
            inputModelParameters.Data           = GetBodyJson <Dictionary <string, object> >(_HttpContext.Request);
            inputModelParameters.FormCollection = _FormCollection;
            inputModelParameters.LoaderType     = GetLoaderType(kraftRequestFlagsKey);
            if (inputModelParameters.LoaderType == ELoaderType.None)
            {
                inputModelParameters.LoaderType = ELoaderType.ViewLoader;
            }
            RouteData routeData = _HttpContext.GetRouteData();

            if (routeData != null)
            {
                inputModelParameters.BindingKey = routeData.Values[Constants.RouteSegmentConstants.RouteBindingkey] as string;
            }
            IProcessingContext processingContext = new ProcessingContext(this);

            processingContext.InputModel = new InputModel(inputModelParameters);
            List <IProcessingContext> processingContexts = new List <IProcessingContext>(1);

            processingContexts.Add(processingContext);
            _ProcessingContextCollection = new ProcessingContextCollection(processingContexts);
            return(_ProcessingContextCollection);
        }
Esempio n. 6
0
        public async Task Preprocessor_Go_Should_Add_BotProperties_For_Each_Bot()
        {
            // Arrange
            var arena = new ArenaDto {
                Width = 4, Height = 6
            };
            var bot = new BotDto {
                Id = Guid.NewGuid()
            };
            var bots = new List <BotDto>(new[] { bot });
            var processingContext = ProcessingContext.Build(arena, bots);
            var preprocessor      = new Preprocessor();

            // Act
            await preprocessor.Go(processingContext);

            // Assert
            var botProperties = processingContext.GetBotProperties(bot.Id);

            botProperties.Should().NotBeNull();
            botProperties.BotId.Should().Be(bot.Id);
            processingContext.GetOrderedBotProperties().Should().HaveCount(1);
        }
        public ShoreLineFillerTests()
        {
            var testData = new TestData();

            _data = testData.GetData();
            var shoreline1 = new List <Shoreline>()
            {
                new Shoreline()
                {
                    GpsLat = 67.247207M, GpsLng = 22.887933M
                },
                new Shoreline()
                {
                    GpsLat = 67.248397M, GpsLng = 22.875103M
                }
            };
            var shoreline2 = new List <Shoreline>()
            {
            };

            _data.LocationSettings.Shoreline1 = shoreline1;
            _data.LocationSettings.Shoreline2 = shoreline2;
        }
Esempio n. 8
0
        public MainWindowViewModel(IUIVisualizerService uiVisualizerService, IPleaseWaitService pleaseWaitService, IMessageService messageService)
        {
            _uiVisualizerService = uiVisualizerService;
            _pleaseWaitService   = pleaseWaitService;
            _messageService      = messageService;

            ProvidersCollection = new ObservableCollection <ProviderModel>();
            using (var db = new ProcessingContext())
            {
                var res = from ap in db.AccessProviders
                          join p in db.Providers on ap.Provider_id equals p.Id
                          join u in db.Users on ap.User_id equals u.Id
                          select new { p.Name, p.Logo };
                foreach (var t in res)
                {
                    ProvidersCollection.Add(new ProviderModel()
                    {
                        Name = t.Name,
                        Logo = ConfigurationManager.AppSettings["images_folder"] + t.Logo
                    });
                }
            }
        }
Esempio n. 9
0
            private void OverwriteRequestedContent(ProcessingContext context)
            {
                StringBuilder pageContentBuilder = new StringBuilder("<!DOCTYPE html>");

                pageContentBuilder.AppendLine("<html>");
                pageContentBuilder.AppendLine("<head>");
                pageContentBuilder.AppendLine("  <title>Hello</title>");
                pageContentBuilder.AppendLine("</head>");
                pageContentBuilder.AppendLine("<body>");
                pageContentBuilder.AppendLine("  <h3>Hello, world!</h3>");
                pageContentBuilder.AppendLine("</body>");
                pageContentBuilder.AppendLine("</html>");
                string pageContent = pageContentBuilder.ToString();

                context.StopProcessing();
                MemoryStream responseStream = new MemoryStream(Encoding.UTF8.GetBytes(pageContent));
                var          responseHeader = new BenderProxy.Headers.HttpResponseHeader(200, "OK", "1.1");

                responseHeader.EntityHeaders.ContentType     = "text/html";
                responseHeader.EntityHeaders.ContentEncoding = "utf-8";
                responseHeader.EntityHeaders.ContentLength   = responseStream.Length;
                new HttpResponseWriter(context.ClientStream).Write(responseHeader, responseStream, responseStream.Length);
            }
Esempio n. 10
0
        public async Task ProcessCoreAsync(ProcessingContext context)
        {
            try
            {
                var worked = await Step(context);

                context.ThrowIfStopping();

                Waiting = true;

                if (!worked)
                {
                    var token = GetTokenToWaitOn(context);
                }

                await WaitHandleEx.WaitAnyAsync(WaitHandleEx.PulseEvent,
                                                context.CancellationToken.WaitHandle, _pollingDelay);
            }
            finally
            {
                Waiting = false;
            }
        }
Esempio n. 11
0
 public override void Process(ProcessingContext processingContext)
 {
     foreach (var sheet in processingContext.AvailableSheets)
     {
         foreach (var row in sheet.GetRows())
         {
             foreach (var indicator in sheet.Indicators)
             {
                 var groupKey       = indicator.GroupColumn.GetCleanCell(row);
                 var indicatorValue = indicator.GetGroupValue(groupKey);
                 if (indicator.IsInclud(row, processingContext.ReferenceYear))
                 {
                     indicatorValue.Increment();
                     if (indicator.AgregateFunction == AgregateFunction.Avg)
                     {
                         var value = decimal.Parse(indicator.ColumnToAgregate.GetCell(row));
                         indicatorValue.AddTotal(value);
                     }
                 }
             }
         }
     }
 }
        public override void Process(ProcessingContext context)
        {
            var pixels = context.Result ?? context.Source;

            var result = new Color[pixels.Height(), pixels.Width()];

            var energies = new int[pixels.Height(), pixels.Width()];

            for (int y = 0; y < pixels.Height(); y++)
            {
                for (int x = 0; x < pixels.Width(); x++)
                {
                    var pixel = pixels[y, x];

                    var neighbours = GetNeighbourPixels(pixels, x, y);

                    energies[y, x] = CalculateEnergy(pixel, neighbours);
                }
            }

            var maxEnergy = energies.Cast <int>().Max();

            for (int y = 0; y < pixels.Height(); y++)
            {
                for (int x = 0; x < pixels.Width(); x++)
                {
                    var rgb = energies[y, x] * 255 / maxEnergy;

                    var color = Color.FromArgb(rgb, rgb, rgb);

                    result[y, x] = color;
                }
            }

            context.Result = result;
            ProcessNextIfNotNull(context);
        }
Esempio n. 13
0
        public void BasicPublish( )
        {
            Solution solution = TestHelper.CreateSolution( );

            using (var ctx = DatabaseContext.GetContext(true, preventPostSaveActionsPropagating: true))
            {
                solution.Save();

                ctx.CommitTransaction();
            }

            List <IEntity> entities = TestHelper.PopulateBasicSolution(solution);

            var context = new ProcessingContext( );

            AppManager.PublishApp(RunAsDefaultTenant.DefaultTenantName, TestHelper.DefaultSolutionName, context);

            Assert.IsNotNull(context);
            Assert.AreEqual(context.Report.FailedEntity.Count, 0);
            Assert.AreEqual(context.Report.FailedRelationship.Count, 0);
            Assert.AreEqual(context.Report.FailedEntityData.Count, 0);

            Assert.AreEqual(GetCount(context.Report, "SourceEntityCount"), GetCount(context.Report, "TargetEntityCount"));
            Assert.AreEqual(GetCount(context.Report, "SourceRelationshipCount"), GetCount(context.Report, "TargetRelationshipCount"));
            Assert.AreEqual(GetSourceDataCount(context.Report), GetTargetDataCount(context.Report));

            Assert.Greater(GetCount(context.Report, "SourceEntityCount"), 4);              // Solution + DummyType + 2 Instances
            Assert.Greater(GetCount(context.Report, "SourceRelationshipCount"), 23);       // ( isOfType, inSolution, createdBy, modifiedBy, createdDate, modifiedDate ) * 4 - resourceInFolder
            Assert.Greater(GetCount(context.Report, "SourceEntityDataCount_NVarChar"), 8); // ( name, description ) * 4

            List <Guid> addedEntities = context.Report.AddedEntities.Select(e => e.EntityId).ToList( );

            foreach (IEntityInternal entity in entities.Select(e => e as IEntityInternal))
            {
                Assert.Contains(entity.UpgradeId, addedEntities);
            }
        }
Esempio n. 14
0
 protected override void Process(ProcessingContext context)
 {
     if (IsEnabled)
     {
         var interval = Interval >= TimeSpan.FromMilliseconds(1) ? Interval : TimeSpan.FromMilliseconds(1);
         if (!_isEnabled || _interval != interval || _highPrecision != HighPrecision)
         {
             _isEnabled = true;
             _interval = interval;
             _highPrecision = HighPrecision;
             _disposable.Dispose();
             if (HighPrecision)
             {
                 _disposable = new NewThreadScheduler(start => new Thread(start) {IsBackground = true}).SchedulePeriodic(interval, TimerCallback);
             }
             else
             {
                 Debug.WriteLine("Enable Timer");
                 _disposable = new Timer(state => TimerCallback(), null, interval, interval);
             }
             context.DoNotPulseFurther = true;
         }
         else
         {
             Counter++;
             TickTime = DateTimeOffset.Now;
         }
     }
     else if (_isEnabled)
     {
         Debug.WriteLine("Disable Timer");
         _isEnabled = false;
         _disposable.Dispose();
         context.DoNotPulseFurther = true;
     }
 }
Esempio n. 15
0
    public async Task Processor_Go_Should_Call_Into_The_BotProcessingFactory_For_Every_Bot_Provided()
    {
        // Arrange
        var botProcessingFactory = new Mock <IBotProcessingFactory>();
        var processor            = new Processor.Middleware.Processor(botProcessingFactory.Object);
        var arena = new ArenaDto(4, 6);
        var bot1  = new BotDto {
            Id = Guid.NewGuid()
        };
        var bot2 = new BotDto {
            Id = Guid.NewGuid()
        };
        var bot3 = new BotDto {
            Id = Guid.NewGuid()
        };
        var bots = new List <BotDto>(new[] { bot1, bot2, bot3 });
        var processingContext = ProcessingContext.Build(arena, bots);

        // Act
        await processor.Go(processingContext);

        // Assert
        botProcessingFactory.Verify(x => x.Process(It.IsAny <BotDto>(), It.IsAny <ProcessingContext>()), Times.Exactly(3));
    }
Esempio n. 16
0
    public async Task BotProcessingFactory_Process_Without_Valid_Script_Should_Register_ScriptError()
    {
        // Arrange
        var botLogic             = new Mock <IBotLogic>();
        var botScriptCompiler    = new Mock <IBotScriptCompiler>();
        var botScriptCache       = new Mock <IBotScriptCache>();
        var logger               = new Mock <ILogger>();
        var botProcessingFactory = new BotProcessingFactory(
            botLogic.Object, botScriptCompiler.Object, botScriptCache.Object, logger.Object);
        var arena = new ArenaDto(4, 3);
        var bot   = new BotDto {
            Id = Guid.NewGuid()
        };
        var bots    = new List <BotDto>(new[] { bot });
        var context = ProcessingContext.Build(arena, bots);

        context.AddBotProperties(bot.Id, BotProperties.Build(bot, arena, bots));

        // Act
        await botProcessingFactory.Process(bot, context);

        // Assert
        context.GetBotProperties(bot.Id).CurrentMove.Should().Be(PossibleMoves.ScriptError);
    }
Esempio n. 17
0
        public override void Process(ProcessingContext processingContext)
        {
            var allIndicators = this.indicatorProvider.GetAll()
                                .ToList();

            foreach (var sheet in processingContext.AvailableSheets)
            {
                var availableIndicators = new List <Indicator>();
                var availableColumn     = sheet.AvailableColumns.ToDictionary(x => x.Header.ToLowerInvariant());

                foreach (var indicator in allIndicators)
                {
                    if (this.TryMapIndicatorColumns(availableColumn, indicator, out var missingColumn))
                    {
                        sheet.Indicators.Add(indicator);
                        processingContext.Request.Indicators.Add(indicator);
                    }
                    else
                    {
                        this.PublishWarning($"L'indicateur '{indicator.Name}' ne sera pas calculé, il se base sur la colonne '{missingColumn}' qui est manquante dans l'onglet '{sheet.Name}'.");
                    }
                }
            }
        }
        public override void Execute(ProcessingContext context)
        {
            if (context.Range.RowCount() <= 1)
            {
                return;
            }

            var summ = GetFunc();

            /*var lastAddress = Range.RangeAddress.LastAddress;
             * var summRow = Range.Worksheet.Range(lastAddress.RowNumber + 1, Range.RangeAddress.FirstAddress.ColumnNumber,
             *  lastAddress.RowNumber + 1, lastAddress.ColumnNumber).Unsubscribed();*/
            var summRow = context.Range.LastRow().Unsubscribed();

            if (summ.FuncNum == 0)
            {
                summRow.Cell(summ.Column).Value = summ.Calculate((IDataSource)context.Value);
            }
            else if (summ.FuncNum > 0)
            {
                var funcRngAddr = context.Range.Offset(0, summ.Column - 1, context.Range.RowCount() - 1, 1).Unsubscribed().Column(1).Unsubscribed().RangeAddress;
                summRow.Cell(summ.Column).FormulaA1 = string.Format("Subtotal({0},{1})", summ.FuncNum, funcRngAddr.ToStringRelative());
            }
        }
Esempio n. 19
0
        private ActionResult Processing_Uniteller(int claim, PaymentMode payment)
        {
            if (payment == null)
            {
                throw new ArgumentNullException("payment");
            }
            PaymentBeforeProcessingResult result = BookingProvider.BeforePaymentProcessing(UrlLanguage.CurrentLanguage, payment.paymentparam);

            if (result == null)
            {
                throw new Exception("cannot get payment details");
            }
            if (!result.success)
            {
                throw new Exception("payment details fail");
            }
            ProcessingContext model = new ProcessingContext {
                Reservation         = BookingProvider.GetReservationState(UrlLanguage.CurrentLanguage, claim),
                PaymentMode         = payment,
                BeforePaymentResult = result
            };

            return(base.View(@"PaymentSystems\Uniteller", model));
        }
Esempio n. 20
0
    public async Task Process()
    {
        using var stopwatch = new SimpleStopwatch();

        var arena = await _arenaLogic.GetArena();

        var elapsedArena = stopwatch.ElapsedMilliseconds;

        var bots = await _botLogic.GetAllLiveBots();

        var elapsedBots = stopwatch.ElapsedMilliseconds - elapsedArena;

        var context = ProcessingContext.Build(arena, bots);

        await _preprocessor.Go(context);

        var elapsedPreprocessing = stopwatch.ElapsedMilliseconds - elapsedBots - elapsedArena;

        await _processor.Go(context);

        var elapsedProcessing = stopwatch.ElapsedMilliseconds - elapsedPreprocessing - elapsedBots - elapsedArena;

        await _postprocessor.Go(context);

        var elapsedPostprocessing = stopwatch.ElapsedMilliseconds - elapsedProcessing - elapsedPreprocessing - elapsedBots - elapsedArena;

        await _botLogic.UpdateBots(context.Bots);

        var elapsedUpdateBots = stopwatch.ElapsedMilliseconds - elapsedPostprocessing - elapsedProcessing - elapsedPreprocessing - elapsedBots - elapsedArena;

        //await _messageLogic.CreateMessages(context.Messages);
        var elapsedCreateMessages = stopwatch.ElapsedMilliseconds - elapsedUpdateBots - elapsedPostprocessing - elapsedProcessing - elapsedPreprocessing - elapsedBots - elapsedArena;

        _logger.LogInformation("{elapsedArena}ms, {elapsedBots}ms, {elapsedPreprocessing}ms, {elapsedProcessing}ms, {elapsedPostprocessing}ms, {elapsedUpdateBots}ms, {elapsedCreateMessages}ms",
                               elapsedArena, elapsedBots, elapsedPreprocessing, elapsedProcessing, elapsedPostprocessing, elapsedUpdateBots, elapsedCreateMessages);
    }
Esempio n. 21
0
 protected override void Process(ProcessingContext context)
 {
     if (IsEnabled)
     {
         var interval = Interval >= TimeSpan.FromMilliseconds(1) ? Interval : TimeSpan.FromMilliseconds(1);
         if (!_isEnabled || _interval != interval || _highPrecision != HighPrecision)
         {
             _isEnabled = true;
             _interval = interval;
             _highPrecision = HighPrecision;
             _disposable.Dispose();
             if (HighPrecision)
             {
                 _disposable = new NewThreadScheduler(start => new Thread(start) {IsBackground = true}).SchedulePeriodic(interval, TimerCallback);
             }
             else
             {
                 Debug.WriteLine("Enable Timer");
                 _disposable = new Timer(state => TimerCallback(), null, interval, interval);
             }
             context.DoNotPulseFurther = true;
         }
         else
         {
             Counter++;
             TickTime = DateTimeOffset.Now;
         }
     }
     else if (_isEnabled)
     {
         Debug.WriteLine("Disable Timer");
         _isEnabled = false;
         _disposable.Dispose();
         context.DoNotPulseFurther = true;
     }
 }
Esempio n. 22
0
        public void Execute(ProcessingContext context)
        {
            while (true)
            {
                var t = this.FirstOrDefault(x => x.Enabled);
                if (t == null)
                {
                    break;
                }

                try
                {
                    t.Execute(context);
                }
                catch (TemplateParseException ex)
                {
                    _errors.Add(new TemplateError(ex.Message, ex.Range));
                }
                finally
                {
                    t.Enabled = false;
                }
            }
        }
Esempio n. 23
0
 protected override void Process(ProcessingContext context)
 {
     Value = $"{In0}{In1}{In2}{In3}{In4}{In5}{In6}{In7}{In8}{In9}";
 }
Esempio n. 24
0
 public void Execute(ProcessingContext context)
 {
     context.Registers[X] = context.GetValue(X) % context.GetValue(Y);
     context.PC++;
 }
Esempio n. 25
0
 public RenderReportYukonInitial(ProcessingContext pc, RenderingContext rc, DateTime executionTimeStamp, ReportProcessing processing, IChunkFactory yukonCompiledDefinition)
     : base(pc, rc, processing)
 {
     this.m_executionTimeStamp      = executionTimeStamp;
     this.m_yukonCompiledDefinition = yukonCompiledDefinition;
 }
        private void SaveContext(ProcessingContext context)
        {
            Stage = context.Stage;
            ClientStream = context.ClientStream;
            ServerStream = context.ServerStream;
            RequestHeader = context.RequestHeader;
            ResponseHeader = context.ResponseHeader;
            ServerEndPoint = context.ServerEndPoint;

            _callbackWaitHandle.Set();
        }
Esempio n. 27
0
 public override Resultset Get(QueryContext queryContext, object[] parameters)
 {
     DbDataReader reader = _dataTable.CreateDataReader();
     ProcessingContext context = new ProcessingContext(reader);
     return new Resultset(new RowType(reader.GetSchemaTable()), context);
 }
Esempio n. 28
0
 public RenderReportYukon(ProcessingContext pc, RenderingContext rc, ReportProcessing processing)
     : base(pc, rc)
 {
     m_processing = processing;
 }
Esempio n. 29
0
        private Resultset CreateResultset(Stream stream, out string fileName, QueryContext queryContext)
        {
            DataTable dt = null;
            TextFileDataFormat format = queryContext.GetTextFileDataFormat();
            fileName = null;
            if (stream is FileStream)
            {
                fileName = ((FileStream)stream).Name;
                dt = CreateRowType(fileName, ref format);
            }
            StreamReader reader = new StreamReader(stream, format.Encoding);
            if (dt == null || dt.Rows.Count == 0)
            {
                switch (format.TextFormat)
                {
                    case TextDataFormat.Delimited:
                        dt = CreateRowType(reader, format.Delimiter[0], format.ColumnNameHeader);
                        break;

                    case TextDataFormat.TabDelimited:
                        dt = CreateRowType(reader, '\t', format.ColumnNameHeader);
                        break;

                    default:
                        throw new ArgumentException("Delimiter");
                }
                stream.Seek(0, SeekOrigin.Begin);
                reader = new StreamReader(stream, format.Encoding);
            }
            ProcessingContextBase context;
            if (format.SequentialProcessing)
            {
                if (format.TextFormat == TextDataFormat.FixedLength)
                    context = new ProcessingContext(reader, format.Width, format.NullValue, format.ColumnNameHeader,
                        GetNumberFormatInfo(format), GetDateTimeFormatInfo(format));
                else
                    context = new ProcessingContext(reader, format.Delimiter[0], format.NullValue, format.ColumnNameHeader,
                        GetNumberFormatInfo(format), GetDateTimeFormatInfo(format));
            }
            else
            {
                if (format.TextFormat == TextDataFormat.FixedLength)
                    context = new ParallelProcessingContext(reader, format.Width, format.NullValue, format.ColumnNameHeader,
                        GetNumberFormatInfo(format), GetDateTimeFormatInfo(format));
                else
                    context = new ParallelProcessingContext(reader, format.Delimiter[0], format.NullValue, format.ColumnNameHeader,
                        GetNumberFormatInfo(format), GetDateTimeFormatInfo(format));
            }
            return new Resultset(new RowType(dt), context);
        }
Esempio n. 30
0
 protected override void Process(ProcessingContext context)
 {
     Value = Left + Right;
 }
Esempio n. 31
0
 public override Resultset Get(QueryContext queryContext, object[] parameters)
 {
     RowType rt = CreateRowType();
     ProcessingContext context = new ProcessingContext(this, parameters);
     return new Resultset(rt, context);            
 }        
Esempio n. 32
0
 /// <summary>
 /// Adds itself as an XML content into the WiX source being generated from the <see cref="WixSharp.Project"/>.
 /// See 'Wix#/samples/Extensions' sample for the details on how to implement this interface correctly.
 /// </summary>
 /// <param name="context">The context.</param>
 public void Process(ProcessingContext context)
 {
     context.Project.Include(WixExtension.Bal);
     context.XParent.Add(this.ToXElement("Variable"));
 }
Esempio n. 33
0
 /// <summary>
 /// Methods call when the node is activated.
 /// The other node connected to the input connector has activated his output link.
 /// </summary>
 /// <param name="context_"></param>
 /// <param name="slot_"></param>
 /// <returns></returns>
 public abstract ProcessingInfo ActivateLogic(ProcessingContext context_, NodeSlot slot_);
Esempio n. 34
0
 public async Task <IEnumerable <long> > GetIdsAsync(long startAfterId, int count, ProcessingContext processingContext)
 {
     return(await _accountRepository.GetAccountLegalEntitiesWithoutPublicHashId(
                startAfterId + 1,
                count));
 }
Esempio n. 35
0
 public void Execute(ProcessingContext context)
 {
     context.Sound = context.GetValue(X);
     context.PC++;
 }
 public ProcessReportOdpStreaming(IConfiguration configuration, ProcessingContext pc, AspNetCore.ReportingServices.ReportIntermediateFormat.Report report, ErrorContext errorContext, ReportProcessing.StoreServerParameters storeServerParameters, GlobalIDOwnerCollection globalIDOwnerCollection, ExecutionLogContext executionLogContext, DateTime executionTime, IAbortHelper abortHelper)
     : base(configuration, pc, report, errorContext, storeServerParameters, globalIDOwnerCollection, executionLogContext, executionTime)
 {
     this.m_abortHelper = abortHelper;
 }
Esempio n. 37
0
 protected override void Process(ProcessingContext context)
 {
 }
Esempio n. 38
0
 protected override void Process(ProcessingContext context)
 {
     Result = Left + Right;
 }
Esempio n. 39
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="context"></param>
 /// <param name="slot"></param>
 /// <returns></returns>
 public ProcessingInfo Activate(ProcessingContext context, NodeSlot slot)
 {
     State = ActivateLogic(context, slot);
     return(State);
 }
Esempio n. 40
0
 protected override void Process(ProcessingContext context)
 {
     Output = Input?.ToString();
     Console.Out.WriteLine(Output);
 }
Esempio n. 41
0
        public async Task Postprocessor_Go_Should_Allow_A_Bot_To_Teleport_Onto_Another_Idling_Bot()
        {
            // Arrange
            var randomHelper  = new Mock <IRandomHelper>();
            var postprocessor = new Postprocessor(randomHelper.Object);
            var arena         = new ArenaDto {
                Width = 4, Height = 1
            };
            var bot1 = new BotDto {
                Id = Guid.NewGuid(), X = 0, Y = 0, Orientation = PossibleOrientations.East, CurrentStamina = 15, CurrentHealth = 1
            };
            var bot2 = new BotDto {
                Id = Guid.NewGuid(), X = 3, Y = 0, Orientation = PossibleOrientations.West, CurrentStamina = 1, CurrentHealth = 1
            };
            var bots           = new List <BotDto>(new[] { bot1, bot2 });
            var context        = ProcessingContext.Build(arena, bots);
            var bot1Properties = BotProperties.Build(bot1, arena, bots);
            var bot2Properties = BotProperties.Build(bot2, arena, bots);

            bot1Properties.CurrentMove      = PossibleMoves.Teleport;
            bot1Properties.MoveDestinationX = 3;
            bot1Properties.MoveDestinationY = 0;
            bot2Properties.CurrentMove      = PossibleMoves.Idling;
            context.AddBotProperties(bot1.Id, bot1Properties);
            context.AddBotProperties(bot2.Id, bot2Properties);

            // Act
            await postprocessor.Go(context);

            // Assert
            context.Bots.Should().HaveCount(2);
            context.Bots.Should().ContainEquivalentOf(new BotDto
            {
                X              = 3,
                Y              = 0,
                FromX          = 0,
                FromY          = 0,
                Orientation    = PossibleOrientations.East,
                CurrentStamina = 15 - Constants.STAMINA_ON_TELEPORT,
                Move           = PossibleMoves.Teleport
            }, c => c
                                                      .Including(p => p.X)
                                                      .Including(p => p.Y)
                                                      .Including(p => p.FromX)
                                                      .Including(p => p.FromY)
                                                      .Including(p => p.Orientation)
                                                      .Including(p => p.CurrentStamina)
                                                      .Including(p => p.Move));
            context.Bots.Should().ContainEquivalentOf(new BotDto
            {
                X              = 0,
                Y              = 0,
                Orientation    = PossibleOrientations.West,
                CurrentStamina = 1,
                Move           = PossibleMoves.Idling
            }, c => c.Including(p => p.X)
                                                      .Including(p => p.Y)
                                                      .Including(p => p.Orientation)
                                                      .Including(p => p.CurrentStamina)
                                                      .Including(p => p.Move));
        }
Esempio n. 42
0
 public AstNode(ProcessingContext context, object o)
 {
     Context = context;
     Object = o;
 }
 public void Process(ProcessingContext context)
 {
     Console.WriteLine("Generating complete shoreline...");
     context.LocationSettings.Shoreline1 = GenerateCompleteShoreLine(context.LocationSettings.Shoreline1);
     context.LocationSettings.Shoreline2 = GenerateCompleteShoreLine(context.LocationSettings.Shoreline2);
 }
Esempio n. 44
0
 protected override void Process(ProcessingContext context)
 {
     Debug.WriteLine(I++);
     Value = _random.Next().ToString();
 }