From c136c9f1805dbd0b1d37fd33e7b3b34cd7d82836 Mon Sep 17 00:00:00 2001 From: schedpas Date: Thu, 16 Jul 2020 08:30:41 +0200 Subject: [PATCH] add some documentation --- Pilz.Cryptography/Pilz.Cryptography.csproj | 1 + Pilz.IO/EmbeddedFilesContainer.cs | 45 ++++++++++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/Pilz.Cryptography/Pilz.Cryptography.csproj b/Pilz.Cryptography/Pilz.Cryptography.csproj index 7afed73..fc42b31 100644 --- a/Pilz.Cryptography/Pilz.Cryptography.csproj +++ b/Pilz.Cryptography/Pilz.Cryptography.csproj @@ -29,6 +29,7 @@ TRACE prompt 4 + bin\Release\Pilz.Cryptography.xml diff --git a/Pilz.IO/EmbeddedFilesContainer.cs b/Pilz.IO/EmbeddedFilesContainer.cs index 9a0114f..f10d0ce 100644 --- a/Pilz.IO/EmbeddedFilesContainer.cs +++ b/Pilz.IO/EmbeddedFilesContainer.cs @@ -14,17 +14,32 @@ namespace Pilz.IO [JsonProperty("CompressedFiles")] private readonly Dictionary compressedFiles = new Dictionary(); + /// + /// Returns the names of all embedded files. + /// [JsonIgnore] public IEnumerable AllFileNames { get => compressedFiles.Keys; } + /// + /// Embeds a file to this container. + /// + /// The name how it should be called in this container. + /// The file path to the file that should be embedded. + /// Returns a that defines if the file as been embedded successfully. public Task AddFileAsync(string fileName, string filePath) { return Task.Run(() => AddFile(fileName, filePath)); } + /// + /// Embeds a file to this container. + /// + /// The name how it should be called in this container. + /// The file path to the file that should be embedded. + /// Returns a that defines if the file as been embedded successfully. public bool AddFile(string fileName, string filePath) { bool success; @@ -63,22 +78,41 @@ namespace Pilz.IO return success; } + /// + /// Removes a file from this container. + /// + /// The name how the file is called. public void RemoveFile(string fileName) { if (compressedFiles.ContainsKey(fileName)) compressedFiles.Remove(fileName); } + /// + /// Checks if the given file exists in this container. + /// + /// The name how the file is called. + /// Returns if the given file exists in this container. public bool HasFile(string fileName) { return compressedFiles.ContainsKey(fileName); } + /// + /// Gets a file from this container as stream. + /// + /// The name how the file is called. + /// Returns a stream of the file with the given name. public Task GetStreamAsync(string fileName) { return Task.Run(() => GetStream(fileName)); } + /// + /// Gets a file from this container as stream. + /// + /// The name how the file is called. + /// Returns a stream of the file with the given name. public Stream GetStream(string fileName) { Stream decompressed = null; @@ -92,11 +126,22 @@ namespace Pilz.IO return decompressed; } + /// + /// Saves a given file to the users temp directory. + /// + /// The name how the file is called. + /// Returns the file path to the temp file. public Task GetLocalFilePathAsync(string fileName) { return Task.Run(() => GetLocalFilePath(fileName)); } + + /// + /// Saves a given file to the users temp directory. + /// + /// The name how the file is called. + /// Returns the file path to the temp file. public string GetLocalFilePath(string fileName) { string filePath = string.Empty;