Skip to content

Commit 1aaf764

Browse files
authored
[MWB] - refactoring "Common" classes - Common.Log.cs, Common.Receiver.cs (#35726)
1 parent 44f170d commit 1aaf764

19 files changed

+698
-661
lines changed

src/modules/MouseWithoutBorders/App/Class/Common.Clipboard.cs

+10-7
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,17 @@
3232
using MouseWithoutBorders.Exceptions;
3333

3434
using SystemClipboard = System.Windows.Forms.Clipboard;
35+
using Thread = MouseWithoutBorders.Core.Thread;
3536

3637
namespace MouseWithoutBorders
3738
{
3839
internal partial class Common
3940
{
40-
private const uint BIG_CLIPBOARD_DATA_TIMEOUT = 30000;
41+
internal static readonly char[] Comma = new char[] { ',' };
42+
internal static readonly char[] Star = new char[] { '*' };
43+
internal static readonly char[] NullSeparator = new char[] { '\0' };
44+
45+
internal const uint BIG_CLIPBOARD_DATA_TIMEOUT = 30000;
4146
private const uint MAX_CLIPBOARD_DATA_SIZE_CAN_BE_SENT_INSTANTLY_TCP = 1024 * 1024; // 1MB
4247
private const uint MAX_CLIPBOARD_FILE_SIZE_CAN_BE_SENT = 100 * 1024 * 1024; // 100MB
4348
private const int TEXT_HEADER_SIZE = 12;
@@ -46,11 +51,9 @@ internal partial class Common
4651
private static long lastClipboardEventTime;
4752
private static string lastMachineWithClipboardData;
4853
private static string lastDragDropFile;
49-
private static long clipboardCopiedTime;
50-
51-
internal static readonly char[] Comma = new char[] { ',' };
52-
internal static readonly char[] Star = new char[] { '*' };
53-
internal static readonly char[] NullSeparator = new char[] { '\0' };
54+
#pragma warning disable SA1307 // Accessible fields should begin with upper-case letter
55+
internal static long clipboardCopiedTime;
56+
#pragma warning restore SA1307
5457

5558
internal static ID LastIDWithClipboardData { get; set; }
5659

@@ -332,7 +335,7 @@ internal static void ReceiveClipboardDataUsingTCP(DATA data, bool image, TcpSk t
332335
break;
333336

334337
default:
335-
ProcessPackage(data, tcp);
338+
Receiver.ProcessPackage(data, tcp);
336339
if (++unexpectedCount > 100)
337340
{
338341
Logger.Log("ReceiveClipboardDataUsingTCP: unexpectedCount > 100!");

src/modules/MouseWithoutBorders/App/Class/Common.DragDrop.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
using MouseWithoutBorders.Class;
2323
using MouseWithoutBorders.Core;
2424

25+
using Thread = MouseWithoutBorders.Core.Thread;
26+
2527
namespace MouseWithoutBorders
2628
{
2729
/* Common.DragDrop.cs
@@ -238,7 +240,7 @@ internal static void DragDropStep06()
238240

239241
internal static void DragDropStep08(DATA package)
240242
{
241-
GetNameOfMachineWithClipboardData(package);
243+
Receiver.GetNameOfMachineWithClipboardData(package);
242244
Logger.LogDebug("DragDropStep08: ClipboardDragDrop Received. machine with drag file was set");
243245
}
244246

src/modules/MouseWithoutBorders/App/Class/Common.Event.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
using MouseWithoutBorders.Core;
2222
using MouseWithoutBorders.Form;
2323

24+
using Thread = MouseWithoutBorders.Core.Thread;
25+
2426
namespace MouseWithoutBorders
2527
{
2628
internal partial class Common
@@ -145,7 +147,7 @@ internal static void MouseEvent(MOUSEDATA e, int dx, int dy)
145147
}
146148
}
147149

148-
private static bool IsSwitchingByMouseEnabled()
150+
internal static bool IsSwitchingByMouseEnabled()
149151
{
150152
return (EasyMouseOption)Setting.Values.EasyMouse == EasyMouseOption.Enable || InputHook.EasyMouseKeyDown;
151153
}

src/modules/MouseWithoutBorders/App/Class/Common.InitAndCleanup.cs

+2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
using MouseWithoutBorders.Form;
2424
using Windows.UI.Input.Preview.Injection;
2525

26+
using Thread = MouseWithoutBorders.Core.Thread;
27+
2628
namespace MouseWithoutBorders
2729
{
2830
internal partial class Common

src/modules/MouseWithoutBorders/App/Class/Common.Log.cs

-119
This file was deleted.

src/modules/MouseWithoutBorders/App/Class/Common.MachineStuff.cs

+7-3
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,14 @@ internal partial class Common
5151
private const int SKIP_PIXELS = 1;
5252
private const int JUMP_PIXELS = 2;
5353

54-
private static ID desMachineID;
54+
#pragma warning disable SA1307 // Accessible fields should begin with upper-case letter
55+
internal static ID desMachineID;
56+
#pragma warning restore SA1307
5557
internal static string DesMachineName = string.Empty;
5658
private static ID newDesMachineID;
57-
private static ID newDesMachineIdEx;
59+
#pragma warning disable SA1307 // Accessible fields should begin with upper-case letter
60+
internal static ID newDesMachineIdEx;
61+
#pragma warning restore SA1307
5862
private static ID dropMachineID;
5963

6064
private static long lastJump = Common.GetTick();
@@ -720,7 +724,7 @@ internal static void RemoveDeadMachines()
720724
}
721725
}
722726

723-
private static string AddToMachinePool(DATA package)
727+
internal static string AddToMachinePool(DATA package)
724728
{
725729
// Log("********** AddToMachinePool called: " + package.src.ToString(CultureInfo.InvariantCulture));
726730

0 commit comments

Comments
 (0)