Skip to content

Latest commit

 

History

History
89 lines (65 loc) · 2.87 KB

README.md

File metadata and controls

89 lines (65 loc) · 2.87 KB

Slko.TraceMoeNET

Build status Build Status NuGet

This is an updated fork of TraceMoe.NET library with the following improvements:

  • Added Nullable Reference Types support
  • Removed dependency on SkiaSharp library
  • Improved API and documentation
  • Removed unnecessary components (e.g. Discord bot)
  • Added support for URL API (i.e. let the server download the file)
  • Added cancellation support (via CancellationToken)
  • And various other fixes and improvements...

Installation

The latest version of the library is available from NuGet:

Requirements

The project is using C# 8.0 and .NET Standard 2.1 and therefore requires the following environment:

  • .NET Core SDK 3.0 or newer
  • [Optional] Visual Studio 2019 version 16.3 or newer with .NET Core cross-platform development workload (for building using Visual Studio)

Example

using Slko.TraceMoeNET;
using System;
using System.Threading.Tasks;

namespace Example
{
    class Program
    {
        static async Task Main(string[] args)
        {
            using var client = new TraceMoeClient(); // C# 8.0 using declaration
            var searchResult = await client.SearchByURLAsync("https://i.imgur.com/OkiJZFc.jpg");
            if (searchResult.Results.Length > 0)
            {
                // Should output this:
                // Most relevant result is Sakura Trick
                Console.WriteLine($"Most relevant result is {searchResult.Results[0].TitleRomaji}");
            }
            else
            {
                Console.WriteLine("Not found");
            }
        }
    }
}

This repository also contains a simple console client for testing the library. You will need to compile it from source code to use.

Compiling from source

Using Visual Studio

Building

Clone the repository, open Slko.TraceMoeNET.sln in Visual Studio, and build the solution.

Testing

Set Slko.TraceMoeNET.ConsoleClient as startup project and press Run.

Using Command Line

Building

$ git clone https://github.com/Slko/TraceMoeNET
$ cd TraceMoeNET
$ dotnet build

Testing

$ cd Tests/Slko.TraceMoeNET.ConsoleClient
$ dotnet run