Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/ClusterM/hakchi2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordaPhie79 <33412188+daPhie79@users.noreply.github.com>2017-12-08 22:32:30 +0300
committerdaPhie79 <33412188+daPhie79@users.noreply.github.com>2017-12-08 22:32:30 +0300
commitc8b4c9326acbc442f46e2989ffb5545af32d4f03 (patch)
tree0bb45f600342f5d8e116d6023d108cc9112e87be /SaveStateManager.cs
parentbb815358c0697969cef65bb0d0dd221b13bbc141 (diff)
remove invalid characters from suggested export filename
Diffstat (limited to 'SaveStateManager.cs')
-rw-r--r--SaveStateManager.cs6
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)