Skip to content
Open
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
26 changes: 26 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"version": "0.2.0",
"configurations": [
{
// Use IntelliSense to find out which attributes exist for C# debugging
// Use hover for the description of the existing attributes
// For further information visit https://github.com/dotnet/vscode-csharp/blob/main/debugger-launchjson.md
"name": ".NET Core Launch (console)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/LilaSharpExample/bin/Debug/net8.0/LilaSharpExample.dll",
"args": [],
"cwd": "${workspaceFolder}/LilaSharpExample",
// For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
"console": "internalConsole",
"stopAtEntry": false
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach"
}
]
}
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"dotnet.preferCSharpExtension": true
}
41 changes: 41 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"command": "dotnet",
"type": "process",
"args": [
"build",
"${workspaceFolder}/LilaSharpExample/LilaSharpExample.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary;ForceNoAlign"
],
"problemMatcher": "$msCompile"
},
{
"label": "publish",
"command": "dotnet",
"type": "process",
"args": [
"publish",
"${workspaceFolder}/LilaSharpExample/LilaSharpExample.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary;ForceNoAlign"
],
"problemMatcher": "$msCompile"
},
{
"label": "watch",
"command": "dotnet",
"type": "process",
"args": [
"watch",
"run",
"--project",
"${workspaceFolder}/LilaSharpExample/LilaSharpExample.csproj"
],
"problemMatcher": "$msCompile"
}
]
}
31 changes: 0 additions & 31 deletions LilaSharp.sln

This file was deleted.

6 changes: 0 additions & 6 deletions LilaSharp/App.config

This file was deleted.

8 changes: 4 additions & 4 deletions LilaSharp/Internal/EventTimer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ private void OnInternalCallback(object state)
long offset = 0;
if ((offset = (sw.ElapsedMilliseconds - Period)) > 50)
{
log.ConditionalDebug("Timer was {0}ms off schedule.", offset);
System.Diagnostics.Debug.WriteLine("Timer was {0}ms off schedule.", offset);
}

if (callback != null)
Expand All @@ -108,7 +108,7 @@ private void OnInternalCallback(object state)
}
catch (Exception ex)
{
log.Error(ex, "Error in timer callback.");
System.Diagnostics.Debug.WriteLine(ex, "Error in timer callback.");
}
}

Expand Down Expand Up @@ -136,12 +136,12 @@ public void Dispose()
/// <param name="finalize"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param>
protected virtual void Dispose(bool finalize)
{
log.ConditionalTrace("~LilaTimer");
System.Diagnostics.Debug.WriteLine("~LilaTimer");

running = false;

lock (timerLock)
{
{
if (timer != null)
{
timer.Dispose();
Expand Down
7 changes: 4 additions & 3 deletions LilaSharp/Internal/Message.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ static Message()
/// </summary>
/// <param name="sender">The sender.</param>
/// <param name="e">The <see cref="ErrorEventArgs"/> instance containing the event data.</param>
private static void OnMessageParseError(object sender, ErrorEventArgs e)
private static void OnMessageParseError(object sender, Newtonsoft.Json.Serialization.ErrorEventArgs e)
{
log.Error(e.ErrorContext.Error, "Failed to deserialize json.");
System.Diagnostics.Debug.WriteLine(e.ErrorContext.Error, "Failed to deserialize json.");
}

private byte[] data;
Expand Down Expand Up @@ -80,6 +80,7 @@ public string Decode(Encoding encoding)
public JObject DecodeObject(Encoding encoding)
{
string jsonStr = Decode(encoding);
System.Diagnostics.Debug.WriteLine("RAW: {0}", jsonStr);
object obj = JsonConvert.DeserializeObject(jsonStr, settings);

if (obj is JObject)
Expand All @@ -88,7 +89,7 @@ public JObject DecodeObject(Encoding encoding)
}
else
{
log.Error("Deserialized object is not a JObject. It is a {0}", obj.GetType().FullName);
System.Diagnostics.Debug.WriteLine("Deserialized object is not a JObject. It is a {0}", obj.GetType().FullName);
return null;
}
}
Expand Down
6 changes: 6 additions & 0 deletions LilaSharp/Internal/StringEngine.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System.Diagnostics;

namespace LilaSharp.Internal
{
Expand Down Expand Up @@ -82,6 +83,11 @@ public static string GetInside(string data, int start)
string inside = data.Substring(s, endIndex - s + 1);
if (level == 0)
{
Debug.WriteLine("--------------");
Debug.WriteLine(" ");
Debug.WriteLine(inside);
Debug.WriteLine(" ");
Debug.WriteLine("--------------");
return inside;
}

Expand Down
18 changes: 9 additions & 9 deletions LilaSharp/Internal/WebSocketBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ protected override void Dispose(bool finalize)
}

schedulers = null;

if (finalize)
{
GC.SuppressFinalize(this);
Expand All @@ -82,7 +82,7 @@ public void Send(string text)
}
else
{
log.Warn("Cannot send null or empty text.");
System.Diagnostics.Debug.WriteLine("Cannot send null or empty text.");
}
}

Expand Down Expand Up @@ -110,7 +110,7 @@ internal void InvokeMessage(JObject jobj)

if (Debug)
{
log.ConditionalDebug("Received {0}", jobj.ToString());
System.Diagnostics.Debug.WriteLine("Received {0}", jobj.ToString());
}

//Lock whole statement for futureproof protection against handlers being removed
Expand All @@ -126,12 +126,12 @@ internal void InvokeMessage(JObject jobj)
}
catch (Exception ex)
{
log.Error(ex, "Error while handling \"{0}\". Check the IMessage json structure.", type);
System.Diagnostics.Debug.WriteLine("Error while handling \"{0}\". Check the IMessage json structure.", ex);
}
}
else
{
log.Warn("Unhandled message: {0}", jobj.ToString());
System.Diagnostics.Debug.WriteLine("Unhandled message: {0}", jobj.ToString());
}
}
}
Expand All @@ -155,7 +155,7 @@ internal void InvokeMessage(JObject jobj)

