a few QoL improvements

- fixed logging issues with custom save locations
- Linux should not have issues installing profiles anymore
- Launching games should not
- fixed an issue if for some reason a language is not found.
pull/6/head
Miepee 6 years ago
parent 4231edebad
commit 4777f34374

@ -611,7 +611,7 @@ namespace AM2RLauncher
{
// sets the arguments to empty, or to the profiles save path/logs and create time based logs. Creates the folder if necessary.
string arguments = "";
string savePath = profile.SaveLocation.Replace("%localappdata%", Environment.GetEnvironmentVariable("LOCALAPPDATA"));
string savePath = profile.SaveLocation.ToLower().Replace("%localappdata%", Environment.GetEnvironmentVariable("LOCALAPPDATA"));
string date = string.Join("-", DateTime.Now.ToString().Split(Path.GetInvalidFileNameChars(), StringSplitOptions.RemoveEmptyEntries));
// Game logging
@ -639,11 +639,16 @@ namespace AM2RLauncher
arguments = "-debugoutput \"" + savePath + "/logs/" + profile.Name + ".txt\" -output \"" + savePath + "/logs/" + profile.Name + ".txt\"";
}
Process proc = Process.Start(CrossPlatformOperations.CURRENTPATH + "/Profiles/" + profile.Name + "/AM2R.exe", arguments);
using (proc)
ProcessStartInfo proc = new ProcessStartInfo();
proc.WorkingDirectory = Environment.CurrentDirectory;
proc.FileName = CrossPlatformOperations.CURRENTPATH + "/Profiles/" + profile.Name + "/AM2R.exe";
proc.Arguments = arguments;
using (var p = Process.Start(proc))
{
SetForegroundWindow(proc.MainWindowHandle);
proc.WaitForExit();
SetForegroundWindow(p.MainWindowHandle);
p.WaitForExit();
}
}
else if (Platform.IsGtk)
@ -689,6 +694,7 @@ namespace AM2RLauncher
}
}
startInfo.WorkingDirectory = Environment.CurrentDirectory;
startInfo.UseShellExecute = false;
startInfo.FileName = CrossPlatformOperations.CURRENTPATH + "/Profiles/" + profile.Name + "/AM2R.AppImage";

@ -139,7 +139,7 @@ namespace AM2RLauncher
// We're basically using it to key a thread and scan for other instances of that tag.
Mutex mutex = new Mutex(true, "AM2RLauncher", out singleInstance);
if(!singleInstance)
if (!singleInstance)
{
// If on Windows, set the original app to the foreground window to prevent confusion
if (Platform.IsWinForms)
@ -158,12 +158,14 @@ namespace AM2RLauncher
}
log.Info("Mutex check passed. Entering main thread.");
log.Info("Current Launcher Version: " + VERSION);
log.Info("Current Platform-ID is: " + Platform.ID);
// Set the Current Directory to the path the Launcher is located. Fixes some relative path issues.
Environment.CurrentDirectory = CrossPlatformOperations.CURRENTPATH;
//Set the language to what User wanted or choose local language
string userLanguage = CrossPlatformOperations.ReadFromConfig("Language").ToLower();
@ -210,7 +212,7 @@ namespace AM2RLauncher
// Load colors
colGreen = Color.FromArgb(142, 188, 35);
colRed = Color.FromArgb(188,10,35);
colRed = Color.FromArgb(188, 10, 35);
colInactive = Color.FromArgb(109, 109, 109);
colBGNoAlpha = Color.FromArgb(10, 10, 10);
colBG = Color.FromArgb(10, 10, 10, 80);
@ -487,7 +489,7 @@ namespace AM2RLauncher
};
if(Platform.IsGtk && !isInternetThere)
if (Platform.IsGtk && !isInternetThere)
{
changelogPage.Content = new TableLayout
{
@ -539,13 +541,18 @@ namespace AM2RLauncher
BackgroundColor = colBGNoAlpha,
};
if (Platform.IsGtk)
languageDropDown = new DropDown {};
languageDropDown = new DropDown { };
languageDropDown.Items.AddRange(languageList);
var tmpLanguage = CrossPlatformOperations.ReadFromConfig("Language");
languageDropDown.SelectedIndex = tmpLanguage == "Default" ? 0 : languageDropDown.Items.IndexOf(languageDropDown.Items.Where(x => x.Text.Equals(tmpLanguage)).First());
languageDropDown.SelectedIndex = tmpLanguage == "Default" ? 0 : languageDropDown.Items.IndexOf(languageDropDown.Items.Where(x => x.Text.Equals(tmpLanguage)).FirstOrDefault());
if (languageDropDown.SelectedIndex == -1)
{
log.Info("User has tried to use " + tmpLanguage + " as a Language, but it was not found. Reverting to System Language");
languageDropDown.SelectedIndex = 0;
}
// autoUpdate checkbox
autoUpdateCheck = new CheckBox

Loading…
Cancel
Save