FiFi.Lib 0.3.0

FiFi is a File Fixer library that can be used to make consistent Line Endings, File Encoding and Remove Invalid ASCII characters. It provides an easy to use Fluent API's that can be easily setup and called in couple of lines of code. FiFi is based on .NET standard and can run in Windows, Mac, and Unix.

Install-Package FiFi.Lib -Version 0.3.0
dotnet add package FiFi.Lib --version 0.3.0
<PackageReference Include="FiFi.Lib" Version="0.3.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add FiFi.Lib --version 0.3.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Introduction

FiFi is a File Fixer library that can be used to fix files for the following

  • consistent Line Endings,
  • File Encoding
  • Remove Invalid ASCII characters.

It provides an easy to use Fluent API's that can be easily setup and called in couple of lines of code. FiFi is based on .NET standard 2.1 and can run in .NET Core 3.0 and .NET Core 4.6.1 or above

Usage
            //First define the list of files that you want to fix
            var fileSources = FileSources.New()
                .Add(directory, "*.cs")
                .Add("/users/sdha/file.xml")
                .Add(new[] {"/users/duck/boo.bar","/opt/exe/foo.sh"});

            //Now configure FiFi with the list of fixers to run on the files mentioned above
            var runner = FiFiRunner.New()
                .FixEncoding(Encoding.UTF8)
                .FixInvalidCharacters()
                .FixLineEndings(LineEndingMode.Windows)
                .ForFiles(fileSources);

            if(!runner.Success())
            {
                foreach(var result in runner.FileResults) //Enumerate all files that failed to perform
                {
                    Console.WriteLine(result.FileName);
                    foreach(var fixer in result.Fixers) //Enumerate all the fixers for a file that failed
                    {
                           Console.WriteLine(fixer.Exception);
                    }
                }
            }


The above code fragment will take the list of files and run the fixers on those files. The fixers configured in the above file are Encoding, InvalidChars and LineEndings. You can ignore a fixer by not calling it (ignoring it). When complete, you can enumerate through the results and see what succeeded and failed , exceptions etc.,

Disclaimer

This is a community package and i don't hold any accountability for the code, it's success and failures. Use it with your own discreation. I don't mind if oyou fork and use it by yourself.

Introduction

FiFi is a File Fixer library that can be used to fix files for the following

  • consistent Line Endings,
  • File Encoding
  • Remove Invalid ASCII characters.

It provides an easy to use Fluent API's that can be easily setup and called in couple of lines of code. FiFi is based on .NET standard 2.1 and can run in .NET Core 3.0 and .NET Core 4.6.1 or above

Usage
            //First define the list of files that you want to fix
            var fileSources = FileSources.New()
                .Add(directory, "*.cs")
                .Add("/users/sdha/file.xml")
                .Add(new[] {"/users/duck/boo.bar","/opt/exe/foo.sh"});

            //Now configure FiFi with the list of fixers to run on the files mentioned above
            var runner = FiFiRunner.New()
                .FixEncoding(Encoding.UTF8)
                .FixInvalidCharacters()
                .FixLineEndings(LineEndingMode.Windows)
                .ForFiles(fileSources);

            if(!runner.Success())
            {
                foreach(var result in runner.FileResults) //Enumerate all files that failed to perform
                {
                    Console.WriteLine(result.FileName);
                    foreach(var fixer in result.Fixers) //Enumerate all the fixers for a file that failed
                    {
                           Console.WriteLine(fixer.Exception);
                    }
                }
            }


The above code fragment will take the list of files and run the fixers on those files. The fixers configured in the above file are Encoding, InvalidChars and LineEndings. You can ignore a fixer by not calling it (ignoring it). When complete, you can enumerate through the results and see what succeeded and failed , exceptions etc.,

Disclaimer

This is a community package and i don't hold any accountability for the code, it's success and failures. Use it with your own discreation. I don't mind if oyou fork and use it by yourself.

Release Notes

* When the runner is complete, now it will return an object that represents the details of the run like success, failure, exceptions
* The runner will capture exceptions as they occure and continue execution (against terminating in the past). At the end you can enumerate through the result object and see those exceptions.

  • .NETStandard 2.1

    • 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.

Version History

Version Downloads Last updated
0.3.0 66 8/22/2020
0.2.0 78 7/17/2020