diff --git a/Rofl.Executables/ExeManager.cs b/Rofl.Executables/ExeManager.cs
index 1fbeba1..5a2e134 100644
--- a/Rofl.Executables/ExeManager.cs
+++ b/Rofl.Executables/ExeManager.cs
@@ -185,6 +185,11 @@ public void SetDefaultExectuable(string name)
_executables.Add(oldDefault);
}
+ public void ReplaceDefaultExecutable(LeagueExecutable exe)
+ {
+ _defaultExecutable = exe;
+ }
+
public void UpdateExecutableTarget(string name)
{
LeagueExecutable targetExe = GetExecutable(name);
@@ -210,6 +215,7 @@ private LeagueExecutable SetupFirstExe()
returnExe.ModifiedDate = ExeTools.GetLastModifiedDate(returnExe.TargetPath);
returnExe.PatchVersion = ExeTools.GetLeagueVersion(returnExe.TargetPath);
returnExe.AllowUpdates = true;
+ returnExe.UseOldLaunchArguments = false;
returnExe.IsDefault = true;
returnExe.Name = "Default";
@@ -224,7 +230,7 @@ private LeagueExecutable SetupFirstExe()
///
///
///
- public void ValidateExecutable(LeagueExecutable exe)
+ public void ValidateExecutable(LeagueExecutable exe, bool requireUniqueName = true)
{
// Name must not already exist
// Start folder must exist
@@ -251,7 +257,10 @@ where e.Name.ToUpper().Equals(exe.Name.ToUpper())
bool defaultMatches = _defaultExecutable.Name.ToUpper().Equals(exe.Name);
- if (matchingExe != null || defaultMatches) { throw new ArgumentException($"{_exceptionOriginName} - Executable by \"{exe.Name}\" already exists"); }
+ if(requireUniqueName)
+ {
+ if (matchingExe != null || defaultMatches) { throw new ArgumentException($"{_exceptionOriginName} - Executable by \"{exe.Name}\" already exists"); }
+ }
// Check if start folder exists
if (!Directory.Exists(exe.StartFolder)) { throw new DirectoryNotFoundException($"{_exceptionOriginName} - Start folder \"{exe.StartFolder}\" does not exist"); }
diff --git a/Rofl.Executables/Models/LeagueExecutable.cs b/Rofl.Executables/Models/LeagueExecutable.cs
index 5af4b86..38d2988 100644
--- a/Rofl.Executables/Models/LeagueExecutable.cs
+++ b/Rofl.Executables/Models/LeagueExecutable.cs
@@ -20,6 +20,9 @@ public class LeagueExecutable
[JsonProperty("allow-updates")]
public bool AllowUpdates { get; set; }
+ [JsonProperty("use-old-launch-args")]
+ public bool UseOldLaunchArguments { get; set; }
+
[JsonProperty("default")]
public bool IsDefault { get; set; }
diff --git a/Rofl.Executables/Utilities/ReplayPlayer.cs b/Rofl.Executables/Utilities/ReplayPlayer.cs
index dd4bfac..c50e20c 100644
--- a/Rofl.Executables/Utilities/ReplayPlayer.cs
+++ b/Rofl.Executables/Utilities/ReplayPlayer.cs
@@ -30,7 +30,8 @@ public void Play(LeagueExecutable leagueExe, string replayPath)
}
// This will throw an exception if exe has issues
- _exeManager.ValidateExecutable(leagueExe);
+ // Turning off unique name flag, otherwise will trigger exception
+ _exeManager.ValidateExecutable(leagueExe, false);
// Create the launch arguments, each argument is put in quotes
// GameBaseDir=...
@@ -40,10 +41,17 @@ public void Play(LeagueExecutable leagueExe, string replayPath)
combinedArgs += $" \"{arg}\"";
}
+ var launchArgs = combinedArgs;
+
+ if(leagueExe.UseOldLaunchArguments)
+ {
+ launchArgs = "\"" + replayPath + "\"";
+ }
+
ProcessStartInfo processStartInfo = new ProcessStartInfo
{
FileName = leagueExe.TargetPath,
- Arguments = combinedArgs,
+ Arguments = launchArgs,
// The game client uses the working directory to find the data files
WorkingDirectory = Path.GetDirectoryName(leagueExe.TargetPath)
diff --git a/Rofl.Logger/Scribe.cs b/Rofl.Logger/Scribe.cs
index d032194..2ace7b5 100644
--- a/Rofl.Logger/Scribe.cs
+++ b/Rofl.Logger/Scribe.cs
@@ -33,7 +33,7 @@ public void WriteToFile()
foreach (LogEntry entry in _entryList)
{
- logOutput += $"{entry.Timestamp}\t|\t{entry.ClassName} -> {entry.MethodName}\t|\t{entry.Level}\t|\t{entry.Message}\n";
+ logOutput += $"{entry.Timestamp} | {entry.ClassName} -> {entry.MethodName} | {entry.Level} | {entry.Message}\n";
}
File.WriteAllText(outputFileName, logOutput);
diff --git a/Rofl.Main/DetailForm.cs b/Rofl.Main/DetailForm.cs
index aa5d11c..59266d1 100644
--- a/Rofl.Main/DetailForm.cs
+++ b/Rofl.Main/DetailForm.cs
@@ -1,6 +1,7 @@
using Rofl.Executables;
using Rofl.Executables.Models;
using Rofl.Executables.Utilities;
+using Rofl.Logger;
using Rofl.Main.Managers;
using Rofl.Reader.Models;
using Rofl.Requests;
@@ -20,13 +21,15 @@ public partial class DetailForm : Form
private RequestManager _requestManager;
private ExeManager _exeManager;
private ReplayPlayer _replayPlayer;
+ private Scribe _logger;
- public DetailForm(ReplayFile replayFile, RequestManager requestManager, ExeManager exeManager, ReplayPlayer replayPlayer)
+ public DetailForm(ReplayFile replayFile, RequestManager requestManager, ExeManager exeManager, ReplayPlayer replayPlayer, Scribe scribe)
{
_replayFile = replayFile;
_requestManager = requestManager;
_exeManager = exeManager;
_replayPlayer = replayPlayer;
+ _logger = scribe;
InitializeComponent();
@@ -151,7 +154,7 @@ private void StartReplay(string execName = "default")
} else
{
// Start update form with target
- var result = new UpdateSplashForm(execName).ShowDialog();
+ var result = new UpdateSplashForm(_exeManager, execName).ShowDialog();
if (result == DialogResult.OK)
{
@@ -184,13 +187,8 @@ private void StartReplay(string execName = "default")
{
if (t.IsFaulted)
{
- string exceptionMsg = $"{t.Exception.GetType().ToString()} : {t.Exception.Message}\n";
- foreach (var exception in t.Exception.InnerExceptions)
- {
- exceptionMsg += $"\n{exception.GetType().ToString()} : {exception.Message}\n";
- }
-
- MessageBox.Show("Failed to play replay!\n\n" + exceptionMsg, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ _logger.Error(this.GetType().ToString(), t.Exception.ToString());
+ MessageBox.Show("Failed to play replay! Check logs for detailed information", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
GeneralPlayReplaySplitButton.Enabled = true;
}));
diff --git a/Rofl.Main/ExecAddForm.Designer.cs b/Rofl.Main/ExecAddForm.Designer.cs
index ff2cb11..fb7cc23 100644
--- a/Rofl.Main/ExecAddForm.Designer.cs
+++ b/Rofl.Main/ExecAddForm.Designer.cs
@@ -48,6 +48,7 @@ private void InitializeComponent()
this.GBoxExecNameLabel = new System.Windows.Forms.Label();
this.ExecSaveButton = new System.Windows.Forms.Button();
this.ExecCancelButton = new System.Windows.Forms.Button();
+ this.ExecArgsCheckbox = new System.Windows.Forms.CheckBox();
this.ExecFlowLayout.SuspendLayout();
this.ExecInfoGroupBox.SuspendLayout();
this.SuspendLayout();
@@ -60,6 +61,7 @@ private void InitializeComponent()
this.ExecFlowLayout.Controls.Add(this.ExecTargetTextBox);
this.ExecFlowLayout.Controls.Add(this.ExecStartLabel);
this.ExecFlowLayout.Controls.Add(this.ExecStartTextBox);
+ this.ExecFlowLayout.Controls.Add(this.ExecArgsCheckbox);
this.ExecFlowLayout.Controls.Add(this.ExecUpdateCheckbox);
this.ExecFlowLayout.Controls.Add(this.ExecBrowseButton);
this.ExecFlowLayout.Controls.Add(this.ExecInfoGroupBox);
@@ -132,20 +134,20 @@ private void InitializeComponent()
//
this.ExecUpdateCheckbox.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.ExecUpdateCheckbox.AutoSize = true;
- this.ExecUpdateCheckbox.Location = new System.Drawing.Point(159, 103);
- this.ExecUpdateCheckbox.Margin = new System.Windows.Forms.Padding(159, 5, 5, 5);
+ this.ExecUpdateCheckbox.Location = new System.Drawing.Point(161, 103);
+ this.ExecUpdateCheckbox.Margin = new System.Windows.Forms.Padding(5);
this.ExecUpdateCheckbox.Name = "ExecUpdateCheckbox";
this.ExecUpdateCheckbox.Size = new System.Drawing.Size(92, 17);
this.ExecUpdateCheckbox.TabIndex = 10;
this.ExecUpdateCheckbox.Text = "Allow updates";
this.ExecUpdateCheckbox.UseVisualStyleBackColor = true;
this.ExecUpdateCheckbox.CheckedChanged += new System.EventHandler(this.ExecUpdateCheckbox_CheckedChanged);
- this.ExecUpdateCheckbox.MouseEnter += new System.EventHandler(this.ExecUpdateCheckbox_ToolTip);
+ this.ExecUpdateCheckbox.MouseHover += new System.EventHandler(this.ExecUpdateCheckbox_ToolTip);
//
// ExecBrowseButton
//
this.ExecBrowseButton.Anchor = System.Windows.Forms.AnchorStyles.Right;
- this.ExecBrowseButton.Location = new System.Drawing.Point(261, 100);
+ this.ExecBrowseButton.Location = new System.Drawing.Point(263, 100);
this.ExecBrowseButton.Margin = new System.Windows.Forms.Padding(5);
this.ExecBrowseButton.Name = "ExecBrowseButton";
this.ExecBrowseButton.Size = new System.Drawing.Size(75, 23);
@@ -280,6 +282,20 @@ private void InitializeComponent()
this.ExecCancelButton.UseVisualStyleBackColor = true;
this.ExecCancelButton.Click += new System.EventHandler(this.ExecCancelButton_Click);
//
+ // ExecArgsCheckbox
+ //
+ this.ExecArgsCheckbox.Anchor = System.Windows.Forms.AnchorStyles.Left;
+ this.ExecArgsCheckbox.AutoSize = true;
+ this.ExecArgsCheckbox.Location = new System.Drawing.Point(38, 103);
+ this.ExecArgsCheckbox.Margin = new System.Windows.Forms.Padding(38, 5, 5, 5);
+ this.ExecArgsCheckbox.Name = "ExecArgsCheckbox";
+ this.ExecArgsCheckbox.Size = new System.Drawing.Size(113, 17);
+ this.ExecArgsCheckbox.TabIndex = 11;
+ this.ExecArgsCheckbox.Text = "Use old play mode";
+ this.ExecArgsCheckbox.UseVisualStyleBackColor = true;
+ this.ExecArgsCheckbox.CheckedChanged += new System.EventHandler(this.ExecArgsCheckbox_CheckedChanged);
+ this.ExecArgsCheckbox.MouseHover += new System.EventHandler(this.ExecArgsCheckbox_ToolTip);
+ //
// ExecAddForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@@ -325,5 +341,6 @@ private void InitializeComponent()
private System.Windows.Forms.Label GBoxFileDescLabel;
private System.Windows.Forms.TextBox GBoxLastModifTextBox;
private System.Windows.Forms.Label GBoxLastModifLabel;
+ private System.Windows.Forms.CheckBox ExecArgsCheckbox;
}
}
\ No newline at end of file
diff --git a/Rofl.Main/ExecAddForm.cs b/Rofl.Main/ExecAddForm.cs
index 80a309b..aef6010 100644
--- a/Rofl.Main/ExecAddForm.cs
+++ b/Rofl.Main/ExecAddForm.cs
@@ -32,7 +32,19 @@ public ExecAddForm(LeagueExecutable leagueExecutable)
InitForm();
toolTip = new ToolTip();
- NewLeagueExec = leagueExecutable;
+ NewLeagueExec = new LeagueExecutable()
+ {
+ TargetPath = leagueExecutable.TargetPath,
+ Name = leagueExecutable.Name,
+ StartFolder = leagueExecutable.StartFolder,
+ PatchVersion = leagueExecutable.PatchVersion,
+ ModifiedDate = leagueExecutable.ModifiedDate,
+ AllowUpdates = leagueExecutable.AllowUpdates,
+ IsDefault = leagueExecutable.IsDefault,
+ UseOldLaunchArguments = leagueExecutable.UseOldLaunchArguments
+ };
+
+
if(!File.Exists(NewLeagueExec.TargetPath))
{
MessageBox.Show("Target specified in entry does not exist. Delete and re-add", "Error reading entry", MessageBoxButtons.OK, MessageBoxIcon.Error);
@@ -50,6 +62,7 @@ public ExecAddForm(LeagueExecutable leagueExecutable)
this.GBoxFileDescTextBox.Text = fileInfo.FileDescription;
this.GBoxLastModifTextBox.Text = NewLeagueExec.ModifiedDate.ToString("yyyy/dd/MM");
this.ExecUpdateCheckbox.Checked = NewLeagueExec.AllowUpdates;
+ this.ExecArgsCheckbox.Checked = NewLeagueExec.UseOldLaunchArguments;
this.Text = "Edit Executable...";
}
@@ -179,6 +192,11 @@ private void ExecUpdateCheckbox_CheckedChanged(object sender, EventArgs e)
NewLeagueExec.AllowUpdates = this.ExecUpdateCheckbox.Checked;
}
+ private void ExecArgsCheckbox_CheckedChanged(object sender, EventArgs e)
+ {
+ NewLeagueExec.UseOldLaunchArguments = this.ExecArgsCheckbox.Checked;
+ }
+
private void ExecUpdateCheckbox_ToolTip(object sender, EventArgs e)
{
CheckBox updateBox = (CheckBox)sender;
@@ -188,6 +206,15 @@ private void ExecUpdateCheckbox_ToolTip(object sender, EventArgs e)
toolTip.Show("ROFLPlayer can automatically update target path when League of Legends updates", updateBox, 0, 20, visTime);
}
+ private void ExecArgsCheckbox_ToolTip(object sender, EventArgs e)
+ {
+ CheckBox updateBox = (CheckBox)sender;
+
+ var visTime = 3000;
+
+ toolTip.Show("Use old launch arguments, required for old versions of League of Legends", updateBox, 0, 20, visTime);
+ }
+
private void ExecSaveButton_Click(object sender, EventArgs e)
{
if(!ValidateForm())
diff --git a/Rofl.Main/Program.cs b/Rofl.Main/Program.cs
index 3febe6b..cd009c8 100644
--- a/Rofl.Main/Program.cs
+++ b/Rofl.Main/Program.cs
@@ -88,7 +88,7 @@ static void Main(string[] args)
RequestManager requestManager = new RequestManager();
- Application.Run(new DetailForm(replayFile.Result, requestManager, exeManager, replayPlayer));
+ Application.Run(new DetailForm(replayFile.Result, requestManager, exeManager, replayPlayer, logger));
}
}
}
@@ -173,7 +173,7 @@ private static void StartReplay(string replayPath, ExeManager exeManager, Replay
else
{
// Start update form with target
- var result = new UpdateSplashForm(execName).ShowDialog();
+ var result = new UpdateSplashForm(exeManager, execName).ShowDialog();
if (result == DialogResult.OK)
{
diff --git a/Rofl.Main/SettingsForm.cs b/Rofl.Main/SettingsForm.cs
index c5678e4..753cb1f 100644
--- a/Rofl.Main/SettingsForm.cs
+++ b/Rofl.Main/SettingsForm.cs
@@ -263,6 +263,10 @@ private void ExecEditButton_Click(object sender, EventArgs e)
_exeManager.DeleteExecutable(selectedName);
_exeManager.AddExecutable(newExec);
}
+ else
+ {
+ _exeManager.ReplaceDefaultExecutable(newExec);
+ }
// Refresh list of execs
RefreshExecListBox();
diff --git a/Rofl.Main/UpdateSplashForm.cs b/Rofl.Main/UpdateSplashForm.cs
index fed7997..5969b63 100644
--- a/Rofl.Main/UpdateSplashForm.cs
+++ b/Rofl.Main/UpdateSplashForm.cs
@@ -18,8 +18,9 @@ public UpdateSplashForm(ExeManager exeManager)
InitializeComponent();
}
- public UpdateSplashForm(string targetExec)
+ public UpdateSplashForm(ExeManager exeManager, string targetExec)
{
+ _exeManager = exeManager;
TargetExecToUpdate = targetExec;
InitializeComponent();
}