Skip to content

Commit

Permalink
Merge pull request #87 from Leo-Corporation/vNext
Browse files Browse the repository at this point in the history
Version 1.4.0.2303
  • Loading branch information
lpeyr authored Mar 5, 2023
2 parents 31029cc + 7aa9f42 commit 4e9809b
Show file tree
Hide file tree
Showing 11 changed files with 209 additions and 30 deletions.
57 changes: 57 additions & 0 deletions PeyrSharp.Core/Converters/Energies.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*
MIT License
Copyright (c) Léo Corporation
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PeyrSharp.Core.Converters
{
/// <summary>
/// Class that contains energies converters methods.
/// </summary>
public static class Energies
{
/// <summary>
/// Converts calories to joules.
/// </summary>
/// <param name="calories">The amount of energy in calories.</param>
/// <returns>The equivalent amount of energy in joules.</returns>
public static double CaloriesToJoules(double calories) =>
// 1 calorie = 4.184 joules
calories * 4.184;

/// <summary>
/// Converts joules to calories.
/// </summary>
/// <param name="joules">The amount of energy in joules.</param>
/// <returns>The equivalent amount of energy in calories.</returns>
public static double JoulesToCalories(double joules) =>
// 1 calorie = 4.184 joules
joules / 4.184;

}
}
94 changes: 94 additions & 0 deletions PeyrSharp.Core/Converters/Speeds.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
/*
MIT License
Copyright (c) Léo Corporation
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PeyrSharp.Core.Converters
{
/// <summary>
/// Class that contains speeds converters methods.
/// </summary>
public static class Speeds
{
/// <summary>
/// Converts knots to kilometers per hour.
/// </summary>
/// <param name="knots">The speed in knots.</param>
/// <returns>The equivalent speed in kilometers per hour.</returns>
public static double KnotsToKilometersPerHour(double knots) => knots * 1.852;

/// <summary>
/// Converts kilometers per hour to knots.
/// </summary>
/// <param name="kilometersPerHour">The speed in kilometers per hour.</param>
/// <returns>The equivalent speed in knots.</returns>
public static double KilometersPerHourToKnots(double kilometersPerHour) => kilometersPerHour / 1.852;

/// <summary>
/// Converts knots to miles per hour.
/// </summary>
/// <param name="knots">The speed in knots.</param>
/// <returns>The equivalent speed in miles per hour.</returns>
public static double KnotsToMilesPerHour(double knots) => knots * 1.15078;

/// <summary>
/// Converts miles per hour to knots.
/// </summary>
/// <param name="milesPerHour">The speed in miles per hour.</param>
/// <returns>The equivalent speed in knots.</returns>
public static double MilesPerHourToKnots(double milesPerHour) => milesPerHour / 1.15078;

/// <summary>
/// Converts kilometers per hour to meters per second.
/// </summary>
/// <param name="kilometersPerHour">The speed in kilometers per hour.</param>
/// <returns>The equivalent speed in meters per second.</returns>
public static double KilometersPerHourToMetersPerSecond(double kilometersPerHour) => kilometersPerHour / 3.6;

/// <summary>
/// Converts meters per second to kilometers per hour.
/// </summary>
/// <param name="metersPerSecond">The speed in meters per second.</param>
/// <returns>The equivalent speed in kilometers per hour.</returns>
public static double MetersPerSecondToKilometersPerHour(double metersPerSecond) => metersPerSecond * 3.6;

/// <summary>
/// Converts miles per hour to kilometers per hour.
/// </summary>
/// <param name="milesPerHour">The speed in miles per hour.</param>
/// <returns>The equivalent speed in kilometers per hour.</returns>
public static double MilesPerHourToKilometersPerHour(double milesPerHour) => milesPerHour * 1.60934;

/// <summary>
/// Converts kilometers per hour to miles per hour.
/// </summary>
/// <param name="kilometersPerHour">The speed in kilometers per hour.</param>
/// <returns>The equivalent speed in miles per hour.</returns>
public static double KilometersPerHourToMilesPerHour(double kilometersPerHour) => kilometersPerHour / 1.60934;
}
}
17 changes: 13 additions & 4 deletions PeyrSharp.Core/PeyrSharp.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFrameworks>net5.0;net6.0;net7.0</TargetFrameworks>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
<Title>PeyrSharp.Core</Title>
<Version>1.3.0.2302</Version>
<Version>1.4.0.2303</Version>
<Authors>Léo Corporation</Authors>
<Description>Core methods and features of PeyrSharp.</Description>
<Copyright>© 2023</Copyright>
Expand All @@ -16,7 +16,16 @@
<PackageReadmeFile>NUGET_README.md</PackageReadmeFile>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<PackageReleaseNotes>- Added the possibility to generate a random value based on probabilities (#71)</PackageReleaseNotes>
<PackageReleaseNotes>- Added `CaloriesToJoules()` method (#79)
- Added `JoulesToCalories()` method (#79)
- Added `KnotsToKilometersPerHour()` method (#80)
- Added `KilometersPerHourToKnots()` method (#80)
- Added `KnotsToMilesPerHour()` method (#81)
- Added `MilesPerHourToKnots()` method (#81)
- Added `KilometersPerHourToMetersPerSecond()` method (#82)
- Added `MetersPerSecondToKilometersPerHour()` method (#82)
- Added `MilesPerHourToKilometersPerHour()` (#83)
- Added `KilometersPerHourToMilesPerHour()` (#83)</PackageReleaseNotes>
</PropertyGroup>

<ItemGroup>
Expand All @@ -31,8 +40,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="PeyrSharp.Enums" Version="1.3.0.2302" />
<PackageReference Include="PeyrSharp.Exceptions" Version="1.3.0.2302" />
<PackageReference Include="PeyrSharp.Enums" Version="1.4.0.2303" />
<PackageReference Include="PeyrSharp.Exceptions" Version="1.4.0.2303" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion PeyrSharp.Enums/PeyrSharp.Enums.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<PackageProjectUrl>https://peyrsharp.leocorporation.dev/</PackageProjectUrl>
<RepositoryUrl>https://github.com/Leo-Corporation/PeyrSharp</RepositoryUrl>
<PackageTags>enums;c-sharp;dotnet;vb;peyrsharp;leo corp</PackageTags>
<Version>1.3.0.2302</Version>
<Version>1.4.0.2303</Version>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<PackageIcon>logo.png</PackageIcon>
<PackageReadmeFile>NUGET_README.md</PackageReadmeFile>
Expand Down
9 changes: 3 additions & 6 deletions PeyrSharp.Env/PeyrSharp.Env.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFrameworks>net5.0;net6.0;net7.0</TargetFrameworks>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
<Title>PeyrSharp.Env</Title>
<Version>1.3.0.2302</Version>
<Version>1.4.0.2303</Version>
<Authors>Léo Corporation</Authors>
<Description>Environment-related methods of PeyrSharp.</Description>
<Copyright>© 2023</Copyright>
Expand All @@ -16,10 +16,7 @@
<PackageReadmeFile>NUGET_README.md</PackageReadmeFile>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<PackageReleaseNotes>- Added the possibility to check if a process is running (#67)
- Added the possibility to get the current directory (#68)
- Added the possibility to get the name of the computer (#69)
- Added the possibility to terminate a process (#70)</PackageReleaseNotes>
<PackageReleaseNotes></PackageReleaseNotes>
</PropertyGroup>

<ItemGroup>
Expand All @@ -34,6 +31,6 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="PeyrSharp.Enums" Version="1.3.0.2302" />
<PackageReference Include="PeyrSharp.Enums" Version="1.4.0.2303" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion PeyrSharp.Exceptions/PeyrSharp.Exceptions.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<Nullable>enable</Nullable>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<Title>PeyrSharp.Exceptions</Title>
<Version>1.3.0.2302</Version>
<Version>1.4.0.2303</Version>
<Company>Léo Corporation</Company>
<Description>Exceptions of PeyrSharp.</Description>
<Copyright>© 2023</Copyright>
Expand Down
6 changes: 3 additions & 3 deletions PeyrSharp.Extensions/PeyrSharp.Extensions.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFrameworks>net5.0;net6.0;net7.0</TargetFrameworks>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
<Title>PeyrSharp.Extensions</Title>
<Version>1.3.0.2302</Version>
<Version>1.4.0.2303</Version>
<Authors>Léo Corporation</Authors>
<Description>Extensions methods of PeyrSharp.</Description>
<Copyright>© 2023</Copyright>
Expand All @@ -16,7 +16,7 @@
<PackageReadmeFile>NUGET_README.md</PackageReadmeFile>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<PackageReleaseNotes></PackageReleaseNotes>
<PackageReleaseNotes>- Added the ``Reverse()`` extension method (string) (#78)</PackageReleaseNotes>
</PropertyGroup>

<ItemGroup>
Expand All @@ -31,7 +31,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="PeyrSharp.Enums" Version="1.3.0.2302" />
<PackageReference Include="PeyrSharp.Enums" Version="1.4.0.2303" />
</ItemGroup>

</Project>
16 changes: 16 additions & 0 deletions PeyrSharp.Extensions/StringExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -184,5 +184,21 @@ public static string DecryptAes(this string encrypted, string key)
/// <returns>The input string with the first letter uppercased.</returns>
public static string ToUpperAt(this string s) => string.IsNullOrEmpty(s) ? s : char.ToUpper(s[0]) + s[1..];

/// <summary>
/// Reverses a <see cref="string"/>.
/// </summary>
/// <param name="input">The string to reverse.</param>
/// <returns>The reversed string.</returns>
public static string Reverse(this string input)
{
if (string.IsNullOrEmpty(input))
{
return input;
}

char[] chars = input.ToCharArray();
Array.Reverse(chars);
return new string(chars);
}
}
}
4 changes: 2 additions & 2 deletions PeyrSharp.UiHelpers/PeyrSharp.UiHelpers.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<UseWPF>true</UseWPF>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
<Title>PeyrSharp.UiHelpers</Title>
<Version>1.3.0.2302</Version>
<Version>1.4.0.2303</Version>
<Authors>Léo Corporation</Authors>
<Description>Useful helpers for Windows Forms and Windows Presentation Framework.</Description>
<Copyright>© 2023</Copyright>
Expand All @@ -34,7 +34,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="PeyrSharp.Enums" Version="1.3.0.2302" />
<PackageReference Include="PeyrSharp.Enums" Version="1.4.0.2303" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion PeyrSharp/PeyrSharp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ public static class PeyrSharp
/// <summary>
/// The current version of PeyrSharp.
/// </summary>
public static string Version => "1.3.0.2302";
public static string Version => "1.4.0.2303";
}
}
30 changes: 18 additions & 12 deletions PeyrSharp/PeyrSharp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFrameworks>net5.0;net6.0;net5.0-windows;net6.0-windows;net7.0;net7.0-windows</TargetFrameworks>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
<Title>PeyrSharp</Title>
<Version>1.3.0.2302</Version>
<Version>1.4.0.2303</Version>
<Authors>Léo Corporation</Authors>
<Copyright>© 2023</Copyright>
<Description>A C# library designed to make developers' job easier.</Description>
Expand All @@ -16,11 +16,17 @@
<PackageReadmeFile>NUGET_README.md</PackageReadmeFile>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<PackageReleaseNotes>- Added the possibility to check if a process is running (#67)
- Added the possibility to get the current directory (#68)
- Added the possibility to get the name of the computer (#69)
- Added the possibility to terminate a process (#70)
- Added the possibility to generate a random value based on probabilities (#71)</PackageReleaseNotes>
<PackageReleaseNotes>- Added the ``Reverse()`` extension method (string) (#78)
- Added `CaloriesToJoules()` method (#79)
- Added `JoulesToCalories()` method (#79)
- Added `KnotsToKilometersPerHour()` method (#80)
- Added `KilometersPerHourToKnots()` method (#80)
- Added `KnotsToMilesPerHour()` method (#81)
- Added `MilesPerHourToKnots()` method (#81)
- Added `KilometersPerHourToMetersPerSecond()` method (#82)
- Added `MetersPerSecondToKilometersPerHour()` method (#82)
- Added `MilesPerHourToKilometersPerHour()` (#83)
- Added `KilometersPerHourToMilesPerHour()` (#83)</PackageReleaseNotes>
</PropertyGroup>

<ItemGroup>
Expand All @@ -35,12 +41,12 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="PeyrSharp.Core" Version="1.3.0.2302" />
<PackageReference Include="PeyrSharp.Enums" Version="1.3.0.2302" />
<PackageReference Include="PeyrSharp.Env" Version="1.3.0.2302" />
<PackageReference Include="PeyrSharp.Exceptions" Version="1.3.0.2302" />
<PackageReference Include="PeyrSharp.Extensions" Version="1.3.0.2302" />
<PackageReference Condition="'$(TargetPlatformIdentifier)' == 'Windows'" Include="PeyrSharp.UiHelpers" Version="1.3.0.2302" />
<PackageReference Include="PeyrSharp.Core" Version="1.4.0.2303" />
<PackageReference Include="PeyrSharp.Enums" Version="1.4.0.2303" />
<PackageReference Include="PeyrSharp.Env" Version="1.4.0.2303" />
<PackageReference Include="PeyrSharp.Exceptions" Version="1.4.0.2303" />
<PackageReference Include="PeyrSharp.Extensions" Version="1.4.0.2303" />
<PackageReference Condition="'$(TargetPlatformIdentifier)' == 'Windows'" Include="PeyrSharp.UiHelpers" Version="1.4.0.2303" />
</ItemGroup>

</Project>

0 comments on commit 4e9809b

Please sign in to comment.