mirror of
https://github.com/kangyu-california/PersistentWindows.git
synced 2025-05-12 13:35:39 +02:00
#354, add command option -restore_snapshot "[0-9a-z]"
This commit is contained in:
parent
5a794baf8b
commit
0e622b8021
2 changed files with 39 additions and 1 deletions
|
@ -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)
|
public bool Start(bool auto_restore_from_db, bool auto_restore_last_capture_at_startup)
|
||||||
{
|
{
|
||||||
process = Process.GetCurrentProcess();
|
process = Process.GetCurrentProcess();
|
||||||
|
@ -2971,6 +2993,7 @@ namespace PersistentWindows.Common
|
||||||
//vacantDeskWindow = User32.FindWindowEx(vacantDeskWindow, IntPtr.Zero, "SHELLDLL_DefView", "");
|
//vacantDeskWindow = User32.FindWindowEx(vacantDeskWindow, IntPtr.Zero, "SHELLDLL_DefView", "");
|
||||||
//vacantDeskWindow = User32.FindWindowEx(vacantDeskWindow, IntPtr.Zero, "SysListView32", "FolderView");
|
//vacantDeskWindow = User32.FindWindowEx(vacantDeskWindow, IntPtr.Zero, "SysListView32", "FolderView");
|
||||||
//show icon on taskbar
|
//show icon on taskbar
|
||||||
|
if (hideRestoreTip != null)
|
||||||
hideRestoreTip();
|
hideRestoreTip();
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -82,6 +82,7 @@ if not errorlevel 1 goto wait_to_finish";
|
||||||
bool auto_upgrade = false;
|
bool auto_upgrade = false;
|
||||||
bool legacy_icon = false;
|
bool legacy_icon = false;
|
||||||
bool waiting_taskbar = false;
|
bool waiting_taskbar = false;
|
||||||
|
int restore_snapshot = -1;
|
||||||
|
|
||||||
foreach (var arg in args)
|
foreach (var arg in args)
|
||||||
{
|
{
|
||||||
|
@ -137,6 +138,11 @@ if not errorlevel 1 goto wait_to_finish";
|
||||||
hotkey = arg[0];
|
hotkey = arg[0];
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
else if (restore_snapshot != -1)
|
||||||
|
{
|
||||||
|
restore_snapshot = SnapshotCharToId(arg[0]);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
switch(arg)
|
switch(arg)
|
||||||
{
|
{
|
||||||
|
@ -287,9 +293,18 @@ if not errorlevel 1 goto wait_to_finish";
|
||||||
case "-dump_window_pos_at_exit=0":
|
case "-dump_window_pos_at_exit=0":
|
||||||
pwp.dumpDataWhenExit = false;
|
pwp.dumpDataWhenExit = false;
|
||||||
break;
|
break;
|
||||||
|
case "-restore_snapshot":
|
||||||
|
restore_snapshot = 0;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (restore_snapshot >= 0)
|
||||||
|
{
|
||||||
|
pwp.RestoreSnapshotCmd(restore_snapshot);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
string productName = System.Windows.Forms.Application.ProductName;
|
string productName = System.Windows.Forms.Application.ProductName;
|
||||||
string appDataFolder = redirect_appdata ? "." :
|
string appDataFolder = redirect_appdata ? "." :
|
||||||
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
|
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue