Пример #1
0
        public async Task EnsureGzipFiles(CloudBlobContainer containerS)
        {
            //segmented and await
            //var blobInfos = containerS.ListBlobs("", true, BlobListingDetails.Metadata);
            List <IListBlobItem>  blobInfos         = new List <IListBlobItem>();
            BlobContinuationToken continuationToken = null;
            var iteration = 0;

            do
            {
                var response = await containerS.ListBlobsSegmentedAsync("", true, BlobListingDetails.Metadata, null, continuationToken, null, null);

                Console.WriteLine($"Iteration: {++iteration} with # of blobs received for the request {containerS.Name}: {response.Results.Count()}");
                continuationToken = response.ContinuationToken;
                blobInfos.AddRange(response.Results);

                foreach (var blob in blobInfos)
                {
                    await someone.Act(blob.Uri.ToString());
                }

                Console.WriteLine($"# {blobInfos.Count} of blobs added to the queue");
                blobInfos.Clear();
            }while (continuationToken != null);
        }
Пример #2
0
        public async Task EnsureGzipFiles(CloudBlobContainer containerS)
        {
            //segmented and await
            //var blobInfos = containerS.ListBlobs("", true, BlobListingDetails.Metadata);
            List <IListBlobItem>  blobInfos         = new List <IListBlobItem>();
            BlobContinuationToken continuationToken = null;
            var iteration = 0;

            do
            {
                var response = await containerS.ListBlobsSegmentedAsync("", true, BlobListingDetails.Metadata, null, continuationToken, null, null);

                Console.WriteLine($"Iteration: {++iteration} with # of blobs received for the request {containerS.Name}: {response.Results.Count()}");
                continuationToken = response.ContinuationToken;
                blobInfos.AddRange(response.Results);
                Console.WriteLine($"# {blobInfos.Count} of blobs added");
            }while (continuationToken != null);
            Console.WriteLine($"# of blobs found in the container {containerS.Name}: {blobInfos.Count}");
            List <string> names = new List <string>();

            foreach (var blob in blobInfos)
            {
                var path = blob.Uri.AbsolutePath.Substring(1, blob.Uri.AbsolutePath.LastIndexOf('/') - 1);
                names.Add(path);
            }

            names = names.Distinct().ToList();

            foreach (var name in names)
            {
                Console.WriteLine($"Acting over \"directory\" {name}");
                await someone.Act(name);
            }
        }
Пример #3
0
        public virtual void LetAct(IActor actor, Vector vector)
        {
            //var action = actor.Act(new View(this, vector));
            //if (action != null)
            //    action.PerformAction(this, vector, actor);

            var action = actor.Act(new View(this, vector));

            if (action == null || !action.PerformAction(this, vector, actor))
            {
                var critter = actor as Critter;
                if (critter != null)
                {
                    critter.Energy -= .2m;
                    if (critter.Energy <= 0)
                    {
                        Grid[vector] = null;
                    }
                }
            }
        }
Пример #4
0
 public ActionOutcome Act(T self)
 {
     return(implementor.Act(self));
 }