diff --git a/README.md b/README.md index 9573523..2f0fe06 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ The tool is an implementation of the guide available at /// Selected file path. - static string OpenFilePicker() + static string? OpenFilePicker() { - AnsiConsole.MarkupLine("Opening File Picker..."); + try + { + AnsiConsole.MarkupLine("Opening File Picker..."); - DialogResult filePicker = Dialog.FileOpen( - null, - Path.GetDirectoryName(Utility.GetLastOpenedFile()) - ); + NfdStatus filePicker = Nfd.OpenDialog( + out string? path, + new Dictionary() + { + { + "Unity Files", + "globalgamemanagers,unity3d,data,data.br,data.gz,data.unityweb" + }, + }, + Path.GetDirectoryName(Utility.GetLastOpenedFile()) + ); - if (filePicker.IsCancelled) - AnsiConsole.MarkupLine("( INFO ) Cancelled."); - else if (filePicker.IsError) + switch (filePicker) + { + case NfdStatus.Cancelled: + AnsiConsole.MarkupLine("Cancelled."); + Console.Clear(); + return string.Empty; + case NfdStatus.Ok: + return path ?? string.Empty; + default: + return string.Empty; + } + } + catch (NfdException ex) { - AnsiConsole.MarkupLine( - "[red]( ERR! )[/] Unable to open File Picker! Try using a different Terminal?" + AnsiConsole.MarkupLineInterpolated( + $"[red]( ERR! )[/] Unable to open File Picker! Try using a different Terminal?\n{ex.Message}" ); + return string.Empty; } - - Console.WriteLine(); - - return filePicker.Path; } /// diff --git a/USSR.csproj b/USSR.csproj index b0f86d1..9630411 100644 --- a/USSR.csproj +++ b/USSR.csproj @@ -3,7 +3,7 @@ Exe win-x64;win-arm64;linux-x64;linux-arm64;osx-x64;osx-arm64 - net6.0;net8.0 + net8.0 enable enable @@ -12,7 +12,7 @@ - + diff --git a/build.sh b/build.sh index f213e7f..95b7f79 100644 --- a/build.sh +++ b/build.sh @@ -5,7 +5,7 @@ VERSION=$(