Ready for Review - [Mouse Without Borders] - refactoring "Common" classes (Part 3) - #35155 (#36950)

* [MWB] - refactoring MachineInf from Common.MachineStuff.cs into MachineInf.cs - #35155

* [MWB] - fixing references to MachineInf - #35155

* [MWB] - cleaning up MachineInf.cs - #35155

* [MWB] - moving MyRectangle from Common.MachineStuff.cs into MyRectangle.cs - #35155

* [MWB] - cleaning up MyRectangle.cs - #35155

* [MWB] - moving Common.MachineStuff.cs to MachineStuff.cs - #35155

* [MWB] - fixing references to MachineStuff - #35155

* [MWB] - cleaning up MachineStuff.cs - #35155

* [MWB] - cleaning up MachineStuff.cs - #35155

* [MWB] - moving Common.DragDrop.cs to DragDrop.cs - #35155

* [MWB] - fixing references to DragDrop - #35155

* [MWB] - fixing unit test - #35155

* [MWB] - cleaning up DragDrop.cs - #35155

* [MWB] - cleaning up DragDrop.cs - #35155
This commit is contained in:
Michael Clayton
2025-02-21 08:31:44 +00:00
committed by GitHub
parent 273a45ff1f
commit 6515374ce9
32 changed files with 1889 additions and 1845 deletions

View File

@@ -31,6 +31,7 @@ using System.Xml.Linq;
using ManagedCommon;
using Microsoft.PowerToys.Settings.UI.Library.Utilities;
using Microsoft.PowerToys.Telemetry;
using MouseWithoutBorders.Core;
using Newtonsoft.Json;
using StreamJsonRpc;
@@ -135,7 +136,7 @@ namespace MouseWithoutBorders.Class
if (firstArg != string.Empty)
{
if (Common.CheckSecondInstance(Common.RunWithNoAdminRight))
if (MachineStuff.CheckSecondInstance(Common.RunWithNoAdminRight))
{
Logger.Log("*** Second instance, exiting...");
return;
@@ -165,7 +166,7 @@ namespace MouseWithoutBorders.Class
}
else
{
if (Common.CheckSecondInstance(true))
if (MachineStuff.CheckSecondInstance(true))
{
Logger.Log("*** Second instance, exiting...");
return;
@@ -301,20 +302,20 @@ namespace MouseWithoutBorders.Class
{
Setting.Values.PauseInstantSaving = true;
Common.ClearComputerMatrix();
MachineStuff.ClearComputerMatrix();
Setting.Values.MyKey = securityKey;
Common.MyKey = securityKey;
Common.MagicNumber = Common.Get24BitHash(Common.MyKey);
Common.MachineMatrix = new string[Common.MAX_MACHINE] { pcName.Trim().ToUpper(CultureInfo.CurrentCulture), Common.MachineName.Trim(), string.Empty, string.Empty };
MachineStuff.MachineMatrix = new string[MachineStuff.MAX_MACHINE] { pcName.Trim().ToUpper(CultureInfo.CurrentCulture), Common.MachineName.Trim(), string.Empty, string.Empty };
string[] machines = Common.MachineMatrix;
Common.MachinePool.Initialize(machines);
Common.UpdateMachinePoolStringSetting();
string[] machines = MachineStuff.MachineMatrix;
MachineStuff.MachinePool.Initialize(machines);
MachineStuff.UpdateMachinePoolStringSetting();
SocketStuff.InvalidKeyFound = false;
Common.ReopenSocketDueToReadError = true;
Common.ReopenSockets(true);
Common.SendMachineMatrix();
MachineStuff.SendMachineMatrix();
Setting.Values.PauseInstantSaving = false;
Setting.Values.SaveSettings();
@@ -325,7 +326,7 @@ namespace MouseWithoutBorders.Class
Setting.Values.PauseInstantSaving = true;
Setting.Values.EasyMouse = (int)EasyMouseOption.Enable;
Common.ClearComputerMatrix();
MachineStuff.ClearComputerMatrix();
Setting.Values.MyKey = Common.MyKey = Common.CreateRandomKey();
Common.GeneratedKey = true;
@@ -352,7 +353,7 @@ namespace MouseWithoutBorders.Class
Common.MMSleep(0.2);
}
Common.SendMachineMatrix();
MachineStuff.SendMachineMatrix();
}
public void Shutdown()