mirror of
https://github.com/kangyu-california/PersistentWindows.git
synced 2025-05-11 04:55:39 +02:00
reduce size of history xml
This commit is contained in:
parent
cc2fa3311c
commit
c8575c1b03
1 changed files with 30 additions and 0 deletions
|
@ -218,6 +218,34 @@ namespace PersistentWindows.Common
|
||||||
File.WriteAllText(Path.Combine(appDataFolder, snapshotTimeFile), xml2, Encoding.Unicode);
|
File.WriteAllText(Path.Combine(appDataFolder, snapshotTimeFile), xml2, Encoding.Unicode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void TrimDumpHistory(Dictionary<string, Dictionary<IntPtr, List<ApplicationDisplayMetrics>>> dump_apps)
|
||||||
|
{
|
||||||
|
foreach (var display_key in dump_apps.Keys)
|
||||||
|
{
|
||||||
|
foreach (var hwnd in dump_apps[display_key].Keys)
|
||||||
|
{
|
||||||
|
if (dualPosSwitchWindows.Contains(hwnd))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
List<int> history = new List<int>();
|
||||||
|
for (int i = 0; i < dump_apps[display_key][hwnd].Count; ++i)
|
||||||
|
{
|
||||||
|
if (dump_apps[display_key][hwnd][i].SnapShotFlags != 0)
|
||||||
|
continue;
|
||||||
|
if (!dump_apps[display_key][hwnd][i].IsValid)
|
||||||
|
continue;
|
||||||
|
history.Add(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
//keep the last record
|
||||||
|
for (int i = history.Count - 2; i >= 0; --i)
|
||||||
|
{
|
||||||
|
dump_apps[display_key][hwnd].RemoveAt(history[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void WriteDataDumpCore(bool dump_dead_window)
|
private void WriteDataDumpCore(bool dump_dead_window)
|
||||||
{
|
{
|
||||||
DataContractSerializer dcs = new DataContractSerializer(typeof(Dictionary<string, Dictionary<IntPtr, List<ApplicationDisplayMetrics>>>));
|
DataContractSerializer dcs = new DataContractSerializer(typeof(Dictionary<string, Dictionary<IntPtr, List<ApplicationDisplayMetrics>>>));
|
||||||
|
@ -239,6 +267,8 @@ namespace PersistentWindows.Common
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TrimDumpHistory(allApps);
|
||||||
|
|
||||||
dcs.WriteObject(xw, allApps);
|
dcs.WriteObject(xw, allApps);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue