[MWB] - refactoring "Common" classes - Common.Log.cs, Common.Receiver.cs (#35726)

This commit is contained in:
Michael Clayton
2025-01-17 15:41:39 +00:00
committed by GitHub
parent 44f170d4ed
commit 1aaf764c14
19 changed files with 698 additions and 661 deletions

View File

@@ -4,20 +4,28 @@
[Other Logs]
===============
= MouseWithoutBorders.Common
lastClipboardEventTime = 0
clipboardCopiedTime = 0
Comma = System.Char[]
--System.Char[] = System.Char[]: N/A
Star = System.Char[]
--System.Char[] = System.Char[]: N/A
NullSeparator = System.Char[]
--System.Char[] = System.Char[]: N/A
lastClipboardEventTime = 0
clipboardCopiedTime = 0
<LastIDWithClipboardData>k__BackingField = NONE
<NextClipboardViewer>k__BackingField = 0
<IsClipboardDataImage>k__BackingField = False
lastClipboardObject =
<HasSwitchedMachineSinceLastCopy>k__BackingField = False
ClipboardThreadOldLock = O
ClipboardThreadOldLock = Lock
--_owningThreadId = 0
--_state = 0
--_recursionCount = 0
--_spinCount = 22
--_waiterStartTimeMs = 0
--s_contentionCount = 0
--s_maxSpinCount = 22
--s_minSpinCountForAdaptiveSpin = -100
screenWidth = 0
screenHeight = 0
lastX = 0
@@ -43,7 +51,15 @@ socketMutexBalance = 0
<BlockingUI>k__BackingField = False
<UIThreadID>k__BackingField = 0
<InputCallbackThreadID>k__BackingField = 0
InputSimulationLock = O
InputSimulationLock = Lock
--_owningThreadId = 0
--_state = 0
--_recursionCount = 0
--_spinCount = 22
--_waiterStartTimeMs = 0
--s_contentionCount = 0
--s_maxSpinCount = 22
--s_minSpinCountForAdaptiveSpin = -100
lastSendNextMachine = 0
lastInputEventCount = 0
lastRealInputEventCount = 0
@@ -85,15 +101,7 @@ LegalKeyDictionary = Concurrent.ConcurrentDictionary`2[System.String,System.Byte
------[5] = 0
------[6] = 0
------[7] = 0
------[8] = 0
------[9] = 0
------[10] = 0
------[11] = 0
------[12] = 0
------[13] = 0
------[14] = 0
------[15] = 0
--_budget = 2
--_budget = ????????????
--_growLockArray = True
--_comparerIsDefaultForClasses = False
KeybdPackage = MouseWithoutBorders.DATA
@@ -155,7 +163,15 @@ ReopenSocketDueToReadError = False
--MaxValue = 31/12/9999 23:59:59
--UnixEpoch = 01/01/1970 00:00:00
lastReleaseAllKeysCall = 0
McMatrixLock = O
McMatrixLock = Lock
--_owningThreadId = 0
--_state = 0
--_recursionCount = 0
--_spinCount = 22
--_waiterStartTimeMs = 0
--s_contentionCount = 0
--s_maxSpinCount = 22
--s_minSpinCountForAdaptiveSpin = -100
desMachineID = NONE
DesMachineName =
newDesMachineID = NONE
@@ -207,66 +223,6 @@ PackageReceived = MouseWithoutBorders.PackageMonitor
--ExplorerDragDrop = 0
--Nil = 0
PackageID = 0
QUEUE_SIZE = 50
RecentProcessedPackageIDs = 32[]
--[0] = 0
--[1] = 0
--[2] = 0
--[3] = 0
--[4] = 0
--[5] = 0
--[6] = 0
--[7] = 0
--[8] = 0
--[9] = 0
--[10] = 0
--[11] = 0
--[12] = 0
--[13] = 0
--[14] = 0
--[15] = 0
--[16] = 0
--[17] = 0
--[18] = 0
--[19] = 0
--[20] = 0
--[21] = 0
--[22] = 0
--[23] = 0
--[24] = 0
--[25] = 0
--[26] = 0
--[27] = 0
--[28] = 0
--[29] = 0
--[30] = 0
--[31] = 0
--[32] = 0
--[33] = 0
--[34] = 0
--[35] = 0
--[36] = 0
--[37] = 0
--[38] = 0
--[39] = 0
--[40] = 0
--[41] = 0
--[42] = 0
--[43] = 0
--[44] = 0
--[45] = 0
--[46] = 0
--[47] = 0
--[48] = 0
--[49] = 0
recentProcessedPackageIndex = 0
processedPackageCount = 0
skippedPackageCount = 0
<JustGotAKey>k__BackingField = 0
lastXY = {X=0,Y=0}
--x = 0
--y = 0
--Empty = {X=0,Y=0}
shownErrMessage = False
lastStartServiceTime = ????????????
--_dateData = ????????????
@@ -334,9 +290,17 @@ WM_KEYDOWN = 256
WM_KEYUP = 257
WM_SYSKEYDOWN = 260
WM_SYSKEYUP = 261
[Logger Logs]
[Logger]
===============
AllLogsLock = O
AllLogsLock = Lock
--_owningThreadId = 0
--_state = 0
--_recursionCount = 0
--_spinCount = 22
--_waiterStartTimeMs = 0
--s_contentionCount = 0
--s_maxSpinCount = 22
--s_minSpinCountForAdaptiveSpin = -100
LogCounter = Concurrent.ConcurrentDictionary`2[System.String,32]
--_tables = Concurrent.ConcurrentDictionary`2+Tables[System.String,32]
----_comparer = Generic.NonRandomizedStringEqualityComparer+OrdinalComparer
@@ -354,15 +318,7 @@ LogCounter = Concurrent.ConcurrentDictionary`2[System.String,32]
------[5] = 0
------[6] = 0
------[7] = 0
------[8] = 0
------[9] = 0
------[10] = 0
------[11] = 0
------[12] = 0
------[13] = 0
------[14] = 0
------[15] = 0
--_budget = 2
--_budget = ????????????
--_growLockArray = True
--_comparerIsDefaultForClasses = False
allLogsIndex = 0
@@ -402,3 +358,65 @@ MAX_LOG = 10000
MaxLogExceptionPerHour = 1000
HeaderSENT = Be{0},Ke{1},Mo{2},He{3},Mx{4},Tx{5},Im{6},By{7},Cl{8},Dr{9},De{10},Ed{11},Ie{12},Ni{13}
HeaderRECEIVED = Be{0},Ke{1},Mo{2},He{3},Mx{4},Tx{5},Im{6},By{7},Cl{8},Dr{9},De{10},Ed{11},In{12},Ni{13},Pc{14}/{15}
[Receiver]
===============
QUEUE_SIZE = 50
RecentProcessedPackageIDs = 32[]
--[0] = 0
--[1] = 0
--[2] = 0
--[3] = 0
--[4] = 0
--[5] = 0
--[6] = 0
--[7] = 0
--[8] = 0
--[9] = 0
--[10] = 0
--[11] = 0
--[12] = 0
--[13] = 0
--[14] = 0
--[15] = 0
--[16] = 0
--[17] = 0
--[18] = 0
--[19] = 0
--[20] = 0
--[21] = 0
--[22] = 0
--[23] = 0
--[24] = 0
--[25] = 0
--[26] = 0
--[27] = 0
--[28] = 0
--[29] = 0
--[30] = 0
--[31] = 0
--[32] = 0
--[33] = 0
--[34] = 0
--[35] = 0
--[36] = 0
--[37] = 0
--[38] = 0
--[39] = 0
--[40] = 0
--[41] = 0
--[42] = 0
--[43] = 0
--[44] = 0
--[45] = 0
--[46] = 0
--[47] = 0
--[48] = 0
--[49] = 0
recentProcessedPackageIndex = 0
processedPackageCount = 0
skippedPackageCount = 0
<JustGotAKey>k__BackingField = 0
lastXY = {X=0,Y=0}
--x = 0
--y = 0
--Empty = {X=0,Y=0}

View File

@@ -62,6 +62,7 @@ public static class LoggerTests
"lastJump = ",
"lastStartServiceTime = ",
"InitialIV = ",
"--_budget = ",
};
for (var i = 0; i < lines.Length; i++)
{
@@ -89,6 +90,10 @@ public static class LoggerTests
"------[13] = 0",
"------[14] = 0",
"------[15] = 0",
"------[16] = 0",
"------[17] = 0",
"------[18] = 0",
"------[19] = 0",
};
lines = lines.Where(line => !removeLines.Contains(line)).ToArray();
@@ -113,8 +118,10 @@ public static class LoggerTests
var sb = new StringBuilder(1000000);
_ = Logger.PrivateDump(sb, Logger.AllLogs, "[Program logs]\r\n===============\r\n", 0, settingsDumpObjectsLevel, false);
_ = Logger.PrivateDump(sb, new Common(), "[Other Logs]\r\n===============\r\n", 0, settingsDumpObjectsLevel, false);
sb.AppendLine("[Logger Logs]\r\n===============");
sb.AppendLine("[Logger]\r\n===============");
Logger.DumpType(sb, typeof(Logger), 0, settingsDumpObjectsLevel);
sb.AppendLine("[Receiver]\r\n===============");
Logger.DumpType(sb, typeof(Receiver), 0, settingsDumpObjectsLevel);
var actual = sb.ToString();
expected = NormalizeLog(expected);
@@ -146,8 +153,6 @@ public static class LoggerTests
message.AppendLine(CultureInfo.InvariantCulture, $"[{j}]: {expectedLines[j]}:");
}
var x = new ConcurrentDictionary<string, string>(-1, 16);
Assert.Fail(message.ToString());
}
}