mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2024-12-26 00:21:48 +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);
|
||||
|
||||
LogDebug(errMsg, true);
|
||||
Log.LogToTray(errMsg, true, true);
|
||||
AppLogger.LogToTray(errMsg, true, true);
|
||||
}
|
||||
|
||||
udpChangeStatus = false;
|
||||
@ -211,7 +211,7 @@ namespace DS4Windows
|
||||
udpChangeStatus = true;
|
||||
_udpServer.Stop();
|
||||
_udpServer = null;
|
||||
Log.LogToGui("Closed UDP server", false);
|
||||
AppLogger.LogToGui("Closed UDP server", 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);
|
||||
|
||||
LogDebug(errMsg, true);
|
||||
Log.LogToTray(errMsg, true, true);
|
||||
AppLogger.LogToTray(errMsg, true, true);
|
||||
}
|
||||
|
||||
changingUDPPort = false;
|
||||
@ -289,7 +289,7 @@ namespace DS4Windows
|
||||
string message = Properties.Resources.CouldNotOpenDS4.Replace("*Mac address*", device.getMacAddress()) + " " +
|
||||
Properties.Resources.QuitOtherPrograms;
|
||||
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]);
|
||||
LogDebug(prolog);
|
||||
Log.LogToTray(prolog);
|
||||
AppLogger.LogToTray(prolog);
|
||||
}
|
||||
else
|
||||
{
|
||||
string prolog = Properties.Resources.NotUsingProfile.Replace("*number*", (i + 1).ToString());
|
||||
LogDebug(prolog);
|
||||
Log.LogToTray(prolog);
|
||||
AppLogger.LogToTray(prolog);
|
||||
}
|
||||
}
|
||||
|
||||
@ -507,7 +507,7 @@ namespace DS4Windows
|
||||
catch (Exception e)
|
||||
{
|
||||
LogDebug(e.Message);
|
||||
Log.LogToTray(e.Message);
|
||||
AppLogger.LogToTray(e.Message);
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
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";
|
||||
LogDebug(logMessage);
|
||||
Log.LogToTray(logMessage);
|
||||
AppLogger.LogToTray(logMessage);
|
||||
}
|
||||
|
||||
runHotPlug = true;
|
||||
@ -719,13 +719,13 @@ namespace DS4Windows
|
||||
{
|
||||
string prolog = Properties.Resources.UsingProfile.Replace("*number*", (Index + 1).ToString()).Replace("*Profile name*", ProfilePath[Index]);
|
||||
LogDebug(prolog);
|
||||
Log.LogToTray(prolog);
|
||||
AppLogger.LogToTray(prolog);
|
||||
}
|
||||
else
|
||||
{
|
||||
string prolog = Properties.Resources.NotUsingProfile.Replace("*number*", (Index + 1).ToString());
|
||||
LogDebug(prolog);
|
||||
Log.LogToTray(prolog);
|
||||
AppLogger.LogToTray(prolog);
|
||||
}
|
||||
|
||||
break;
|
||||
@ -1028,7 +1028,7 @@ namespace DS4Windows
|
||||
}
|
||||
|
||||
LogDebug(removed);
|
||||
Log.LogToTray(removed);
|
||||
AppLogger.LogToTray(removed);
|
||||
/*Stopwatch sw = new Stopwatch();
|
||||
sw.Start();
|
||||
while (sw.ElapsedMilliseconds < XINPUT_UNPLUG_SETTLE_TIME)
|
||||
@ -1291,7 +1291,7 @@ namespace DS4Windows
|
||||
getTouchSensitivity()[deviceID] = 0;
|
||||
getScrollSensitivity()[deviceID] = 0;
|
||||
LogDebug(Properties.Resources.TouchpadMovementOff);
|
||||
Log.LogToTray(Properties.Resources.TouchpadMovementOff);
|
||||
AppLogger.LogToTray(Properties.Resources.TouchpadMovementOff);
|
||||
touchreleased[deviceID] = false;
|
||||
}
|
||||
else if (touchreleased[deviceID])
|
||||
@ -1299,7 +1299,7 @@ namespace DS4Windows
|
||||
getTouchSensitivity()[deviceID] = oldtouchvalue[deviceID];
|
||||
getScrollSensitivity()[deviceID] = oldscrollvalue[deviceID];
|
||||
LogDebug(Properties.Resources.TouchpadMovementOn);
|
||||
Log.LogToTray(Properties.Resources.TouchpadMovementOn);
|
||||
AppLogger.LogToTray(Properties.Resources.TouchpadMovementOn);
|
||||
touchreleased[deviceID] = false;
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
namespace DS4Windows
|
||||
{
|
||||
public class Log
|
||||
public class AppLogger
|
||||
{
|
||||
public static event EventHandler<DebugEventArgs> TrayIconLog;
|
||||
public static event EventHandler<DebugEventArgs> GuiLog;
|
||||
|
@ -1940,7 +1940,7 @@ namespace DS4Windows
|
||||
dets = action.details.Split(',');
|
||||
if (bool.Parse(dets[1]) && !actionDone[index].dev[device])
|
||||
{
|
||||
Log.LogToTray("Controller " + (device + 1) + ": " +
|
||||
AppLogger.LogToTray("Controller " + (device + 1) + ": " +
|
||||
ctrl.getDS4Battery(device), true);
|
||||
}
|
||||
if (bool.Parse(dets[2]))
|
||||
|
@ -2900,12 +2900,12 @@ namespace DS4Windows
|
||||
if (xinputResult)
|
||||
{
|
||||
dinputOnly[device] = false;
|
||||
Log.LogToGui("X360 Controller # " + xinputIndex + " connected", false);
|
||||
AppLogger.LogToGui("X360 Controller # " + xinputIndex + " connected", false);
|
||||
}
|
||||
else
|
||||
{
|
||||
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)
|
||||
@ -2915,11 +2915,11 @@ namespace DS4Windows
|
||||
if (xinputResult)
|
||||
{
|
||||
dinputOnly[device] = true;
|
||||
Log.LogToGui("X360 Controller # " + xinputIndex + " unplugged", false);
|
||||
AppLogger.LogToGui("X360 Controller # " + xinputIndex + " unplugged", false);
|
||||
}
|
||||
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);
|
||||
|
||||
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;
|
||||
}
|
||||
@ -3386,7 +3386,7 @@ namespace DS4Windows
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.LogToGui("LinkedProfiles.xml can't be found.", false);
|
||||
AppLogger.LogToGui("LinkedProfiles.xml can't be found.", false);
|
||||
loaded = false;
|
||||
}
|
||||
|
||||
@ -3424,7 +3424,7 @@ namespace DS4Windows
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
|
@ -149,8 +149,8 @@ namespace DS4Windows
|
||||
|
||||
Program.rootHub.Debug += On_Debug;
|
||||
|
||||
Log.GuiLog += On_Debug;
|
||||
Log.TrayIconLog += ShowNotification;
|
||||
AppLogger.GuiLog += On_Debug;
|
||||
AppLogger.TrayIconLog += ShowNotification;
|
||||
|
||||
Directory.CreateDirectory(appdatapath);
|
||||
if (!Save()) //if can't write to file
|
||||
@ -252,7 +252,7 @@ namespace DS4Windows
|
||||
|
||||
FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location);
|
||||
string version = fvi.FileVersion;
|
||||
Log.LogToGui("DS4Windows version " + version, false);
|
||||
AppLogger.LogToGui("DS4Windows version " + version, false);
|
||||
|
||||
LoadP();
|
||||
LoadLinkedProfiles();
|
||||
@ -2493,7 +2493,7 @@ Properties.Resources.DS4Update, MessageBoxButtons.YesNo, MessageBoxIcon.Question
|
||||
{
|
||||
RegistryKey key = Registry.LocalMachine.CreateSubKey(@"SYSTEM\CurrentControlSet\Services\HidGuardian\Parameters");
|
||||
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 { }
|
||||
}
|
||||
@ -2503,7 +2503,7 @@ Properties.Resources.DS4Update, MessageBoxButtons.YesNo, MessageBoxIcon.Question
|
||||
try
|
||||
{
|
||||
Registry.LocalMachine.DeleteSubKeyTree(@"SYSTEM\CurrentControlSet\Services\HidGuardian\Parameters\Whitelist");
|
||||
Log.LogToGui("Cleared HidGuardian Whitelist", false);
|
||||
AppLogger.LogToGui("Cleared HidGuardian Whitelist", false);
|
||||
Program.rootHub.CreateHidGuardKey();
|
||||
}
|
||||
catch { }
|
||||
|
@ -503,7 +503,7 @@ namespace DS4Windows
|
||||
bool validCrc = recvCrc32 == calcCrc32;
|
||||
if (!validCrc && tries >= 5)
|
||||
{
|
||||
Log.LogToGui("Gyro Calibration Failed", true);
|
||||
AppLogger.LogToGui("Gyro Calibration Failed", true);
|
||||
continue;
|
||||
}
|
||||
else if (validCrc)
|
||||
@ -786,7 +786,7 @@ namespace DS4Windows
|
||||
{
|
||||
if (res == HidDevice.ReadStatus.WaitTimedOut)
|
||||
{
|
||||
Log.LogToGui(Mac.ToString() + " disconnected due to timeout", true);
|
||||
AppLogger.LogToGui(Mac.ToString() + " disconnected due to timeout", true);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -814,7 +814,7 @@ namespace DS4Windows
|
||||
{
|
||||
if (res == HidDevice.ReadStatus.WaitTimedOut)
|
||||
{
|
||||
Log.LogToGui(Mac.ToString() + " disconnected due to timeout", true);
|
||||
AppLogger.LogToGui(Mac.ToString() + " disconnected due to timeout", true);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1051,7 +1051,7 @@ namespace DS4Windows
|
||||
|
||||
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)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user