Merge pull request #604 from csharpforevermore/dev-v7

Fixed: U4-6054 "Unit test 'Umbraco.Tests.IO.AbstractFileSystemTests.Can_...
This commit is contained in:
Shannon Deminick
2015-01-02 15:54:11 +11:00

View File

@@ -7,13 +7,22 @@ namespace Umbraco.Core.IO
{
public static long GetSize(this IFileSystem fs, string path)
{
using (var s = fs.OpenFile(path))
{
var size = s.Length;
s.Close();
return size;
}
using (var ms = new MemoryStream())
{
using (var sr = new StreamReader(ms))
{
using (Stream file = fs.OpenFile(path))
{
var bytes = new byte[file.Length];
file.Read(bytes, 0, (int) file.Length);
ms.Write(bytes, 0, (int) file.Length);
file.Close();
ms.Position = 0;
string str = sr.ReadToEnd();
return str.Length;
}
}
}
}
public static void CopyFile(this IFileSystem fs, string path, string newPath)