From cf1a23341a324e4628fdb404a74e36c4dfbe5b08 Mon Sep 17 00:00:00 2001 From: Fionn Date: Wed, 25 May 2022 08:30:31 +0200 Subject: [PATCH] added checksum utilities --- Checksums/Checksums.sln | 23 ++++++++++++++++++- .../dotFionn.Checksum.Utils/Extensions.cs | 19 +++++++++++++++ .../dotFionn.Checksum.Utils.csproj | 7 ++++++ Checksums/test/Program.cs | 15 ++++++++++++ Checksums/test/test.csproj | 12 ++++++++++ 5 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 Checksums/dotFionn.Checksum.Utils/Extensions.cs create mode 100644 Checksums/dotFionn.Checksum.Utils/dotFionn.Checksum.Utils.csproj create mode 100644 Checksums/test/Program.cs create mode 100644 Checksums/test/test.csproj diff --git a/Checksums/Checksums.sln b/Checksums/Checksums.sln index 35c158b..8fc3432 100644 --- a/Checksums/Checksums.sln +++ b/Checksums/Checksums.sln @@ -3,7 +3,16 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.2.32516.85 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ISBN", "ISBN\ISBN.csproj", "{3BFA78C7-4DE1-46CD-912F-59D3DE0B9788}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ISBN", "ISBN\ISBN.csproj", "{3BFA78C7-4DE1-46CD-912F-59D3DE0B9788}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EANValidator", "EANValidator\EANValidator.csproj", "{2E12BD9A-5E23-4ED9-8B1C-63C8AB19D39D}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "dotFionn.Checksum.Utils", "dotFionn.Checksum.Utils\dotFionn.Checksum.Utils.csproj", "{B8ED20C2-C851-47B8-8509-12E4A3D2F18C}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "test", "test\test.csproj", "{DAE25550-52A1-440A-B6B9-C588357620D4}" + ProjectSection(ProjectDependencies) = postProject + {B8ED20C2-C851-47B8-8509-12E4A3D2F18C} = {B8ED20C2-C851-47B8-8509-12E4A3D2F18C} + EndProjectSection EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -15,6 +24,18 @@ Global {3BFA78C7-4DE1-46CD-912F-59D3DE0B9788}.Debug|Any CPU.Build.0 = Debug|Any CPU {3BFA78C7-4DE1-46CD-912F-59D3DE0B9788}.Release|Any CPU.ActiveCfg = Release|Any CPU {3BFA78C7-4DE1-46CD-912F-59D3DE0B9788}.Release|Any CPU.Build.0 = Release|Any CPU + {2E12BD9A-5E23-4ED9-8B1C-63C8AB19D39D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2E12BD9A-5E23-4ED9-8B1C-63C8AB19D39D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2E12BD9A-5E23-4ED9-8B1C-63C8AB19D39D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2E12BD9A-5E23-4ED9-8B1C-63C8AB19D39D}.Release|Any CPU.Build.0 = Release|Any CPU + {B8ED20C2-C851-47B8-8509-12E4A3D2F18C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B8ED20C2-C851-47B8-8509-12E4A3D2F18C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B8ED20C2-C851-47B8-8509-12E4A3D2F18C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B8ED20C2-C851-47B8-8509-12E4A3D2F18C}.Release|Any CPU.Build.0 = Release|Any CPU + {DAE25550-52A1-440A-B6B9-C588357620D4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DAE25550-52A1-440A-B6B9-C588357620D4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DAE25550-52A1-440A-B6B9-C588357620D4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DAE25550-52A1-440A-B6B9-C588357620D4}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Checksums/dotFionn.Checksum.Utils/Extensions.cs b/Checksums/dotFionn.Checksum.Utils/Extensions.cs new file mode 100644 index 0000000..ca622bf --- /dev/null +++ b/Checksums/dotFionn.Checksum.Utils/Extensions.cs @@ -0,0 +1,19 @@ +using System; + +namespace dotFionn.Checksum.Utils +{ + public static class Extensions + { + public static int digitSum(this int inInt) + { + int digitSum = 0; + + while (inInt > 0) { + digitSum += inInt % 10; + inInt /= 10; + } + + return digitSum; + } + } +} diff --git a/Checksums/dotFionn.Checksum.Utils/dotFionn.Checksum.Utils.csproj b/Checksums/dotFionn.Checksum.Utils/dotFionn.Checksum.Utils.csproj new file mode 100644 index 0000000..f208d30 --- /dev/null +++ b/Checksums/dotFionn.Checksum.Utils/dotFionn.Checksum.Utils.csproj @@ -0,0 +1,7 @@ + + + + net5.0 + + + diff --git a/Checksums/test/Program.cs b/Checksums/test/Program.cs new file mode 100644 index 0000000..6cf112a --- /dev/null +++ b/Checksums/test/Program.cs @@ -0,0 +1,15 @@ +using System; +using dotFionn.Checksum.Utils; + +namespace test +{ + internal class Program + { + static void Main(string[] args) + { + Console.WriteLine("Hello World!"); + Console.WriteLine(123.digitSum()); + + } + } +} diff --git a/Checksums/test/test.csproj b/Checksums/test/test.csproj new file mode 100644 index 0000000..18e5926 --- /dev/null +++ b/Checksums/test/test.csproj @@ -0,0 +1,12 @@ + + + + Exe + net5.0 + + + + + + +