Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP - [Mouse Without Borders] - refactoring "Common" classes - Common.Log.cs, Common.Receiver.cs #35156 #35726

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions src/modules/MouseWithoutBorders/App/Class/Common.Clipboard.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,17 @@
using MouseWithoutBorders.Exceptions;

using SystemClipboard = System.Windows.Forms.Clipboard;
using Thread = MouseWithoutBorders.Core.Thread;

namespace MouseWithoutBorders
{
internal partial class Common
{
private const uint BIG_CLIPBOARD_DATA_TIMEOUT = 30000;
internal static readonly char[] Comma = new char[] { ',' };
internal static readonly char[] Star = new char[] { '*' };
internal static readonly char[] NullSeparator = new char[] { '\0' };

internal const uint BIG_CLIPBOARD_DATA_TIMEOUT = 30000;
private const uint MAX_CLIPBOARD_DATA_SIZE_CAN_BE_SENT_INSTANTLY_TCP = 1024 * 1024; // 1MB
private const uint MAX_CLIPBOARD_FILE_SIZE_CAN_BE_SENT = 100 * 1024 * 1024; // 100MB
private const int TEXT_HEADER_SIZE = 12;
Expand All @@ -46,11 +51,9 @@ internal partial class Common
private static long lastClipboardEventTime;
private static string lastMachineWithClipboardData;
private static string lastDragDropFile;
private static long clipboardCopiedTime;

internal static readonly char[] Comma = new char[] { ',' };
internal static readonly char[] Star = new char[] { '*' };
internal static readonly char[] NullSeparator = new char[] { '\0' };
#pragma warning disable SA1307 // Accessible fields should begin with upper-case letter
internal static long clipboardCopiedTime;
#pragma warning restore SA1307

internal static ID LastIDWithClipboardData { get; set; }

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

default:
ProcessPackage(data, tcp);
Receiver.ProcessPackage(data, tcp);
if (++unexpectedCount > 100)
{
Logger.Log("ReceiveClipboardDataUsingTCP: unexpectedCount > 100!");
Expand Down
4 changes: 3 additions & 1 deletion src/modules/MouseWithoutBorders/App/Class/Common.DragDrop.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
using MouseWithoutBorders.Class;
using MouseWithoutBorders.Core;

using Thread = MouseWithoutBorders.Core.Thread;

namespace MouseWithoutBorders
{
/* Common.DragDrop.cs
Expand Down Expand Up @@ -238,7 +240,7 @@ internal static void DragDropStep06()

internal static void DragDropStep08(DATA package)
{
GetNameOfMachineWithClipboardData(package);
Receiver.GetNameOfMachineWithClipboardData(package);
Logger.LogDebug("DragDropStep08: ClipboardDragDrop Received. machine with drag file was set");
}

Expand Down
4 changes: 3 additions & 1 deletion src/modules/MouseWithoutBorders/App/Class/Common.Event.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
using MouseWithoutBorders.Core;
using MouseWithoutBorders.Form;

using Thread = MouseWithoutBorders.Core.Thread;

namespace MouseWithoutBorders
{
internal partial class Common
Expand Down Expand Up @@ -145,7 +147,7 @@ internal static void MouseEvent(MOUSEDATA e, int dx, int dy)
}
}

private static bool IsSwitchingByMouseEnabled()
internal static bool IsSwitchingByMouseEnabled()
{
return (EasyMouseOption)Setting.Values.EasyMouse == EasyMouseOption.Enable || InputHook.EasyMouseKeyDown;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
using MouseWithoutBorders.Form;
using Windows.UI.Input.Preview.Injection;

using Thread = MouseWithoutBorders.Core.Thread;

namespace MouseWithoutBorders
{
internal partial class Common
Expand Down
119 changes: 0 additions & 119 deletions src/modules/MouseWithoutBorders/App/Class/Common.Log.cs

This file was deleted.

10 changes: 7 additions & 3 deletions src/modules/MouseWithoutBorders/App/Class/Common.MachineStuff.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,14 @@ internal partial class Common
private const int SKIP_PIXELS = 1;
private const int JUMP_PIXELS = 2;

private static ID desMachineID;
#pragma warning disable SA1307 // Accessible fields should begin with upper-case letter
internal static ID desMachineID;
#pragma warning restore SA1307
internal static string DesMachineName = string.Empty;
private static ID newDesMachineID;
private static ID newDesMachineIdEx;
#pragma warning disable SA1307 // Accessible fields should begin with upper-case letter
internal static ID newDesMachineIdEx;
#pragma warning restore SA1307
private static ID dropMachineID;

private static long lastJump = Common.GetTick();
Expand Down Expand Up @@ -720,7 +724,7 @@ internal static void RemoveDeadMachines()
}
}

private static string AddToMachinePool(DATA package)
internal static string AddToMachinePool(DATA package)
{
// Log("********** AddToMachinePool called: " + package.src.ToString(CultureInfo.InvariantCulture));

Expand Down
Loading
Loading