mirror of
https://github.com/muskit/MercuryConverter.git
synced 2026-06-02 20:24:26 -07:00
add workflows, app versioning
This commit is contained in:
@@ -0,0 +1 @@
|
||||
1
|
||||
@@ -39,7 +39,7 @@ public static class Database
|
||||
{
|
||||
AudioPaths.Clear();
|
||||
|
||||
using (var reader = new StreamReader(Utils.AssetPath("awb.csv")))
|
||||
using (var reader = new StreamReader(Utils.GetAsset("awb.csv")))
|
||||
{
|
||||
string? line;
|
||||
while ((line = reader.ReadLine()) != null)
|
||||
|
||||
@@ -27,10 +27,10 @@ public partial class ExportRow : ObservableObject
|
||||
{
|
||||
private static Dictionary<ExportStatus, IImage?> StatusImgs = new()
|
||||
{
|
||||
{ ExportStatus.Working, new Bitmap(Utils.AssetPath("imgs/status/indeterminate_spinner.png")) },
|
||||
{ ExportStatus.Error, new Bitmap(Utils.AssetPath("imgs/status/task_error.png")) },
|
||||
{ ExportStatus.Finished, new Bitmap(Utils.AssetPath("imgs/status/task_complete.png")) },
|
||||
{ ExportStatus.FinishedWithMessages, new Bitmap(Utils.AssetPath("imgs/status/task_alert.png")) },
|
||||
{ ExportStatus.Working, new Bitmap(Utils.GetAsset("imgs/status/indeterminate_spinner.png")) },
|
||||
{ ExportStatus.Error, new Bitmap(Utils.GetAsset("imgs/status/task_error.png")) },
|
||||
{ ExportStatus.Finished, new Bitmap(Utils.GetAsset("imgs/status/task_complete.png")) },
|
||||
{ ExportStatus.FinishedWithMessages, new Bitmap(Utils.GetAsset("imgs/status/task_alert.png")) },
|
||||
};
|
||||
|
||||
[ObservableProperty]
|
||||
@@ -111,7 +111,6 @@ public partial class Export : Panel
|
||||
{
|
||||
if (Exporting) return;
|
||||
|
||||
Console.WriteLine("Updating rows!");
|
||||
Rows.Clear();
|
||||
|
||||
if ((bool)RadioExportAll.IsChecked!)
|
||||
|
||||
+24
-2
@@ -2,6 +2,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading.Tasks;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Platform;
|
||||
@@ -49,7 +50,7 @@ public static class Utils
|
||||
/// </summary>
|
||||
/// <param name="path">Forward-slash (/)-separated path to asset.</param>
|
||||
/// <returns></returns>
|
||||
public static Stream AssetPath(string path) => AssetLoader.Open(new Uri("avares://MercuryConverter/Assets/" + path));
|
||||
public static Stream GetAsset(string path) => AssetLoader.Open(new Uri(Path.Combine("avares://MercuryConverter/Assets/", path)));
|
||||
|
||||
public static string IIDToMusicFilePath(uint id)
|
||||
{
|
||||
@@ -82,10 +83,14 @@ public static class Utils
|
||||
Console.WriteLine($"Could not find FFmpeg on PATH!");
|
||||
_ffmpegAvailable = false;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"Something's wrong with FFmpeg!\n{ex.Message}");
|
||||
_ffmpegAvailable = false;
|
||||
}
|
||||
|
||||
Console.WriteLine($"FFmpeg available: {_ffmpegAvailable}");
|
||||
}
|
||||
|
||||
return (bool)_ffmpegAvailable!;
|
||||
}
|
||||
}
|
||||
@@ -94,4 +99,21 @@ public static class Utils
|
||||
{
|
||||
return string.Concat(filename.Split(['/', '\\', '\"', '\'']));
|
||||
}
|
||||
|
||||
private static string? _version = null;
|
||||
public static string VERSION
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_version == null)
|
||||
{
|
||||
using (StreamReader reader = new(GetAsset("version")))
|
||||
{
|
||||
_version = reader.ReadToEnd();
|
||||
}
|
||||
_version = _version.Trim();
|
||||
}
|
||||
return _version!;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user