if (parseErrors == versionHandlers.Count)
{
log.ConditionalDebug("No handlers were able to parse the IVersionedMessage.");
System.Diagnostics.Debug.WriteLine("No handlers were able to parse the IVersionedMessage.");
}
}
}
Expand Down Expand Up @@ -190,7 +190,7 @@ public void AddHandler<T>(MessageHandler<T> handler) where T : ITypeMessage
}
catch (MissingMethodException mme)
{
log.Error(mme, "ITypeMessage type must have a zero argument constructor.");
System.Diagnostics.Debug.WriteLine(mme, "ITypeMessage type must have a zero argument constructor.");
return;
}

Expand Down Expand Up @@ -306,9 +306,9 @@ public override void OnConnect()
/// </summary>
/// <param name="sender">The sender.</param>
/// <param name="e">The <see cref="ErrorEventArgs"/> instance containing the event data.</param>
private void OnJsonParseError(object sender, ErrorEventArgs e)
private void OnJsonParseError(object sender, Newtonsoft.Json.Serialization.ErrorEventArgs e)
{
log.Error(e.ErrorContext.Error, "Failed to deserialize json.");
System.Diagnostics.Debug.WriteLine(e.ErrorContext.Error, "Failed to deserialize json.");
}
}
}
6 changes: 3 additions & 3 deletions LilaSharp/Internal/WebSocketTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ private void HandleCompletion()
{
for (int i = 0; i < task.Exception.InnerExceptions.Count; i++)
{
log.ConditionalDebug(task.Exception.InnerExceptions[i], "WebSocketTask faulted.");
System.Diagnostics.Debug.WriteLine(task.Exception.InnerExceptions[i], "WebSocketTask faulted.");
}
}

Expand Down Expand Up @@ -89,7 +89,7 @@ public void Wait(int timeout)
{
for (int i = 0; i < ae.InnerExceptions.Count; i++)
{
log.ConditionalDebug(ae.InnerExceptions[i], "WebSocketTask faulted.");
System.Diagnostics.Debug.WriteLine(ae.InnerExceptions[i], "WebSocketTask faulted.");
}
}
}
Expand All @@ -114,7 +114,7 @@ private void Dispose()
{
if (task != null && task.IsCompleted)
{
log.ConditionalTrace("~WebSocketTask");
System.Diagnostics.Debug.WriteLine("~WebSocketTask");
result = task.Status;
task.Dispose();
task = null;
Expand Down
Loading