Esempio n. 1
0
 public AdminController(UserManager <ApplicationUser> userManager, RoleManager <ApplicationRole> roleManager, IHydra hydra, ApplicationDbContext db)
 {
     _db          = db;
     _userManager = userManager;
     _roleManager = roleManager;
     _hydra       = hydra;
 }
        public static List <Guid> GetOriginalTweets(IHydra hydra)
        {
            var meta  = hydra.DocumentMetadata.ToDictionary(x => x.Key, x => x.Value);
            var guids = new List <Guid>();

            foreach (var x in meta)
            {
                if (!x.Value.ContainsKey("Referenz (Id)"))
                {
                    continue;
                }
                if ((ulong)x.Value["Referenz (Id)"] > 0)
                {
                    continue;
                }
                if (!x.Value.ContainsKey("Externe-URL (|-separiert)"))
                {
                    continue;
                }
                if (!string.IsNullOrWhiteSpace(x.Value["Externe-URL (|-separiert)"]?.ToString()))
                {
                    continue;
                }

                guids.Add(x.Key);
            }

            return(guids);
        }
Esempio n. 3
0
 public IDPController(UserManager <ApplicationUser> userManager,
                      IHydra hydra, ApplicationDbContext db)
 {
     _userManager = userManager;
     _hydra       = hydra;
     _db          = db;
 }
Esempio n. 4
0
        public string Process(INonPlayerCharacter npc, string command)
        {
            IHydra hydra = npc as IHydra;

            if (hydra != null)
            {
                hydra.RegrowHeads();
            }

            return(command);
        }
Esempio n. 5
0
        private async Task Copy(CloudTableClient source, IHydra target, CancellationToken token)
        {
            var response = await source.ListTablesSegmentedAsync(null);

            do
            {
                foreach (var sourceItem in response.Results.Where(x => string.IsNullOrWhiteSpace(Options.Object) || x.Name.EqualsCi(Options.Object)))
                {
                    _logger.LogInformation($"Processing {sourceItem.GetType().Name} '{sourceItem.Name}'.");

                    var processed = 0L;
                    var query     = new TableQuery <DynamicTableEntity>();
                    var entities  = await sourceItem.ExecuteQuerySegmentedAsync(query, null);

                    do
                    {
                        ApplyOverrides(entities);

                        foreach (var group in entities.GroupBy(x => x.PartitionKey))
                        {
                            var targetClient = target.CreateTableClient(group.Key);
                            var targetItem   = targetClient.GetTableReference(sourceItem.Name);
                            await _policyCreate.ExecuteAsync(async() => await targetItem.CreateIfNotExistsAsync());

                            foreach (var batch in group.Batch(100))
                            {
                                var operation = new TableBatchOperation();

                                batch.ForEach(x => operation.Insert(x));

                                await targetItem.ExecuteBatchAsync(operation);
                            }
                        }

                        processed += entities.LongCount();

                        _logger.LogInformation($"Processed {sourceItem.GetType().Name} '{sourceItem.Name}' {processed} entities.");

                        entities = await sourceItem.ExecuteQuerySegmentedAsync(query, entities.ContinuationToken);
                    }while (entities.ContinuationToken != null && !token.IsCancellationRequested);
                }

                response = await source.ListTablesSegmentedAsync(response.ContinuationToken);
            }while (response.ContinuationToken != null && !token.IsCancellationRequested);
        }
Esempio n. 6
0
        private async Task Copy(CloudQueueClient sourceClient, IHydra target, CancellationToken token)
        {
            var response = await sourceClient.ListQueuesSegmentedAsync(null);

            do
            {
                foreach (var sourceItem in response.Results.Where(x => string.IsNullOrWhiteSpace(Options.Object) || x.Name.EqualsCi(Options.Object)))
                {
                    _logger.LogInformation($"Processing {sourceItem.GetType().Name} '{sourceItem.Name}'.");

                    var targetClient = target.CreateQueueClient(sourceItem.Name);
                    var targetItem   = targetClient.GetQueueReference(sourceItem.Name);
                    await _policyCreate.ExecuteAsync(async() => await targetItem.CreateIfNotExistsAsync());
                }

                response = await sourceClient.ListQueuesSegmentedAsync(response.ContinuationToken);
            }while (response.ContinuationToken != null && !token.IsCancellationRequested);
        }
Esempio n. 7
0
 public StreamContainer(IHydra hydra)
 {
     _hydra = hydra;
 }
Esempio n. 8
0
        static IntegrationBase()
        {
            //PrepareAccount(CloudStorageAccount.DevelopmentStorageAccount);

            Subject = CreateHydra();
        }
 public AuthorizeController(AccessDecision decision, ILogger <AuthorizeController> logger, IHydra hydra)
 {
     _decision = decision;
     _logger   = logger;
     _hydra    = hydra;
 }
Esempio n. 10
0
 public StreamContainer(IHydra hydra)
 {
     _hydra = hydra;
 }
Esempio n. 11
0
        private async Task Copy(CloudBlobClient sourceClient, IHydra target, CancellationToken token)
        {
            var response = await sourceClient.ListContainersSegmentedAsync(null);

            do
            {
                foreach (var sourceItem in response.Results.Where(x => string.IsNullOrWhiteSpace(Options.Object) || x.Name.EqualsCi(Options.Object)).Where(x => !x.Name.StartsWith("azure-")))
                {
                    _logger.LogInformation($"Processing {sourceItem.GetType().Name} '{sourceItem.Name}'.");

                    var sourceResponse = await sourceItem.ListBlobsSegmentedAsync(null, true, BlobListingDetails.All, null, null, null, null);

                    do
                    {
                        foreach (var sourceEntity in sourceResponse.Results.Cast <CloudBlockBlob>())
                        {
                            _logger.LogInformation($"Processing {sourceEntity.GetType().Name} '{sourceEntity.Name}'.");

                            var targetName   = ApplyOverrides(sourceEntity);
                            var targetClient = target.CreateBlobClient(targetName.Split('/')[0]);
                            var targetItem   = targetClient.GetContainerReference(sourceItem.Name);
                            await _policyCreate.ExecuteAsync(async() => await targetItem.CreateIfNotExistsAsync());

                            var targetEntity = targetItem.GetBlockBlobReference(targetName);

                            if (sourceEntity.Properties.Length > 0)
                            {
                                var tempFile = Path.GetTempFileName();

                                await _policyDownload.ExecuteAsync(async() =>
                                {
                                    if (File.Exists(tempFile))
                                    {
                                        File.Delete(tempFile);
                                    }

                                    await sourceEntity.DownloadToFileAsync(tempFile, FileMode.CreateNew, null, null, null, new CommandProgress(_logger, sourceEntity.Properties.Length, $"Download: {sourceEntity.Name}."), token);
                                });

                                await _policyUpload.ExecuteAsync(async() =>
                                {
                                    await targetEntity.UploadFromFileAsync(tempFile, null, null, null, new CommandProgress(_logger, sourceEntity.Properties.Length, $"Upload: {targetEntity.Name}."), token);
                                });

                                File.Delete(tempFile);
                            }
                            else
                            {
                                await _policyUpload.ExecuteAsync(async() =>
                                {
                                    await targetEntity.UploadTextAsync(string.Empty);
                                });
                            }

                            await _policyUpload.ExecuteAsync(async() =>
                            {
                                targetEntity.Properties.ContentType = sourceEntity.Properties.ContentType;

                                await targetEntity.SetPropertiesAsync();
                            });
                        }

                        sourceResponse = await sourceItem.ListBlobsSegmentedAsync(null, true, BlobListingDetails.All, null, sourceResponse.ContinuationToken, null, null);
                    }while (sourceResponse.ContinuationToken != null && !token.IsCancellationRequested);
                }

                response = await sourceClient.ListContainersSegmentedAsync(response.ContinuationToken);
            }while (response.ContinuationToken != null && !token.IsCancellationRequested);
        }
Esempio n. 12
0
 public IDPController(UserManager <ApplicationUser> userManager,
                      IHydra hydra)
 {
     _userManager = userManager;
     _hydra       = hydra;
 }
Esempio n. 13
0
 static IntegrationBase()
 {
     Subject = CreateHydra();
 }