Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release/v4.0.0 #6

Merged
merged 8 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/CI-Package-Release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
- name: Step-04 Install .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x
dotnet-version: 9.0.x

- name: Step-05 Restore dependencies
run: dotnet restore
Expand Down Expand Up @@ -101,7 +101,7 @@ jobs:
- name: Step-04 Install .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x
dotnet-version: 9.0.x

- name: Step-05 Restore dependencies
run: dotnet restore
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/Master-Build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x
dotnet-version: 9.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/Master-CodeQL.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
#
name: "Master-CodeQL"

on:
Expand Down
10 changes: 6 additions & 4 deletions Ninja.FileUtil.Core.sln → FileUtil.Core.sln
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@ VisualStudioVersion = 17.6.33712.159
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution", "Solution", "{4181FF50-7335-4293-8EE4-66E0C47C736E}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ninja.FileUtil", "src\Ninja.FileUtil\Ninja.FileUtil.csproj", "{FD920B11-BA4F-4781-BD56-56CF362982CF}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FileUtil", "src\FileUtil\FileUtil.csproj", "{FD920B11-BA4F-4781-BD56-56CF362982CF}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ninja.FileUtil.Tests", "test\Ninja.FileUtil.Tests\Ninja.FileUtil.Tests.csproj", "{95A1410C-6FB4-446D-A692-9BC018882298}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FileUtil.Tests", "test\FileUtil.Tests\FileUtil.Tests.csproj", "{95A1410C-6FB4-446D-A692-9BC018882298}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github", ".github", "{D549CC35-5318-45B0-ACCD-F28C543E482C}"
ProjectSection(SolutionItems) = preProject
.github\workflows\CI-Build.yml = .github\workflows\CI-Build.yml
.github\workflows\codeql.yml = .github\workflows\codeql.yml
.github\workflows\Master-Build.yml = .github\workflows\Master-Build.yml
.github\workflows\CI-Package-Release.yml = .github\workflows\CI-Package-Release.yml
.github\workflows\Master-CodeQL.yml = .github\workflows\Master-CodeQL.yml
.github\workflows\PR-CodeQL.yml = .github\workflows\PR-CodeQL.yml
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{8A1A1535-2928-4313-9AFC-9CA1892426E3}"
Expand Down
2 changes: 1 addition & 1 deletion GitVersion.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
next-version: 3.0.0
next-version: 4.0.0
tag-prefix: '[vV]'
mode: ContinuousDeployment
branches:
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
# <img src="https://github.com/NinjaRocks/FileUtil.Core/blob/master/ninja-icon-16.png" alt="ninja" style="width:30px;"/> FileUtil v3.0.0
[![NuGet version](https://badge.fury.io/nu/FixedWidth.FileParser.svg)](https://badge.fury.io/nu/FixedWidth.FileParser)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/CodeShayk/FileUtil.Core/blob/master/LICENSE.md)
# <img src="https://github.com/CodeShayk/FileUtil.Core/blob/master/Images/ninja-icon-16.png" alt="ninja" style="width:30px;"/> FileUtil.Core v4.0.0
[![NuGet version](https://badge.fury.io/nu/FixedWidth.FileParser.svg)](https://badge.fury.io/nu/FixedWidth.FileParser) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/CodeShayk/FileUtil.Core/blob/master/LICENSE.md)
[![Master-Build](https://github.com/CodeShayk/FileUtil.Core/actions/workflows/Master-Build.yml/badge.svg)](https://github.com/CodeShayk/FileUtil.Core/actions/workflows/Master-Build.yml)
[![GitHub Release](https://img.shields.io/github/v/release/CodeShayk/FileUtil.Core?logo=github&sort=semver)](https://github.com/CodeShayk/FileUtil.Core/releases/latest)
[![Master-CodeQL](https://github.com/CodeShayk/FileUtil.Core/actions/workflows/Master-CodeQL.yml/badge.svg)](https://github.com/CodeShayk/FileUtil.Core/actions/workflows/Master-CodeQL.yml)
[![.Net 8.0](https://img.shields.io/badge/.Net-8.0-blue)](https://dotnet.microsoft.com/en-us/download/dotnet/8.0)


#### .Net Library to read from fixed width or delimiter separated file using strongly typed objects.
-------------
#### .Net Library to read from fixed width or delimiter separated file using strongly typed objects.


**Fixed Width or Delimiter Separated File**
------------------------------------------------------------------------
Expand Down Expand Up @@ -47,7 +46,7 @@ NuGet\Install-Package FixedWidth.FileParser

### ii. Developer Guide

Please read [Developer Guide](https://github.com/CodeShayk/FileUtil.Core/blob/master/DeveloperGuide.md) for details on how to implement ApiAggregator in your project.
Please read [Developer Guide](https://github.com/CodeShayk/FileUtil.Core/blob/master/DeveloperGuide.md) for details on how to implement FileUtil.Core in your project.

## Support

Expand All @@ -58,9 +57,10 @@ If you are having problems, please let me know by [raising a new issue](https://
This project is licensed with the [MIT license](LICENSE).

## Version History
The main branch is now on .NET 8.0. The following previous versions are available:
The main branch is now on .NET 9.0. The following previous versions are available:
| Version | Release Notes |
| -------- | --------|
| [`v4.0.0`](https://github.com/CodeShayk/FileUtil.Core/tree/v4.0.0) | [Notes](https://github.com/CodeShayk/FileUtil.Core/releases/tag/v4.0.0) |
| [`v3.0.0`](https://github.com/CodeShayk/FileUtil.Core/tree/v3.0.0) | [Notes](https://github.com/CodeShayk/FileUtil.Core/releases/tag/v3.0.0) |
| [`v2.0.0`](https://github.com/CodeShayk/FileUtil.Core/tree/v2.0.0) | [Notes](https://github.com/CodeShayk/FileUtil.Core/releases/tag/v2.0.0) |
| [`v1.0.0`](https://github.com/CodeShayk/FileUtil.Core/tree/v1.0.0) | [Notes](https://github.com/CodeShayk/FileUtil.Core/releases/tag/v1.0.0) |
Expand Down
19 changes: 19 additions & 0 deletions src/FileUtil/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// In SDK-style projects such as this one, several assembly attributes that were historically
// defined in this file are now automatically added during build and populated with
// values defined in project properties. For details of which attributes are included
// and how to customise this process see: https://aka.ms/assembly-info-properties

// Setting ComVisible to false makes the types in this assembly not visible to COM
// components. If you need to access a type in this assembly from COM, set the ComVisible
// attribute to true on that type.

[assembly: ComVisible(false)]
[assembly: InternalsVisibleTo("FileUtil.Tests")]
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")]

// The following GUID is for the ID of the typelib if this project is exposed to COM.

[assembly: Guid("5188e472-36fc-4e3c-9978-17d5e32c9ee8")]
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
using System;

namespace Ninja.FileUtil
namespace FileUtil
{
public class ColumnAttribute : Attribute

Check warning on line 5 in src/FileUtil/ColumnAttribute.cs

View workflow job for this annotation

GitHub Actions / Build-Release

Missing XML comment for publicly visible type or member 'ColumnAttribute'
{
public ColumnAttribute(int index, object defaultvalue = null)

Check warning on line 7 in src/FileUtil/ColumnAttribute.cs

View workflow job for this annotation

GitHub Actions / Build-Release

Missing XML comment for publicly visible type or member 'ColumnAttribute.ColumnAttribute(int, object)'
{
Index = index;
DefaultValue = defaultvalue;
}

public int Index { get; }

Check warning on line 13 in src/FileUtil/ColumnAttribute.cs

View workflow job for this annotation

GitHub Actions / Build-Release

Missing XML comment for publicly visible type or member 'ColumnAttribute.Index'
public object DefaultValue { get; }

Check warning on line 14 in src/FileUtil/ColumnAttribute.cs

View workflow job for this annotation

GitHub Actions / Build-Release

Missing XML comment for publicly visible type or member 'ColumnAttribute.DefaultValue'
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
namespace Ninja.FileUtil.Configuration
namespace FileUtil.Configuration
{
public interface IConfigSettings

Check warning on line 3 in src/FileUtil/Configuration/IConfigSettings.cs

View workflow job for this annotation

GitHub Actions / Build-Release

Missing XML comment for publicly visible type or member 'IConfigSettings'
{
IParserSettings ParserSettings { get; set; }

Check warning on line 5 in src/FileUtil/Configuration/IConfigSettings.cs

View workflow job for this annotation

GitHub Actions / Build-Release

Missing XML comment for publicly visible type or member 'IConfigSettings.ParserSettings'
IProviderSettings ProviderSettings { get; set; }

Check warning on line 6 in src/FileUtil/Configuration/IConfigSettings.cs

View workflow job for this annotation

GitHub Actions / Build-Release

Missing XML comment for publicly visible type or member 'IConfigSettings.ProviderSettings'
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace Ninja.FileUtil.Configuration
namespace FileUtil.Configuration
{
public interface IDelimiter

Check warning on line 3 in src/FileUtil/Configuration/IDelimiter.cs

View workflow job for this annotation

GitHub Actions / Build-Release

Missing XML comment for publicly visible type or member 'IDelimiter'
{
char Value { get; set; }

Check warning on line 5 in src/FileUtil/Configuration/IDelimiter.cs

View workflow job for this annotation

GitHub Actions / Build-Release

Missing XML comment for publicly visible type or member 'IDelimiter.Value'
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace Ninja.FileUtil.Configuration
namespace FileUtil.Configuration
{
public interface ILineHeaders
public interface ILineHeaders

Check warning on line 3 in src/FileUtil/Configuration/ILineHeaders.cs

View workflow job for this annotation

GitHub Actions / Build-Release

Missing XML comment for publicly visible type or member 'ILineHeaders'
{
string Header { get; set; }
string Footer { get; set; }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Ninja.FileUtil.Configuration
namespace FileUtil.Configuration
{
public interface IParserSettings
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Ninja.FileUtil.Configuration
namespace FileUtil.Configuration
{
public interface IProviderSettings
{
Expand Down
46 changes: 22 additions & 24 deletions src/Ninja.FileUtil/Engine.cs → src/FileUtil/Engine.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
using System.Linq;
using Ninja.FileUtil.Configuration;
using Ninja.FileUtil.Parser;
using Ninja.FileUtil.Parser.Impl;
using Ninja.FileUtil.Provider;
using Ninja.FileUtil.Provider.Impl;
using System.Linq;
using FileUtil.Configuration;
using FileUtil.Parser;
using FileUtil.Parser.Impl;
using FileUtil.Provider;
using FileUtil.Provider.Impl;

namespace Ninja.FileUtil
namespace FileUtil
{
public class Engine
{
Expand All @@ -28,7 +28,6 @@ internal Engine(ILineParser lineParser, IFileProvider fileProvider)
public Engine(IConfigSettings settings)
: this(new LineParser(settings.ParserSettings), new DefaulProvider(settings.ProviderSettings, new FileHelper()))
{

}

/// <summary>
Expand All @@ -39,8 +38,8 @@ public Engine(IConfigSettings settings)
public Engine(IParserSettings parserSettings, IFileProvider fileProvider)
: this(new LineParser(parserSettings), fileProvider)
{

}

/// <summary>
/// Get all single fixed format lines from a text file parsed into a strongly typed array
/// Default delimiter is '|'. Override by specifying the delimiter in parser settings.
Expand All @@ -56,27 +55,27 @@ public Engine(IParserSettings parserSettings, IFileProvider fileProvider)
{
var files = fileProvider.GetFiles();
return files.Select(file => new File<T>
{
FileMeta = new FileMeta
{
FileMeta = new FileMeta
{
FileName = file.FileName,
FilePath = file.FilePath,
FileSize = file.FileSize,
Lines = file.Lines,
},
FileName = file.FileName,
FilePath = file.FilePath,
FileSize = file.FileSize,
Lines = file.Lines,
},

Data = lineParser.Parse<T>(file.Lines)
})
Data = lineParser.Parse<T>(file.Lines)
})
.ToArray();
}

/// <summary>
/// Get all multi-format lines from a text file parsed into header, data and footer
/// Get all multi-format lines from a text file parsed into header, data and footer
/// typed arrays respectively.
/// Default delimiter is '|'.
/// By default, Header line starts with H, data line starts with D and footer line starts with F.
/// Override these values in parser settings.
/// Example File -
/// Example File -
/// "H|22-10-2016|Employee Status"
/// "D|John Walsh|456RT4|True"
/// "D|Mark Walsh|456RT5|True"
Expand All @@ -88,11 +87,11 @@ public Engine(IParserSettings parserSettings, IFileProvider fileProvider)
/// <returns>
/// Collection of Files each parsed with header, footer and data typed arrays
/// </returns>
public File<TH, TD, TF>[] GetFiles<TH,TD,TF>()
public File<TH, TD, TF>[] GetFiles<TH, TD, TF>()
where TH : FileLine, new()
where TD : FileLine, new()
where TF : FileLine, new()
{
{
var files = fileProvider.GetFiles();

return files.Select(file =>
Expand All @@ -113,8 +112,7 @@ public File<TH, TD, TF>[] GetFiles<TH,TD,TF>()
};

return parsed;

}).ToArray();
}
}
}
}
6 changes: 3 additions & 3 deletions src/Ninja.FileUtil/File.cs → src/FileUtil/File.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace Ninja.FileUtil
namespace FileUtil
{
public class File<T> where T: FileLine
public class File<T> where T : FileLine
{
/// <summary>
/// File meta data.
Expand All @@ -10,7 +10,7 @@ public class File<T> where T: FileLine
/// Strongly typed parsed lines.
/// </summary>
public T[] Data { get; set; }

}

public class File<TH, TD, TF> where TH : FileLine, new()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Collections.Generic;

namespace Ninja.FileUtil
namespace FileUtil
{
public abstract class FileLine : IFileLine
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,31 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<RepositoryType>Public</RepositoryType>
<RepositoryUrl>https://github.com/TechNinjaLabs/FileUtil.Core</RepositoryUrl>
<RepositoryUrl>https://github.com/CodeShayk/FileUtil.Core</RepositoryUrl>
<PackageTags>csv tsv fixed-width delimiter-file delimiter file-parser file parser</PackageTags>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Description>.Net Library to read from fixed width or delimiter separated file using strongly typed objects.
Example: pipe delimited, csv, tsv, etc.</Description>
<NeutralLanguage>en-GB</NeutralLanguage>
<Company>Tech Ninja Labs</Company>
<Authors>Tech Ninja Labs</Authors>
<Company>Code Shayk</Company>
<Authors>Code Shayk</Authors>
<PackageId>FixedWidth.FileParser</PackageId>
<Product>Fixed Width File Parser</Product>
<PackageProjectUrl>https://github.com/TechNinjaLabs/FileUtil.Core</PackageProjectUrl>
<PackageProjectUrl>https://github.com/CodeShayk/FileUtil.Core/wiki</PackageProjectUrl>
<PackageIconUrl>https://1drv.ms/u/s!Aq_ncig7TU4551b5fzxOad-pDMfL</PackageIconUrl>
<Version>3.0.0</Version>
<Version>4.0.0</Version>
<Title>FixedWidth.FileParser</Title>
<Copyright>© Copyright 2024 Tech Ninja Labs.</Copyright>
<Copyright>© Copyright 2024 Code Shayk.</Copyright>
<PackageIcon>ninja-icon-16.png</PackageIcon>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageLicenseFile>License.md</PackageLicenseFile>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
<IncludeSymbols>True</IncludeSymbols>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<Optimize>True</Optimize>
</PropertyGroup>
<ItemGroup>
<None Include="..\..\License.md">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
using System.Collections.Generic;
using System.Runtime.CompilerServices;

[assembly: InternalsVisibleTo("Ninja.FileUtil.Tests")]
namespace Ninja.FileUtil
namespace FileUtil
{
internal interface IFileLine
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Ninja.FileUtil
namespace FileUtil
{
public enum LineType
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using System.Collections.Generic;
using System.Linq;
using Ninja.FileUtil.Configuration;
using FileUtil.Configuration;

namespace Ninja.FileUtil.Parser
namespace FileUtil.Parser
{
internal static class Extensions
{
Expand All @@ -13,7 +13,8 @@ public static bool In(this string input, params string[] values)

public static void SetError(this IFileLine obj, string error)
{
if (obj.Errors == null) obj.Errors = new List<string>();
if (obj.Errors == null)
obj.Errors = new List<string>();

obj.Errors.Add(error);
}
Expand All @@ -32,7 +33,7 @@ public static string GetLineHead(this ILineHeaders lineHeaders, LineType type)
case LineType.Footer:
return lineHeaders?.Footer ?? "F";
default:
return lineHeaders?.Data ?? "D";
return lineHeaders?.Data ?? "D";
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Ninja.FileUtil.Parser
namespace FileUtil.Parser
{
internal interface ILineParser
{
Expand Down
Loading
Loading