CraftingDragon007.KekUploadLibrary 1.0.0.5

There is a newer version of this package available.
See the version list below for details.
dotnet add package CraftingDragon007.KekUploadLibrary --version 1.0.0.5                
NuGet\Install-Package CraftingDragon007.KekUploadLibrary -Version 1.0.0.5                
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="CraftingDragon007.KekUploadLibrary" Version="1.0.0.5" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add CraftingDragon007.KekUploadLibrary --version 1.0.0.5                
#r "nuget: CraftingDragon007.KekUploadLibrary, 1.0.0.5"                
#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 CraftingDragon007.KekUploadLibrary as a Cake Addin
#addin nuget:?package=CraftingDragon007.KekUploadLibrary&version=1.0.0.5

// Install CraftingDragon007.KekUploadLibrary as a Cake Tool
#tool nuget:?package=CraftingDragon007.KekUploadLibrary&version=1.0.0.5                

KekUploadLibrary

A simple C# Library for UploadServer

Installation

You can install this Library via NuGet:

PM> Install-Package CraftingDragon007.KekUploadLibrary

Usage

Using the upload client:

using System;
using System.IO;
using KekUploadLibrary;

class Program
{
    static void Main(string[] args)
	{
	    var client = new UploadClient("<Your UploadServer URL>", <If you want to also upload the filenames>);
	    // Diffrent Events are available (Optional)
	    client.UploadCompleteEvent += (sender, e) => Console.WriteLine("Upload Complete: " + e.FileUrl);
	    client.UploadChunkCompleteEvent += (sender, e) => Console.WriteLine("Upload progress: {0}/{1}", e.CurrentChunkCount, e.TotalChunkCount);
	    client.UploadErrorEvent += (sender, e) => 
	    {
	        if(eventArgs.ErrorResponse != null)
	        {
	            Console.WriteLine("Error: " + eventArgs.ErrorResponse);
	            Console.WriteLine("Exception: " + eventArgs.Exception);
	        }else
	        {
	            Console.WriteLine("Error: " + eventArgs.Exception);
	        }
	    };
	    client.UploadStreamCreateEvent += (sender, e) => Console.WriteLine("Upload Stream created: " + e.UploadStreamId);
	    // Upload a file
	    client.Upload(new UploadItem("<Your File Path>"));
	    // Upload a stream
	    using(var stream = new FileStream("<FilePath>", FileMode.Open))
	    {
	        client.Upload(new UploadItem(stream, "<Extension>", "<Filename>")); // the filename is optional and must not contain the extension
	    }
	    // Upload a byte array
	    client.Upload(new UploadItem(File.ReadAllBytes("<FilePath>"), "<Extension>", "<Filename>")); // the filename is optional and must not contain the extension
	    // The upload method returns the download url of the uploaded file
	}
}

Using the chunked upload stream:

using System;
using System.IO;
using KekUploadLibrary;

class Program
{
    static void Main(string[] args)
    {
        var stream = new ChunkedUploadStream("<Extension>", "<Your UploadServer URL>", "<Filename>"); // the filname can be null and must not contain the extension
        // Diffrent Events are available (Optional)
        stream.UploadChunkCompleteEvent += (sender, e) => Console.WriteLine("Upload progress: {0}/{1}", e.CurrentChunkCount, e.TotalChunkCount);
        stream.UploadCompleteEvent += (sender, e) => Console.WriteLine("Upload Complete: " + e.FileUrl);
        stream.UploadErrorEvent += (sender, e) => 
        {
            if(eventArgs.ErrorResponse != null)
            {
                Console.WriteLine("Error: " + eventArgs.ErrorResponse);
                Console.WriteLine("Exception: " + eventArgs.Exception);
            }else
            {
                Console.WriteLine("Error: " + eventArgs.Exception);
            }
        };
        stream.UploadStreamCreateEvent += (sender, e) => Console.WriteLine("Upload Stream created: " + e.UploadStreamId);
        // Now you can write everything you want to the stream
        // The stream will be chunked and uploaded to the upload server
        // It will only be uploaded, when you flush the stream
        stream.Write(new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }, 0, 10);
        stream.Flush();
        // You can do this as often as you want
        stream.Write(new byte[] { 2, 5, 3, 4, 5, 0, 7, 8, 4, 10 }, 0, 10);
        stream.Flush();
        // When you are done, you can finish the upload with a final request
        stream.FinishUpload(); // This returns the download url of the uploaded bytes
        // Then you can dispose the stream
        stream.Dispose();
    }
}

License

This Library is licensed under the GNU General Public License v3.0

Contributing

If you want to contribute to this Library, please open an issue or pull request on GitHub.

Contributors

Contact

Email <br> Discord: CraftingDragon007#9504

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos 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.2.0 157 1/24/2024
1.0.0.6 218 7/5/2023
1.0.0.5 301 11/27/2022
1.0.0.4 460 5/25/2022
1.0.0.3 396 5/10/2022
1.0.0.2 386 5/9/2022
1.0.0.1 426 4/3/2022
1.0.0 443 3/2/2022