2012-08-20 10:46:32 -01:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using System.Text;
|
2012-11-08 08:27:38 +05:00
|
|
|
|
using Umbraco.Core.CodeAnnotations;
|
2012-08-20 10:46:32 -01:00
|
|
|
|
|
|
|
|
|
|
namespace Umbraco.Core.IO
|
|
|
|
|
|
{
|
2012-11-08 08:27:38 +05:00
|
|
|
|
[UmbracoExperimentalFeature("http://issues.umbraco.org/issue/U4-1156", "Will be declared public after 4.10")]
|
|
|
|
|
|
public static class FileSystemExtensions
|
2012-08-20 10:46:32 -01:00
|
|
|
|
{
|
2012-11-08 08:27:38 +05:00
|
|
|
|
[UmbracoExperimentalFeature("", "Will be declared public after 4.10")]
|
2012-08-20 10:46:32 -01:00
|
|
|
|
internal static long GetSize(this IFileSystem fs, string path)
|
|
|
|
|
|
{
|
|
|
|
|
|
var s = fs.OpenFile(path);
|
|
|
|
|
|
var size = s.Length;
|
|
|
|
|
|
s.Close();
|
|
|
|
|
|
|
|
|
|
|
|
return size;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2012-11-08 08:27:38 +05:00
|
|
|
|
[UmbracoExperimentalFeature("", "Will be declared public after 4.10")]
|
2012-08-20 11:42:18 -01:00
|
|
|
|
internal static void CopyFile(this IFileSystem fs, string path, string newPath)
|
2012-08-20 10:46:32 -01:00
|
|
|
|
{
|
2012-08-20 11:42:18 -01:00
|
|
|
|
fs.AddFile(newPath, fs.OpenFile(path));
|
2012-08-20 10:46:32 -01:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|