diff --git a/Frends.Files.Read/CHANGELOG.md b/Frends.Files.Read/CHANGELOG.md index 37e4a91..13b5eff 100644 --- a/Frends.Files.Read/CHANGELOG.md +++ b/Frends.Files.Read/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [1.1.0] - 2024-10-14 +### Fixed +- Fixed documentation for Path parameter. +### Added +- Added Windows1252 encoding to the FileEncoding enum. +- Added different sizes to the Task result. + ## [1.0.0] - 2023-02-28 ### Added - Initial implementation \ No newline at end of file diff --git a/Frends.Files.Read/Frends.Files.Read.Tests/ImpersonationTests.cs b/Frends.Files.Read/Frends.Files.Read.Tests/ImpersonationTests.cs index 1b9fe25..d6b4556 100644 --- a/Frends.Files.Read/Frends.Files.Read.Tests/ImpersonationTests.cs +++ b/Frends.Files.Read/Frends.Files.Read.Tests/ImpersonationTests.cs @@ -61,7 +61,7 @@ public void TearDown() } [Test] - public async Task FileMoveTestWithCredentials() + public async Task FileReadTestWithCredentials() { var result = await Files.Read(_input, _options); @@ -70,7 +70,7 @@ public async Task FileMoveTestWithCredentials() } [Test] - public void FileMoveTestWithUsernameWithoutDomain() + public void FileReadTestWithUsernameWithoutDomain() { var options = new Options { diff --git a/Frends.Files.Read/Frends.Files.Read.Tests/TestFiles/folder/test.txt b/Frends.Files.Read/Frends.Files.Read.Tests/TestFiles/folder/test.txt new file mode 100644 index 0000000..534ef03 --- /dev/null +++ b/Frends.Files.Read/Frends.Files.Read.Tests/TestFiles/folder/test.txt @@ -0,0 +1 @@ +This is test file \ No newline at end of file diff --git a/Frends.Files.Read/Frends.Files.Read/Definitions/FileEncoding.cs b/Frends.Files.Read/Frends.Files.Read/Definitions/FileEncoding.cs index 996b5dd..6b944f4 100644 --- a/Frends.Files.Read/Frends.Files.Read/Definitions/FileEncoding.cs +++ b/Frends.Files.Read/Frends.Files.Read/Definitions/FileEncoding.cs @@ -8,8 +8,9 @@ namespace Frends.Files.Read.Definitions; public enum FileEncoding { UTF8, - ANSI, + Default, ASCII, Unicode, + Windows1252, Other } \ No newline at end of file diff --git a/Frends.Files.Read/Frends.Files.Read/Definitions/Input.cs b/Frends.Files.Read/Frends.Files.Read/Definitions/Input.cs index 3caf1e5..df121c7 100644 --- a/Frends.Files.Read/Frends.Files.Read/Definitions/Input.cs +++ b/Frends.Files.Read/Frends.Files.Read/Definitions/Input.cs @@ -8,7 +8,7 @@ namespace Frends.Files.Read.Definitions; public class Input { /// - /// Full path of the target file to be written + /// Full path of the target file to be read. /// /// c:\temp\foo.txt [DisplayFormat(DataFormatString = "Text")] diff --git a/Frends.Files.Read/Frends.Files.Read/Definitions/Result.cs b/Frends.Files.Read/Frends.Files.Read/Definitions/Result.cs index 370903c..83b4e32 100644 --- a/Frends.Files.Read/Frends.Files.Read/Definitions/Result.cs +++ b/Frends.Files.Read/Frends.Files.Read/Definitions/Result.cs @@ -25,6 +25,18 @@ public class Result /// 32 public double SizeInMegaBytes { get; private set; } + /// + /// Size of the written file in kilo bytes. + /// + /// 32 + public double SizeInKiloBytes { get; private set; } + + /// + /// Size of the written file in bytes. + /// + /// 32 + public double SizeInBytes { get; private set; } + /// /// DateTime when file was created. /// @@ -42,6 +54,8 @@ internal Result(FileInfo info, string content) Content = content; Path = info.FullName; SizeInMegaBytes = Math.Round(info.Length / 1024d / 1024d, 3); + SizeInKiloBytes = Math.Round(info.Length / 1024d, 3); + SizeInBytes = info.Length; CreationTime = info.CreationTime; LastWriteTime = info.LastWriteTime; } diff --git a/Frends.Files.Read/Frends.Files.Read/Frends.Files.Read.csproj b/Frends.Files.Read/Frends.Files.Read/Frends.Files.Read.csproj index 7cc35bc..c1fd48b 100644 --- a/Frends.Files.Read/Frends.Files.Read/Frends.Files.Read.csproj +++ b/Frends.Files.Read/Frends.Files.Read/Frends.Files.Read.csproj @@ -3,7 +3,7 @@ net6.0 Latest - 1.0.0 + 1.1.0 Frends Frends Frends diff --git a/Frends.Files.Read/Frends.Files.Read/Read.cs b/Frends.Files.Read/Frends.Files.Read/Read.cs index b97c885..9f7bf6d 100644 --- a/Frends.Files.Read/Frends.Files.Read/Read.cs +++ b/Frends.Files.Read/Frends.Files.Read/Read.cs @@ -17,7 +17,7 @@ namespace Frends.Files.Read; public class Files { /// - /// Read file. + /// Reads a file from directory. /// [Documentation](https://tasks.frends.com/tasks/frends-tasks/Frends.Files.Read) /// /// Input parameters @@ -75,10 +75,14 @@ private static Encoding GetEncoding(FileEncoding optionsFileEncoding, bool optio return Encoding.GetEncoding(optionsEncodingInString); case FileEncoding.ASCII: return Encoding.ASCII; - case FileEncoding.ANSI: + case FileEncoding.Default: return Encoding.Default; case FileEncoding.UTF8: return optionsEnableBom ? new UTF8Encoding(true) : new UTF8Encoding(false); + case FileEncoding.Windows1252: + EncodingProvider provider = CodePagesEncodingProvider.Instance; + Encoding.RegisterProvider(provider); + return Encoding.GetEncoding(1252); case FileEncoding.Unicode: return Encoding.Unicode; default: