Represents the File Service, which is an easy access to operations involving IFile objects like Scripts, Stylesheets and Templates
InheritanceSystem.Object
Namespace: Umbraco.Cms.Core.Services Assembly: Umbraco.Core.dll Syntaxpublic class FileService : RepositoryService, IFileService, IService
Constructors View Source FileService(ICoreScopeProvider, ILoggerFactory, IEventMessagesFactory, IStylesheetRepository, IScriptRepository, IPartialViewRepository, IAuditRepository, IHostingEnvironment, ITemplateService, ITemplateRepository, IUserIdKeyResolver, IShortStringHelper, IOptions<GlobalSettings>) Declaration
public FileService(ICoreScopeProvider uowProvider, ILoggerFactory loggerFactory, IEventMessagesFactory eventMessagesFactory, IStylesheetRepository stylesheetRepository, IScriptRepository scriptRepository, IPartialViewRepository partialViewRepository, IAuditRepository auditRepository, IHostingEnvironment hostingEnvironment, ITemplateService templateService, ITemplateRepository templateRepository, IUserIdKeyResolver userIdKeyResolver, IShortStringHelper shortStringHelper, IOptions<GlobalSettings> globalSettings)
Parameters View Source FileService(ICoreScopeProvider, ILoggerFactory, IEventMessagesFactory, IStylesheetRepository, IScriptRepository, ITemplateRepository, IPartialViewRepository, IAuditRepository, IShortStringHelper, IOptions<GlobalSettings>, IHostingEnvironment) Declaration
public FileService(ICoreScopeProvider uowProvider, ILoggerFactory loggerFactory, IEventMessagesFactory eventMessagesFactory, IStylesheetRepository stylesheetRepository, IScriptRepository scriptRepository, ITemplateRepository templateRepository, IPartialViewRepository partialViewRepository, IAuditRepository auditRepository, IShortStringHelper shortStringHelper, IOptions<GlobalSettings> globalSettings, IHostingEnvironment hostingEnvironment)
Parameters Methods View Source CreatePartialView(IPartialView, String, Nullable<Int32>) Declaration
public Attempt<IPartialView> CreatePartialView(IPartialView partialView, string snippetName = null, int? userId = -1)
Parameters Type Name Description IPartialView partialView System.String snippetName System.Nullable<System.Int32> userId Returns View Source CreatePartialViewFolder(String) Declaration
public void CreatePartialViewFolder(string folderPath)
Parameters Type Name Description System.String folderPath View Source CreateScriptFolder(String)
Creates a folder for scripts
Declarationpublic void CreateScriptFolder(string folderPath)
Parameters Type Name Description System.String folderPath View Source CreateStyleSheetFolder(String)
Creates a folder for style sheets
Declarationpublic void CreateStyleSheetFolder(string folderPath)
Parameters Type Name Description System.String folderPath View Source CreateTemplateForContentType(String, String, Int32)
Creates a template for a content type
Declarationpublic Attempt<OperationResult<OperationResultType, ITemplate>> CreateTemplateForContentType(string contentTypeAlias, string contentTypeName, int userId = -1)
Parameters Type Name Description System.String contentTypeAlias System.String contentTypeName System.Int32 userId Returns View Source CreateTemplateWithIdentity(String, String, String, ITemplate, Int32)
Create a new template, setting the content if a view exists in the filesystem
Declarationpublic ITemplate CreateTemplateWithIdentity(string name, string alias, string content, ITemplate masterTemplate = null, int userId = -1)
Parameters Type Name Description System.String name System.String alias System.String content ITemplate masterTemplate System.Int32 userId Returns View Source DeletePartialView(String, Nullable<Int32>) Declaration
public bool DeletePartialView(string path, int? userId = null)
Parameters Type Name Description System.String path System.Nullable<System.Int32> userId Returns Type Description System.Boolean View Source DeletePartialViewFolder(String) Declaration
public void DeletePartialViewFolder(string folderPath)
Parameters Type Name Description System.String folderPath View Source DeleteScript(String, Nullable<Int32>)
Deletes a script by its name
Declarationpublic void DeleteScript(string path, int? userId = null)
Parameters Type Name Description System.String path
Name incl. extension of the Script to delete
System.Nullable<System.Int32> userIdOptional id of the user deleting the script
View Source DeleteScriptFolder(String)Deletes a folder for scripts
Declarationpublic void DeleteScriptFolder(string folderPath)
Parameters Type Name Description System.String folderPath View Source DeleteStylesheet(String, Nullable<Int32>)
Deletes a stylesheet by its name
Declarationpublic void DeleteStylesheet(string path, int? userId)
Parameters Type Name Description System.String path
Name incl. extension of the Stylesheet to delete
System.Nullable<System.Int32> userIdOptional id of the user deleting the stylesheet
View Source DeleteStyleSheetFolder(String)Deletes a folder for style sheets
Declarationpublic void DeleteStyleSheetFolder(string folderPath)
Parameters Type Name Description System.String folderPath View Source DeleteTemplate(String, Int32)
Deletes a template by its alias
Declarationpublic void DeleteTemplate(string alias, int userId = -1)
Parameters Type Name Description System.String alias
Alias of the ITemplate to delete
System.Int32 userId View Source GetPartialView(String) Declarationpublic IPartialView GetPartialView(string path)
Parameters Type Name Description System.String path Returns View Source GetPartialViewFileContentStream(String)
Gets the content of a partial view as a stream.
Declarationpublic Stream GetPartialViewFileContentStream(string filepath)
Parameters Type Name Description System.String filepath
The filesystem path to the partial view.
Returns Type Description StreamThe content of the partial view.
View Source GetPartialViewFileSize(String)Gets the size of a partial view.
Declarationpublic long GetPartialViewFileSize(string filepath)
Parameters Type Name Description System.String filepath
The filesystem path to the partial view.
Returns Type Description System.Int64The size of the partial view.
View Source GetPartialViews(String[]) Declarationpublic IEnumerable<IPartialView> GetPartialViews(params string[] names)
Parameters Type Name Description System.String[] names Returns View Source GetScript(String)
Gets a IScript object by its name
Declarationpublic IScript GetScript(string name)
Parameters Type Name Description System.String name
Name of the script incl. extension
Returns View Source GetScriptFileContentStream(String)Gets the content of a script file as a stream.
Declarationpublic Stream GetScriptFileContentStream(string filepath)
Parameters Type Name Description System.String filepath
The filesystem path to the script.
Returns Type Description StreamThe content of the script file.
View Source GetScriptFileSize(String)Gets the size of a script file.
Declarationpublic long GetScriptFileSize(string filepath)
Parameters Type Name Description System.String filepath
The filesystem path to the script file.
Returns Type Description System.Int64The size of the script file.
View Source GetScripts(String[])Gets a list of all IScript objects
Declarationpublic IEnumerable<IScript> GetScripts(params string[] names)
Parameters Type Name Description System.String[] names Returns Type Description IEnumerable<IScript>
An enumerable list of IScript objects
View Source GetStylesheet(String)Gets a IStylesheet object by its name
Declarationpublic IStylesheet GetStylesheet(string path)
Parameters Type Name Description System.String path
Path of the stylesheet incl. extension
Returns View Source GetStylesheetFileContentStream(String)Gets the content of a stylesheet as a stream.
Declarationpublic Stream GetStylesheetFileContentStream(string filepath)
Parameters Type Name Description System.String filepath
The filesystem path to the stylesheet.
Returns Type Description StreamThe content of the stylesheet.
View Source GetStylesheetFileSize(String)Gets the size of a stylesheet.
Declarationpublic long GetStylesheetFileSize(string filepath)
Parameters Type Name Description System.String filepath
The filesystem path to the stylesheet.
Returns Type Description System.Int64The size of the stylesheet.
View Source GetStylesheets(String[])Gets a list of all IStylesheet objects
Declarationpublic IEnumerable<IStylesheet> GetStylesheets(params string[] paths)
Parameters Type Name Description System.String[] paths Returns View Source GetTemplate(Guid)
Gets a ITemplate object by its guid identifier.
Declarationpublic ITemplate GetTemplate(Guid id)
Parameters Type Name Description Guid id
The guid identifier of the template.
Returns View Source GetTemplate(Int32)Gets a ITemplate object by its identifier.
Declarationpublic ITemplate GetTemplate(int id)
Parameters Type Name Description System.Int32 id
The identifier of the template.
Returns View Source GetTemplate(String)Gets a ITemplate object by its alias.
Declarationpublic ITemplate GetTemplate(string alias)
Parameters Type Name Description System.String alias
The alias of the template.
Returns View Source GetTemplateDescendants(Int32)Gets the template descendants
Declarationpublic IEnumerable<ITemplate> GetTemplateDescendants(int masterTemplateId)
Parameters Type Name Description System.Int32 masterTemplateId Returns View Source GetTemplateFileContentStream(String)
Gets the content of a template as a stream.
Declarationpublic Stream GetTemplateFileContentStream(string filepath)
Parameters Type Name Description System.String filepath
The filesystem path to the template.
Returns Type Description StreamThe content of the template.
View Source GetTemplateFileSize(String)Gets the size of a template.
Declarationpublic long GetTemplateFileSize(string filepath)
Parameters Type Name Description System.String filepath
The filesystem path to the template.
Returns Type Description System.Int64The size of the template.
View Source GetTemplates(Int32)Gets a list of all ITemplate objects
Declarationpublic IEnumerable<ITemplate> GetTemplates(int masterTemplateId)
Parameters Type Name Description System.Int32 masterTemplateId Returns View Source GetTemplates(String[])
Gets a list of all ITemplate objects
Declarationpublic IEnumerable<ITemplate> GetTemplates(params string[] aliases)
Parameters Type Name Description System.String[] aliases Returns View Source SavePartialView(IPartialView, Nullable<Int32>) Declaration
public Attempt<IPartialView> SavePartialView(IPartialView partialView, int? userId = null)
Parameters Type Name Description IPartialView partialView System.Nullable<System.Int32> userId Returns View Source SaveScript(IScript, Nullable<Int32>)
Saves a Script
Declarationpublic void SaveScript(IScript script, int? userId)
Parameters Type Name Description IScript script
IScript to save
System.Nullable<System.Int32> userIdOptional id of the user saving the script
View Source SaveStylesheet(IStylesheet, Nullable<Int32>)Saves a IStylesheet
Declarationpublic void SaveStylesheet(IStylesheet stylesheet, int? userId = null)
Parameters Type Name Description IStylesheet stylesheet
IStylesheet to save
System.Nullable<System.Int32> userIdOptional id of the user saving the stylesheet
View Source SaveTemplate(IEnumerable<ITemplate>, Int32)Saves a collection of Template objects
Declarationpublic void SaveTemplate(IEnumerable<ITemplate> templates, int userId = -1)
Parameters Type Name Description IEnumerable<ITemplate> templates
List of Template to save
System.Int32 userIdOptional id of the user
View Source SaveTemplate(ITemplate, Int32)Saves a Template
Declarationpublic void SaveTemplate(ITemplate template, int userId = -1)
Parameters View Source SetPartialViewFileContent(String, Stream)
Sets the content of a partial view.
Declarationpublic void SetPartialViewFileContent(string filepath, Stream content)
Parameters Type Name Description System.String filepath
The filesystem path to the partial view.
Stream contentThe content of the partial view.
View Source SetScriptFileContent(String, Stream)Sets the content of a script file.
Declarationpublic void SetScriptFileContent(string filepath, Stream content)
Parameters Type Name Description System.String filepath
The filesystem path to the script.
Stream contentThe content of the script file.
View Source SetStylesheetFileContent(String, Stream)Sets the content of a stylesheet.
Declarationpublic void SetStylesheetFileContent(string filepath, Stream content)
Parameters Type Name Description System.String filepath
The filesystem path to the stylesheet.
Stream contentThe content of the stylesheet.
View Source SetTemplateFileContent(String, Stream)Sets the content of a template.
Declarationpublic void SetTemplateFileContent(string filepath, Stream content)
Parameters Type Name Description System.String filepath
The filesystem path to the template.
Stream contentThe content of the template.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4