From 4e48c569f1cae820ffade8a786354b2ba79b50b4 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Tue, 6 Mar 2018 18:28:51 +0200 Subject: Some improvements on hive. --- .../Tango.Editors/StringExtensions.cs | 107 --------------------- .../Tango.Editors/Tango.Editors.csproj | 9 +- 2 files changed, 7 insertions(+), 109 deletions(-) delete mode 100644 Software/Visual_Studio/Tango.Editors/StringExtensions.cs (limited to 'Software/Visual_Studio/Tango.Editors') diff --git a/Software/Visual_Studio/Tango.Editors/StringExtensions.cs b/Software/Visual_Studio/Tango.Editors/StringExtensions.cs deleted file mode 100644 index 0f5923512..000000000 --- a/Software/Visual_Studio/Tango.Editors/StringExtensions.cs +++ /dev/null @@ -1,107 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; -using System.Text.RegularExpressions; -using System.Threading.Tasks; - -/// -/// -/// A collection of extension methods. -/// -internal static class StringExtensions -{ - private static Regex titleRegEx; - - /// - /// Initializes the class. - /// - static StringExtensions() - { - titleRegEx = new Regex(@" - (?<=[A-Z])(?=[A-Z][a-z]) | - (?<=[^A-Z])(?=[A-Z]) | - (?<=[A-Za-z])(?=[^A-Za-z])", RegexOptions.IgnorePatternWhitespace); - } - - /// - /// Returns true if the string is not null or contains white spaces. - /// - /// The string. - /// - internal static bool IsValid(this String str) - { - return !String.IsNullOrWhiteSpace(str); - } - - /// - /// Determines whether the string contains an existing file path. - /// - /// The path. - /// - internal static bool IsFileExists(this String path) - { - return System.IO.File.Exists(path); - } - - /// - /// Determines whether the string is valid as a file system path. - /// - /// The path. - /// - internal static bool IsPathValid(this String path) - { - return path.IsValid() && path.IndexOfAny(System.IO.Path.GetInvalidPathChars()) == -1; - } - - /// - /// Returns a friendly file size of the file path. - /// - /// The file path. - /// - internal static String GetFileSizeString(this String filePath) - { - FileInfo f = new FileInfo(filePath); - double length = f.Length; - - string[] sizes = { "B", "KB", "MB", "GB" }; - double len = length; - int order = 0; - while (len >= 1024 && order + 1 < sizes.Length) - { - order++; - len = len / 1024; - } - - // Adjust the format string to your preferences. For example "{0:0.#}{1}" would - // show a single decimal place, and no space. - return String.Format("{0:0.##} {1}", len, sizes[order]); - } - - /// - /// If string is a path, returns the file name. - /// - /// The file path. - /// - internal static String GetFileName(this String filePath) - { - return Path.GetFileName(filePath); - } - - /// - /// If string is a path, returns the file extension. - /// - /// The file path. - /// - internal static String GetFileExtension(this String filePath) - { - return Path.GetExtension(filePath); - } - - internal static String ToTitle(this String str) - { - return titleRegEx.Replace(str, " "); - } -} - diff --git a/Software/Visual_Studio/Tango.Editors/Tango.Editors.csproj b/Software/Visual_Studio/Tango.Editors/Tango.Editors.csproj index 217048e63..1eaeddb9c 100644 --- a/Software/Visual_Studio/Tango.Editors/Tango.Editors.csproj +++ b/Software/Visual_Studio/Tango.Editors/Tango.Editors.csproj @@ -76,7 +76,6 @@ - @@ -109,7 +108,7 @@ - + @@ -166,5 +165,11 @@ Settings.Designer.cs + + + {a34ee0f0-649d-41c8-8489-b6f1cc6924ee} + Tango.Core + + \ No newline at end of file -- cgit v1.3.1