Skip to content

Commit

Permalink
Merge pull request #86 from FlaminSarge/folders
Browse files Browse the repository at this point in the history
Use modernized folder selection dialog for selecting non-xbox location
  • Loading branch information
Fr33dan authored May 8, 2024
2 parents d5090d3 + 0751338 commit 98f8a4d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
3 changes: 3 additions & 0 deletions GPSaveConverter/GPSaveConverter.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,9 @@
<PackageReference Include="NLog.Windows.Forms">
<Version>4.6.0</Version>
</PackageReference>
<PackageReference Include="Ookii.Dialogs.WinForms">
<Version>4.0.0</Version>
</PackageReference>
<PackageReference Include="System.AppContext">
<Version>4.3.0</Version>
</PackageReference>
Expand Down
8 changes: 8 additions & 0 deletions GPSaveConverter/Library/PCGameWiki.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ public static async Task FetchSaveLocation(GameInfo i)
{
return;
}
if (queryRoot["query"]["pages"][0]["missing"] != null && queryRoot["query"]["pages"][0]["missing"].AsValue().GetValue<bool>())
{
return;
}
int pageID = queryRoot["query"]["pages"][0]["pageid"].AsValue().GetValue<int>();


Expand All @@ -54,6 +58,10 @@ public static async Task FetchSaveLocation(GameInfo i)
sectionIndex = n["index"].GetValue<string>();
}
}
if (sectionIndex == null || sectionIndex == "-1")
{
return;
}

url = String.Format(@"https://www.pcgamingwiki.com/w/api.php?action=parse&pageid={0}&formatversion=2&format=json&prop=wikitext&section={1}", pageID, sectionIndex);
string saveFileSectionJson = await wc.DownloadStringTaskAsync(url);
Expand Down
7 changes: 6 additions & 1 deletion GPSaveConverter/SaveFileConverterForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using System.Text.Json;
using System.Threading.Tasks;
using System.Windows.Forms;
using Ookii.Dialogs.WinForms;

namespace GPSaveConverter
{
Expand Down Expand Up @@ -56,7 +57,11 @@ private async Task<bool> promptForNonXboxSaveLocation(string reason)
}
if (res == DialogResult.OK)
{
FolderBrowserDialog dialog = new FolderBrowserDialog();
VistaFolderBrowserDialog dialog = new VistaFolderBrowserDialog();
if (ActiveGame.BaseNonXboxSaveLocation != null && ActiveGame.BaseNonXboxSaveLocation != string.Empty)
{
dialog.SelectedPath = ActiveGame.BaseNonXboxSaveLocation;
}
res = dialog.ShowDialog();
if (res == DialogResult.OK)
{
Expand Down

0 comments on commit 98f8a4d

Please sign in to comment.