mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2024-11-29 04:24:19 +01:00
Resolve name collision with Log class and Diagnostics namespace
Makes app snappier
This commit is contained in:
parent
00851a649a
commit
1019499612
@ -198,7 +198,7 @@ namespace DS4Windows
|
|||||||
var errMsg = String.Format("Couldn't start UDP server on port {0}, outside applications won't be able to access pad data ({1})", UDP_SERVER_PORT, ex.SocketErrorCode);
|
var errMsg = String.Format("Couldn't start UDP server on port {0}, outside applications won't be able to access pad data ({1})", UDP_SERVER_PORT, ex.SocketErrorCode);
|
||||||
|
|
||||||
LogDebug(errMsg, true);
|
LogDebug(errMsg, true);
|
||||||
Log.LogToTray(errMsg, true, true);
|
AppLogger.LogToTray(errMsg, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
udpChangeStatus = false;
|
udpChangeStatus = false;
|
||||||
@ -211,7 +211,7 @@ namespace DS4Windows
|
|||||||
udpChangeStatus = true;
|
udpChangeStatus = true;
|
||||||
_udpServer.Stop();
|
_udpServer.Stop();
|
||||||
_udpServer = null;
|
_udpServer = null;
|
||||||
Log.LogToGui("Closed UDP server", false);
|
AppLogger.LogToGui("Closed UDP server", false);
|
||||||
udpChangeStatus = false;
|
udpChangeStatus = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -276,7 +276,7 @@ namespace DS4Windows
|
|||||||
var errMsg = String.Format("Couldn't start UDP server on port {0}, outside applications won't be able to access pad data ({1})", UDP_SERVER_PORT, ex.SocketErrorCode);
|
var errMsg = String.Format("Couldn't start UDP server on port {0}, outside applications won't be able to access pad data ({1})", UDP_SERVER_PORT, ex.SocketErrorCode);
|
||||||
|
|
||||||
LogDebug(errMsg, true);
|
LogDebug(errMsg, true);
|
||||||
Log.LogToTray(errMsg, true, true);
|
AppLogger.LogToTray(errMsg, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
changingUDPPort = false;
|
changingUDPPort = false;
|
||||||
@ -289,7 +289,7 @@ namespace DS4Windows
|
|||||||
string message = Properties.Resources.CouldNotOpenDS4.Replace("*Mac address*", device.getMacAddress()) + " " +
|
string message = Properties.Resources.CouldNotOpenDS4.Replace("*Mac address*", device.getMacAddress()) + " " +
|
||||||
Properties.Resources.QuitOtherPrograms;
|
Properties.Resources.QuitOtherPrograms;
|
||||||
LogDebug(message, true);
|
LogDebug(message, true);
|
||||||
Log.LogToTray(message, true);
|
AppLogger.LogToTray(message, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -490,13 +490,13 @@ namespace DS4Windows
|
|||||||
{
|
{
|
||||||
string prolog = Properties.Resources.UsingProfile.Replace("*number*", (i + 1).ToString()).Replace("*Profile name*", ProfilePath[i]);
|
string prolog = Properties.Resources.UsingProfile.Replace("*number*", (i + 1).ToString()).Replace("*Profile name*", ProfilePath[i]);
|
||||||
LogDebug(prolog);
|
LogDebug(prolog);
|
||||||
Log.LogToTray(prolog);
|
AppLogger.LogToTray(prolog);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
string prolog = Properties.Resources.NotUsingProfile.Replace("*number*", (i + 1).ToString());
|
string prolog = Properties.Resources.NotUsingProfile.Replace("*number*", (i + 1).ToString());
|
||||||
LogDebug(prolog);
|
LogDebug(prolog);
|
||||||
Log.LogToTray(prolog);
|
AppLogger.LogToTray(prolog);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -507,7 +507,7 @@ namespace DS4Windows
|
|||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
LogDebug(e.Message);
|
LogDebug(e.Message);
|
||||||
Log.LogToTray(e.Message);
|
AppLogger.LogToTray(e.Message);
|
||||||
}
|
}
|
||||||
|
|
||||||
running = true;
|
running = true;
|
||||||
@ -527,7 +527,7 @@ namespace DS4Windows
|
|||||||
var errMsg = String.Format("Couldn't start UDP server on port {0}, outside applications won't be able to access pad data ({1})", UDP_SERVER_PORT, ex.SocketErrorCode);
|
var errMsg = String.Format("Couldn't start UDP server on port {0}, outside applications won't be able to access pad data ({1})", UDP_SERVER_PORT, ex.SocketErrorCode);
|
||||||
|
|
||||||
LogDebug(errMsg, true);
|
LogDebug(errMsg, true);
|
||||||
Log.LogToTray(errMsg, true, true);
|
AppLogger.LogToTray(errMsg, true, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -535,7 +535,7 @@ namespace DS4Windows
|
|||||||
{
|
{
|
||||||
string logMessage = "Could not connect to Scp Virtual Bus Driver. Please check the status of the System device in Device Manager";
|
string logMessage = "Could not connect to Scp Virtual Bus Driver. Please check the status of the System device in Device Manager";
|
||||||
LogDebug(logMessage);
|
LogDebug(logMessage);
|
||||||
Log.LogToTray(logMessage);
|
AppLogger.LogToTray(logMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
runHotPlug = true;
|
runHotPlug = true;
|
||||||
@ -719,13 +719,13 @@ namespace DS4Windows
|
|||||||
{
|
{
|
||||||
string prolog = Properties.Resources.UsingProfile.Replace("*number*", (Index + 1).ToString()).Replace("*Profile name*", ProfilePath[Index]);
|
string prolog = Properties.Resources.UsingProfile.Replace("*number*", (Index + 1).ToString()).Replace("*Profile name*", ProfilePath[Index]);
|
||||||
LogDebug(prolog);
|
LogDebug(prolog);
|
||||||
Log.LogToTray(prolog);
|
AppLogger.LogToTray(prolog);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
string prolog = Properties.Resources.NotUsingProfile.Replace("*number*", (Index + 1).ToString());
|
string prolog = Properties.Resources.NotUsingProfile.Replace("*number*", (Index + 1).ToString());
|
||||||
LogDebug(prolog);
|
LogDebug(prolog);
|
||||||
Log.LogToTray(prolog);
|
AppLogger.LogToTray(prolog);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@ -1028,7 +1028,7 @@ namespace DS4Windows
|
|||||||
}
|
}
|
||||||
|
|
||||||
LogDebug(removed);
|
LogDebug(removed);
|
||||||
Log.LogToTray(removed);
|
AppLogger.LogToTray(removed);
|
||||||
/*Stopwatch sw = new Stopwatch();
|
/*Stopwatch sw = new Stopwatch();
|
||||||
sw.Start();
|
sw.Start();
|
||||||
while (sw.ElapsedMilliseconds < XINPUT_UNPLUG_SETTLE_TIME)
|
while (sw.ElapsedMilliseconds < XINPUT_UNPLUG_SETTLE_TIME)
|
||||||
@ -1291,7 +1291,7 @@ namespace DS4Windows
|
|||||||
getTouchSensitivity()[deviceID] = 0;
|
getTouchSensitivity()[deviceID] = 0;
|
||||||
getScrollSensitivity()[deviceID] = 0;
|
getScrollSensitivity()[deviceID] = 0;
|
||||||
LogDebug(Properties.Resources.TouchpadMovementOff);
|
LogDebug(Properties.Resources.TouchpadMovementOff);
|
||||||
Log.LogToTray(Properties.Resources.TouchpadMovementOff);
|
AppLogger.LogToTray(Properties.Resources.TouchpadMovementOff);
|
||||||
touchreleased[deviceID] = false;
|
touchreleased[deviceID] = false;
|
||||||
}
|
}
|
||||||
else if (touchreleased[deviceID])
|
else if (touchreleased[deviceID])
|
||||||
@ -1299,7 +1299,7 @@ namespace DS4Windows
|
|||||||
getTouchSensitivity()[deviceID] = oldtouchvalue[deviceID];
|
getTouchSensitivity()[deviceID] = oldtouchvalue[deviceID];
|
||||||
getScrollSensitivity()[deviceID] = oldscrollvalue[deviceID];
|
getScrollSensitivity()[deviceID] = oldscrollvalue[deviceID];
|
||||||
LogDebug(Properties.Resources.TouchpadMovementOn);
|
LogDebug(Properties.Resources.TouchpadMovementOn);
|
||||||
Log.LogToTray(Properties.Resources.TouchpadMovementOn);
|
AppLogger.LogToTray(Properties.Resources.TouchpadMovementOn);
|
||||||
touchreleased[deviceID] = false;
|
touchreleased[deviceID] = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace DS4Windows
|
namespace DS4Windows
|
||||||
{
|
{
|
||||||
public class Log
|
public class AppLogger
|
||||||
{
|
{
|
||||||
public static event EventHandler<DebugEventArgs> TrayIconLog;
|
public static event EventHandler<DebugEventArgs> TrayIconLog;
|
||||||
public static event EventHandler<DebugEventArgs> GuiLog;
|
public static event EventHandler<DebugEventArgs> GuiLog;
|
||||||
|
@ -1940,7 +1940,7 @@ namespace DS4Windows
|
|||||||
dets = action.details.Split(',');
|
dets = action.details.Split(',');
|
||||||
if (bool.Parse(dets[1]) && !actionDone[index].dev[device])
|
if (bool.Parse(dets[1]) && !actionDone[index].dev[device])
|
||||||
{
|
{
|
||||||
Log.LogToTray("Controller " + (device + 1) + ": " +
|
AppLogger.LogToTray("Controller " + (device + 1) + ": " +
|
||||||
ctrl.getDS4Battery(device), true);
|
ctrl.getDS4Battery(device), true);
|
||||||
}
|
}
|
||||||
if (bool.Parse(dets[2]))
|
if (bool.Parse(dets[2]))
|
||||||
|
@ -2900,12 +2900,12 @@ namespace DS4Windows
|
|||||||
if (xinputResult)
|
if (xinputResult)
|
||||||
{
|
{
|
||||||
dinputOnly[device] = false;
|
dinputOnly[device] = false;
|
||||||
Log.LogToGui("X360 Controller # " + xinputIndex + " connected", false);
|
AppLogger.LogToGui("X360 Controller # " + xinputIndex + " connected", false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dinputOnly[device] = true;
|
dinputOnly[device] = true;
|
||||||
Log.LogToGui("X360 Controller # " + xinputIndex + " failed. Using DInput only mode", true);
|
AppLogger.LogToGui("X360 Controller # " + xinputIndex + " failed. Using DInput only mode", true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (xinputStatus && !xinputPlug)
|
else if (xinputStatus && !xinputPlug)
|
||||||
@ -2915,11 +2915,11 @@ namespace DS4Windows
|
|||||||
if (xinputResult)
|
if (xinputResult)
|
||||||
{
|
{
|
||||||
dinputOnly[device] = true;
|
dinputOnly[device] = true;
|
||||||
Log.LogToGui("X360 Controller # " + xinputIndex + " unplugged", false);
|
AppLogger.LogToGui("X360 Controller # " + xinputIndex + " unplugged", false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Log.LogToGui("X360 Controller # " + xinputIndex + " failed to unplug", true);
|
AppLogger.LogToGui("X360 Controller # " + xinputIndex + " failed to unplug", true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3355,7 +3355,7 @@ namespace DS4Windows
|
|||||||
m_Xdoc.AppendChild(Node);
|
m_Xdoc.AppendChild(Node);
|
||||||
|
|
||||||
try { m_Xdoc.Save(m_linkedProfiles); }
|
try { m_Xdoc.Save(m_linkedProfiles); }
|
||||||
catch (UnauthorizedAccessException) { Log.LogToGui("Unauthorized Access - Save failed to path: " + m_linkedProfiles, false); saved = false; }
|
catch (UnauthorizedAccessException) { AppLogger.LogToGui("Unauthorized Access - Save failed to path: " + m_linkedProfiles, false); saved = false; }
|
||||||
|
|
||||||
return saved;
|
return saved;
|
||||||
}
|
}
|
||||||
@ -3386,7 +3386,7 @@ namespace DS4Windows
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Log.LogToGui("LinkedProfiles.xml can't be found.", false);
|
AppLogger.LogToGui("LinkedProfiles.xml can't be found.", false);
|
||||||
loaded = false;
|
loaded = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3424,7 +3424,7 @@ namespace DS4Windows
|
|||||||
}
|
}
|
||||||
|
|
||||||
try { linkedXdoc.Save(m_linkedProfiles); }
|
try { linkedXdoc.Save(m_linkedProfiles); }
|
||||||
catch (UnauthorizedAccessException) { Log.LogToGui("Unauthorized Access - Save failed to path: " + m_linkedProfiles, false); saved = false; }
|
catch (UnauthorizedAccessException) { AppLogger.LogToGui("Unauthorized Access - Save failed to path: " + m_linkedProfiles, false); saved = false; }
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -149,8 +149,8 @@ namespace DS4Windows
|
|||||||
|
|
||||||
Program.rootHub.Debug += On_Debug;
|
Program.rootHub.Debug += On_Debug;
|
||||||
|
|
||||||
Log.GuiLog += On_Debug;
|
AppLogger.GuiLog += On_Debug;
|
||||||
Log.TrayIconLog += ShowNotification;
|
AppLogger.TrayIconLog += ShowNotification;
|
||||||
|
|
||||||
Directory.CreateDirectory(appdatapath);
|
Directory.CreateDirectory(appdatapath);
|
||||||
if (!Save()) //if can't write to file
|
if (!Save()) //if can't write to file
|
||||||
@ -252,7 +252,7 @@ namespace DS4Windows
|
|||||||
|
|
||||||
FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location);
|
FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location);
|
||||||
string version = fvi.FileVersion;
|
string version = fvi.FileVersion;
|
||||||
Log.LogToGui("DS4Windows version " + version, false);
|
AppLogger.LogToGui("DS4Windows version " + version, false);
|
||||||
|
|
||||||
LoadP();
|
LoadP();
|
||||||
LoadLinkedProfiles();
|
LoadLinkedProfiles();
|
||||||
@ -2493,7 +2493,7 @@ Properties.Resources.DS4Update, MessageBoxButtons.YesNo, MessageBoxIcon.Question
|
|||||||
{
|
{
|
||||||
RegistryKey key = Registry.LocalMachine.CreateSubKey(@"SYSTEM\CurrentControlSet\Services\HidGuardian\Parameters");
|
RegistryKey key = Registry.LocalMachine.CreateSubKey(@"SYSTEM\CurrentControlSet\Services\HidGuardian\Parameters");
|
||||||
key.SetValue("AffectedDevices", Program.rootHub.affectedDevs.ToArray(), RegistryValueKind.MultiString);
|
key.SetValue("AffectedDevices", Program.rootHub.affectedDevs.ToArray(), RegistryValueKind.MultiString);
|
||||||
Log.LogToGui("Wrote HidGuardian Device List to Registry", false);
|
AppLogger.LogToGui("Wrote HidGuardian Device List to Registry", false);
|
||||||
}
|
}
|
||||||
catch { }
|
catch { }
|
||||||
}
|
}
|
||||||
@ -2503,7 +2503,7 @@ Properties.Resources.DS4Update, MessageBoxButtons.YesNo, MessageBoxIcon.Question
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
Registry.LocalMachine.DeleteSubKeyTree(@"SYSTEM\CurrentControlSet\Services\HidGuardian\Parameters\Whitelist");
|
Registry.LocalMachine.DeleteSubKeyTree(@"SYSTEM\CurrentControlSet\Services\HidGuardian\Parameters\Whitelist");
|
||||||
Log.LogToGui("Cleared HidGuardian Whitelist", false);
|
AppLogger.LogToGui("Cleared HidGuardian Whitelist", false);
|
||||||
Program.rootHub.CreateHidGuardKey();
|
Program.rootHub.CreateHidGuardKey();
|
||||||
}
|
}
|
||||||
catch { }
|
catch { }
|
||||||
|
@ -503,7 +503,7 @@ namespace DS4Windows
|
|||||||
bool validCrc = recvCrc32 == calcCrc32;
|
bool validCrc = recvCrc32 == calcCrc32;
|
||||||
if (!validCrc && tries >= 5)
|
if (!validCrc && tries >= 5)
|
||||||
{
|
{
|
||||||
Log.LogToGui("Gyro Calibration Failed", true);
|
AppLogger.LogToGui("Gyro Calibration Failed", true);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (validCrc)
|
else if (validCrc)
|
||||||
@ -786,7 +786,7 @@ namespace DS4Windows
|
|||||||
{
|
{
|
||||||
if (res == HidDevice.ReadStatus.WaitTimedOut)
|
if (res == HidDevice.ReadStatus.WaitTimedOut)
|
||||||
{
|
{
|
||||||
Log.LogToGui(Mac.ToString() + " disconnected due to timeout", true);
|
AppLogger.LogToGui(Mac.ToString() + " disconnected due to timeout", true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -814,7 +814,7 @@ namespace DS4Windows
|
|||||||
{
|
{
|
||||||
if (res == HidDevice.ReadStatus.WaitTimedOut)
|
if (res == HidDevice.ReadStatus.WaitTimedOut)
|
||||||
{
|
{
|
||||||
Log.LogToGui(Mac.ToString() + " disconnected due to timeout", true);
|
AppLogger.LogToGui(Mac.ToString() + " disconnected due to timeout", true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1051,7 +1051,7 @@ namespace DS4Windows
|
|||||||
|
|
||||||
if (shouldDisconnect)
|
if (shouldDisconnect)
|
||||||
{
|
{
|
||||||
Log.LogToGui(Mac.ToString() + " disconnecting due to idle disconnect", false);
|
AppLogger.LogToGui(Mac.ToString() + " disconnecting due to idle disconnect", false);
|
||||||
|
|
||||||
if (conType == ConnectionType.BT)
|
if (conType == ConnectionType.BT)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user