From d42b2492b7b46f985fe5fd7c8d4aa5dd801b4dcc Mon Sep 17 00:00:00 2001 From: Shannon Date: Mon, 20 May 2019 18:40:13 +0200 Subject: [PATCH] Moves more utilities --- .../DictionaryExtensions.cs | 2 +- .../EnumExtensions.cs | 0 .../HashCodeHelper.cs | 2 +- .../HashGenerator.cs | 22 +++++++++---------- .../Sections/ISection.cs | 0 src/Umbraco.Core/Umbraco.Core.csproj | 5 ----- 6 files changed, 13 insertions(+), 18 deletions(-) rename src/{Umbraco.Core => Umbraco.Abstractions}/DictionaryExtensions.cs (99%) rename src/{Umbraco.Core => Umbraco.Abstractions}/EnumExtensions.cs (100%) rename src/{Umbraco.Core => Umbraco.Abstractions}/HashCodeHelper.cs (98%) rename src/{Umbraco.Core => Umbraco.Abstractions}/HashGenerator.cs (90%) rename src/{Umbraco.Core/Models => Umbraco.Abstractions}/Sections/ISection.cs (100%) diff --git a/src/Umbraco.Core/DictionaryExtensions.cs b/src/Umbraco.Abstractions/DictionaryExtensions.cs similarity index 99% rename from src/Umbraco.Core/DictionaryExtensions.cs rename to src/Umbraco.Abstractions/DictionaryExtensions.cs index d9e998dbd1..0c0049a4b9 100644 --- a/src/Umbraco.Core/DictionaryExtensions.cs +++ b/src/Umbraco.Abstractions/DictionaryExtensions.cs @@ -12,7 +12,7 @@ namespace Umbraco.Core /// /// Extension methods for Dictionary & ConcurrentDictionary /// - internal static class DictionaryExtensions + public static class DictionaryExtensions { /// diff --git a/src/Umbraco.Core/EnumExtensions.cs b/src/Umbraco.Abstractions/EnumExtensions.cs similarity index 100% rename from src/Umbraco.Core/EnumExtensions.cs rename to src/Umbraco.Abstractions/EnumExtensions.cs diff --git a/src/Umbraco.Core/HashCodeHelper.cs b/src/Umbraco.Abstractions/HashCodeHelper.cs similarity index 98% rename from src/Umbraco.Core/HashCodeHelper.cs rename to src/Umbraco.Abstractions/HashCodeHelper.cs index f3dc7fcd0e..dd9d5c89dc 100644 --- a/src/Umbraco.Core/HashCodeHelper.cs +++ b/src/Umbraco.Abstractions/HashCodeHelper.cs @@ -5,7 +5,7 @@ namespace Umbraco.Core /// /// Borrowed from http://stackoverflow.com/a/2575444/694494 /// - internal static class HashCodeHelper + public static class HashCodeHelper { public static int GetHashCode(T1 arg1, T2 arg2) { diff --git a/src/Umbraco.Core/HashGenerator.cs b/src/Umbraco.Abstractions/HashGenerator.cs similarity index 90% rename from src/Umbraco.Core/HashGenerator.cs rename to src/Umbraco.Abstractions/HashGenerator.cs index 80cc3c3de4..62be0dacdd 100644 --- a/src/Umbraco.Core/HashGenerator.cs +++ b/src/Umbraco.Abstractions/HashGenerator.cs @@ -14,7 +14,7 @@ namespace Umbraco.Core /// This will use the crypto libs to generate the hash and will try to ensure that /// strings, etc... are not re-allocated so it's not consuming much memory. /// - internal class HashGenerator : DisposableObjectSlim + public class HashGenerator : DisposableObjectSlim { public HashGenerator() { @@ -24,33 +24,33 @@ namespace Umbraco.Core private readonly MemoryStream _ms = new MemoryStream(); private StreamWriter _writer; - internal void AddInt(int i) + public void AddInt(int i) { _writer.Write(i); } - internal void AddLong(long i) + public void AddLong(long i) { _writer.Write(i); } - internal void AddObject(object o) + public void AddObject(object o) { _writer.Write(o); } - internal void AddDateTime(DateTime d) + public void AddDateTime(DateTime d) { _writer.Write(d.Ticks);; } - internal void AddString(string s) + public void AddString(string s) { if (s != null) _writer.Write(s); } - internal void AddCaseInsensitiveString(string s) + public void AddCaseInsensitiveString(string s) { //I've tried to no allocate a new string with this which can be done if we use the CompareInfo.GetSortKey method which will create a new //byte array that we can use to write to the output, however this also allocates new objects so i really don't think the performance @@ -63,7 +63,7 @@ namespace Umbraco.Core _writer.Write(s.ToUpperInvariant()); } - internal void AddFileSystemItem(FileSystemInfo f) + public void AddFileSystemItem(FileSystemInfo f) { //if it doesn't exist, don't proceed. if (f.Exists == false) @@ -94,12 +94,12 @@ namespace Umbraco.Core } } - internal void AddFile(FileInfo f) + public void AddFile(FileInfo f) { AddFileSystemItem(f); } - internal void AddFolder(DirectoryInfo d) + public void AddFolder(DirectoryInfo d) { AddFileSystemItem(d); } @@ -108,7 +108,7 @@ namespace Umbraco.Core /// Returns the generated hash output of all added objects /// /// - internal string GenerateHash() + public string GenerateHash() { //flush,close,dispose the writer,then create a new one since it's possible to keep adding after GenerateHash is called. diff --git a/src/Umbraco.Core/Models/Sections/ISection.cs b/src/Umbraco.Abstractions/Sections/ISection.cs similarity index 100% rename from src/Umbraco.Core/Models/Sections/ISection.cs rename to src/Umbraco.Abstractions/Sections/ISection.cs diff --git a/src/Umbraco.Core/Umbraco.Core.csproj b/src/Umbraco.Core/Umbraco.Core.csproj index 51b87621f4..dbbaead7b9 100755 --- a/src/Umbraco.Core/Umbraco.Core.csproj +++ b/src/Umbraco.Core/Umbraco.Core.csproj @@ -307,7 +307,6 @@ - @@ -445,7 +444,6 @@ - @@ -545,7 +543,6 @@ - @@ -595,8 +592,6 @@ - -