mirror of
https://git.triforceproject.com/triforce/source
synced 2026-11-29 04:18:49 -04:00
Triforce v0.8.5
A Randomizer page in the launcher, a new title screen with Mods and Save Select tabs, scaling changes applied in game, the Jabu-Jabu bars fixed, renderer frame-time work and the brightness-flash fix, and fixes from the 0.8.4 reports.
This commit is contained in:
@@ -31,7 +31,8 @@ public sealed class TexturePack
|
||||
{
|
||||
public const string FolderName = "triforce_texpack";
|
||||
public const string StateName = ".pack.json";
|
||||
static readonly Regex FileName = new(@"^[0-9a-f]{16}(_m\d{1,2})?\.png$", RegexOptions.CultureInvariant);
|
||||
// ((Triforce, 11-26) \z, not $: $ also matches before a last line break, so a name ending in a line break passed)
|
||||
static readonly Regex FileName = new(@"^[0-9a-f]{16}(_m[0-9]{1,2})?\.png\z", RegexOptions.CultureInvariant);
|
||||
static readonly Regex PartName = new(@"^[A-Za-z0-9._-]{1,80}\.zip$", RegexOptions.CultureInvariant);
|
||||
|
||||
readonly TriforceContext ctx;
|
||||
@@ -78,7 +79,7 @@ public sealed class TexturePack
|
||||
{
|
||||
using var r = await http.GetAsync(BaseUrl + "/manifest.json", token).ConfigureAwait(false);
|
||||
r.EnsureSuccessStatusCode();
|
||||
return Parse(await r.Content.ReadAsStringAsync(token).ConfigureAwait(false));
|
||||
return Parse(await Downloader.TextAsync(r.Content, 4 << 20, token).ConfigureAwait(false));
|
||||
}
|
||||
|
||||
sealed record State(string Id, List<string> Done, bool Whole);
|
||||
@@ -184,19 +185,30 @@ public sealed class TexturePack
|
||||
{
|
||||
if (e.FullName.EndsWith('/')) continue;
|
||||
if (!FileName.IsMatch(e.FullName)) throw new InvalidDataException("a file Evil HD's textures do not have: " + e.FullName);
|
||||
// (one picture is a few MB: an entry far larger is no picture of the pack's, whatever its name)
|
||||
if (e.Length > 256L << 20) throw new InvalidDataException("a file far larger than a texture: " + e.FullName);
|
||||
var dst = Path.Combine(folder, e.FullName);
|
||||
e.ExtractToFile(dst + ".new", true);
|
||||
File.Move(dst + ".new", dst, true);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>The folder gone (the pack's pictures and its list); the game then draws its own textures.</summary>
|
||||
/// <summary>The pack gone (its pictures, their .new leftovers and its list); the game then draws its own textures. ((Triforce,
|
||||
/// 11-26) only files with a pack picture's name: anything else a player keeps in the folder (in folders of its own, or with
|
||||
/// other names) stays, and the folder goes only when nothing is left in it.</summary>
|
||||
public void Remove(string game)
|
||||
{
|
||||
var f = Folder(game);
|
||||
if (!Directory.Exists(f)) return;
|
||||
// (a link to a folder elsewhere, the lab's: only the link goes)
|
||||
if (new DirectoryInfo(f).LinkTarget != null) { Directory.Delete(f); return; }
|
||||
Directory.Delete(f, true);
|
||||
foreach (var file in Directory.EnumerateFiles(f).ToList())
|
||||
{
|
||||
var name = Path.GetFileName(file);
|
||||
if (name == StateName || FileName.IsMatch(name) || name.EndsWith(".new", StringComparison.Ordinal) && FileName.IsMatch(name.Substring(0, name.Length - 4)))
|
||||
File.Delete(file);
|
||||
}
|
||||
if (!Directory.EnumerateFileSystemEntries(f).Any()) Directory.Delete(f);
|
||||
else ctx.Log.Write("texture pack: removed; other files in " + f + " are kept");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user