diff --git a/PeyrSharp.Core/Converters/Temperatures.cs b/PeyrSharp.Core/Converters/Temperatures.cs
index 3026ac6..cee66bd 100644
--- a/PeyrSharp.Core/Converters/Temperatures.cs
+++ b/PeyrSharp.Core/Converters/Temperatures.cs
@@ -42,5 +42,33 @@ 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;
+
+ ///
+ /// 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;
+
+ ///
+ /// 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;
+
+ ///
+ /// 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;
}
}
diff --git a/PeyrSharp.Core/Internet.cs b/PeyrSharp.Core/Internet.cs
index 398ca61..2c72200 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,28 @@ 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
+ {
+ 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.
///
diff --git a/PeyrSharp.Core/Password.cs b/PeyrSharp.Core/Password.cs
index 98811a3..a4ba045 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.
///
diff --git a/PeyrSharp.Core/PeyrSharp.Core.csproj b/PeyrSharp.Core/PeyrSharp.Core.csproj
index 6c61597..4ef36c0 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
Devyus
Core methods and features of PeyrSharp.
© 2023
@@ -16,8 +16,13 @@
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)
+- Added CelsiusToKelvin() method (#159)
+- Added FahrenheitToKelvin() method (#159)
+- Added KelvinToCelsius() method (#159)
+- Added KelvinToFahrenheit() method (#159)
@@ -32,8 +37,8 @@
-
-
+
+
\ No newline at end of file
diff --git a/PeyrSharp.Enums/PeyrSharp.Enums.csproj b/PeyrSharp.Enums/PeyrSharp.Enums.csproj
index 607ecc8..44bbba6 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 810b7a9..b57ad88 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 260db97..a037e97 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 e47d589..4910621 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 537bdec..4f1cbd3 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 8aad586..a15c482 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 6df1fa9..399b183 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