aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.Editors
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-03-06 18:28:51 +0200
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-03-06 18:28:51 +0200
commit4e48c569f1cae820ffade8a786354b2ba79b50b4 (patch)
tree1bfbdf19f8c86cc1f1a1d8b900756b0cc2781d66 /Software/Visual_Studio/Tango.Editors
parent7e6c673cc8b04086fa3c78cd1bf5e31085fd8cc8 (diff)
downloadTango-4e48c569f1cae820ffade8a786354b2ba79b50b4.tar.gz
Tango-4e48c569f1cae820ffade8a786354b2ba79b50b4.zip
Some improvements on hive.
Diffstat (limited to 'Software/Visual_Studio/Tango.Editors')
-rw-r--r--Software/Visual_Studio/Tango.Editors/StringExtensions.cs107
-rw-r--r--Software/Visual_Studio/Tango.Editors/Tango.Editors.csproj9
2 files changed, 7 insertions, 109 deletions
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;
-
-/// <exclude/>
-/// <summary>
-/// A collection of <see cref="String"/> extension methods.
-/// </summary>
-internal static class StringExtensions
-{
- private static Regex titleRegEx;
-
- /// <summary>
- /// Initializes the <see cref="StringExtensions"/> class.
- /// </summary>
- static StringExtensions()
- {
- titleRegEx = new Regex(@"
- (?<=[A-Z])(?=[A-Z][a-z]) |
- (?<=[^A-Z])(?=[A-Z]) |
- (?<=[A-Za-z])(?=[^A-Za-z])", RegexOptions.IgnorePatternWhitespace);
- }
-
- /// <summary>
- /// Returns true if the string is not null or contains white spaces.
- /// </summary>
- /// <param name="str">The string.</param>
- /// <returns></returns>
- internal static bool IsValid(this String str)
- {
- return !String.IsNullOrWhiteSpace(str);
- }
-
- /// <summary>
- /// Determines whether the string contains an existing file path.
- /// </summary>
- /// <param name="path">The path.</param>
- /// <returns></returns>
- internal static bool IsFileExists(this String path)
- {
- return System.IO.File.Exists(path);
- }
-
- /// <summary>
- /// Determines whether the string is valid as a file system path.
- /// </summary>
- /// <param name="path">The path.</param>
- /// <returns></returns>
- internal static bool IsPathValid(this String path)
- {
- return path.IsValid() && path.IndexOfAny(System.IO.Path.GetInvalidPathChars()) == -1;
- }
-
- /// <summary>
- /// Returns a friendly file size of the file path.
- /// </summary>
- /// <param name="filePath">The file path.</param>
- /// <returns></returns>
- 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]);
- }
-
- /// <summary>
- /// If string is a path, returns the file name.
- /// </summary>
- /// <param name="filePath">The file path.</param>
- /// <returns></returns>
- internal static String GetFileName(this String filePath)
- {
- return Path.GetFileName(filePath);
- }
-
- /// <summary>
- /// If string is a path, returns the file extension.
- /// </summary>
- /// <param name="filePath">The file path.</param>
- /// <returns></returns>
- 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 @@
<Compile Include="ParameterItem.cs" />
<Compile Include="ParameterItemAttribute.cs" />
<Compile Include="ParameterItemMode.cs" />
- <Compile Include="StringExtensions.cs" />
<Compile Include="UIElementExtension.cs" />
<Compile Include="UIHelper.cs" />
<Compile Include="UndoRedoStatesProviderBase.cs" />
@@ -109,7 +108,7 @@
<Compile Include="Converters\StringFormatConverter.cs" />
<Compile Include="Converters\TransformPointToPointConverter.cs" />
<Compile Include="CustomScrollViewer.cs" />
- <Compile Include="DependencyObjectExtensions.cs" />
+ <None Include="DependencyObjectExtensions.cs" />
<Compile Include="ElementCreationEventArgs.cs" />
<Compile Include="ElementEditor.cs" />
<Compile Include="ElementEditorConfiguration.cs" />
@@ -166,5 +165,11 @@
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
</ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\Tango.Core\Tango.Core.csproj">
+ <Project>{a34ee0f0-649d-41c8-8489-b6f1cc6924ee}</Project>
+ <Name>Tango.Core</Name>
+ </ProjectReference>
+ </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project> \ No newline at end of file