Improved loading speed by skipping game loading in certain instances

No longer attempt to load games in profile reload, and in create profile. Need it for all other modes, but at least those two load quicker now!
This commit is contained in:
Terry MacDonald 2021-10-30 20:05:44 +13:00
parent 9cdb1cb3f2
commit 5f266aacbb
2 changed files with 19 additions and 6 deletions

View File

@ -316,6 +316,9 @@ namespace DisplayMagician {
// This is the RunShortcut command
app.Command(DisplayMagicianStartupAction.RunShortcut.ToString(), (runShortcutCmd) =>
{
// Try to load all the games in parallel to this process
Task.Run(() => LoadGamesInBackground());
// Set the --trace or --debug options if supplied
if (trace.HasValue())
{
@ -588,6 +591,10 @@ namespace DisplayMagician {
}
}
logger.Info("Starting Normally...");
// Try to load all the games in parallel to this process
Task.Run(() => LoadGamesInBackground());
StartUpApplication();
return 0;
});
@ -603,10 +610,7 @@ namespace DisplayMagician {
splashThread.SetApartmentState(ApartmentState.STA);
splashThread.Start();
}
// Try to load all the games in parallel to this process
Task.Run(() => LoadGamesInBackground());
}
try
{
@ -658,6 +662,9 @@ namespace DisplayMagician {
IPCService.GetInstance().Status = InstanceStatus.User;
if (ProgramSettings.LoadSettings().ShowSplashScreen && AppSplashScreen != null && !AppSplashScreen.Disposing && !AppSplashScreen.IsDisposed)
AppSplashScreen.Invoke(new Action(() => AppSplashScreen.Close()));
// Run the program with directly showing CreateProfile form
Application.Run(new DisplayProfileForm());
@ -788,6 +795,9 @@ namespace DisplayMagician {
throw new Exception(Language.Cannot_find_shortcut_in_library);
}
if (ProgramSettings.LoadSettings().ShowSplashScreen && AppSplashScreen != null && !AppSplashScreen.Disposing && !AppSplashScreen.IsDisposed)
AppSplashScreen.Invoke(new Action(() => AppSplashScreen.Close()));
if (shortcutToRun is ShortcutItem)
{
ShortcutRepository.RunShortcut(shortcutToRun);
@ -815,6 +825,9 @@ namespace DisplayMagician {
ProfileItem profileToUse = ProfileRepository.AllProfiles.Where(p => p.UUID.Equals(profileName)).First();
logger.Trace($"Program/RunProfile: Found profile called {profileName} and now starting to apply the profile");
if (ProgramSettings.LoadSettings().ShowSplashScreen && AppSplashScreen != null && !AppSplashScreen.Disposing && !AppSplashScreen.IsDisposed)
AppSplashScreen.Invoke(new Action(() => AppSplashScreen.Close()));
ProfileRepository.ApplyProfile(profileToUse);
}

View File

@ -26,8 +26,8 @@ using System.Resources;
[assembly: Guid("e4ceaf5e-ad01-4695-b179-31168eb74c48")]
// Version information
[assembly: AssemblyVersion("2.1.0.59")]
[assembly: AssemblyFileVersion("2.1.0.59")]
[assembly: AssemblyVersion("2.1.0.65")]
[assembly: AssemblyFileVersion("2.1.0.65")]
[assembly: NeutralResourcesLanguageAttribute( "en" )]
[assembly: CLSCompliant(true)]