FileCombiner 1.0.8
dotnet add package FileCombiner --version 1.0.8
NuGet\Install-Package FileCombiner -Version 1.0.8
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="FileCombiner" Version="1.0.8" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="FileCombiner" Version="1.0.8" />
<PackageReference Include="FileCombiner" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add FileCombiner --version 1.0.8
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: FileCombiner, 1.0.8"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=FileCombiner&version=1.0.8
#tool nuget:?package=FileCombiner&version=1.0.8
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
FileCombiner
A robust .NET library for combining multiple files into a single output file with comprehensive configuration options.
Installation
NuGet Package
dotnet add package FileCombiner
Usage
Basic Usage
using FileCombiner;
using FileCombiner.Models.Options;
using FileCombiner.Services.Abstractions;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
// Setup dependency injection
var host = Host.CreateDefaultBuilder(args)
.ConfigureServices(services =>
{
services.AddFileCombiner();
})
.Build();
// Get the service
var fileCombinerService = host.Services.GetRequiredService<IFileCombinerService>();
// Configure options
var options = new FileCombinerOptions
{
DirectoryPath = "/path/to/source",
OutputPath = "/path/to/output.txt",
FileExtensions = new[] { ".cs", ".txt" },
IncludeSubdirectories = true
};
// Execute the operation
var result = await fileCombinerService.CombineFilesAsync(options);
// Check the result
if (result.IsSuccess)
{
Console.WriteLine($"Combined {result.FilesProcessed} files into {result.OutputPath}");
}
else
{
Console.WriteLine($"Error: {result.Error}");
}
Advanced Configuration
// Advanced configuration example
var options = new FileCombinerOptions
{
DirectoryPath = "/path/to/source",
OutputPath = "/path/to/output.txt",
FileExtensions = new[] { ".cs", ".txt" },
IncludeSubdirectories = true,
IncludeFileHeaders = true,
HeaderFormat = "// File: {path} (Last Modified: {index})",
FileSeparator = "\n\n// --------------------\n\n",
Encoding = System.Text.Encoding.UTF8,
FileFilter = filePath => !filePath.Contains("bin") && !filePath.Contains("obj")
};
API Reference
FileCombinerOptions
Property | Type | Description |
---|---|---|
DirectoryPath | string | The base directory path to scan for files |
FileExtensions | string[] | The file extensions to include (e.g., ".cs", ".txt") |
OutputPath | string | The output file path where combined content will be written |
IncludeSubdirectories | bool | Whether to include subdirectories in the scan |
IncludeFileHeaders | bool | Whether to include file headers with relative paths |
HeaderFormat | string | The header format to use when including file headers |
FileSeparator | string | The line separator to use between files |
Encoding | Encoding? | The encoding to use when reading and writing files |
FileFilter | Func<string, bool>? | An optional filter function to apply to files |
FileCombinerResult
Property | Type | Description |
---|---|---|
IsSuccess | bool | Whether the operation was successful |
Error | string? | The error that occurred during the operation, if any |
OutputPath | string? | The output file path where combined content was written |
FilesProcessed | int | The number of files that were combined |
TotalBytes | long | The total size of the combined output in bytes |
License
This project is licensed under the MIT License - see the LICENSE.md file for details.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
- Initial release of FileCombiner.