Winify

Subversion Repositories:
Compare Path: Rev
With Path: Rev
?path1? @ 50  →  ?path2? @ 51
/trunk/Winify/Gotify/GotifyConnection.cs
@@ -89,7 +89,7 @@
 
if (!Uri.TryCreate(_server.Url, UriKind.Absolute, out _httpUri))
{
Log.Error($"No HTTP URL could be built out of the supplied server URI {_server.Url}.");
Log.Error($"No HTTP URL could be built out of the supplied server URI {_server.Url}");
return;
}
 
@@ -111,7 +111,7 @@
}
catch (ArgumentException exception)
{
Log.Error($"No WebSockets URL could be built from the provided URL {_server.Url} due to {exception.Message}.");
Log.Error($"No WebSockets URL could be built from the provided URL {_server.Url} due to {exception.Message}");
}
 
_webSocketsUri = webSocketsUriBuilder.Uri;
@@ -146,7 +146,7 @@
{
if (_webSocketsUri == null || _httpUri == null)
{
Log.Error("Could not start connection to server due to unreadable URLs.");
Log.Error("Could not start connection to server due to unreadable URLs");
return;
}
 
@@ -179,30 +179,32 @@
(sender, certificate, chain, errors) => true;
}
 
_webSocketSharp.Log.Output = (logData, s) =>
{
Log.Information($"WebSockets low level logging reported: {logData.Message}");
};
 
_webSocketSharp.OnMessage += WebSocketSharp_OnMessage;
_webSocketSharp.OnError += WebSocketSharp_OnError;
_webSocketSharp.OnOpen += WebSocketSharp_OnOpen;
_webSocketSharp.OnClose += WebSocketSharp_OnClose;
_webSocketSharp.Log.Output = (data, s) =>
{
var a = s;
};
_webSocketSharp.ConnectAsync();
}
 
private void WebSocketSharp_OnClose(object sender, CloseEventArgs e)
{
Log.Information($"WebSockets connection to server {_webSocketsUri.AbsoluteUri} closed with reason {e.Reason}.");
Log.Information($"WebSockets connection to server {_webSocketsUri.AbsoluteUri} closed with reason {e.Reason}");
}
 
private void WebSocketSharp_OnOpen(object sender, EventArgs e)
{
Log.Information($"WebSockets connection to server {_webSocketsUri.AbsoluteUri} is now open.");
Log.Information($"WebSockets connection to server {_webSocketsUri.AbsoluteUri} is now open");
}
 
private async void WebSocketSharp_OnError(object sender, ErrorEventArgs e)
{
Log.Error($"Connection to WebSockets server {_webSocketsUri.AbsoluteUri} terminated unexpectedly with message {e.Message}.", e.Exception);
Log.Error($"Connection to WebSockets server {_webSocketsUri.AbsoluteUri} terminated unexpectedly with message {e.Message}", e.Exception);
 
if (_cancellationToken.IsCancellationRequested)
{
@@ -211,7 +213,7 @@
}
 
await Task.Delay(TimeSpan.FromSeconds(1), _cancellationToken);
Log.Information($"Reconnecting to websocket server {_webSocketsUri.AbsoluteUri}.");
Log.Information($"Reconnecting to websocket server {_webSocketsUri.AbsoluteUri}");
 
Connect();
}
@@ -220,7 +222,7 @@
{
if (e.RawData.Length == 0)
{
Log.Warning($"Empty message received from server.");
Log.Warning($"Empty message received from server");
return;
}
 
@@ -250,7 +252,7 @@
if (!Uri.TryCreate(Path.Combine($"{_httpUri}", "application"), UriKind.Absolute,
out var applicationUri))
{
Log.Warning($"Could not build an URI to an application.");
Log.Warning($"Could not build an URI to an application");
return;
}
 
@@ -259,7 +261,7 @@
{
if (imageStream == null)
{
Log.Warning("Could not find any application image for notification.");
Log.Warning("Could not find any application image for notification");
return;
}
 
@@ -295,7 +297,7 @@
}
catch (Exception exception)
{
Log.Warning(exception, "Failure running connection loop.");
Log.Warning(exception, "Failure running connection loop");
}
}
 
@@ -326,7 +328,7 @@
if (!Uri.TryCreate(Path.Combine($"{_httpUri}", $"{application.Image}"), UriKind.Absolute,
out var applicationImageUri))
{
Log.Warning("Could not build URL path to application icon.");
Log.Warning("Could not build URL path to application icon");
continue;
}