FileManagerLibrary 1.4.0

dotnet add package FileManagerLibrary --version 1.4.0
NuGet\Install-Package FileManagerLibrary -Version 1.4.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="FileManagerLibrary" Version="1.4.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add FileManagerLibrary --version 1.4.0
#r "nuget: FileManagerLibrary, 1.4.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install FileManagerLibrary as a Cake Addin
#addin nuget:?package=FileManagerLibrary&version=1.4.0

// Install FileManagerLibrary as a Cake Tool
#tool nuget:?package=FileManagerLibrary&version=1.4.0

FileManager

Full documentation: FileManagerDoc.pdf

Table of contents

General info

FileManager is the library to management files in your project.

Technologies

  • C#
  • EntityFramework - version 6.2.0

Setup

Add following config to your web.config:

<configuration>
  <configSections>
    <section name="FileManager" type="FileManagerLibrary.Config.Section"/>
  </configSections>
  <FileManager>
    <DbConfig connectionString="CONNECTION STRING TO DATABASE"/>
    <DirectoryConfig path="~/BASE DIRECTORY"/>
    
    <CustomConfig maxFileSize="MAX FILE SIZE IN KB"/>
  </FileManager>
</configuration>

Code Examples

Get

try
{
    var file = FilesRepository.Get(2, withDependencies: true);
}
catch (FileManagerException ex)
{
    throw;
}

GetList

var testList = new List<long>(){1, 2, 3};

try
{
    var files = FilesRepository.GetList(testList, withDependencies: true);
}
catch (FileManagerException ex)
{
    throw;
}

GetName

try
{
    var fileName = FilesRepository.GetName(3);
}
catch (FileManagerException ex)
{
    throw;
}

GetNames

var testList = new List<long>(){1, 2, 3};

try
{
    var fileNames = FilesRepository.GetNames(testList);
}
catch (FileManagerException ex)
{
    throw;
}

GetSize

try
{
    var fileSize = FilesRepository.GetSize(3);  //possible null
}
catch (FileManagerException ex)
{
    throw;
}

Create

[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Test(HttpPostedFileBase file)
{
    try
    {
        var status = FilesRepository.Create(file, "directory", "createdBy");

        if (status != StorageFile.Status.Ok)
        {
            switch (status)
            {
                case StorageFile.Status.Exists:
                    break;
                case StorageFile.Status.SizeIsToBig:
                    break;
            }
        }
    }
    catch (FileManagerException ex)
    {
        throw;
    }

    return View();
}

Delete

try
{
    //var file = FilesRepository.Get(3);
    //var status = FilesRepository.Delete(file);

    //var testList = new List<long>(){1, 2, 3};
    //var files = FilesRepository.GetList(testList);
    //var status = FilesRepository.Delete(files);

    //var testList = new List<long>(){1, 2, 3};
    //var status = FilesRepository.Delete(testList);

    var status = FilesRepository.Delete(3);

    if (status != StorageFile.Status.Ok)
    {
        switch (status)
        {
            case StorageFile.Status.NotExists:
                break;
        }
    }
}
catch (FileManagerException ex)
{
    throw;
}
Product Compatible and additional computed target framework versions.
.NET Framework net472 is compatible.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.4.0 573 9/2/2019
1.3.0 503 8/29/2019

Create first version library with basic functionality.