public void GetBatchSql_UpdateSqlite_ReturnsExpectedValues() { ContextUtil.DbServer = DbServer.Sqlite; using var context = new TestContext(ContextUtil.GetOptions()); (string sql, string tableAlias, string tableAliasSufixAs, _, _, _) = BatchUtil.GetBatchSql(context.Items, context, true); Assert.Equal("\"Item\"", tableAlias); Assert.Equal(" AS \"i\"", tableAliasSufixAs); }
private void buttonImport_Click(object sender, EventArgs e) { if (buttonImport.Enabled) { FileExporter io; if (radioIAStash.Checked) { io = new IAFileExporter(_filename); } else if (radioGDStash.Checked) { GDTransferFile settings = cbItemSelection.SelectedItem as GDTransferFile; io = new GDFileExporter(_filename, settings?.Mod ?? string.Empty); } else { _playerItemDao.Save(_sm.EmptyStash(_filename)); MessageBox.Show( RuntimeSettings.Language.GetTag("iatag_ui_importexport_import_success"), RuntimeSettings.Language.GetTag("iatag_ui_importexport_import_success"), MessageBoxButtons.OK, MessageBoxIcon.Information ); return; } var items = io.Read(Read(_filename)); Logger.Debug($"Storing {items.Count} items to db"); progressBar1.Maximum = items.Count; buttonImport.Enabled = false; Thread t = new Thread(() => { ExceptionReporter.EnableLogUnhandledOnThread(); isLocked = true; var batches = BatchUtil.ToBatches <PlayerItem>(items); foreach (var batch in batches) { _playerItemDao.Import(batch); Invoke((MethodInvoker) delegate { progressBar1.Value += batch.Count; }); } isLocked = false; MessageBox.Show( RuntimeSettings.Language.GetTag("iatag_ui_importexport_import_success_body"), RuntimeSettings.Language.GetTag("iatag_ui_importexport_import_success"), MessageBoxButtons.OK, MessageBoxIcon.Information ); }); t.Start(); } }
public override void render(PokeEngine engine, int xs, int ys) { if (texArr[0] == -1 && texArr[1] == -1) { refreshTexture(); } int rx = x * WIDTH + xs; int ry = y * WIDTH + ys; BatchUtil.Draw(engine, Art.tiles[0, 0], rx, ry); BatchUtil.Draw(engine, Art.blocks[texArr[0], texArr[1]], rx, ry); }
protected override void Draw(GameTime gameTime) { totalframes++; //long before = Environment.TickCount; BatchUtil.BeginNoAA(sbatch, this); GraphicsDevice.Clear(Color.Black); map.render(); Font.Draw(sbatch, "x. " + ((int)map.player.x >> 4) + ", y. " + ((int)map.player.y >> 4), 16, 16, 2); Font.Draw(sbatch, "Map id: " + map.mapid, 16, 25, 2); Font.Draw(sbatch, "fps: " + fps, 16, 34, 2); sbatch.End(); //long diff = Environment.TickCount - before; //Console.WriteLine("Diff : " + diff); base.Draw(gameTime); }
private void SyncDown(BuddySubscription subscription) { try { Logger.Debug("Checking buddy cloud for new items.."); // Fetching the known IDs will allow us to skip the items we just uploaded. A massive issue if you just logged on and have 10,000 items for download. var knownItems = _buddyItemDao.GetOnlineIds(subscription); var sync = Get(subscription); // Skip items we've already have var items = sync.Items .Where(item => !knownItems.Contains(item.Id)) .Select(item => ToBuddyItem(subscription, item)) .ToList(); // Store items in batches, to prevent IA just freezing up if we happen to get 10-20,000 items. var batches = BatchUtil.ToBatches <BuddyItem>(items); foreach (var batch in batches) { Logger.Debug($"Storing batch of {batch.Count} items"); _buddyItemDao.Save(subscription, batch); } _buddyItemDao.UpdateNames(items); // Delete items that no longer exist _buddyItemDao.Delete(subscription, sync.Removed); // Store timestamp to db subscription.LastSyncTimestamp = sync.Timestamp; _subscriptionRepo.Update(subscription); Logger.Debug($"Fetched {items.Count} items, new timestamp is {sync.Timestamp}"); } catch (AggregateException ex) { Logger.Warn(ex.Message, ex); return; } catch (WebException ex) { Logger.Warn(ex.Message, ex); return; } catch (Exception ex) { ExceptionReporter.ReportException(ex, "SyncDown"); Logger.Warn(ex); return; } }
protected internal virtual BatchEntity createBatch(CommandContext commandContext, ICollection <string> processInstanceIds) { ProcessEngineConfigurationImpl processEngineConfiguration = commandContext.ProcessEngineConfiguration; BatchJobHandler <SetRetriesBatchConfiguration> batchJobHandler = getBatchJobHandler(processEngineConfiguration); SetRetriesBatchConfiguration configuration = new SetRetriesBatchConfiguration(new List <string>(processInstanceIds), builder.Retries); BatchEntity batch = new BatchEntity(); batch.Type = batchJobHandler.Type; batch.TotalJobs = BatchUtil.calculateBatchSize(processEngineConfiguration, configuration); batch.BatchJobsPerSeed = processEngineConfiguration.BatchJobsPerSeed; batch.InvocationsPerBatchJob = processEngineConfiguration.InvocationsPerBatchJob; batch.ConfigurationBytes = batchJobHandler.writeConfiguration(configuration); commandContext.BatchManager.insertBatch(batch); return(batch); }
protected internal virtual BatchEntity createBatch(CommandContext commandContext, IList <string> ids) { ProcessEngineConfigurationImpl processEngineConfiguration = commandContext.ProcessEngineConfiguration; BatchJobHandler batchJobHandler = getBatchJobHandler(processEngineConfiguration); BatchConfiguration configuration = getAbstractIdsBatchConfiguration(ids); BatchEntity batch = new BatchEntity(); batch.Type = batchJobHandler.Type; batch.TotalJobs = BatchUtil.calculateBatchSize(processEngineConfiguration, configuration); batch.BatchJobsPerSeed = processEngineConfiguration.BatchJobsPerSeed; batch.InvocationsPerBatchJob = processEngineConfiguration.InvocationsPerBatchJob; batch.ConfigurationBytes = batchJobHandler.writeConfiguration(configuration); commandContext.BatchManager.insertBatch(batch); return(batch); }
protected internal virtual BatchEntity createBatch(CommandContext commandContext, IList <AbstractProcessInstanceModificationCommand> instructions, IList <string> processInstanceIds, ProcessDefinitionEntity processDefinition) { ProcessEngineConfigurationImpl processEngineConfiguration = commandContext.ProcessEngineConfiguration; BatchJobHandler <RestartProcessInstancesBatchConfiguration> batchJobHandler = getBatchJobHandler(processEngineConfiguration); RestartProcessInstancesBatchConfiguration configuration = new RestartProcessInstancesBatchConfiguration(processInstanceIds, instructions, builder.ProcessDefinitionId, builder.InitialVariables, builder.SkipCustomListeners, builder.SkipIoMappings, builder.WithoutBusinessKey); BatchEntity batch = new BatchEntity(); batch.Type = batchJobHandler.Type; batch.TotalJobs = BatchUtil.calculateBatchSize(processEngineConfiguration, configuration); batch.BatchJobsPerSeed = processEngineConfiguration.BatchJobsPerSeed; batch.InvocationsPerBatchJob = processEngineConfiguration.InvocationsPerBatchJob; batch.ConfigurationBytes = batchJobHandler.writeConfiguration(configuration); batch.TenantId = processDefinition.TenantId; commandContext.BatchManager.insertBatch(batch); return(batch); }
protected internal virtual BatchEntity createBatch(CommandContext commandContext, MigrationPlan migrationPlan, ICollection <string> processInstanceIds, ProcessDefinitionEntity sourceProcessDefinition) { ProcessEngineConfigurationImpl processEngineConfiguration = commandContext.ProcessEngineConfiguration; BatchJobHandler <MigrationBatchConfiguration> batchJobHandler = getBatchJobHandler(processEngineConfiguration); MigrationBatchConfiguration configuration = new MigrationBatchConfiguration(new List <string>(processInstanceIds), migrationPlan, executionBuilder.SkipCustomListeners, executionBuilder.SkipIoMappings); BatchEntity batch = new BatchEntity(); batch.Type = batchJobHandler.Type; batch.TotalJobs = BatchUtil.calculateBatchSize(processEngineConfiguration, configuration); batch.BatchJobsPerSeed = processEngineConfiguration.BatchJobsPerSeed; batch.InvocationsPerBatchJob = processEngineConfiguration.InvocationsPerBatchJob; batch.ConfigurationBytes = batchJobHandler.writeConfiguration(configuration); batch.TenantId = sourceProcessDefinition.TenantId; commandContext.BatchManager.insertBatch(batch); return(batch); }
public override void render() { SpriteBatch batch = engine.sbatch; int spy = Math.Abs(BatchUtil.getYScroll()) >> 4; int spx = Math.Abs(BatchUtil.getXScroll()) >> 4; int tpy = (Math.Abs(BatchUtil.getYScroll()) >> 4) + (PokeEngine.HEIGHT >> 4) + 1; int tpx = (Math.Abs(BatchUtil.getXScroll()) >> 4) + (PokeEngine.WIDTH >> 4) + 1; if (spy < 0) { spy = 0; } if (spx < 0) { spx = 0; } if (tpy >= w) { tpy = h - 1; } if (tpx >= h) { tpx = w - 1; } if (BatchUtil.getYScroll() >> 4 > 0) { spy = 0; } if (BatchUtil.getXScroll() >> 4 > 0) { spx = 0; } int vx, vy, sx, sy, tx, ty; vx = vy = sx = sy = tx = ty = 0; //not the best idea i had here, but it'll do! if (direction == ConnectionDirection.LEFT) { vx -= w << 4; vy += offset << 4; ty = h; sx = w - 16; tx = w; } else if (direction == ConnectionDirection.UP) { vx += offset << 4; vy -= h << 4; sy = h - 16; ty = h; tx = w; } else if (direction == ConnectionDirection.RIGHT) { vx += parent.w << 4; vy += offset << 4; ty = h; tx = 16; } else if (direction == ConnectionDirection.DOWN) { vx += offset << 4; vy += parent.h << 4; ty = 16; tx = w; } for (int y = sy; y <= ty; y++) { for (int x = sx; x <= tx; x++) { if (getTile(x, y) != null) //just in case ... { tilerendered++; getTile(x, y).render(engine, vx, vy); } } } }
public override void render() { BatchUtil.Draw(map.engine, Art.tiles[0, 1], x, y); }
public override void render(PokeEngine engine, int xs, int ys) { BatchUtil.Draw(engine, Art.tiles[tex, 0], (x << 4) + xs, (y << 4) + ys); }
public virtual void render() { SpriteBatch batch = engine.sbatch; { //START OF SCROLL OFFSET VALUES int xs = 0, ys = 0; if (player != null) { int xx = (int)player.x; int yy = (int)player.y; xs = (int)-(xx - (PokeEngine.WIDTH >> 1)); ys = (int)-(yy - (PokeEngine.HEIGHT >> 1)); int xMax = (Tile.WIDTH * w) - PokeEngine.WIDTH; int yMax = (Tile.WIDTH * h) - PokeEngine.HEIGHT; /*if (xs > 0 && connectionLeft == null) xs = 0; * if (ys > 0 && connectionUp == null) ys = 0; * if (-xs > xMax && connectionRight == null) xs = -xMax; * if (-ys > yMax && connectionDown == null) ys = -yMax;*/ } BatchUtil.setScroll(xs, ys); } //END OF SCROLL OFFSET VALUES int spy = Math.Abs(BatchUtil.getYScroll()) >> 4; int spx = Math.Abs(BatchUtil.getXScroll()) >> 4; int tpy = (Math.Abs(BatchUtil.getYScroll()) >> 4) + (PokeEngine.HEIGHT >> 4) + 1; int tpx = (Math.Abs(BatchUtil.getXScroll()) >> 4) + (PokeEngine.WIDTH >> 4) + 1; if (spy < 0) { spy = 0; } if (spx < 0) { spx = 0; } if (tpy >= w) { tpy = h - 1; } if (tpx >= h) { tpx = w - 1; } if (BatchUtil.getYScroll() >> 4 > 0) { spy = 0; } if (BatchUtil.getXScroll() >> 4 > 0) { spx = 0; } //Console.WriteLine("tpx:" + tpx + ", " + (w << 4)); if (connectionLeft != null && spx < 1) { connectionLeft.render(); } if (connectionUp != null && spy < 1) { connectionUp.render(); } if (connectionRight != null && tpx <= w << 4) { connectionRight.render(); } if (connectionDown != null && tpy <= h << 4) { connectionDown.render(); } for (int y = spy; y <= tpy; y++) { for (int x = spx; x <= tpx; x++) { //Console.WriteLine(x + " + " + y + " * " + w + " = " + index + " (length: " + tiles.Length)); if (getTile(x, y) != null) //just in case ... { tilerendered++; getTile(x, y).render(engine, 0, 0); } } } //Console.WriteLine("rendered: " + tilerendered); tilerendered = 0; player.render(); foreach (Entity e in entities) { if (e != null) { e.render(); } } }