add some documentation
This commit is contained in:
@@ -29,6 +29,7 @@
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<DocumentationFile>bin\Release\Pilz.Cryptography.xml</DocumentationFile>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.VisualBasic" />
|
||||
|
||||
@@ -14,17 +14,32 @@ namespace Pilz.IO
|
||||
[JsonProperty("CompressedFiles")]
|
||||
private readonly Dictionary<string, byte[]> compressedFiles = new Dictionary<string, byte[]>();
|
||||
|
||||
/// <summary>
|
||||
/// Returns the names of all embedded files.
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
public IEnumerable<string> AllFileNames
|
||||
{
|
||||
get => compressedFiles.Keys;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Embeds a file to this container.
|
||||
/// </summary>
|
||||
/// <param name="fileName">The name how it should be called in this container.</param>
|
||||
/// <param name="filePath">The file path to the file that should be embedded.</param>
|
||||
/// <returns>Returns a <see cref="bool"/> that defines if the file as been embedded successfully.</returns>
|
||||
public Task<bool> AddFileAsync(string fileName, string filePath)
|
||||
{
|
||||
return Task.Run(() => AddFile(fileName, filePath));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Embeds a file to this container.
|
||||
/// </summary>
|
||||
/// <param name="fileName">The name how it should be called in this container.</param>
|
||||
/// <param name="filePath">The file path to the file that should be embedded.</param>
|
||||
/// <returns>Returns a <see cref="bool"/> that defines if the file as been embedded successfully.</returns>
|
||||
public bool AddFile(string fileName, string filePath)
|
||||
{
|
||||
bool success;
|
||||
@@ -63,22 +78,41 @@ namespace Pilz.IO
|
||||
return success;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes a file from this container.
|
||||
/// </summary>
|
||||
/// <param name="fileName">The name how the file is called.</param>
|
||||
public void RemoveFile(string fileName)
|
||||
{
|
||||
if (compressedFiles.ContainsKey(fileName))
|
||||
compressedFiles.Remove(fileName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks if the given file exists in this container.
|
||||
/// </summary>
|
||||
/// <param name="fileName">The name how the file is called.</param>
|
||||
/// <returns>Returns if the given file exists in this container.</returns>
|
||||
public bool HasFile(string fileName)
|
||||
{
|
||||
return compressedFiles.ContainsKey(fileName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a file from this container as stream.
|
||||
/// </summary>
|
||||
/// <param name="fileName">The name how the file is called.</param>
|
||||
/// <returns>Returns a stream of the file with the given name.</returns>
|
||||
public Task<Stream> GetStreamAsync(string fileName)
|
||||
{
|
||||
return Task.Run(() => GetStream(fileName));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a file from this container as stream.
|
||||
/// </summary>
|
||||
/// <param name="fileName">The name how the file is called.</param>
|
||||
/// <returns>Returns a stream of the file with the given name.</returns>
|
||||
public Stream GetStream(string fileName)
|
||||
{
|
||||
Stream decompressed = null;
|
||||
@@ -92,11 +126,22 @@ namespace Pilz.IO
|
||||
return decompressed;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Saves a given file to the users temp directory.
|
||||
/// </summary>
|
||||
/// <param name="fileName">The name how the file is called.</param>
|
||||
/// <returns>Returns the file path to the temp file.</returns>
|
||||
public Task<string> GetLocalFilePathAsync(string fileName)
|
||||
{
|
||||
return Task.Run(() => GetLocalFilePath(fileName));
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Saves a given file to the users temp directory.
|
||||
/// </summary>
|
||||
/// <param name="fileName">The name how the file is called.</param>
|
||||
/// <returns>Returns the file path to the temp file.</returns>
|
||||
public string GetLocalFilePath(string fileName)
|
||||
{
|
||||
string filePath = string.Empty;
|
||||
|
||||
Reference in New Issue
Block a user