diff options
author | daPhie79 <33412188+daPhie79@users.noreply.github.com> | 2017-12-09 05:37:05 +0300 |
---|---|---|
committer | daPhie79 <33412188+daPhie79@users.noreply.github.com> | 2017-12-09 05:37:05 +0300 |
commit | 43ae3cf48c3cb636781ddb1748b137d7727487dc (patch) | |
tree | 41fc4a987573f51fe54cfba873d8caa4a5914509 | |
parent | ff7f200496cd031761ea7fb2f03acbf8726972f7 (diff) | |
parent | 3e8af5d45b2d1c0aa4fd9879283cb6b3d418dbac (diff) |
Merge branch 'stable' into improve_automaticfindcover
-rw-r--r-- | SaveStateManager.cs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/SaveStateManager.cs b/SaveStateManager.cs index f50056bc..92077f75 100644 --- a/SaveStateManager.cs +++ b/SaveStateManager.cs @@ -7,6 +7,7 @@ using System.Diagnostics; using System.Drawing;
using System.IO;
using System.Text;
+using System.Text.RegularExpressions;
using System.Threading;
using System.Windows.Forms;
@@ -191,9 +192,12 @@ namespace com.clusterrr.hakchi_gui {
try
{
+ string invalidChars = new string(Path.GetInvalidFileNameChars());
+ Regex removeInvalidChars = new Regex($"[{Regex.Escape(invalidChars)}]", RegexOptions.Singleline | RegexOptions.Compiled | RegexOptions.CultureInvariant);
+
foreach (ListViewItem game in listViewSaves.SelectedItems)
{
- saveFileDialog.FileName = game.SubItems["colName"].Text + ".clvs";
+ saveFileDialog.FileName = removeInvalidChars.Replace(game.SubItems["colName"].Text, "") + ".clvs";
var name = game.SubItems["colName"].Text != null ? game.SubItems["colName"].Text : "save";
saveFileDialog.Title = name;
if (saveFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
|