diff options
| author | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2024-09-02 06:41:16 +0300 |
|---|---|---|
| committer | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2024-09-02 06:41:16 +0300 |
| commit | b2b4196d6f3bb007ae250a3e0648d1a5786d8dbf (patch) | |
| tree | 7de10793cef1ad125febee72cbb29627461488dd /Software/Visual_Studio/Tango.Core | |
| parent | 0d22d909e6263692d61709f1baf5dd6f0b34806e (diff) | |
| download | Tango-b2b4196d6f3bb007ae250a3e0648d1a5786d8dbf.tar.gz Tango-b2b4196d6f3bb007ae250a3e0648d1a5786d8dbf.zip | |
Implemented a workaround for light inks rounding.
Diffstat (limited to 'Software/Visual_Studio/Tango.Core')
| -rw-r--r-- | Software/Visual_Studio/Tango.Core/ExtensionMethods/DoubleExtensions.cs | 22 | ||||
| -rw-r--r-- | Software/Visual_Studio/Tango.Core/Tango.Core.csproj | 3 |
2 files changed, 24 insertions, 1 deletions
diff --git a/Software/Visual_Studio/Tango.Core/ExtensionMethods/DoubleExtensions.cs b/Software/Visual_Studio/Tango.Core/ExtensionMethods/DoubleExtensions.cs new file mode 100644 index 000000000..8ccab4d44 --- /dev/null +++ b/Software/Visual_Studio/Tango.Core/ExtensionMethods/DoubleExtensions.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + + +public static class DoubleExtensions +{ + /// <summary> + /// Replaces the decimal part of this value and returns a new value. + /// </summary> + /// <param name="value">The value.</param> + /// <param name="fromValue">The value to take the decimal part from.</param> + /// <returns></returns> + public static double ReplaceDecimalPart(this double value, double fromValue) + { + decimal right = (decimal)fromValue - Math.Truncate((decimal)fromValue); + double result = (double)(Decimal.Truncate((decimal)value) + right); + return result; + } +} diff --git a/Software/Visual_Studio/Tango.Core/Tango.Core.csproj b/Software/Visual_Studio/Tango.Core/Tango.Core.csproj index 9a55a25f9..71b17e014 100644 --- a/Software/Visual_Studio/Tango.Core/Tango.Core.csproj +++ b/Software/Visual_Studio/Tango.Core/Tango.Core.csproj @@ -104,6 +104,7 @@ <Compile Include="CustomAttributes\StringFormatAttribute.cs" /> <Compile Include="ExtensionMethods\BooleanExtensions.cs" /> <Compile Include="ExtensionMethods\ByteArrayExtensions.cs" /> + <Compile Include="ExtensionMethods\DoubleExtensions.cs" /> <Compile Include="ExtensionMethods\ListExtensions.cs" /> <Compile Include="ExtensionMethods\TimeSpanExtensions.cs" /> <Compile Include="ExtensionMethods\ZipArchiveExtensions.cs" /> @@ -221,7 +222,7 @@ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <ProjectExtensions> <VisualStudio> - <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" /> + <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" /> </VisualStudio> </ProjectExtensions> <Import Project="..\packages\System.Data.SQLite.Core.1.0.108.0\build\net46\System.Data.SQLite.Core.targets" Condition="Exists('..\packages\System.Data.SQLite.Core.1.0.108.0\build\net46\System.Data.SQLite.Core.targets')" /> |
