Table of Contents

Class FormFileManager

Namespace
JJMasterData.Core.DataManager.IO
Assembly
JJMasterData.Core.dll
public class FormFileManager
Inheritance
FormFileManager
Inherited Members

Constructors

FormFileManager(string, IHttpContext, IStringLocalizer<MasterDataResources>, ILogger<FormFileManager>)

public FormFileManager(string memoryFilesSessionName, IHttpContext httpContext, IStringLocalizer<MasterDataResources> stringLocalizer, ILogger<FormFileManager> logger)

Parameters

memoryFilesSessionName string
httpContext IHttpContext
stringLocalizer IStringLocalizer<MasterDataResources>
logger ILogger<FormFileManager>

Properties

AutoSave

Always apply changes from files on disk, if it is false, keep it in memory Default: true

public bool AutoSave { get; set; }

Property Value

bool

FolderPath

Full Directory Path.

(Optional) If the path is not given, all files will be stored in the session.
public string FolderPath { get; set; }

Property Value

string

Remarks

The path is OS agnostic, you can use for example C:\Temp\Files\ or /home/gumbarros/Documents/Files, but beware where you're deploying your application.

MemoryFiles

public List<FormFileInfo> MemoryFiles { get; set; }

Property Value

List<FormFileInfo>

Methods

CountFiles()

public int CountFiles()

Returns

int

CreateFile(FormFileContent, bool)

public void CreateFile(FormFileContent fileContent, bool replaceIfExists)

Parameters

fileContent FormFileContent
replaceIfExists bool

DeleteAll()

public void DeleteAll()

DeleteFile(string)

public void DeleteFile(string fileName)

Parameters

fileName string

GetFile(string)

public FormFileInfo GetFile(string fileName)

Parameters

fileName string

Returns

FormFileInfo

GetFilePath(string)

public string GetFilePath(string fileName)

Parameters

fileName string

Returns

string

GetFiles()

public List<FormFileInfo> GetFiles()

Returns

List<FormFileInfo>

RenameFile(string, string)

public void RenameFile(string currentName, string newName)

Parameters

currentName string
newName string

SaveMemoryFiles(string)

public void SaveMemoryFiles(string folderPath)

Parameters

folderPath string

Events

OnBeforeCreateFile

public event EventHandler<FormUploadFileEventArgs> OnBeforeCreateFile

Event Type

EventHandler<FormUploadFileEventArgs>

OnBeforeDeleteFile

public event EventHandler<FormDeleteFileEventArgs> OnBeforeDeleteFile

Event Type

EventHandler<FormDeleteFileEventArgs>

OnBeforeRenameFile

public event EventHandler<FormRenameFileEventArgs> OnBeforeRenameFile

Event Type

EventHandler<FormRenameFileEventArgs>