#354, add command option -restore_snapshot "[0-9a-z]"

This commit is contained in:
Kang Yu 2025-02-02 11:58:06 -08:00
parent 5a794baf8b
commit 0e622b8021
2 changed files with 39 additions and 1 deletions

View file

@ -567,6 +567,28 @@ namespace PersistentWindows.Common
}
public void RestoreSnapshotCmd(int id)
{
string productName = System.Windows.Forms.Application.ProductName;
appDataFolder = redirectAppDataFolder ? "." :
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), productName);
#if DEBUG
//avoid db path conflict with release version
//appDataFolder = ".";
appDataFolder = AppDomain.CurrentDomain.BaseDirectory;
#endif
ReadDataDumpSafe();
curDisplayKey = GetDisplayKey();
CaptureNewDisplayConfig(curDisplayKey);
//RestoreSnapshot(id);
restoringSnapshot = true;
snapshotId = id;
restoringFromMem = true;
RestoreApplicationsOnCurrentDisplays(curDisplayKey, IntPtr.Zero, DateTime.Now);
}
public bool Start(bool auto_restore_from_db, bool auto_restore_last_capture_at_startup)
{
process = Process.GetCurrentProcess();
@ -2971,7 +2993,8 @@ namespace PersistentWindows.Common
//vacantDeskWindow = User32.FindWindowEx(vacantDeskWindow, IntPtr.Zero, "SHELLDLL_DefView", "");
//vacantDeskWindow = User32.FindWindowEx(vacantDeskWindow, IntPtr.Zero, "SysListView32", "FolderView");
//show icon on taskbar
hideRestoreTip();
if (hideRestoreTip != null)
hideRestoreTip();
}
continue;
}