From 121b4045b379b67e1ee5156f11db82d92b49c9ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Peyronnet?= Date: Sat, 2 Dec 2023 14:29:49 +0100 Subject: [PATCH 01/10] Added DownloadFile() method (#157) --- PeyrSharp.Core/Internet.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/PeyrSharp.Core/Internet.cs b/PeyrSharp.Core/Internet.cs index 398ca61a..e18482d6 100644 --- a/PeyrSharp.Core/Internet.cs +++ b/PeyrSharp.Core/Internet.cs @@ -24,6 +24,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE using PeyrSharp.Enums; using System; +using System.IO; using System.Net.Http; using System.Threading.Tasks; @@ -92,6 +93,21 @@ public static async Task IsAvailableAsync() } } + public static async Task DownloadFile(string link, string path) + { + try + { + using HttpClient client = new(); + byte[] data = await client.GetByteArrayAsync(link); + await File.WriteAllBytesAsync(path, data); + return true; + } + catch + { + return false; + } + } + /// /// Gets the kind of the status code. /// From 733dddb13b3da4f8d31ebcbce44ff8d957ed0134 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Peyronnet?= Date: Sat, 2 Dec 2023 14:34:55 +0100 Subject: [PATCH 02/10] Added XML Documentation --- PeyrSharp.Core/Internet.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/PeyrSharp.Core/Internet.cs b/PeyrSharp.Core/Internet.cs index e18482d6..2c722001 100644 --- a/PeyrSharp.Core/Internet.cs +++ b/PeyrSharp.Core/Internet.cs @@ -93,6 +93,13 @@ public static async Task IsAvailableAsync() } } + /// + /// Downloads a file from a specified link and saves it to a specified path. + /// + /// The URL of the file to download. + /// The local path where the file should be saved. + /// Returns true if the file was downloaded and saved successfully, otherwise returns false. + /// Throws an exception if an error occurs during the download or save process. public static async Task DownloadFile(string link, string path) { try From b80a637c3309ed7d61e18d74742e6c2679d077f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Peyronnet?= Date: Sat, 2 Dec 2023 14:38:38 +0100 Subject: [PATCH 03/10] Added new overload for GenerateAsync() in Password (#158) --- PeyrSharp.Core/Password.cs | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/PeyrSharp.Core/Password.cs b/PeyrSharp.Core/Password.cs index 98811a3c..a4ba0459 100644 --- a/PeyrSharp.Core/Password.cs +++ b/PeyrSharp.Core/Password.cs @@ -82,6 +82,40 @@ public static Task GenerateAsync(int length, string chars, string separa return task; } + /// + /// Asynchronously generates a string of a specified length using a given set of characters. + /// + /// The length of the string to generate. + /// An array of characters to use for generating the string. + /// A task that represents the asynchronous operation. The task result contains the generated string. + /// Throws an exception if the length parameter is not greater than 0. + public static Task GenerateAsync(int length, string[] chars) + { + Task task = new(() => + { + // Setup variables + string finalPassword = ""; + Random random = new(); + int number = 0; + + if (length > 0) // Check if the length valid + { + for (int i = 1; i < length; i++) // Generate a password of a specific length + { + number = random.Next(0, chars.Length); + finalPassword += chars[number]; // Append a character to the string + } + } + else + { + throw new Exception("The parameter 'length' (int) must be higher than 0."); + } + return finalPassword; + }); + task.Start(); + return task; + } + /// /// Generates a password asynchronously. /// From 90dfc5b353c6b15b7fd5e6d1346797d23ece7f93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Peyronnet?= Date: Sat, 2 Dec 2023 14:41:36 +0100 Subject: [PATCH 04/10] Version 2.1.0.2312-pre1 --- PeyrSharp.Core/PeyrSharp.Core.csproj | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/PeyrSharp.Core/PeyrSharp.Core.csproj b/PeyrSharp.Core/PeyrSharp.Core.csproj index 6c615974..ccb3cb80 100644 --- a/PeyrSharp.Core/PeyrSharp.Core.csproj +++ b/PeyrSharp.Core/PeyrSharp.Core.csproj @@ -4,7 +4,7 @@ net6.0;net7.0;net8.0 True PeyrSharp.Core - 2.0.0.2311 + 2.1.0.2312-pre1 Devyus Core methods and features of PeyrSharp. © 2023 @@ -16,8 +16,9 @@ NUGET_README.md MIT True - - Added .NET 8 Support -- Removed .NET 5 Support + - Added DownloadFile() method (#157) +- Added XML Documentation +- Added new overload for GenerateAsync() in Password (#158) From c41cc2ab5245bca6653df640fbfca0ca03beb63e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Peyronnet?= Date: Sun, 3 Dec 2023 13:55:07 +0100 Subject: [PATCH 05/10] Added CelsiusToKelvin() method (#159) --- PeyrSharp.Core/Converters/Temperatures.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/PeyrSharp.Core/Converters/Temperatures.cs b/PeyrSharp.Core/Converters/Temperatures.cs index 3026ac69..d65fdb65 100644 --- a/PeyrSharp.Core/Converters/Temperatures.cs +++ b/PeyrSharp.Core/Converters/Temperatures.cs @@ -42,5 +42,12 @@ public static class Temperatures /// Number of Fahrenheit to convert. /// The original value converted in Celsius. public static double FahrenheitToCelsius(double fahrenheit) => (fahrenheit - 32) / 1.8; // Convert + + /// + /// Converts a temperature value from Celsius to Kelvin. + /// + /// Temperature value in Celsius. + /// Temperature value in Kelvin. + public static double CelsiusToKelvin(double celsius) => celsius + 273.15; } } From 1bfc3a9005459c1dda519ee1a591a0257339bcbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Peyronnet?= Date: Sun, 3 Dec 2023 13:56:21 +0100 Subject: [PATCH 06/10] Added FahrenheitToKelvin() method (#159) --- PeyrSharp.Core/Converters/Temperatures.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/PeyrSharp.Core/Converters/Temperatures.cs b/PeyrSharp.Core/Converters/Temperatures.cs index d65fdb65..f1e284a5 100644 --- a/PeyrSharp.Core/Converters/Temperatures.cs +++ b/PeyrSharp.Core/Converters/Temperatures.cs @@ -49,5 +49,12 @@ public static class Temperatures /// Temperature value in Celsius. /// Temperature value in Kelvin. public static double CelsiusToKelvin(double celsius) => celsius + 273.15; + + /// + /// Converts a temperature value from Fahrenheit to Kelvin. + /// + /// Temperature value in Fahrenheit. + /// Temperature value in Kelvin. + public static double FahrenheitToKelvin(double fahrenheit) => (fahrenheit + 459.67) * 5 / 9; } } From ec6dfc8b3eb8cbfb2cd1a49e260cfac867cd71c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Peyronnet?= Date: Sun, 3 Dec 2023 13:56:29 +0100 Subject: [PATCH 07/10] Added KelvinToCelsius() method (#159) --- PeyrSharp.Core/Converters/Temperatures.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/PeyrSharp.Core/Converters/Temperatures.cs b/PeyrSharp.Core/Converters/Temperatures.cs index f1e284a5..c8d660ea 100644 --- a/PeyrSharp.Core/Converters/Temperatures.cs +++ b/PeyrSharp.Core/Converters/Temperatures.cs @@ -56,5 +56,12 @@ public static class Temperatures /// Temperature value in Fahrenheit. /// Temperature value in Kelvin. public static double FahrenheitToKelvin(double fahrenheit) => (fahrenheit + 459.67) * 5 / 9; + + /// + /// Converts a temperature value from Kelvin to Celsius. + /// + /// Temperature value in Kelvin. + /// Temperature value in Celsius. + public static double KelvinToCelsius(double kelvin) => kelvin - 273.15; } } From a6e52029c3b4cc814339d7739e167be14e6f53cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Peyronnet?= Date: Sun, 3 Dec 2023 13:56:41 +0100 Subject: [PATCH 08/10] Added KelvinToFahrenheit() method (#159) --- PeyrSharp.Core/Converters/Temperatures.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/PeyrSharp.Core/Converters/Temperatures.cs b/PeyrSharp.Core/Converters/Temperatures.cs index c8d660ea..cee66bdc 100644 --- a/PeyrSharp.Core/Converters/Temperatures.cs +++ b/PeyrSharp.Core/Converters/Temperatures.cs @@ -63,5 +63,12 @@ public static class Temperatures /// Temperature value in Kelvin. /// Temperature value in Celsius. public static double KelvinToCelsius(double kelvin) => kelvin - 273.15; + + /// + /// Converts a temperature value from Kelvin to Fahrenheit. + /// + /// Temperature value in Kelvin. + /// Temperature value in Fahrenheit. + public static double KelvinToFahrenheit(double kelvin) => kelvin * 9 / 5 - 459.67; } } From da38ead94fcdb08a6dd227dc8f9c5651b16a7175 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Peyronnet?= Date: Sun, 3 Dec 2023 13:58:47 +0100 Subject: [PATCH 09/10] Version 2.1.0.2312-rc1 --- PeyrSharp.Core/PeyrSharp.Core.csproj | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/PeyrSharp.Core/PeyrSharp.Core.csproj b/PeyrSharp.Core/PeyrSharp.Core.csproj index ccb3cb80..95feabec 100644 --- a/PeyrSharp.Core/PeyrSharp.Core.csproj +++ b/PeyrSharp.Core/PeyrSharp.Core.csproj @@ -4,7 +4,7 @@ net6.0;net7.0;net8.0 True PeyrSharp.Core - 2.1.0.2312-pre1 + 2.1.0.2312-rc1 Devyus Core methods and features of PeyrSharp. © 2023 @@ -18,7 +18,11 @@ True - Added DownloadFile() method (#157) - Added XML Documentation -- Added new overload for GenerateAsync() in Password (#158) +- Added new overload for GenerateAsync() in Password (#158) +- Added CelsiusToKelvin() method (#159) +- Added FahrenheitToKelvin() method (#159) +- Added KelvinToCelsius() method (#159) +- Added KelvinToFahrenheit() method (#159) From ee00ad555774851afa59118289332401226b707d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Peyronnet?= Date: Sun, 3 Dec 2023 14:51:42 +0100 Subject: [PATCH 10/10] Version 2.1.0.2312 --- PeyrSharp.Core/PeyrSharp.Core.csproj | 6 +++--- PeyrSharp.Enums/PeyrSharp.Enums.csproj | 5 ++--- PeyrSharp.Env/PeyrSharp.Env.csproj | 7 +++---- PeyrSharp.Exceptions/PeyrSharp.Exceptions.csproj | 5 ++--- PeyrSharp.Extensions/PeyrSharp.Extensions.csproj | 7 +++---- PeyrSharp.UiHelpers/PeyrSharp.UiHelpers.csproj | 7 +++---- PeyrSharp/PeyrSharp.cs | 2 +- PeyrSharp/PeyrSharp.csproj | 14 +++++++------- 8 files changed, 24 insertions(+), 29 deletions(-) diff --git a/PeyrSharp.Core/PeyrSharp.Core.csproj b/PeyrSharp.Core/PeyrSharp.Core.csproj index 95feabec..4ef36c08 100644 --- a/PeyrSharp.Core/PeyrSharp.Core.csproj +++ b/PeyrSharp.Core/PeyrSharp.Core.csproj @@ -4,7 +4,7 @@ net6.0;net7.0;net8.0 True PeyrSharp.Core - 2.1.0.2312-rc1 + 2.1.0.2312 Devyus Core methods and features of PeyrSharp. © 2023 @@ -37,8 +37,8 @@ - - + + \ No newline at end of file diff --git a/PeyrSharp.Enums/PeyrSharp.Enums.csproj b/PeyrSharp.Enums/PeyrSharp.Enums.csproj index 607ecc8c..44bbba6b 100644 --- a/PeyrSharp.Enums/PeyrSharp.Enums.csproj +++ b/PeyrSharp.Enums/PeyrSharp.Enums.csproj @@ -11,15 +11,14 @@ https://peyrsharp.leocorporation.dev/ https://github.com/DevyusCode/PeyrSharp enums;c-sharp;dotnet;vb;peyrsharp;leo corp - 2.0.0.2311 + 2.1.0.2312 True logo.png NUGET_README.md True MIT git - - Added .NET 8 Support -- Removed .NET 5 Support + diff --git a/PeyrSharp.Env/PeyrSharp.Env.csproj b/PeyrSharp.Env/PeyrSharp.Env.csproj index 810b7a90..b57ad88c 100644 --- a/PeyrSharp.Env/PeyrSharp.Env.csproj +++ b/PeyrSharp.Env/PeyrSharp.Env.csproj @@ -4,7 +4,7 @@ net6.0;net7.0;net8.0 True PeyrSharp.Env - 2.0.0.2311 + 2.1.0.2312 Devyus Environment-related methods of PeyrSharp. © 2023 @@ -16,8 +16,7 @@ NUGET_README.md MIT True - - Added .NET 8 Support -- Removed .NET 5 Support + @@ -33,6 +32,6 @@ - + \ No newline at end of file diff --git a/PeyrSharp.Exceptions/PeyrSharp.Exceptions.csproj b/PeyrSharp.Exceptions/PeyrSharp.Exceptions.csproj index 260db97e..a037e973 100644 --- a/PeyrSharp.Exceptions/PeyrSharp.Exceptions.csproj +++ b/PeyrSharp.Exceptions/PeyrSharp.Exceptions.csproj @@ -6,7 +6,7 @@ enable True PeyrSharp.Exceptions - 2.0.0.2311 + 2.1.0.2312 Devyus Exceptions of PeyrSharp. © 2023 @@ -18,8 +18,7 @@ True MIT git - - Added .NET 8 Support -- Removed .NET 5 Support + diff --git a/PeyrSharp.Extensions/PeyrSharp.Extensions.csproj b/PeyrSharp.Extensions/PeyrSharp.Extensions.csproj index e47d5895..49106212 100644 --- a/PeyrSharp.Extensions/PeyrSharp.Extensions.csproj +++ b/PeyrSharp.Extensions/PeyrSharp.Extensions.csproj @@ -4,7 +4,7 @@ net6.0;net7.0;net8.0 True PeyrSharp.Extensions - 2.0.0.2311 + 2.1.0.2312 Devyus Extensions methods of PeyrSharp. © 2023 @@ -16,8 +16,7 @@ NUGET_README.md MIT True - - Added .NET 8 Support -- Removed .NET 5 Support + @@ -32,7 +31,7 @@ - + \ No newline at end of file diff --git a/PeyrSharp.UiHelpers/PeyrSharp.UiHelpers.csproj b/PeyrSharp.UiHelpers/PeyrSharp.UiHelpers.csproj index 537bdec0..4f1cbd3b 100644 --- a/PeyrSharp.UiHelpers/PeyrSharp.UiHelpers.csproj +++ b/PeyrSharp.UiHelpers/PeyrSharp.UiHelpers.csproj @@ -8,7 +8,7 @@ true True PeyrSharp.UiHelpers - 2.0.0.2311 + 2.1.0.2312 Devyus Useful helpers for Windows Forms and Windows Presentation Framework. © 2023 @@ -20,8 +20,7 @@ NUGET_README.md MIT True - - Added .NET 8 Support -- Removed .NET 5 Support + @@ -36,7 +35,7 @@ - + \ No newline at end of file diff --git a/PeyrSharp/PeyrSharp.cs b/PeyrSharp/PeyrSharp.cs index 8aad5863..a15c4825 100644 --- a/PeyrSharp/PeyrSharp.cs +++ b/PeyrSharp/PeyrSharp.cs @@ -32,6 +32,6 @@ public static class PeyrSharp /// /// The current version of PeyrSharp. /// - public static string Version => "2.0.0.2311"; + public static string Version => "2.1.0.2312"; } } diff --git a/PeyrSharp/PeyrSharp.csproj b/PeyrSharp/PeyrSharp.csproj index 6df1fa94..399b1833 100644 --- a/PeyrSharp/PeyrSharp.csproj +++ b/PeyrSharp/PeyrSharp.csproj @@ -4,7 +4,7 @@ net6.0;net6.0-windows;net7.0;net7.0-windows;net8.0;net8.0-windows True PeyrSharp - 2.0.0.2311 + 2.1.0.2312 Devyus © 2023 A C# library designed to make developers' job easier. @@ -34,12 +34,12 @@ - - - - - - + + + + + + \ No newline at end of file