Skip to content
This repository has been archived by the owner on Dec 10, 2019. It is now read-only.

Commit

Permalink
Merge pull request #46 from beat-saber-modding-group/scoresaber-debug
Browse files Browse the repository at this point in the history
Fix for ScoreSaber not appearing in mods list
  • Loading branch information
megalon authored Apr 24, 2019
2 parents 2e52a32 + 0eebf0b commit 5c49927
Show file tree
Hide file tree
Showing 8 changed files with 111 additions and 31 deletions.
42 changes: 38 additions & 4 deletions BeatSaberModManager/Core/PathLogic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,29 @@ public class PathLogic
public string GetInstallationPath()
{
// Check if install path is already saved
if (Properties.Settings.Default.InstallPath != null)
if (Properties.Settings.Default.InstallPath.Length != 0
&& Properties.Settings.Default.Platform != (int)Platform.Default)
{
if (File.Exists(Path.Combine(Properties.Settings.Default.InstallPath, AppFileName)))
{
installPath = Properties.Settings.Default.InstallPath;

if ((Platform)Properties.Settings.Default.Platform == Platform.Steam)
{
platform = Platform.Steam;
} else if ((Platform)Properties.Settings.Default.Platform == Platform.Oculus)
{
platform = Platform.Oculus;
} else
{
// If the platform isn't saved, prompt user to select
FormPlatformSelect selector = new FormPlatformSelect(this);
selector.ShowDialog();

Properties.Settings.Default.Platform = (int)platform;
Properties.Settings.Default.Save();
}

return installPath;
}
}
Expand Down Expand Up @@ -139,7 +157,6 @@ private string GetValidOculusLocation()
}
}
}

return null;
}
private string NotFoundHandler()
Expand All @@ -157,8 +174,7 @@ private string NotFoundHandler()
FormPlatformSelect selector = new FormPlatformSelect(this);
selector.ShowDialog();
found = true;
Properties.Settings.Default.InstallPath = path;
Properties.Settings.Default.Save();
SaveInstallPath(path);
return path;
}
else
Expand Down Expand Up @@ -199,5 +215,23 @@ public string ManualFind()
}
return string.Empty;
}

public string GetPlatformString()
{
switch (platform)
{
case Platform.Steam: return "Steam";
case Platform.Oculus: return "Oculus";
}
return "Default";
}

// Ensure that platform is saved along with install path
public void SaveInstallPath(string _path)
{
Properties.Settings.Default.InstallPath = _path;
Properties.Settings.Default.Platform = (int)platform;
Properties.Settings.Default.Save();
}
}
}
19 changes: 16 additions & 3 deletions BeatSaberModManager/Core/RemoteLogic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,22 +73,35 @@ public void PopulateReleases()

var files = current["downloads"];

JSONNode steam = files[0];
JSONNode oculus = files[1];

for (var f = 0; f < files.Count; ++f)
{
files[f]["url"] = BeatModsURL + files[f]["url"];
}

if (files.Count > 1)
{
JSONNode steam = null;
JSONNode oculus = null;
for (var f = 0; f < files.Count; ++f)
{
if (files[f]["type"] == "steam") steam = files[f];
if (files[f]["type"] == "oculus") oculus = files[f];
}

if (steam == null && oculus == null)
{
MessageBox.Show($"Could not find Steam or Oculus release for {current["name"]}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
continue;
}else if (steam == null)
{
MessageBox.Show($"Could not find steam release for {current["name"]}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
continue;
}else if (oculus == null)
{
MessageBox.Show($"Could not find oculus release for {current["name"]}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
continue;
}

CreateRelease(
new ReleaseInfo(current["name"], current["name"], current["version"], current["author"]["username"],
current["description"], current["link"], 0, "0.13.2", steam["url"],
Expand Down
54 changes: 35 additions & 19 deletions BeatSaberModManager/Forms/FormMain.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions BeatSaberModManager/Forms/FormMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ private void FormMain_Load(object sender, EventArgs e)
{
new Thread(() => { updater.CheckForUpdates(); }).Start();
textBoxDirectory.Text = path.GetInstallationPath();
platformLabel.Text = $"Platform: {path.GetPlatformString()}";

new Thread(() => { RemoteLoad(); }).Start();
}
Expand Down Expand Up @@ -208,7 +209,6 @@ private void ShowReleases()
groups.Add(release.category, index);
item.Group = listViewMods.Groups[index];
}

listViewMods.Items.Add(item);
release.itemHandle = item;

Expand Down Expand Up @@ -488,8 +488,7 @@ private void BrowseInstallationButton_Click(object sender, EventArgs e)
{
textBoxDirectory.Text = path.ManualFind();
installer.installDirectory = textBoxDirectory.Text;
Properties.Settings.Default.InstallPath = textBoxDirectory.Text;
Properties.Settings.Default.Save();
path.SaveInstallPath(textBoxDirectory.Text);
}

private void ToggleTheme_CheckedChanged(object sender, EventArgs e)
Expand Down
4 changes: 2 additions & 2 deletions BeatSaberModManager/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.3.4.0")]
[assembly: AssemblyFileVersion("0.3.4.0")]
[assembly: AssemblyVersion("0.3.4.1")]
[assembly: AssemblyFileVersion("0.3.4.1")]
[assembly: NeutralResourcesLanguage("en")]

12 changes: 12 additions & 0 deletions BeatSaberModManager/Properties/Settings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions BeatSaberModManager/Properties/Settings.settings
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,8 @@
<Setting Name="InstallPath" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="Platform" Type="System.Int32" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
</Settings>
</SettingsFile>
3 changes: 3 additions & 0 deletions BeatSaberModManager/app.config
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
<setting name="InstallPath" serializeAs="String">
<value />
</setting>
<setting name="Platform" serializeAs="String">
<value>0</value>
</setting>
</BeatSaberModManager.Properties.Settings>
</userSettings>
</configuration>

0 comments on commit 5c49927

Please sign in to comment.