-
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Decouple Send & Listen logic. Better "Identity" handling. Better "Software ID" handling. File logging option
- Loading branch information
xmegz
committed
Nov 2, 2018
1 parent
da2a5c9
commit 807defc
Showing
14 changed files
with
948 additions
and
280 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
using System; | ||
using System.IO; | ||
using System.Reflection; | ||
|
||
namespace MndpTray.Protocol | ||
{ | ||
public static class MndpDebug | ||
{ | ||
#region Variables | ||
private static string LOG_FILE_NAME = Assembly.GetEntryAssembly().GetLocationWithExtension("txt"); | ||
private static bool LOG_IS_ENABLED = File.Exists(LOG_FILE_NAME); | ||
private static object LOG_FILE_LOCK = new object(); | ||
#endregion | ||
|
||
private static void File_WriteLine(string str) | ||
{ | ||
if (!LOG_IS_ENABLED) return; | ||
|
||
str = string.Concat("<", DateTime.Now.ToString(), "> ", str, "\r\n"); | ||
|
||
lock (LOG_FILE_LOCK) | ||
{ | ||
File.AppendAllText(LOG_FILE_NAME, str); | ||
} | ||
} | ||
|
||
public static void Debug(string format, params object[] args) | ||
{ | ||
try | ||
{ | ||
String str = String.Format(format, args); | ||
|
||
System.Diagnostics.Debug.WriteLine(str); | ||
File_WriteLine(str); | ||
} | ||
catch { } | ||
} | ||
|
||
public static void DebugException(string className, string methodName, Exception ex) | ||
{ | ||
try | ||
{ | ||
Debug("{0}, {1} Exception:\r\n {2}", className, methodName, ex.ToString()); | ||
} | ||
catch { } | ||
} | ||
} | ||
} |
15 changes: 14 additions & 1 deletion
15
MndpTray/MndpTray/Extensions/Extensions.cs → MndpTray/MndpTray/Protocol/MndpExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.