Skip to content

Commit 23aa12c

Browse files
committed
Added warning to profile creation overwrite
1 parent eccc88e commit 23aa12c

File tree

4 files changed

+38
-6
lines changed

4 files changed

+38
-6
lines changed

Sonic-06-Mod-Manager/Properties/AssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@
1212
[assembly: ComVisible(false)]
1313
[assembly: Guid("277111e3-79d8-41b5-b0d7-7609dff6e36f")]
1414
[assembly: AssemblyVersion("2.0.0.6")]
15-
[assembly: AssemblyFileVersion("3.3.4.0")]
15+
[assembly: AssemblyFileVersion("3.3.5.0")]

Sonic-06-Mod-Manager/src/Environment3/ProfileSelect.cs

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,24 @@ private void UpdateInfo()
108108
ListBox_Patches.Items.Clear();
109109
ListBox_Tweaks.Items.Clear();
110110

111-
string noneSelected = "Please select a profile...";
111+
string none = "N/A";
112+
113+
if (ListView_ProfilesList.SelectedItems.Count == 0)
114+
{
115+
string noneSelected = "Please select a profile...";
116+
117+
// No profile selected, so 'disable' preview
118+
ListBox_Mods.Items.Add(noneSelected);
119+
ListBox_Patches.Items.Add(noneSelected);
120+
ListBox_Tweaks.Items.Add(noneSelected);
121+
122+
return;
123+
}
112124

113125
// Update mod info list box
114126
if (Profile.Mods.Count == 0)
115127
{
116-
ListBox_Mods.Items.Add(noneSelected);
128+
ListBox_Mods.Items.Add(none);
117129
}
118130
else
119131
{
@@ -124,7 +136,7 @@ private void UpdateInfo()
124136
// Update patch info list box
125137
if (Profile.Patches.Count == 0)
126138
{
127-
ListBox_Patches.Items.Add(noneSelected);
139+
ListBox_Patches.Items.Add(none);
128140
}
129141
else
130142
{
@@ -135,7 +147,7 @@ private void UpdateInfo()
135147
// Update tweak info list box
136148
if (Profile.Tweaks.Count == 0)
137149
{
138-
ListBox_Tweaks.Items.Add(noneSelected);
150+
ListBox_Tweaks.Items.Add(none);
139151
}
140152
else
141153
{

Sonic-06-Mod-Manager/src/UnifyProfile.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
using System.Collections.Generic;
3333
using Unify.Serialisers;
3434
using Unify.Globalisation;
35+
using Unify.Messenger;
3536

3637
namespace Unify
3738
{
@@ -59,6 +60,22 @@ public static void Create(string name, ListView modsList, ListView patchesList)
5960
#endif
6061
string profile = Path.Combine(Program.Profiles, $"{Literal.UseSafeFormattedCharacters(name)}.06mm");
6162

63+
if (File.Exists(profile))
64+
{
65+
DialogResult confirmation = UnifyMessenger.UnifyMessage.ShowDialog
66+
(
67+
"A profile already exists with this name! Would you like to overwrite it?",
68+
"Profile already exists...",
69+
MessageBoxButtons.YesNo,
70+
MessageBoxIcon.Warning
71+
);
72+
73+
if (confirmation == DialogResult.No)
74+
{
75+
return;
76+
}
77+
}
78+
6279
using (StreamWriter sw = File.CreateText(profile))
6380
{
6481
sw.WriteLine($"Sonic '06 Mod Manager\n{DateTime.Now}");
@@ -107,6 +124,9 @@ public static void Create(string name, ListView modsList, ListView patchesList)
107124
}
108125
}
109126

127+
// Set last used profile to the newly created one
128+
Properties.Settings.Default.General_Profile = name;
129+
110130
Console.WriteLine($"[{DateTime.Now:HH:mm:ss tt}] [Success] Created profile successfully!");
111131
}
112132
#if !DEBUG

Sonic-06-Mod-Manager/src/UnifyProgram.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ namespace Unify
4040
{
4141
static class Program
4242
{
43-
public static readonly string GlobalVersionNumber = $"Version 3.34";
43+
public static readonly string GlobalVersionNumber = $"Version 3.35";
4444

4545
#if !DEBUG
4646
public static readonly string VersionNumber = GlobalVersionNumber;

0 commit comments

Comments
 (0)