Fix visual studio

This commit is contained in:
js6pak committed 2021-01-01 18:28:25 +01:00
1 parent 257a19f653
commit 36dc6bc36b
3 files changed
+21 -10

No files matched your search

+2 -1
View File
@@ -7,7 +7,8 @@ namespace Reactor.OxygenFilter.MSBuild
{
public static class Context
{
public static string DataPath { get; } = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), ".reactor");
// Path#Combine is borken on visual studio
public static string DataPath { get; } = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + Path.DirectorySeparatorChar + ".reactor";
public static string TempPath { get; } = Path.Combine(DataPath, "temp");
public static string ComputeHash(FileInfo file)
+17 -7
View File
@@ -1,3 +1,4 @@
using System;
using System.IO;
using System.Net.Http;
using Microsoft.Build.Framework;
@@ -23,8 +24,13 @@ namespace Reactor.OxygenFilter.MSBuild
return true;
}
Directory.CreateDirectory(Context.TempPath);
var file = Path.Combine(Context.TempPath, Mappings.Replace("/", "_") + $"-{TargetGamePlatform.ToLower()}" + ".json");
var split = Mappings.Split(':');
var repo = split[0];
var version = split[1];
var directory = Path.Combine(Context.TempPath, repo.Replace("/", "_"), version);
Directory.CreateDirectory(directory);
var file = Path.Combine(directory, $"{TargetGamePlatform.ToLower()}.json");
if (File.Exists(file))
{
@@ -32,15 +38,19 @@ namespace Reactor.OxygenFilter.MSBuild
return true;
}
var split = Mappings.Split(':');
var repo = split[0];
var version = split[1];
var httpClient = new HttpClient();
var json = httpClient.GetStringAsync($"https://github.com/{repo}/releases/download/{version}/{TargetGamePlatform.ToLower()}.json").GetAwaiter().GetResult();
MappingsJson = json;
File.WriteAllText(file, json);
try
{
File.WriteAllText(file, json);
}
catch (Exception e)
{
Log.LogWarning("Failed to cache " + file + "\n" + e);
}
return true;
}
@@ -4,7 +4,7 @@
<LangVersion>latest</LangVersion>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<Version>0.1.1</Version>
<Version>0.1.2</Version>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/NuclearPowered/Reactor.OxygenFilter</RepositoryUrl>
<PackageLicenseExpression>LGPL-3.0-or-later</PackageLicenseExpression>
@@ -31,7 +31,7 @@
<Target Name="PackTaskDependencies" BeforeTargets="GenerateNuspec">
<ItemGroup>
<_PackageFiles Include="bin\$(Configuration)\*\Reactor.OxygenFilter.dll;bin\$(Configuration)\*\Newtonsoft.Json.dll;bin\$(Configuration)\*\Il2CppDumper.dll;bin\$(Configuration)\*\AssemblyUnhollower.dll;bin\$(Configuration)\*\Unhollower*Lib.dll;bin\$(Configuration)\*\Iced.dll;bin\$(Configuration)\*\Mono.*.dll">
<_PackageFiles Include="bin\$(Configuration)\*\Reactor.OxygenFilter.dll;bin\$(Configuration)\*\Newtonsoft.Json.dll;bin\$(Configuration)\*\Il2CppDumper.dll;bin\$(Configuration)\*\AssemblyUnhollower.*;bin\$(Configuration)\*\Unhollower*Lib.dll;bin\$(Configuration)\*\Iced.dll;bin\$(Configuration)\*\Mono.*.dll">
<PackagePath>lib%(RecursiveDir)</PackagePath>
<Visible>false</Visible>
<BuildAction>Content</BuildAction>