Revert "PathToUrl"

This reverts commit 396adcdbc6b5a770ffb3a69a8a8991368e8a305a.
This commit is contained in:
JohnCorby 2024-06-17 13:32:11 -07:00
parent e12d357c1d
commit 6eed6642f4
3 changed files with 3 additions and 17 deletions

View File

@ -108,7 +108,7 @@ namespace NewHorizons.Utility.Files
{
DownloadHandlerAudioClip dh = new DownloadHandlerAudioClip(path, UnityEngine.AudioType.MPEG);
dh.compressed = true;
using (UnityWebRequest www = new UnityWebRequest(path.PathToUrl(), "GET", dh, null))
using (UnityWebRequest www = new UnityWebRequest(path, "GET", dh, null))
{
var result = www.SendWebRequest();
@ -127,7 +127,7 @@ namespace NewHorizons.Utility.Files
}
else
{
using (UnityWebRequest www = UnityWebRequestMultimedia.GetAudioClip(path.PathToUrl(), audioType))
using (UnityWebRequest www = UnityWebRequestMultimedia.GetAudioClip(path, audioType))
{
var result = www.SendWebRequest();

View File

@ -83,7 +83,7 @@ public class SlideReelAsyncImageLoader
yield break;
}
using UnityWebRequest uwr = UnityWebRequestTexture.GetTexture(url.PathToUrl());
using UnityWebRequest uwr = UnityWebRequestTexture.GetTexture(url);
yield return uwr.SendWebRequest();

View File

@ -1,4 +1,3 @@
using HarmonyLib;
using NewHorizons.External.Configs;
using NewHorizons.External.Modules.VariableSize;
using NewHorizons.External.SerializableData;
@ -16,7 +15,6 @@ using System.Text;
using System.Text.RegularExpressions;
using System.Xml;
using UnityEngine;
using UnityEngine.Networking;
using static NewHorizons.External.Modules.ParticleFieldModule;
using NomaiCoordinates = NewHorizons.External.Configs.StarSystemConfig.NomaiCoordinates;
@ -427,17 +425,5 @@ namespace NewHorizons.Utility
playerCameraEffectController._owCamera.postProcessingSettings.bloom.threshold = 0f;
playerCameraEffectController._owCamera.postProcessingSettings.eyeMaskEnabled = true;
}
/// <summary>
/// unity is STUPID and makes us use UnityWebRequest stuff.
/// so we have to do this to let it work with special characters.
/// </summary>
public static string PathToUrl(this string url) =>
$"file:///{url
.Replace('\\', '/')
.Split('/')
.Select(UnityWebRequest.EscapeURL)
.Join(delimiter: "/")
}";
}
}