diff --git a/cmonitor.llock.win/cmonitor.llock.win.csproj.user b/cmonitor.llock.win/cmonitor.llock.win.csproj.user index 317a8c7b..cf98a901 100644 --- a/cmonitor.llock.win/cmonitor.llock.win.csproj.user +++ b/cmonitor.llock.win/cmonitor.llock.win.csproj.user @@ -1,2 +1,8 @@  - \ No newline at end of file + + + + Form + + + \ No newline at end of file diff --git a/cmonitor.wallpaper.win/Program.cs b/cmonitor.wallpaper.win/Program.cs index 0d47ea01..0ad4082e 100644 --- a/cmonitor.wallpaper.win/Program.cs +++ b/cmonitor.wallpaper.win/Program.cs @@ -20,7 +20,7 @@ namespace cmonitor.wallpaper.win string imgUrl = "./bg.jpg"; string shareMkey = "cmonitor/share"; - int shareMLength = 10; + int shareMLength = 100; int shareItemMLength = 1024; int shareKeyBoardIndex = 1; int shareWallpaperIndex = 2; diff --git a/cmonitor/plugins/llock/report/LLockReport.cs b/cmonitor/plugins/llock/report/LLockReport.cs index eb6ffa31..3b32d47b 100644 --- a/cmonitor/plugins/llock/report/LLockReport.cs +++ b/cmonitor/plugins/llock/report/LLockReport.cs @@ -34,14 +34,9 @@ namespace cmonitor.plugins.llock.report public object GetReports(ReportType reportType) { - if (reportType == ReportType.Full || shareMemory.ReadVersionUpdated((int)ShareMemoryIndexs.LLock)) + report.LockScreen = Running(); + if (reportType == ReportType.Full || report.Updated() || shareMemory.ReadVersionUpdated((int)ShareMemoryIndexs.LLock)) { - bool old = lLockConfigInfo.Open; - lLockConfigInfo.Open = report.LockScreen = Running(); - if (lLockConfigInfo.Open != old) - { - clientConfig.Set(lLockConfigInfo); - } return report; } return null; @@ -96,9 +91,14 @@ namespace cmonitor.plugins.llock.report public bool Open { get; set; } } - public sealed class LLockReportInfo + public sealed class LLockReportInfo : ReportInfo { public bool LockScreen { get; set; } + + public override int HashCode() + { + return LockScreen.GetHashCode(); + } } } diff --git a/cmonitor/plugins/share/report/ShareReport.cs b/cmonitor/plugins/share/report/ShareReport.cs index e41eeb34..55e3cd21 100644 --- a/cmonitor/plugins/share/report/ShareReport.cs +++ b/cmonitor/plugins/share/report/ShareReport.cs @@ -2,6 +2,7 @@ using cmonitor.config; using cmonitor.libs; using common.libs; +using Microsoft.Win32; namespace cmonitor.plugins.share.report { @@ -20,11 +21,34 @@ namespace cmonitor.plugins.share.report if (config.Common.BlueProtect && OperatingSystem.IsWindows()) { ProcessBlueProtection.Protect(); + SystemEvents.SessionEnding += SystemEvents_SessionEnding; + SystemEvents.SessionSwitch += SystemEvents_SessionSwitch; } #endif + this.shareMemory = shareMemory; InitShare(); } + + private void SystemEvents_SessionSwitch(object sender, SessionSwitchEventArgs e) + { + if (OperatingSystem.IsWindows()) + { + if (e.Reason == SessionSwitchReason.SessionLogoff) + { + ProcessBlueProtection.Unprotect(); + } + } + } + + private void SystemEvents_SessionEnding(object sender, SessionEndingEventArgs e) + { + if (OperatingSystem.IsWindows()) + { + ProcessBlueProtection.Unprotect(); + } + } + public object GetReports(ReportType reportType) { bool updated = GetShare(); diff --git a/cmonitor/plugins/wallpaper/report/WallpaperReport.cs b/cmonitor/plugins/wallpaper/report/WallpaperReport.cs index a022c99f..c0d6bd61 100644 --- a/cmonitor/plugins/wallpaper/report/WallpaperReport.cs +++ b/cmonitor/plugins/wallpaper/report/WallpaperReport.cs @@ -33,10 +33,9 @@ namespace cmonitor.plugins.wallpaper.report public object GetReports(ReportType reportType) { - if (reportType == ReportType.Full || shareMemory.ReadVersionUpdated((int)ShareMemoryIndexs.Wallpaper)) + report.Value = Running(); + if (reportType == ReportType.Full || report.Updated() || shareMemory.ReadVersionUpdated((int)ShareMemoryIndexs.Wallpaper)) { - report.Value = Running(); - return report; } return null;