2019-01-21 10:18:59 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Runtime.InteropServices;
|
|
|
|
|
|
|
|
|
|
namespace Jackett.Common.Utils
|
|
|
|
|
{
|
|
|
|
|
public class Variants
|
|
|
|
|
{
|
|
|
|
|
public enum JackettVariant
|
|
|
|
|
{
|
|
|
|
|
NotFound,
|
|
|
|
|
FullFrameworkWindows,
|
|
|
|
|
Mono,
|
|
|
|
|
CoreWindows,
|
|
|
|
|
CoreMacOs,
|
2019-03-05 10:25:37 +00:00
|
|
|
|
CoreLinuxAmdx64,
|
2019-01-21 10:18:59 +00:00
|
|
|
|
CoreLinuxArm32,
|
|
|
|
|
CoreLinuxArm64
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public JackettVariant GetVariant()
|
|
|
|
|
{
|
|
|
|
|
if (DotNetCoreUtil.IsRunningOnDotNetCore)
|
|
|
|
|
{
|
|
|
|
|
//Dot Net Core
|
|
|
|
|
|
|
|
|
|
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
|
|
|
|
{
|
|
|
|
|
return JackettVariant.CoreWindows;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
|
|
|
|
|
{
|
|
|
|
|
return JackettVariant.CoreMacOs;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux) && RuntimeInformation.ProcessArchitecture == Architecture.X64)
|
|
|
|
|
{
|
2019-03-05 10:25:37 +00:00
|
|
|
|
return JackettVariant.CoreLinuxAmdx64;
|
2019-01-21 10:18:59 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux) && RuntimeInformation.ProcessArchitecture == Architecture.Arm)
|
|
|
|
|
{
|
|
|
|
|
return JackettVariant.CoreLinuxArm32;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux) && RuntimeInformation.ProcessArchitecture == Architecture.Arm64)
|
|
|
|
|
{
|
|
|
|
|
return JackettVariant.CoreLinuxArm64;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
//Full framework
|
|
|
|
|
|
|
|
|
|
if (Environment.OSVersion.Platform == PlatformID.Win32NT)
|
|
|
|
|
{
|
|
|
|
|
return JackettVariant.FullFrameworkWindows;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return JackettVariant.Mono;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return JackettVariant.NotFound;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string GetArtifactFileName(JackettVariant variant)
|
|
|
|
|
{
|
|
|
|
|
switch (variant)
|
|
|
|
|
{
|
|
|
|
|
case JackettVariant.FullFrameworkWindows:
|
|
|
|
|
{
|
|
|
|
|
return "Jackett.Binaries.Windows.zip";
|
|
|
|
|
}
|
|
|
|
|
case JackettVariant.Mono:
|
|
|
|
|
{
|
|
|
|
|
return "Jackett.Binaries.Mono.tar.gz";
|
|
|
|
|
}
|
|
|
|
|
case JackettVariant.CoreWindows:
|
|
|
|
|
{
|
2020-02-06 02:22:54 +00:00
|
|
|
|
return "Jackett.Binaries.Windows.zip";
|
2019-01-21 10:18:59 +00:00
|
|
|
|
}
|
|
|
|
|
case JackettVariant.CoreMacOs:
|
|
|
|
|
{
|
|
|
|
|
return "Jackett.Binaries.macOS.tar.gz";
|
|
|
|
|
}
|
2019-03-05 10:25:37 +00:00
|
|
|
|
case JackettVariant.CoreLinuxAmdx64:
|
2019-01-21 10:18:59 +00:00
|
|
|
|
{
|
2019-03-05 10:25:37 +00:00
|
|
|
|
return "Jackett.Binaries.LinuxAMDx64.tar.gz";
|
2019-01-21 10:18:59 +00:00
|
|
|
|
}
|
|
|
|
|
case JackettVariant.CoreLinuxArm32:
|
|
|
|
|
{
|
|
|
|
|
return "Jackett.Binaries.LinuxARM32.tar.gz";
|
|
|
|
|
}
|
|
|
|
|
case JackettVariant.CoreLinuxArm64:
|
|
|
|
|
{
|
|
|
|
|
return "Jackett.Binaries.LinuxARM64.tar.gz";
|
|
|
|
|
}
|
|
|
|
|
default:
|
|
|
|
|
{
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-04-08 10:32:08 +00:00
|
|
|
|
|
|
|
|
|
public bool IsNonWindowsDotNetCoreVariant(JackettVariant variant)
|
|
|
|
|
{
|
|
|
|
|
if (variant == JackettVariant.CoreMacOs || variant == JackettVariant.CoreLinuxAmdx64
|
|
|
|
|
|| variant == JackettVariant.CoreLinuxArm32 || variant == JackettVariant.CoreLinuxArm64)
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-01-21 10:18:59 +00:00
|
|
|
|
}
|
|
|
|
|
}
|