Skip to content

Commit 6dbbbb8

Browse files
authored
Merge into develop
Merge into develop
2 parents 12d459f + 9020265 commit 6dbbbb8

File tree

2 files changed

+31
-7
lines changed

2 files changed

+31
-7
lines changed

gamevault/Helper/Integrations/SaveGameHelper.cs

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,13 @@ internal async Task<bool> RestoreBackup(int gameId, string installationDir)
9595
Process process = new Process();
9696
ProcessShepherd.Instance.AddProcess(process);
9797
process.StartInfo = CreateProcessHeader();
98-
process.StartInfo.Arguments = $"--config {AppFilePath.CloudSaveConfigDir} restore --force --path \"{extractFolder}\"";
98+
//process.StartInfo.Arguments = $"--config {AppFilePath.CloudSaveConfigDir} restore --force --path \"{extractFolder}\"";
99+
process.StartInfo.ArgumentList.Add("--config");
100+
process.StartInfo.ArgumentList.Add(AppFilePath.CloudSaveConfigDir);
101+
process.StartInfo.ArgumentList.Add("restore");
102+
process.StartInfo.ArgumentList.Add("--force");
103+
process.StartInfo.ArgumentList.Add("--path");
104+
process.StartInfo.ArgumentList.Add(extractFolder);
99105
process.Start();
100106
process.WaitForExit();
101107
ProcessShepherd.Instance.RemoveProcess(process);
@@ -167,20 +173,20 @@ internal async Task BackupSaveGamesFromIds(List<int> gameIds)
167173
}
168174
internal async Task<bool> BackupSaveGame(int gameId)
169175
{
170-
if (!SettingsViewModel.Instance.License.IsActive())
176+
if (!SettingsViewModel.Instance.CloudSaves || !SettingsViewModel.Instance.License.IsActive())
171177
return false;
172178

173179
var installedGame = InstallViewModel.Instance?.InstalledGames?.FirstOrDefault(g => g.Key?.ID == gameId);
174180
string gameMetadataTitle = installedGame?.Key?.Metadata?.Title ?? "";
175181
string installationDir = installedGame?.Value ?? "";
176182
if (gameMetadataTitle != "" && installationDir != "")
177183
{
184+
PrepareConfigFile(installedGame?.Value!, Path.Combine(AppFilePath.CloudSaveConfigDir, "config.yaml"));
178185
string title = await SearchForLudusaviGameTitle(gameMetadataTitle);
179186
if (string.IsNullOrEmpty(title))
180187
return false;
181188
string tempFolder = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
182189
Directory.CreateDirectory(tempFolder);
183-
PrepareConfigFile(installedGame?.Value!, Path.Combine(AppFilePath.CloudSaveConfigDir, "config.yaml"));
184190
await CreateBackup(title, tempFolder);
185191
string archive = Path.Combine(tempFolder, "backup.zip");
186192
if (Directory.GetFiles(tempFolder, "mapping.yaml", SearchOption.AllDirectories).Length == 0)
@@ -266,7 +272,13 @@ internal async Task<string> SearchForLudusaviGameTitle(string title)
266272
Process process = new Process();
267273
ProcessShepherd.Instance.AddProcess(process);
268274
process.StartInfo = CreateProcessHeader(true);
269-
process.StartInfo.Arguments = $"find \"{title}\" --fuzzy --api";//--normalized
275+
//process.StartInfo.Arguments = $"find \"{title}\" --fuzzy --api";//--normalized
276+
process.StartInfo.ArgumentList.Add("--config");
277+
process.StartInfo.ArgumentList.Add(AppFilePath.CloudSaveConfigDir);
278+
process.StartInfo.ArgumentList.Add("find");
279+
process.StartInfo.ArgumentList.Add(title);
280+
process.StartInfo.ArgumentList.Add("--fuzzy");
281+
process.StartInfo.ArgumentList.Add("--api");
270282
process.EnableRaisingEvents = true;
271283

272284
List<string> output = new List<string>();
@@ -302,7 +314,17 @@ await Task.Run(() =>
302314
Process process = new Process();
303315
ProcessShepherd.Instance.AddProcess(process);
304316
process.StartInfo = CreateProcessHeader();
305-
process.StartInfo.Arguments = $"--config {AppFilePath.CloudSaveConfigDir} backup --force --format \"zip\" --path \"{tempFolder}\" \"{lunusaviTitle}\"";
317+
//process.StartInfo.Arguments = $"--config {AppFilePath.CloudSaveConfigDir} backup --force --format \"zip\" --path \"{tempFolder}\" \"{lunusaviTitle}\"";
318+
process.StartInfo.ArgumentList.Add("--config");
319+
process.StartInfo.ArgumentList.Add(AppFilePath.CloudSaveConfigDir);
320+
process.StartInfo.ArgumentList.Add("backup");
321+
process.StartInfo.ArgumentList.Add("--force");
322+
process.StartInfo.ArgumentList.Add("--format");
323+
process.StartInfo.ArgumentList.Add("zip");
324+
process.StartInfo.ArgumentList.Add("--path");
325+
process.StartInfo.ArgumentList.Add(tempFolder);
326+
process.StartInfo.ArgumentList.Add(lunusaviTitle);
327+
306328
process.Start();
307329
process.WaitForExit();
308330
ProcessShepherd.Instance.RemoveProcess(process);

gamevault/UserControls/GameViewUserControl.xaml.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
using System.Windows.Input;
2525
using System.Windows.Markup;
2626
using System.Windows.Navigation;
27+
using Windows.Gaming.Input;
2728
using YoutubeExplode;
2829
using YoutubeExplode.Videos.Streams;
2930

@@ -163,6 +164,7 @@ private async void UserControl_Loaded(object sender, RoutedEventArgs e)
163164
{
164165
try
165166
{
167+
SaveGameHelper.Instance.PrepareConfigFile("", Path.Combine(AppFilePath.CloudSaveConfigDir, "config.yaml"));
166168
ViewModel.CloudSaveMatchTitle = await SaveGameHelper.Instance.SearchForLudusaviGameTitle(ViewModel?.Game?.Metadata?.Title);
167169
}
168170
catch { }
@@ -447,7 +449,7 @@ private async void RestoreCloudSaves_Click(object sender, RoutedEventArgs e)
447449
if (success)
448450
{
449451
MainWindowViewModel.Instance.AppBarText = "Successfully synchronized the cloud save";
450-
}
452+
}
451453
}
452454
catch
453455
{
@@ -488,6 +490,6 @@ private void PrepareMarkdownElements()
488490
}
489491

490492
#endregion
491-
493+
492494
}
493495
}

0 commit comments

Comments
 (0)