Skip to content

Commit

Permalink
implemented PowerProfiles and Game arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
Lesueur Benjamin committed Feb 6, 2021
1 parent f70230d commit 3bb7ce9
Show file tree
Hide file tree
Showing 6 changed files with 313 additions and 40 deletions.
Binary file modified .vs/DockerForm/v16/.suo
Binary file not shown.
26 changes: 17 additions & 9 deletions DockerForm/DatabaseManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,18 +81,19 @@ public static void UpdateFilesAndRegistries(DockerGame game, string path_dest, s
string filename = Environment.ExpandEnvironmentVariables(setting.GetUri(game));
string file = Path.GetFileName(filename);

if (!File.Exists(filename))
{
setting.IsEnabled = false;
continue;
}

// check if we have opposite plugged status
if (updateFILE && !setting.data.ContainsKey(path_dest))
path_dest = path_dest.Replace(":False", "");

if (setting.Type == SettingsType.File)
{
if (!File.Exists(filename))
{
setting.IsEnabled = false;
LogManager.UpdateLog("[" + game.Name + "]" + " " + path_dest + " settings disabled for file [" + file + "] - no data available");
continue;
}

// We store the data
byte[] s_file = File.ReadAllBytes(filename);

Expand Down Expand Up @@ -124,14 +125,21 @@ public static void UpdateFilesAndRegistries(DockerGame game, string path_dest, s
string tempfile = Path.Combine(Form1.path_application, "temp.reg");
RegistryManager.ExportKey(filename, tempfile);

if (!File.Exists(tempfile))
{
setting.IsEnabled = false;
LogManager.UpdateLog("[" + game.Name + "]" + " " + path_dest + " settings disabled registry entry " + filename + " - no data available");
continue;
}

// We store the data
byte[] s_file = File.ReadAllBytes(tempfile);

// 1. Save current settings
if (updateDB)
{
setting.data[path_game] = s_file;
LogManager.UpdateLog("[" + game.Name + "]" + " " + path_game + " database updated for registry entry [" + file + "]");
LogManager.UpdateLog("[" + game.Name + "]" + " " + path_game + " database updated for registry entry " + filename);
}

// 2. Restore proper settings
Expand All @@ -141,11 +149,11 @@ public static void UpdateFilesAndRegistries(DockerGame game, string path_dest, s
{
File.WriteAllBytes(tempfile, setting.data[path_dest]);
RegistryManager.RestoreKey(tempfile);
LogManager.UpdateLog("[" + game.Name + "]" + " " + path_dest + " settings restored for registry entry [" + file + "]");
LogManager.UpdateLog("[" + game.Name + "]" + " " + path_dest + " settings restored for registry entry " + filename);
}
else
{
LogManager.UpdateLog("[" + game.Name + "]" + " " + path_dest + " settings restoration skipped for registry entry [" + file + "] - no data available");
LogManager.UpdateLog("[" + game.Name + "]" + " " + path_dest + " settings restoration skipped for registry entry " + filename + " - no data available");
}
}

Expand Down
Loading

0 comments on commit 3bb7ce9

Please sign in to comment.