Esempio n. 1
0
        public async Task <bool> ExecuteAsync()
        {
            Debugger.Launch();
            try
            {
                Log.LogMessage(MessageImportance.High, "Performing feed push...");
                if (ItemsToPush == null)
                {
                    Log.LogError($"No items to push. Please check ItemGroup ItemsToPush.");
                }
                if (string.IsNullOrEmpty(RelativePath))
                {
                    Log.LogWarning($"No relative path. Items are pushed to root of container.");
                }
                BlobFeedAction blobFeedAction  = new BlobFeedAction(AccountName, AccountKey, ContainerName, IndexDirectory, Log);
                bool           containerExists = await blobFeedAction.feed.CheckIfFeedExists();

                if (!containerExists)
                {
                    await blobFeedAction.feed.CreateFeedContainer(RelativePath);
                }
                if (!PublishFlatContainer)
                {
                    if (!containerExists)
                    {
                        await blobFeedAction.PushToFeed(ConvertToStringLists(ItemsToPush), RelativePath);
                    }
                    else
                    {
                        await blobFeedAction.PushToFeed(ConvertToStringLists(ItemsToPush), RelativePath, Overwrite);
                    }
                }
                else
                {
                    await blobFeedAction.PushToFeedFlat(ConvertToStringLists(ItemsToPush), RelativePath, Overwrite);
                }
            }
            catch (Exception e)
            {
                Log.LogErrorFromException(e, true);
            }
            return(!Log.HasLoggedErrors);
        }
Esempio n. 2
0
        public async Task <bool> ExecuteAsync()
        {
            try
            {
                Log.LogMessage(MessageImportance.High, "Performing feed push...");
                if (ItemsToPush == null)
                {
                    Log.LogError($"No items to push. Please check ItemGroup ItemsToPush.");
                }
                BlobFeedAction blobFeedAction  = new BlobFeedAction(ExpectedFeedUrl, AccountKey, IndexDirectory, Log);
                bool           containerExists = await blobFeedAction.feed.CheckIfFeedExists();

                if (!containerExists)
                {
                    await blobFeedAction.feed.CreateFeedContainer();
                }
                if (!PublishFlatContainer)
                {
                    if (!containerExists)
                    {
                        await blobFeedAction.PushToFeed(ConvertToStringLists(ItemsToPush));
                    }
                    else
                    {
                        await blobFeedAction.PushToFeed(ConvertToStringLists(ItemsToPush), Overwrite);
                    }
                }
                else
                {
                    await blobFeedAction.PushToFeedFlat(ConvertToStringLists(ItemsToPush), Overwrite);
                }
            }
            catch (Exception e)
            {
                Log.LogErrorFromException(e, true);
            }
            return(!Log.HasLoggedErrors);
        }