U4-10124 Update IFileService to handle MacroScripts and UserControls
This commit is contained in:
@@ -621,6 +621,34 @@ namespace Umbraco.Core.Services
|
||||
}
|
||||
}
|
||||
|
||||
public Stream GetMacroScriptFileContentStream(string filepath)
|
||||
{
|
||||
using (var uow = UowProvider.GetUnitOfWork(readOnly: true))
|
||||
{
|
||||
var repository = RepositoryFactory.CreateMacroScriptRepository(uow);
|
||||
return repository.GetFileContentStream(filepath);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetMacroScriptFileContent(string filepath, Stream content)
|
||||
{
|
||||
using (var uow = UowProvider.GetUnitOfWork())
|
||||
{
|
||||
var repository = RepositoryFactory.CreateMacroScriptRepository(uow);
|
||||
repository.SetFileContent(filepath, content);
|
||||
uow.Commit();
|
||||
}
|
||||
}
|
||||
|
||||
public long GetMacroScriptFileSize(string filepath)
|
||||
{
|
||||
using (var uow = UowProvider.GetUnitOfWork(readOnly: true))
|
||||
{
|
||||
var repository = RepositoryFactory.CreateMacroScriptRepository(uow);
|
||||
return repository.GetFileSize(filepath);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public Stream GetStylesheetFileContentStream(string filepath)
|
||||
@@ -679,6 +707,34 @@ namespace Umbraco.Core.Services
|
||||
}
|
||||
}
|
||||
|
||||
public Stream GetUserControlFileContentStream(string filepath)
|
||||
{
|
||||
using (var uow = UowProvider.GetUnitOfWork(readOnly: true))
|
||||
{
|
||||
var repository = RepositoryFactory.CreateUserControlRepository(uow);
|
||||
return repository.GetFileContentStream(filepath);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetUserControlFileContent(string filepath, Stream content)
|
||||
{
|
||||
using (var uow = UowProvider.GetUnitOfWork())
|
||||
{
|
||||
var repository = RepositoryFactory.CreateUserControlRepository(uow);
|
||||
repository.SetFileContent(filepath, content);
|
||||
uow.Commit();
|
||||
}
|
||||
}
|
||||
|
||||
public long GetUserControlFileSize(string filepath)
|
||||
{
|
||||
using (var uow = UowProvider.GetUnitOfWork(readOnly: true))
|
||||
{
|
||||
var repository = RepositoryFactory.CreateUserControlRepository(uow);
|
||||
return repository.GetFileSize(filepath);
|
||||
}
|
||||
}
|
||||
|
||||
public Stream GetXsltFileContentStream(string filepath)
|
||||
{
|
||||
using (var uow = UowProvider.GetUnitOfWork(readOnly: true))
|
||||
|
||||
@@ -267,6 +267,27 @@ namespace Umbraco.Core.Services
|
||||
/// <returns>The size of the template.</returns>
|
||||
long GetTemplateFileSize(string filepath);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the content of a macroscript as a stream.
|
||||
/// </summary>
|
||||
/// <param name="filepath">The filesystem path to the macroscript.</param>
|
||||
/// <returns>The content of the macroscript.</returns>
|
||||
Stream GetMacroScriptFileContentStream(string filepath);
|
||||
|
||||
/// <summary>
|
||||
/// Sets the content of a macroscript.
|
||||
/// </summary>
|
||||
/// <param name="filepath">The filesystem path to the macroscript.</param>
|
||||
/// <param name="content">The content of the macroscript.</param>
|
||||
void SetMacroScriptFileContent(string filepath, Stream content);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the size of a macroscript.
|
||||
/// </summary>
|
||||
/// <param name="filepath">The filesystem path to the macroscript.</param>
|
||||
/// <returns>The size of the macroscript.</returns>
|
||||
long GetMacroScriptFileSize(string filepath);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the content of a stylesheet as a stream.
|
||||
/// </summary>
|
||||
@@ -309,6 +330,27 @@ namespace Umbraco.Core.Services
|
||||
/// <returns>The size of the script file.</returns>
|
||||
long GetScriptFileSize(string filepath);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the content of a usercontrol as a stream.
|
||||
/// </summary>
|
||||
/// <param name="filepath">The filesystem path to the usercontrol.</param>
|
||||
/// <returns>The content of the usercontrol.</returns>
|
||||
Stream GetUserControlFileContentStream(string filepath);
|
||||
|
||||
/// <summary>
|
||||
/// Sets the content of a usercontrol.
|
||||
/// </summary>
|
||||
/// <param name="filepath">The filesystem path to the usercontrol.</param>
|
||||
/// <param name="content">The content of the usercontrol.</param>
|
||||
void SetUserControlFileContent(string filepath, Stream content);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the size of a usercontrol.
|
||||
/// </summary>
|
||||
/// <param name="filepath">The filesystem path to the usercontrol.</param>
|
||||
/// <returns>The size of the usercontrol.</returns>
|
||||
long GetUserControlFileSize(string filepath);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the content of a XSLT file as a stream.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user