Skip to content

Commit 6969547

Browse files
authored
Added filtering options by platform
1 parent 7d72c87 commit 6969547

File tree

6 files changed

+220
-33
lines changed

6 files changed

+220
-33
lines changed

Sonic '06 Mod Manager/App.config

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@
3838
<setting name="manUninstall" serializeAs="String">
3939
<value>False</value>
4040
</setting>
41+
<setting name="filter" serializeAs="String">
42+
<value>0</value>
43+
</setting>
4144
</Sonic_06_Mod_Manager.Properties.Settings>
4245
<SONIC_THE_HEDGEHOG__2006__Mod_Manager.Properties.Settings>
4346
<setting name="modsPath" serializeAs="String">

Sonic '06 Mod Manager/ModManager.Designer.cs

Lines changed: 46 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Sonic '06 Mod Manager/ModManager.cs

Lines changed: 155 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ namespace Sonic_06_Mod_Manager
4040
{
4141
public partial class ModManager : Form
4242
{
43-
public static string versionNumber = "Version 1.02";
43+
public static string versionNumber = "Version 1.03";
4444
public static string installState = "";
4545
public static bool isCreatorDisposed;
4646
public static string username;
@@ -90,43 +90,33 @@ private void ModManager_Load(object sender, EventArgs e)
9090
Height = 529;
9191
check_manUninstall.Visible = false;
9292
check_FTP.Checked = true;
93+
playButton.Left = 10;
9394
playButton.Width = 186;
9495
playButton.Text = "Test Connection";
9596
}
9697
else
9798
{
98-
Height = 503;
99-
check_manUninstall.Visible = true;
100-
check_FTP.Checked = false;
101-
playButton.Width = 282;
102-
playButton.Text = "Save and Play";
103-
}
104-
105-
if (Properties.Settings.Default.manUninstall == true)
106-
{
107-
check_manUninstall.Checked = true;
108-
playButton.Text = "Install Mods";
109-
playButton.Left = 106;
110-
playButton.Width = 90;
111-
stopButton.Visible = true;
112-
launchXeniaButton.Visible = true;
113-
}
114-
else
115-
{
116-
check_manUninstall.Checked = false;
117-
playButton.Text = "Save and Play";
118-
playButton.Left = 10;
119-
if (!check_FTP.Checked)
99+
if (Properties.Settings.Default.manUninstall == true)
120100
{
121-
playButton.Width = 282;
122-
stopButton.Visible = false;
123-
launchXeniaButton.Visible = false;
101+
Height = 503;
102+
check_FTP.Checked = false;
103+
check_manUninstall.Checked = true;
104+
playButton.Text = "Install Mods";
105+
playButton.Left = 106;
106+
playButton.Width = 90;
107+
stopButton.Visible = true;
108+
launchXeniaButton.Visible = true;
124109
}
125110
else
126111
{
127-
playButton.Width = 186;
128-
stopButton.Visible = true;
112+
Height = 503;
113+
check_FTP.Checked = false;
114+
check_manUninstall.Checked = false;
115+
stopButton.Visible = false;
129116
launchXeniaButton.Visible = false;
117+
playButton.Left = 10;
118+
playButton.Width = 282;
119+
playButton.Text = "Save and Play";
130120
}
131121
}
132122

@@ -136,6 +126,25 @@ private void ModManager_Load(object sender, EventArgs e)
136126
if (Properties.Settings.Default.priority == 0) combo_Priority.SelectedIndex = 0;
137127
else if (Properties.Settings.Default.priority == 1) combo_Priority.SelectedIndex = 1;
138128

129+
if (Properties.Settings.Default.filter == 0)
130+
{
131+
radio_All.Checked = true;
132+
radio_Xbox.Checked = false;
133+
radio_PlayStation.Checked = false;
134+
}
135+
else if (Properties.Settings.Default.filter == 1)
136+
{
137+
radio_All.Checked = false;
138+
radio_Xbox.Checked = true;
139+
radio_PlayStation.Checked = false;
140+
}
141+
else if (Properties.Settings.Default.filter == 2)
142+
{
143+
radio_All.Checked = false;
144+
radio_Xbox.Checked = false;
145+
radio_PlayStation.Checked = true;
146+
}
147+
139148
userField.Text = Properties.Settings.Default.username;
140149
}
141150

@@ -252,7 +261,32 @@ private void RefreshMods()
252261
{
253262
var modName = mod.Remove(0, Path.GetDirectoryName(mod).Length);
254263
modName = modName.Replace("\\", "");
255-
modList.Items.Add(modName);
264+
if (Properties.Settings.Default.filter == 0)
265+
{
266+
modList.Items.Add(modName);
267+
}
268+
else if (Properties.Settings.Default.filter == 1)
269+
{
270+
if (File.Exists($"{Path.Combine(modsPath, modName)}\\mod.ini"))
271+
{
272+
var getPlatform = File.ReadAllText($"{Path.Combine(modsPath, modName)}\\mod.ini");
273+
if (getPlatform.Contains("Platform=\"Xbox 360\""))
274+
{
275+
modList.Items.Add(modName);
276+
}
277+
}
278+
}
279+
else if (Properties.Settings.Default.filter == 2)
280+
{
281+
if (File.Exists($"{Path.Combine(modsPath, modName)}\\mod.ini"))
282+
{
283+
var getPlatform = File.ReadAllText($"{Path.Combine(modsPath, modName)}\\mod.ini");
284+
if (getPlatform.Contains("Platform=\"PlayStation 3\""))
285+
{
286+
modList.Items.Add(modName);
287+
}
288+
}
289+
}
256290
}
257291
}
258292
}
@@ -274,7 +308,32 @@ private void GetChecks()
274308
}
275309
if (modExists)
276310
{
277-
modList.Items.Add(line);
311+
if (Properties.Settings.Default.filter == 0)
312+
{
313+
modList.Items.Add(line);
314+
}
315+
else if (Properties.Settings.Default.filter == 1)
316+
{
317+
if (File.Exists($"{Path.Combine(modsPath, line)}\\mod.ini"))
318+
{
319+
var getPlatform = File.ReadAllText($"{Path.Combine(modsPath, line)}\\mod.ini");
320+
if (getPlatform.Contains("Platform=\"Xbox 360\""))
321+
{
322+
modList.Items.Add(line);
323+
}
324+
}
325+
}
326+
else if (Properties.Settings.Default.filter == 2)
327+
{
328+
if (File.Exists($"{Path.Combine(modsPath, line)}\\mod.ini"))
329+
{
330+
var getPlatform = File.ReadAllText($"{Path.Combine(modsPath, line)}\\mod.ini");
331+
if (getPlatform.Contains("Platform=\"PlayStation 3\""))
332+
{
333+
modList.Items.Add(line);
334+
}
335+
}
336+
}
278337
for (int i = 0; i < modList.Items.Count; i++) modList.SetItemChecked(i, true);
279338
}
280339
}
@@ -294,7 +353,32 @@ private void GetChecks()
294353
}
295354
if (!isInList)
296355
{
297-
modList.Items.Add(modName);
356+
if (Properties.Settings.Default.filter == 0)
357+
{
358+
modList.Items.Add(modName);
359+
}
360+
else if (Properties.Settings.Default.filter == 1)
361+
{
362+
if (File.Exists($"{Path.Combine(modsPath, modName)}\\mod.ini"))
363+
{
364+
var getPlatform = File.ReadAllText($"{Path.Combine(modsPath, modName)}\\mod.ini");
365+
if (getPlatform.Contains("Platform=\"Xbox 360\""))
366+
{
367+
modList.Items.Add(modName);
368+
}
369+
}
370+
}
371+
else if (Properties.Settings.Default.filter == 2)
372+
{
373+
if (File.Exists($"{Path.Combine(modsPath, modName)}\\mod.ini"))
374+
{
375+
var getPlatform = File.ReadAllText($"{Path.Combine(modsPath, modName)}\\mod.ini");
376+
if (getPlatform.Contains("Platform=\"PlayStation 3\""))
377+
{
378+
modList.Items.Add(modName);
379+
}
380+
}
381+
}
298382
}
299383
}
300384
}
@@ -1950,7 +2034,7 @@ private void Button1_Click(object sender, EventArgs e)
19502034
}
19512035
MessageBox.Show(modDetails, modList.Items[modList.SelectedIndex].ToString(), MessageBoxButtons.OK, MessageBoxIcon.Information);
19522036
}
1953-
else { MessageBox.Show("No configuration file found for selected mod.", "None", MessageBoxButtons.OK, MessageBoxIcon.Warning); }
2037+
else { MessageBox.Show("No configuration file found for the selected mod.", "None", MessageBoxButtons.OK, MessageBoxIcon.Warning); }
19542038
}
19552039
}
19562040

@@ -2239,5 +2323,44 @@ private void LaunchXeniaButton_Click(object sender, EventArgs e)
22392323
{
22402324
LaunchXenia();
22412325
}
2326+
2327+
private void RadioButton1_CheckedChanged(object sender, EventArgs e)
2328+
{
2329+
if (radio_All.Checked == true)
2330+
{
2331+
Properties.Settings.Default.filter = 0;
2332+
btn_UpperPriority.Enabled = false;
2333+
btn_DownerPriority.Enabled = false;
2334+
RefreshMods();
2335+
}
2336+
2337+
Properties.Settings.Default.Save();
2338+
}
2339+
2340+
private void Radio_Xbox_CheckedChanged(object sender, EventArgs e)
2341+
{
2342+
if (radio_Xbox.Checked == true)
2343+
{
2344+
Properties.Settings.Default.filter = 1;
2345+
btn_UpperPriority.Enabled = false;
2346+
btn_DownerPriority.Enabled = false;
2347+
RefreshMods();
2348+
}
2349+
2350+
Properties.Settings.Default.Save();
2351+
}
2352+
2353+
private void Radio_PlayStation_CheckedChanged(object sender, EventArgs e)
2354+
{
2355+
if (radio_PlayStation.Checked == true)
2356+
{
2357+
Properties.Settings.Default.filter = 2;
2358+
btn_UpperPriority.Enabled = false;
2359+
btn_DownerPriority.Enabled = false;
2360+
RefreshMods();
2361+
}
2362+
2363+
Properties.Settings.Default.Save();
2364+
}
22422365
}
22432366
}

Sonic '06 Mod Manager/Properties/AssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,4 @@
3333
// by using the '*' as shown below:
3434
// [assembly: AssemblyVersion("1.0.*")]
3535
[assembly: AssemblyVersion("1.0.0.0")]
36-
[assembly: AssemblyFileVersion("1.0.2.0")]
36+
[assembly: AssemblyFileVersion("1.0.3.0")]

Sonic '06 Mod Manager/Properties/Settings.Designer.cs

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Sonic '06 Mod Manager/Properties/Settings.settings

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,8 @@
2929
<Setting Name="manUninstall" Type="System.Boolean" Scope="User">
3030
<Value Profile="(Default)">False</Value>
3131
</Setting>
32+
<Setting Name="filter" Type="System.Int32" Scope="User">
33+
<Value Profile="(Default)">0</Value>
34+
</Setting>
3235
</Settings>
3336
</SettingsFile>

0 commit comments

Comments
 (0)