Skip to content

Commit

Permalink
Some update
Browse files Browse the repository at this point in the history
  • Loading branch information
sefinek24 committed Apr 2, 2024
1 parent 5893f6f commit f2d7f78
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Stella.Launcher
4 changes: 2 additions & 2 deletions Stella.Prepare/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public static async Task Run()
if (string.IsNullOrEmpty(SavedGamePath) || !File.Exists(SavedGamePath))
{
string errorMessage = SavedGamePath != null ? $"File was not found: {SavedGamePath}" : "Full game path was not found";
Log.ErrorAndExit(new Exception($"{errorMessage}\n\nYou must provide the specific location where the game is installed.\nThis program will not modify ANY game files."), false, false);
Log.ErrorAndExit(new Exception($"{errorMessage}\n\nYou must provide the specific location where the game is installed.\nThis program will not modify ANY game files."));
}

// If the variable is not empty, save the data
Expand Down Expand Up @@ -102,7 +102,7 @@ public static async Task Run()
}
else
{
Log.ErrorAndExit(new Exception("Unknown\n\nSorry. Directory with the resources was not found.\nIn the resources directory, files such as your shaders, presets, screenshots, and custom mods are stored."), false, false);
Log.ErrorAndExit(new Exception("Unknown\n\nSorry. Directory with the resources was not found.\nIn the resources directory, files such as your shaders, presets, screenshots, and custom mods are stored."));
}

TaskbarProgress.SetProgressValue(26);
Expand Down
5 changes: 2 additions & 3 deletions Stella.Prepare/Scripts/Cmd.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public static async Task CliWrap(string app, string? args, string? workingDir)
Console.WriteLine(@"Installing Microsoft Visual C++ 2015 UWP Desktop Package...");

if (!File.Exists(Start.VcLibsAppx))
Log.ErrorAndExit(new Exception($"I can't find a required file. Please unpack downloaded zip archive.\nNot found: {Start.VcLibsAppx}"), false, false);
Log.ErrorAndExit(new Exception($"I can't find a required file. Please unpack downloaded zip archive.\nNot found: {Start.VcLibsAppx}"));

Start.Logger.Info("Installing missing dependency VCLibs...");
await CliWrap("powershell", $"Add-AppxPackage -Path {Start.VcLibsAppx}", null).ConfigureAwait(false);
Expand Down Expand Up @@ -158,8 +158,7 @@ public static async Task CliWrap(string app, string? args, string? workingDir)
case 5:
Log.ErrorAndExit(
new Exception(
$"Software was denied access to a location for the purposes of saving, copying, opening, or loading files.\nRestart your computer or suspend antivirus program and try again.{info}"),
false, false);
$"Software was denied access to a location for the purposes of saving, copying, opening, or loading files.\nRestart your computer or suspend antivirus program and try again.{info}"));
return;

default:
Expand Down
2 changes: 1 addition & 1 deletion Stella.Prepare/Scripts/Log.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public static void ThrowError(Exception msg, bool tryAgain)
TryAgain(tryAgain);
}

public static void ErrorAndExit(Exception log, bool hideError, bool reportIssue)
public static void ErrorAndExit(Exception log, bool hideError = false, bool reportIssue = false)
{
Start.Logger.Error(log);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public static async Task RunAsync()

if (percentage == lastPercentage) continue;
Console.SetCursorPosition(0, Console.CursorTop);
Console.Write($"\rDownloading Stella Mod resources... {totalBytes}.{receivedBytes} bytes ({percentage}%) at {speed / 1024:0.00} KB/s ");
Console.Write($"\rDownloading Stella Mod resources... {receivedBytes}/{totalBytes} bytes ({percentage}%) at {speed / 1024:0.00} KB/s ");
lastPercentage = percentage;
}

Expand Down
4 changes: 2 additions & 2 deletions Stella.Prepare/Scripts/Preparing/TerminalInstallation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public static async Task MakeBackup()
public static async Task<Task> Install()
{
if (!File.Exists(Start.WtMsixBundle))
Log.ErrorAndExit(new Exception($"I can't find a required file: {Start.WtMsixBundle}"), false, false);
Log.ErrorAndExit(new Exception($"I can't find a required file: {Start.WtMsixBundle}"));

Process[] dllHostName = Process.GetProcessesByName("dllhost");
if (dllHostName.Length != 0) await Cmd.CliWrap("taskkill", "/F /IM dllhost.exe", null).ConfigureAwait(false);
Expand All @@ -80,7 +80,7 @@ public static async Task<Task> Install()
string? wtProgramFiles = Utils.GetWtProgramFiles();
if (string.IsNullOrEmpty(wtProgramFiles))
{
Log.ErrorAndExit(new Exception($"Windows Terminal directory was not found in: {Program.WindowsApps}"), false, false);
Log.ErrorAndExit(new Exception($"Windows Terminal directory was not found in: {Program.WindowsApps}"));
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion Stella.Prepare/Scripts/Preparing/UpdateReShadeCfg.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public static async Task RunAsync()
await DownloadFileAsync("https://cdn.sefinek.net/resources/v3/genshin-stella-mod/reshade/ReShade.ini", reshadeIniPath).ConfigureAwait(false);
await DownloadFileAsync("https://cdn.sefinek.net/resources/v3/genshin-stella-mod/reshade/ReShade.log", reshadeLogPath).ConfigureAwait(false);

if (!File.Exists(reshadeIniPath) || !File.Exists(reshadeLogPath)) Log.ErrorAndExit(new Exception($"Something went wrong. Config or log file for ReShade was not found in: {giGame}"), false, false);
if (!File.Exists(reshadeIniPath) || !File.Exists(reshadeLogPath)) Log.ErrorAndExit(new Exception($"Something went wrong. Config or log file for ReShade was not found in: {giGame}"));

Start.Logger.Info($"{Path.GetFileName(reshadeIniPath)} and {Path.GetFileName(reshadeLogPath)} were successfully downloaded.");

Expand Down
4 changes: 2 additions & 2 deletions Stella.Prepare/Start.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ private static async Task Main()
if (!Utils.IsRunAsAdmin())
{
TaskbarProgress.SetProgressValue(100);
Log.ErrorAndExit(new Exception("» This application requires administrator privileges to run."), false, false);
Log.ErrorAndExit(new Exception("» This application requires administrator privileges to run."));
return;
}

Expand Down Expand Up @@ -93,7 +93,7 @@ private static async Task Main()
}
catch (Exception ex)
{
Log.ErrorAndExit(ex, false, false);
Log.ErrorAndExit(ex);
}
}

Expand Down

0 comments on commit f2d7f78

Please sign in to comment.