diff --git a/DragonFruit.OnionFruit.Native/DragonFruit.OnionFruit.Native.csproj b/Common.Build.props similarity index 78% rename from DragonFruit.OnionFruit.Native/DragonFruit.OnionFruit.Native.csproj rename to Common.Build.props index 389185e..c7dba1e 100644 --- a/DragonFruit.OnionFruit.Native/DragonFruit.OnionFruit.Native.csproj +++ b/Common.Build.props @@ -1,18 +1,18 @@ - + Library - net6.0 - OnionFruit Native - OnionFruit Native Libraries - Native libraries for OnionFruit + false + netstandard1.0 true + icon.png + OnionFruit Native Libraries readme.md - DragonFruit.OnionFruit.Native dragonfruit onionfruit native MIT + Native libraries for OnionFruit diff --git a/DragonFruit.OnionFruit.Native.osx/DragonFruit.OnionFruit.Native.osx.csproj b/DragonFruit.OnionFruit.Native.osx/DragonFruit.OnionFruit.Native.osx.csproj new file mode 100644 index 0000000..0043f9d --- /dev/null +++ b/DragonFruit.OnionFruit.Native.osx/DragonFruit.OnionFruit.Native.osx.csproj @@ -0,0 +1,9 @@ + + + + + + DragonFruit.OnionFruit.Native.osx + + + \ No newline at end of file diff --git a/DragonFruit.OnionFruit.Native/runtimes/osx-arm64/native/libevent-2.1.7.dylib b/DragonFruit.OnionFruit.Native.osx/runtimes/osx-arm64/native/libevent-2.1.7.dylib similarity index 100% rename from DragonFruit.OnionFruit.Native/runtimes/osx-arm64/native/libevent-2.1.7.dylib rename to DragonFruit.OnionFruit.Native.osx/runtimes/osx-arm64/native/libevent-2.1.7.dylib diff --git a/DragonFruit.OnionFruit.Native/runtimes/osx-arm64/native/lyrebird b/DragonFruit.OnionFruit.Native.osx/runtimes/osx-arm64/native/lyrebird similarity index 100% rename from DragonFruit.OnionFruit.Native/runtimes/osx-arm64/native/lyrebird rename to DragonFruit.OnionFruit.Native.osx/runtimes/osx-arm64/native/lyrebird diff --git a/DragonFruit.OnionFruit.Native/runtimes/osx-arm64/native/snowflake-client b/DragonFruit.OnionFruit.Native.osx/runtimes/osx-arm64/native/snowflake-client similarity index 100% rename from DragonFruit.OnionFruit.Native/runtimes/osx-arm64/native/snowflake-client rename to DragonFruit.OnionFruit.Native.osx/runtimes/osx-arm64/native/snowflake-client diff --git a/DragonFruit.OnionFruit.Native/runtimes/osx-arm64/native/tor b/DragonFruit.OnionFruit.Native.osx/runtimes/osx-arm64/native/tor similarity index 100% rename from DragonFruit.OnionFruit.Native/runtimes/osx-arm64/native/tor rename to DragonFruit.OnionFruit.Native.osx/runtimes/osx-arm64/native/tor diff --git a/DragonFruit.OnionFruit.Native/runtimes/osx-arm64/native/tor-LICENSE b/DragonFruit.OnionFruit.Native.osx/runtimes/osx-arm64/native/tor-LICENSE similarity index 100% rename from DragonFruit.OnionFruit.Native/runtimes/osx-arm64/native/tor-LICENSE rename to DragonFruit.OnionFruit.Native.osx/runtimes/osx-arm64/native/tor-LICENSE diff --git a/DragonFruit.OnionFruit.Native/runtimes/osx-x64/native/libevent-2.1.7.dylib b/DragonFruit.OnionFruit.Native.osx/runtimes/osx-x64/native/libevent-2.1.7.dylib similarity index 100% rename from DragonFruit.OnionFruit.Native/runtimes/osx-x64/native/libevent-2.1.7.dylib rename to DragonFruit.OnionFruit.Native.osx/runtimes/osx-x64/native/libevent-2.1.7.dylib diff --git a/DragonFruit.OnionFruit.Native/runtimes/osx-x64/native/lyrebird b/DragonFruit.OnionFruit.Native.osx/runtimes/osx-x64/native/lyrebird similarity index 100% rename from DragonFruit.OnionFruit.Native/runtimes/osx-x64/native/lyrebird rename to DragonFruit.OnionFruit.Native.osx/runtimes/osx-x64/native/lyrebird diff --git a/DragonFruit.OnionFruit.Native/runtimes/osx-x64/native/snowflake-client b/DragonFruit.OnionFruit.Native.osx/runtimes/osx-x64/native/snowflake-client similarity index 100% rename from DragonFruit.OnionFruit.Native/runtimes/osx-x64/native/snowflake-client rename to DragonFruit.OnionFruit.Native.osx/runtimes/osx-x64/native/snowflake-client diff --git a/DragonFruit.OnionFruit.Native/runtimes/osx-x64/native/tor b/DragonFruit.OnionFruit.Native.osx/runtimes/osx-x64/native/tor similarity index 100% rename from DragonFruit.OnionFruit.Native/runtimes/osx-x64/native/tor rename to DragonFruit.OnionFruit.Native.osx/runtimes/osx-x64/native/tor diff --git a/DragonFruit.OnionFruit.Native/runtimes/osx-x64/native/tor-LICENSE b/DragonFruit.OnionFruit.Native.osx/runtimes/osx-x64/native/tor-LICENSE similarity index 100% rename from DragonFruit.OnionFruit.Native/runtimes/osx-x64/native/tor-LICENSE rename to DragonFruit.OnionFruit.Native.osx/runtimes/osx-x64/native/tor-LICENSE diff --git a/DragonFruit.OnionFruit.Native.sln b/DragonFruit.OnionFruit.Native.sln index aab61f8..580aab4 100644 --- a/DragonFruit.OnionFruit.Native.sln +++ b/DragonFruit.OnionFruit.Native.sln @@ -1,6 +1,8 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DragonFruit.OnionFruit.Native", "DragonFruit.OnionFruit.Native\DragonFruit.OnionFruit.Native.csproj", "{4F1C79A5-0AB4-4D7F-9786-D0898B74942E}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DragonFruit.OnionFruit.Native.win", "DragonFruit.OnionFruit.Native.win\DragonFruit.OnionFruit.Native.win.csproj", "{4F1C79A5-0AB4-4D7F-9786-D0898B74942E}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DragonFruit.OnionFruit.Native.osx", "DragonFruit.OnionFruit.Native.osx\DragonFruit.OnionFruit.Native.osx.csproj", "{9DF6F90C-FA9E-4A9F-BD19-54CD26252BF7}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -12,5 +14,9 @@ Global {4F1C79A5-0AB4-4D7F-9786-D0898B74942E}.Debug|Any CPU.Build.0 = Debug|Any CPU {4F1C79A5-0AB4-4D7F-9786-D0898B74942E}.Release|Any CPU.ActiveCfg = Release|Any CPU {4F1C79A5-0AB4-4D7F-9786-D0898B74942E}.Release|Any CPU.Build.0 = Release|Any CPU + {9DF6F90C-FA9E-4A9F-BD19-54CD26252BF7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9DF6F90C-FA9E-4A9F-BD19-54CD26252BF7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9DF6F90C-FA9E-4A9F-BD19-54CD26252BF7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9DF6F90C-FA9E-4A9F-BD19-54CD26252BF7}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection EndGlobal diff --git a/DragonFruit.OnionFruit.Native.win/DragonFruit.OnionFruit.Native.win.csproj b/DragonFruit.OnionFruit.Native.win/DragonFruit.OnionFruit.Native.win.csproj new file mode 100644 index 0000000..257e2a0 --- /dev/null +++ b/DragonFruit.OnionFruit.Native.win/DragonFruit.OnionFruit.Native.win.csproj @@ -0,0 +1,9 @@ + + + + + + DragonFruit.OnionFruit.Native.win + + + \ No newline at end of file diff --git a/DragonFruit.OnionFruit.Native/runtimes/win-x64/native/lyrebird.exe b/DragonFruit.OnionFruit.Native.win/runtimes/win-x64/native/lyrebird.exe similarity index 100% rename from DragonFruit.OnionFruit.Native/runtimes/win-x64/native/lyrebird.exe rename to DragonFruit.OnionFruit.Native.win/runtimes/win-x64/native/lyrebird.exe diff --git a/DragonFruit.OnionFruit.Native/runtimes/win-x64/native/snowflake-client.exe b/DragonFruit.OnionFruit.Native.win/runtimes/win-x64/native/snowflake-client.exe similarity index 100% rename from DragonFruit.OnionFruit.Native/runtimes/win-x64/native/snowflake-client.exe rename to DragonFruit.OnionFruit.Native.win/runtimes/win-x64/native/snowflake-client.exe diff --git a/DragonFruit.OnionFruit.Native/runtimes/win-x64/native/tor-LICENSE b/DragonFruit.OnionFruit.Native.win/runtimes/win-x64/native/tor-LICENSE similarity index 100% rename from DragonFruit.OnionFruit.Native/runtimes/win-x64/native/tor-LICENSE rename to DragonFruit.OnionFruit.Native.win/runtimes/win-x64/native/tor-LICENSE diff --git a/DragonFruit.OnionFruit.Native/runtimes/win-x64/native/tor.exe b/DragonFruit.OnionFruit.Native.win/runtimes/win-x64/native/tor.exe similarity index 100% rename from DragonFruit.OnionFruit.Native/runtimes/win-x64/native/tor.exe rename to DragonFruit.OnionFruit.Native.win/runtimes/win-x64/native/tor.exe diff --git a/DragonFruit.OnionFruit.Native/runtimes/win-x86/native/lyrebird.exe b/DragonFruit.OnionFruit.Native.win/runtimes/win-x86/native/lyrebird.exe similarity index 100% rename from DragonFruit.OnionFruit.Native/runtimes/win-x86/native/lyrebird.exe rename to DragonFruit.OnionFruit.Native.win/runtimes/win-x86/native/lyrebird.exe diff --git a/DragonFruit.OnionFruit.Native/runtimes/win-x86/native/snowflake-client.exe b/DragonFruit.OnionFruit.Native.win/runtimes/win-x86/native/snowflake-client.exe similarity index 100% rename from DragonFruit.OnionFruit.Native/runtimes/win-x86/native/snowflake-client.exe rename to DragonFruit.OnionFruit.Native.win/runtimes/win-x86/native/snowflake-client.exe diff --git a/DragonFruit.OnionFruit.Native/runtimes/win-x86/native/tor-LICENSE b/DragonFruit.OnionFruit.Native.win/runtimes/win-x86/native/tor-LICENSE similarity index 100% rename from DragonFruit.OnionFruit.Native/runtimes/win-x86/native/tor-LICENSE rename to DragonFruit.OnionFruit.Native.win/runtimes/win-x86/native/tor-LICENSE diff --git a/DragonFruit.OnionFruit.Native/runtimes/win-x86/native/tor.exe b/DragonFruit.OnionFruit.Native.win/runtimes/win-x86/native/tor.exe similarity index 100% rename from DragonFruit.OnionFruit.Native/runtimes/win-x86/native/tor.exe rename to DragonFruit.OnionFruit.Native.win/runtimes/win-x86/native/tor.exe diff --git a/DragonFruit.OnionFruit.Native/TorResolver.cs b/DragonFruit.OnionFruit.Native/TorResolver.cs deleted file mode 100644 index 8d85b61..0000000 --- a/DragonFruit.OnionFruit.Native/TorResolver.cs +++ /dev/null @@ -1,55 +0,0 @@ -// OnionFruit Native Copyright DragonFruit Network -// Licensed under the MIT License. Refer to licence.md for more info - -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Runtime.InteropServices; -using System.Runtime.Versioning; - -namespace DragonFruit.OnionFruit.Native -{ - public static class TorResolver - { - /// - /// Attempts to locate the tor executable, returning the full path if found. - /// - /// - /// Currently not supported on linux platforms - /// - [UnsupportedOSPlatform("ios")] - [UnsupportedOSPlatform("linux")] - [UnsupportedOSPlatform("android")] - public static string LocateTorExecutable() - { - var filename = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "tor.exe" : "tor"; - return EnumeratePotentialDirectories().Select(targetDir => Path.Combine(targetDir, filename)).FirstOrDefault(File.Exists); - } - - private static IEnumerable EnumeratePotentialDirectories() - { - // app dir (in case of published program) - yield return AppDomain.CurrentDomain.BaseDirectory; - - // native executable location (debug/local build) - string platformName; - - if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) - { - platformName = "win"; - } - else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) - { - platformName = "osx"; - } - else - { - throw new PlatformNotSupportedException("OnionFruit NativeLibs are currently only available on Windows and macOS"); - } - - var genericRid = $"{platformName}-{RuntimeInformation.OSArchitecture.ToString().ToLowerInvariant()}"; - yield return Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "runtimes", genericRid, "native"); - } - } -} \ No newline at end of file