MyTrout.Pipelines.Steps.IO.Files
4.1.0
dotnet add package MyTrout.Pipelines.Steps.IO.Files --version 4.1.0
NuGet\Install-Package MyTrout.Pipelines.Steps.IO.Files -Version 4.1.0
<PackageReference Include="MyTrout.Pipelines.Steps.IO.Files" Version="4.1.0" />
<PackageVersion Include="MyTrout.Pipelines.Steps.IO.Files" Version="4.1.0" />
<PackageReference Include="MyTrout.Pipelines.Steps.IO.Files" />
paket add MyTrout.Pipelines.Steps.IO.Files --version 4.1.0
#r "nuget: MyTrout.Pipelines.Steps.IO.Files, 4.1.0"
#addin nuget:?package=MyTrout.Pipelines.Steps.IO.Files&version=4.1.0
#tool nuget:?package=MyTrout.Pipelines.Steps.IO.Files&version=4.1.0
MyTrout.Pipelines.Steps.IO.Files
Introduction
MyTrout.Pipelines.Steps.IO.Files provides Pipeline steps to read, write, delete, and move files on the file system.
MyTrout.Pipelines.Steps.IO.Files targets .NET 6.0 and .NET 7.0
Pipelines.Hosting runs the Pipeline in a Console Application using Generic Host.
Installing via NuGet
Install-Package MyTrout.Pipelines.Steps.IO.Files
Software dependencies
1. MyTrout.Pipelines 4.0.0 minimum.
All software dependencies listed above use the MIT License.
How do I use the steps in this library?
sample C# code
using MyTrout.Pipelines;
using MyTrout.Pipelines.Hosting;
using MyTrout.Pipelines.Steps.Cryptography
using System;
using System.Linq;
using System.Threading.Tasks;
namespace MyTrout.Pipeline.Hosting.Samples
{
public class Program
{
public static async Task Main(string[] args)
{
var host = Host.CreateDefaultBuilder(args)
.AddStepDependency<DeleteFileOptions>()
.UsePipeline(builder =>
{
builder
// The first step doesn't exist and must be user-provided.
.AddStep<LoadTargetFileNameStep>()
.AddStep<DeleteFileStep>()
})
.Build();
//
// IMPORTANT NOTE FOR DEVELOPERS:
//
// Use StartAsync() to allow the caller to review the PipelineContext after execution.
//
await host.StartAsync().ConfigureAwait(false);
var context = host.Services.GetService<PipelineContext>();
if(context.Errors.Any())
{
// TODO: Errors have already been logged, do any special error processing here.
}
return 0;
}
}
}
}
sample appsettings.json file
This configuration provides a base directory to prevent path traversal issues.
{
"DeleteFileBaseDirectory": "C:\"
}
How do I use Pipelines.Hosting with different configurations for different instances of the same step.
If Step1 prints the Step1Options value with a trailing space to the Console when each step is called, then the following code will generate "Moe, Larry & Curly ".
using MyTrout.Pipelines;
using MyTrout.Pipelines.Hosting;
using MyTrout.Pipelines.Steps.Cryptography
using System;
using System.Linq;
using System.Threading.Tasks;
namespace MyTrout.Pipeline.Hosting.Samples
{
public class Program
{
public static async Task Main(string[] args)
{
// IMPORTANT NOTE FOR DEVELOPERS !
//
// Step Dependencies with context must be defined BEFORE UsePipelines() to load the dependencies correctly.
//
var host = Host.CreateDefaultBuilder(args)
.UsePipeline(builder =>
{
builder
.AddStep<LoadTheFirstMofeFileLocationsStep>()
.AddStep<MoveFileStep, MoveFileOptions>("context-A")
.AddStep<LoadTheSecondMoveFileLocationStep>()
.AddStep<MoveFileStepStep, MoveFileOptions>("context-B")
.AddStep<DoOtherActionsStep>()
})
.Build();
// IMPORTANT NOTE FOR DEVELOPERS !
//
// Use StartAsync() to allow the caller to review the PipelineContext after execution.
//
await host.StartAsync().ConfigureAwait(false);
var context = host.Services.GetService<PipelineContext>();
if(context.Errors.Any())
{
// TODO: Errors have already been logged, do any special error processing here.
}
return 0;
}
}
}
}
sample appsettings.json file
{
"context-A": {
"MoveSourceFileBaseDirectory": "C:\\source\\",
"MoveTargetFileBaseDirectory: "D:\\source\\"
},
"context-B": {
"MoveSourceFileBaseDirectory": "D:\\source\\",
"MoveTargetFileBaseDirectory: "E:\\source\\"
}
}
Build the software locally.
1. Clone the software from the Pipelines repository.
2. Build the software in Visual Studio 2019 to pull down all of the dependencies from nuget.org.
3. In Visual Studio, run all tests. All of the should pass.
4. If you have Visual Studio Enterprise 2019, analyze the code coverage; it should be 100%.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net6.0
- MyTrout.Pipelines (>= 4.0.3 && < 5.0.0)
-
net7.0
- MyTrout.Pipelines (>= 4.0.3 && < 5.0.0)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on MyTrout.Pipelines.Steps.IO.Files:
Package | Downloads |
---|---|
MyTrout.Pipelines.Steps.IO.Command
Provides Pipeline steps run a command line utility. |
|
MyTrout.Pipelines.Steps.IO.Directories
Provides Pipeline steps to create, delete, move, and rename directories and enumerate files in directories on the file system. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
4.1.0 | 564 | 12/6/2022 |
4.0.0 | 828 | 6/15/2022 |
3.2.0 | 473 | 4/28/2022 |
3.1.0 | 436 | 12/26/2021 |
3.0.0 | 526 | 6/30/2021 |
2.1.0 | 401 | 2/3/2021 |
2.0.2 | 388 | 1/23/2021 |
2.0.1 | 532 | 1/1/2021 |
1.0.0 | 507 | 8/20/2020 |
0.5.0-beta | 362 | 7/23/2020 |
0.4.0-beta | 406 | 7/17/2020 |
0.3.0-beta | 382 | 7/17/2020 |
0.2.1-beta | 403 | 6/27/2020 |