mirror of
https://github.com/kangyu-california/PersistentWindows.git
synced 2025-05-11 04:55:39 +02:00
persist snapshot captures on disk
This commit is contained in:
parent
ef02d287d5
commit
e8322d5a8a
2 changed files with 7 additions and 5 deletions
|
@ -217,6 +217,9 @@ namespace PersistentWindows.Common
|
||||||
|
|
||||||
public void WriteDataDump()
|
public void WriteDataDump()
|
||||||
{
|
{
|
||||||
|
if (!dumpDataWhenExit)
|
||||||
|
return;
|
||||||
|
|
||||||
DataContractSerializer dcs = new DataContractSerializer(typeof(Dictionary<string, Dictionary<IntPtr, List<ApplicationDisplayMetrics>>>));
|
DataContractSerializer dcs = new DataContractSerializer(typeof(Dictionary<string, Dictionary<IntPtr, List<ApplicationDisplayMetrics>>>));
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
using (XmlWriter xw = XmlWriter.Create(sb))
|
using (XmlWriter xw = XmlWriter.Create(sb))
|
||||||
|
@ -240,7 +243,7 @@ namespace PersistentWindows.Common
|
||||||
{
|
{
|
||||||
deadApps = (Dictionary<string, Dictionary<IntPtr, List<ApplicationDisplayMetrics>>>)dcs.ReadObject(xr);
|
deadApps = (Dictionary<string, Dictionary<IntPtr, List<ApplicationDisplayMetrics>>>)dcs.ReadObject(xr);
|
||||||
}
|
}
|
||||||
File.Delete(Path.Combine(appDataFolder, windowPosDataFile));
|
//File.Delete(Path.Combine(appDataFolder, windowPosDataFile));
|
||||||
|
|
||||||
string path2 = Path.Combine(appDataFolder, snapshotTimeFile);
|
string path2 = Path.Combine(appDataFolder, snapshotTimeFile);
|
||||||
if (!File.Exists(path2))
|
if (!File.Exists(path2))
|
||||||
|
@ -251,7 +254,7 @@ namespace PersistentWindows.Common
|
||||||
{
|
{
|
||||||
snapshotTakenTime = (Dictionary<string, Dictionary<int, DateTime>>)dcs2.ReadObject(xr);
|
snapshotTakenTime = (Dictionary<string, Dictionary<int, DateTime>>)dcs2.ReadObject(xr);
|
||||||
}
|
}
|
||||||
File.Delete(Path.Combine(appDataFolder, snapshotTimeFile));
|
//File.Delete(Path.Combine(appDataFolder, snapshotTimeFile));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ReadDataDumpSafe()
|
private void ReadDataDumpSafe()
|
||||||
|
@ -1972,7 +1975,7 @@ namespace PersistentWindows.Common
|
||||||
Log.Event("Snapshot {0} is captured", snapshotId);
|
Log.Event("Snapshot {0} is captured", snapshotId);
|
||||||
}
|
}
|
||||||
|
|
||||||
DumpSnapshotTakenTime();
|
WriteDataDump();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -814,7 +814,6 @@ namespace PersistentWindows.SystrayShell
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (pwp.dumpDataWhenExit)
|
|
||||||
pwp.WriteDataDump();
|
pwp.WriteDataDump();
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue