protected override async Task <Action <AsyncCodeActivityContext> > ExecuteAsync(AsyncCodeActivityContext context, CancellationToken cancellationToken) { // Inputs var key = Key.Get(context); var encoding = Encoding.Get(context); var iterations = Iterations.Get(context); var inDt = DataTable.Get(context); var dataColumns = DataTableHelper.IdentifyDataColumns(inDt, ColumnIndexes?.Get(context), ColumnNames?.Get(context)); var outDt = DataTableHelper.NewCryptoDataTable(inDt, dataColumns); using (var crypto = new Crypto(Algorithm, encoding, iterations)) { outDt.BeginLoadData(); AddToDataTable(inDt, outDt, dataColumns, key, crypto); outDt.AcceptChanges(); outDt.EndLoadData(); } var sortBy = Sort.Get(context); if (sortBy != null) { outDt.DefaultView.Sort = sortBy; outDt = outDt.DefaultView.ToTable(); } // Outputs return((ctx) => Result.Set(ctx, outDt)); }
protected override void Execute(NativeActivityContext context) { var exitBookmark = context.CreateBookmark(OnExit, BookmarkOptions.NonBlocking); context.Properties.Add(Exit.Bookmark, exitBookmark); var nextBookmark = context.CreateBookmark(OnNext, BookmarkOptions.MultipleResume | BookmarkOptions.NonBlocking); context.Properties.Add(Next.Bookmark, nextBookmark); _totalIterations = Iterations.Get(context); ExecuteNext(context); }
protected override void Execute(NativeActivityContext context) { var exitBookmark = context.CreateBookmark(OnExit, BookmarkOptions.NonBlocking); context.Properties.Add(Exit.BOOKMARK_NAME, exitBookmark); var nextBookmark = context.CreateBookmark(OnNext, BookmarkOptions.MultipleResume | BookmarkOptions.NonBlocking); context.Properties.Add(Next.BOOKMARK_NAME, nextBookmark); _iterations = Iterations.Get(context); if (_iterations <= 0) { throw new InvalidOperationException(Resources.Iterate_ErrorMsg_IterationsMinValue); } ExecuteNext(context); }
protected override async Task <Action <AsyncCodeActivityContext> > ExecuteAsync(AsyncCodeActivityContext context, CancellationToken cancellationToken) { // Inputs var text = Text.Get(context); var password = Key.Get(context); var encoding = TextEncoding.Get(context); var iterations = Iterations.Get(context); string result = text; if (!string.IsNullOrEmpty(text)) { using (var crypto = new Crypto(Algorithm, encoding, iterations)) result = crypto.Decrypt(text, password); } return((ctx) => Result.Set(ctx, result)); }