implémentation fonctionnelle des caméras et des alarmes
Tento commit je obsažen v:
rodič
01448676f7
revize
7701a41e91
123 změnil soubory, kde provedl 19599 přidání a 186 odebrání
3
RSTP_DSLink/.vs/ProjectSettings.json
Normální soubor
3
RSTP_DSLink/.vs/ProjectSettings.json
Normální soubor
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"CurrentProjectSetting": null
|
||||
}
|
binární
RSTP_DSLink/.vs/RSTP_DSLink/DesignTimeBuild/.dtbcache.v2
Normální soubor
binární
RSTP_DSLink/.vs/RSTP_DSLink/DesignTimeBuild/.dtbcache.v2
Normální soubor
Binární soubor nebyl zobrazen.
Binární soubor nebyl zobrazen.
7
RSTP_DSLink/.vs/VSWorkspaceState.json
Normální soubor
7
RSTP_DSLink/.vs/VSWorkspaceState.json
Normální soubor
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"ExpandedNodes": [
|
||||
""
|
||||
],
|
||||
"SelectedNode": "\\RSTP_DSLink.sln",
|
||||
"PreviewInSolutionExplorer": false
|
||||
}
|
binární
RSTP_DSLink/.vs/slnx.sqlite
Normální soubor
binární
RSTP_DSLink/.vs/slnx.sqlite
Normální soubor
Binární soubor nebyl zobrazen.
170
RSTP_DSLink/RSTP_DSLink/Driver.cs
Normální soubor
170
RSTP_DSLink/RSTP_DSLink/Driver.cs
Normální soubor
|
@ -0,0 +1,170 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Device.Gpio;
|
||||
using System.Net;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Iot.Device.Pigpio
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class Driver : GpioDriver
|
||||
{
|
||||
private readonly IPEndPoint _endpoint;
|
||||
private readonly PigpiodIf _proxy;
|
||||
private readonly List<int> _openPins;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="endpoint"></param>
|
||||
public Driver(IPEndPoint endpoint)
|
||||
{
|
||||
_endpoint = endpoint;
|
||||
_proxy = new PigpiodIf();
|
||||
|
||||
_openPins = new List<int>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Task ConnectAsync()
|
||||
{
|
||||
_proxy.pigpio_start(_endpoint.Address.ToString(), _endpoint.Port.ToString());
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
protected override int PinCount => PigpiodIf.PI_MAX_USER_GPIO;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="pinNumber"></param>
|
||||
/// <param name="eventTypes"></param>
|
||||
/// <param name="callback"></param>
|
||||
protected override void AddCallbackForPinValueChangedEvent(int pinNumber, PinEventTypes eventTypes, PinChangeEventHandler callback)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
protected override void ClosePin(int pinNumber)
|
||||
{
|
||||
if (_openPins.Contains(pinNumber))
|
||||
{
|
||||
_openPins.Remove(pinNumber);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new InvalidOperationException($"Pin '{pinNumber}' hasn't been opened");
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
protected override int ConvertPinNumberToLogicalNumberingScheme(int pinNumber)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
protected override PinMode GetPinMode(int pinNumber)
|
||||
{
|
||||
var mode = _proxy.get_mode((uint)pinNumber);
|
||||
|
||||
switch (mode)
|
||||
{
|
||||
case PigpiodIf.PI_INPUT: return PinMode.Input;
|
||||
case PigpiodIf.PI_OUTPUT: return PinMode.Output;
|
||||
default: throw new ArgumentException($"Unknown PinMode value '{mode}'");
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
protected override bool IsPinModeSupported(int pinNumber, PinMode mode)
|
||||
{
|
||||
switch (mode)
|
||||
{
|
||||
case PinMode.Input: return true;
|
||||
case PinMode.InputPullUp: return true;
|
||||
case PinMode.InputPullDown: return true;
|
||||
case PinMode.Output: return true;
|
||||
default: return false; // Only input & output supported ATM. Should be increased to support input-pullup/pulldown
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
protected override void OpenPin(int pinNumber)
|
||||
{
|
||||
if (!_openPins.Contains(pinNumber))
|
||||
{
|
||||
_openPins.Add(pinNumber);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new InvalidOperationException($"Pin '{pinNumber}' is already been open");
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
protected override PinValue Read(int pinNumber)
|
||||
{
|
||||
return _proxy.gpio_read((uint)pinNumber);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
protected override void RemoveCallbackForPinValueChangedEvent(int pinNumber, PinChangeEventHandler callback)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
protected override void SetPinMode(int pinNumber, PinMode pinMode)
|
||||
{
|
||||
var mode = pinMode.AsMode();
|
||||
var pud = pinMode.AsPullUpDown();
|
||||
|
||||
_proxy.set_mode((uint)pinNumber, mode);
|
||||
_proxy.set_pull_up_down((uint)pinNumber, pud);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
protected override WaitForEventResult WaitForEvent(int pinNumber, PinEventTypes eventTypes, CancellationToken cancellationToken)
|
||||
{
|
||||
bool eventDetected = false;
|
||||
int oldValue = _proxy.gpio_read((uint)pinNumber);
|
||||
int newValue;
|
||||
while (!eventDetected && !cancellationToken.IsCancellationRequested)
|
||||
{
|
||||
newValue = _proxy.gpio_read ((uint)pinNumber);
|
||||
//Console.WriteLine(newValue);
|
||||
|
||||
if ((eventTypes == PinEventTypes.Rising && newValue == 1 && oldValue == 0)
|
||||
|| (eventTypes == PinEventTypes.Falling && newValue == 0 && oldValue == 1))
|
||||
eventDetected = true;
|
||||
|
||||
oldValue = newValue;
|
||||
//System.Threading.Thread.Sleep(500);
|
||||
}
|
||||
|
||||
WaitForEventResult result;
|
||||
result.EventTypes = cancellationToken.IsCancellationRequested?PinEventTypes.None:eventTypes;
|
||||
//If the task was cancelled, the event type is none
|
||||
result.TimedOut = false;
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
protected override void Write(int pinNumber, PinValue pinValue)
|
||||
{
|
||||
var value = pinValue.AsValue();
|
||||
|
||||
_proxy.gpio_write((uint)pinNumber, value);
|
||||
}
|
||||
}
|
||||
}
|
36
RSTP_DSLink/RSTP_DSLink/Helpers.cs
Normální soubor
36
RSTP_DSLink/RSTP_DSLink/Helpers.cs
Normální soubor
|
@ -0,0 +1,36 @@
|
|||
using System;
|
||||
using System.Device.Gpio;
|
||||
|
||||
namespace Iot.Device.Pigpio
|
||||
{
|
||||
internal static class Helpers
|
||||
{
|
||||
public static uint AsMode(this PinMode mode)
|
||||
{
|
||||
switch (mode)
|
||||
{
|
||||
case PinMode.Input: return PigpiodIf.PI_INPUT;
|
||||
case PinMode.InputPullUp: return PigpiodIf.PI_INPUT;
|
||||
case PinMode.InputPullDown: return PigpiodIf.PI_INPUT;
|
||||
case PinMode.Output: return PigpiodIf.PI_OUTPUT;
|
||||
default: throw new ArgumentException($"PinMode value of '{mode}' is not valid");
|
||||
}
|
||||
}
|
||||
|
||||
public static uint AsPullUpDown(this PinMode mode)
|
||||
{
|
||||
switch (mode)
|
||||
{
|
||||
case PinMode.InputPullUp: return PigpiodIf.PI_PUD_UP;
|
||||
case PinMode.InputPullDown: return PigpiodIf.PI_PUD_DOWN;
|
||||
default: return PigpiodIf.PI_PUD_OFF;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static uint AsValue(this PinValue value)
|
||||
{
|
||||
return (uint)(int)value;
|
||||
}
|
||||
}
|
||||
}
|
2789
RSTP_DSLink/RSTP_DSLink/PigpiodIf.cs
Normální soubor
2789
RSTP_DSLink/RSTP_DSLink/PigpiodIf.cs
Normální soubor
Rozdílový obsah nebyl zobrazen, protože je příliš veliký
Načíst porovnání
8
RSTP_DSLink/RSTP_DSLink/Properties/launchSettings.json
Normální soubor
8
RSTP_DSLink/RSTP_DSLink/Properties/launchSettings.json
Normální soubor
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"profiles": {
|
||||
"RSTP_DSLink": {
|
||||
"commandName": "Project",
|
||||
"commandLineArgs": "--name RTSP --broker http://192.168.1.54:8080/conn"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -7,24 +7,44 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Net.NetworkInformation;
|
||||
using System.Net;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Diagnostics;
|
||||
using Iot.Device.Pigpio;
|
||||
using Serilog;
|
||||
using CommandLine;
|
||||
using System.IO;
|
||||
using RTSP_DSLink;
|
||||
using System.Device.Gpio;
|
||||
|
||||
namespace RTSP_DSLink
|
||||
{
|
||||
public class RSTP_DSLink : DSLinkContainer
|
||||
{
|
||||
private readonly Dictionary<string, Node> _rngValues;
|
||||
private readonly Random _random;
|
||||
private readonly Thread _randomNumberThread;
|
||||
private readonly Dictionary<string, System.Diagnostics.Process> _processes;
|
||||
private readonly Dictionary<string, CancellationTokenSource> _alarmCTs;
|
||||
public static bool PortInUse(int port)
|
||||
{
|
||||
bool inUse = false;
|
||||
|
||||
IPGlobalProperties ipProperties = IPGlobalProperties.GetIPGlobalProperties();
|
||||
IPEndPoint[] ipEndPoints = ipProperties.GetActiveTcpListeners();
|
||||
foreach (IPEndPoint endPoint in ipEndPoints)
|
||||
{
|
||||
if (endPoint.Port == port)
|
||||
{
|
||||
inUse = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return inUse;
|
||||
}
|
||||
private static void Main(string[] args)
|
||||
{
|
||||
Parser.Default.ParseArguments<CommandLineArguments>(args)
|
||||
.WithParsed(cmdLineOptions =>
|
||||
{
|
||||
{
|
||||
cmdLineOptions = ProcessDSLinkJson(cmdLineOptions);
|
||||
|
||||
//Init the logging engine
|
||||
|
@ -49,11 +69,13 @@ namespace RTSP_DSLink
|
|||
public static async Task InitializeLink(RSTP_DSLink dsLink)
|
||||
{
|
||||
await dsLink.Connect();
|
||||
await dsLink.SaveNodes();
|
||||
//dsLink.ClearNodes();
|
||||
}
|
||||
|
||||
public RSTP_DSLink(Configuration config, CommandLineArguments cmdLineOptions) : base(config)
|
||||
{
|
||||
_processes = new Dictionary<string, Process>();
|
||||
_alarmCTs = new Dictionary<string, CancellationTokenSource>();
|
||||
//Perform any configuration overrides from command line options
|
||||
if (cmdLineOptions.BrokerUrl != null)
|
||||
{
|
||||
|
@ -75,97 +97,279 @@ namespace RTSP_DSLink
|
|||
config.KeysFolder = cmdLineOptions.KeysFolder;
|
||||
}
|
||||
|
||||
_rngValues = new Dictionary<string, Node>();
|
||||
_random = new Random();
|
||||
|
||||
Responder.AddNodeClass("rngAdd", delegate(Node node)
|
||||
Responder.AddNodeClass("streamAdd", delegate(Node node)
|
||||
{
|
||||
node.Configs.Set(ConfigType.DisplayName, new Value("Create RNG"));
|
||||
node.Configs.Set(ConfigType.DisplayName, new Value("Add Stream"));
|
||||
node.AddParameter(new Parameter
|
||||
{
|
||||
Name = "rngName",
|
||||
Name = "RSTP URL",
|
||||
ValueType = DSLink.Nodes.ValueType.String
|
||||
});
|
||||
node.SetAction(new ActionHandler(Permission.Config, _createRngAction));
|
||||
});
|
||||
|
||||
Responder.AddNodeClass("rng", delegate(Node node)
|
||||
{
|
||||
node.Configs.Set(ConfigType.Writable, new Value(Permission.Read.Permit));
|
||||
node.Configs.Set(ConfigType.ValueType, DSLink.Nodes.ValueType.Number.TypeValue);
|
||||
node.Value.Set(0);
|
||||
|
||||
lock (_rngValues)
|
||||
{
|
||||
_rngValues.Add(node.Name, node);
|
||||
}
|
||||
);
|
||||
node.AddParameter(new Parameter
|
||||
{
|
||||
Name = "Stream name",
|
||||
ValueType = DSLink.Nodes.ValueType.String
|
||||
}
|
||||
);
|
||||
node.SetAction(new ActionHandler(Permission.Config, _createStreamAction));
|
||||
});
|
||||
|
||||
Responder.AddNodeClass("number", delegate (Node node)
|
||||
Responder.AddNodeClass("alarmAdd", delegate (Node node)
|
||||
{
|
||||
node.Configs.Set(ConfigType.DisplayName, new Value("Add Alarm"));
|
||||
node.AddParameter(new Parameter
|
||||
{
|
||||
Name = "Alarm name",
|
||||
ValueType = DSLink.Nodes.ValueType.String
|
||||
}
|
||||
);
|
||||
/*node.AddParameter(new Parameter
|
||||
{
|
||||
Name = "Camera name",
|
||||
ValueType = DSLink.Nodes.ValueType.String
|
||||
}
|
||||
); */
|
||||
node.AddParameter(new Parameter
|
||||
{
|
||||
Name = "Raspberry Pi IP Address",
|
||||
ValueType = DSLink.Nodes.ValueType.String
|
||||
}
|
||||
);
|
||||
node.AddParameter(new Parameter
|
||||
{
|
||||
Name = "Port Number",
|
||||
ValueType = DSLink.Nodes.ValueType.Number
|
||||
}
|
||||
);
|
||||
node.AddParameter(new Parameter
|
||||
{
|
||||
Name = "GPIO Pin",
|
||||
ValueType = DSLink.Nodes.ValueType.Number
|
||||
}
|
||||
);
|
||||
|
||||
node.SetAction(new ActionHandler(Permission.Config, _createAlarmAction));
|
||||
});
|
||||
|
||||
Responder.AddNodeClass("removeNode", delegate (Node node)
|
||||
{
|
||||
node.Configs.Set(ConfigType.DisplayName, new Value("Remove"));
|
||||
node.SetAction(new ActionHandler(Permission.Config, removeNodeAction));
|
||||
});
|
||||
|
||||
Responder.AddNodeClass("stream", delegate (Node node)
|
||||
{
|
||||
node.Configs.Set(ConfigType.Writable, new Value(Permission.Read.Permit));
|
||||
node.Configs.Set(ConfigType.ValueType, DSLink.Nodes.ValueType.Number.TypeValue);
|
||||
|
||||
node.Value.Set(-1);
|
||||
});
|
||||
|
||||
Responder.AddNodeClass("alarm", delegate (Node node)
|
||||
{
|
||||
node.Configs.Set(ConfigType.Writable, new Value(Permission.Read.Permit));
|
||||
node.Configs.Set(ConfigType.ValueType, DSLink.Nodes.ValueType.Boolean.TypeValue);
|
||||
node.Value.Set(false);
|
||||
});
|
||||
|
||||
/*Responder.AddNodeClass("rng", delegate(Node node)
|
||||
{
|
||||
node.Configs.Set(ConfigType.Writable, new Value(Permission.Read.Permit));
|
||||
node.Configs.Set(ConfigType.ValueType, DSLink.Nodes.ValueType.Number.TypeValue);
|
||||
node.Value.Set(0);
|
||||
});
|
||||
|
||||
_randomNumberThread = new Thread(_updateRandomNumbers);
|
||||
_randomNumberThread.Start();
|
||||
});*/
|
||||
}
|
||||
public void ClearNodes()
|
||||
{
|
||||
foreach (var key in Responder.SuperRoot.Children.Keys)
|
||||
{
|
||||
Responder.SuperRoot.Children.TryGetValue(key, out Node oldStream);
|
||||
if (oldStream.ClassName == "stream")
|
||||
{
|
||||
//Console.WriteLine(key);
|
||||
Responder.SuperRoot.RemoveChild(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void InitializeDefaultNodes()
|
||||
{
|
||||
Responder.SuperRoot.CreateChild("createRNG", "rngAdd").BuildNode();
|
||||
Responder.SuperRoot.CreateChild("createStream", "streamAdd").BuildNode();
|
||||
Responder.SuperRoot.CreateChild("createAlarm", "alarmAdd").BuildNode();
|
||||
SaveNodes();
|
||||
//Responder.SuperRoot.CreateChild("removeStream", "remove").BuildNode();
|
||||
}
|
||||
|
||||
private void _updateRandomNumbers()
|
||||
private async void _createStreamAction(InvokeRequest request)
|
||||
{
|
||||
while (Thread.CurrentThread.IsAlive)
|
||||
try
|
||||
{
|
||||
lock (_rngValues)
|
||||
{
|
||||
foreach (var n in _rngValues)
|
||||
{
|
||||
Node minChild, maxChild;
|
||||
n.Value.Children.TryGetValue("min", out minChild);
|
||||
n.Value.Children.TryGetValue("max", out maxChild);
|
||||
//Si les enfants ne sont pas initialisés, on met les valeurs de min et max à 0
|
||||
// Code équivalent à :
|
||||
//int min, max;
|
||||
//if (minChild != null) {
|
||||
// min = minChild.Value.Int;
|
||||
//}
|
||||
//else {
|
||||
// min = 0;
|
||||
//}
|
||||
//if (maxChild != null) {
|
||||
// max = maxChild.Value.Int;
|
||||
//}
|
||||
//else {
|
||||
// max = 0;
|
||||
//}
|
||||
int min = (minChild != null ? minChild.Value.Int : 0);
|
||||
int max = (maxChild != null ? maxChild.Value.Int : 0);
|
||||
var address = request.Parameters["RSTP URL"].Value<string>();
|
||||
var streamName = request.Parameters["Stream name"].Value<string>();
|
||||
int port = 8081;
|
||||
|
||||
n.Value.Value.Set(_random.Next(min, max+1));
|
||||
if (string.IsNullOrEmpty(address)) return;
|
||||
|
||||
while (PortInUse(port))
|
||||
port++;
|
||||
|
||||
/*foreach (var oldStreamName in Responder.SuperRoot.Children.Keys)
|
||||
{
|
||||
|
||||
Responder.SuperRoot.Children.TryGetValue(oldStreamName, out Node oldStream);
|
||||
if (oldStream.ClassName == "stream")
|
||||
{
|
||||
//Console.WriteLine(oldStreamName);
|
||||
if (oldStream.Value.Int == port)
|
||||
{
|
||||
Responder.SuperRoot.RemoveChild(oldStreamName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Thread.Sleep(10000);
|
||||
}*/
|
||||
|
||||
if (string.IsNullOrEmpty(streamName)) return;
|
||||
if (Responder.SuperRoot.Children.ContainsKey(streamName)) return;
|
||||
|
||||
var stream = Responder.SuperRoot.CreateChild(streamName, "stream").BuildNode();
|
||||
|
||||
stream.Value.Set(port);
|
||||
stream.CreateChild("remove", "removeNode").BuildNode();
|
||||
|
||||
/*System.Diagnostics.Process.Start("CMD.exe", "/C \"C:\\Program Files\\VideoLAN\\VLC\\VLC.exe\"" +
|
||||
" -vvv -Idummy " + address + " --sout #transcode{vcodec=MJPG,venc=ffmpeg{strict=1}}" +
|
||||
":standard{access=http{mime=multipart/x-mixed-replace;boundary=--7b3cc56e5f51db803f790dad720ed50a}," +
|
||||
"mux=mpjpeg,dst=:" + port + "/} vlc://quit;");*/
|
||||
var proc = new Process {
|
||||
StartInfo = new ProcessStartInfo
|
||||
{
|
||||
FileName = "C:\\Program Files\\VideoLAN\\VLC\\VLC.exe",
|
||||
Arguments = " -vvv -Idummy " + address + " --sout #transcode{vcodec=MJPG,venc=ffmpeg{strict=1}}" +
|
||||
":standard{access=http{mime=multipart/x-mixed-replace;boundary=--7b3cc56e5f51db803f790dad720ed50a}," +
|
||||
"mux=mpjpeg,dst=:" + port + "/} vlc://quit;",
|
||||
UseShellExecute = false,
|
||||
RedirectStandardOutput = false,
|
||||
CreateNoWindow = true
|
||||
}};
|
||||
proc.Start();
|
||||
_processes.Add(streamName, proc);
|
||||
|
||||
await request.Close();
|
||||
await SaveNodes();
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
Console.WriteLine(e.GetType() + ":" + e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
private async void _createRngAction(InvokeRequest request)
|
||||
private async void _createAlarmAction(InvokeRequest request)
|
||||
{
|
||||
var rngName = request.Parameters["rngName"].Value<string>();
|
||||
if (string.IsNullOrEmpty(rngName)) return;
|
||||
if (Responder.SuperRoot.Children.ContainsKey(rngName)) return;
|
||||
try
|
||||
{
|
||||
var alarmName = request.Parameters["Alarm name"].Value<string>();
|
||||
//var cameraName = request.Parameters["Camera name"].Value<string>();
|
||||
var address = request.Parameters["Raspberry Pi IP Address"].Value<string>();
|
||||
var port = request.Parameters["Port Number"].Value<int>();
|
||||
var pin = request.Parameters["GPIO Pin"].Value<int>();
|
||||
|
||||
var newRng = Responder.SuperRoot.CreateChild(rngName, "rng").BuildNode();
|
||||
newRng.CreateChild("min", "number").BuildNode();
|
||||
newRng.CreateChild("max", "number").BuildNode();
|
||||
if (string.IsNullOrEmpty(alarmName)) return;
|
||||
//if (string.IsNullOrEmpty(cameraName)) return;
|
||||
if (Responder.SuperRoot.Children.ContainsKey(alarmName)) return;
|
||||
//if (!Responder.SuperRoot.Children.ContainsKey(cameraName)) return;
|
||||
|
||||
await request.Close();
|
||||
await SaveNodes();
|
||||
var alarm = Responder.SuperRoot.CreateChild(alarmName, "alarm").BuildNode();
|
||||
|
||||
alarm.CreateChild("remove", "removeNode").BuildNode();
|
||||
var ts = new CancellationTokenSource();
|
||||
CancellationToken ct = ts.Token;
|
||||
Task.Run(() => _updateAlarm(alarm, address, port, pin, ct));
|
||||
_alarmCTs.Add(alarmName, ts);
|
||||
|
||||
|
||||
|
||||
await request.Close();
|
||||
await SaveNodes();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine(e.GetType() + ":" + e.Message);
|
||||
}
|
||||
}
|
||||
private async void removeNodeAction(InvokeRequest request)
|
||||
{
|
||||
try
|
||||
{
|
||||
//Console.WriteLine(request.Path);
|
||||
|
||||
//on récupère le nom du noeud ayant envoyé la requête
|
||||
//dans le chemin de la requête en utilisant une regex (le chemin se terminant par /noeud/remove)
|
||||
var nodeName = Regex.Replace(request.Path, "^.*\\/([^\\/]*)\\/remove$", "$1");
|
||||
//Console.WriteLine(streamName);
|
||||
|
||||
|
||||
Responder.SuperRoot.Children.TryGetValue(nodeName, out Node node);
|
||||
if (node != null)
|
||||
{
|
||||
if (node.ClassName == "stream")
|
||||
{
|
||||
var port = node.Value.Int;
|
||||
_processes.TryGetValue(nodeName, out Process proc);
|
||||
if (proc != null)
|
||||
proc.Kill();
|
||||
_processes.Remove(nodeName);
|
||||
|
||||
/*System.Diagnostics.Process.Start("CMD.exe", "/C FOR /F \"tokens=5 delims= \" %P IN ('netstat -a -n -o ^|" +
|
||||
"findstr :" + stream.Value.Int + "') DO @ECHO taskkill /F /PID %P");*/
|
||||
|
||||
//FOR /F "tokens=5 delims= " %P IN('netstat -a -n -o | findstr :8081') DO @ECHO TaskKill.exe /PID %P
|
||||
}
|
||||
else if (node.ClassName == "alarm")
|
||||
{
|
||||
_alarmCTs.TryGetValue(nodeName, out CancellationTokenSource ts);
|
||||
if(ts != null)
|
||||
ts.Cancel();
|
||||
}
|
||||
Responder.SuperRoot.RemoveChild(nodeName);
|
||||
}
|
||||
|
||||
await request.Close();
|
||||
await SaveNodes();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine(e.GetType() + ":" + e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
private async void _updateAlarm(Node alarm, string addr, int port, int pin, CancellationToken ct)
|
||||
{
|
||||
using (var driver = new Driver(new IPEndPoint(IPAddress.Parse(addr), port)))
|
||||
{
|
||||
await driver.ConnectAsync();
|
||||
await Task.Delay(TimeSpan.FromSeconds(1)); //Give the socket time to get connected
|
||||
|
||||
Console.WriteLine("Connected");
|
||||
|
||||
using (var controller = new GpioController(PinNumberingScheme.Logical, driver))
|
||||
{
|
||||
controller.OpenPin(pin);
|
||||
controller.SetPinMode(pin, PinMode.InputPullUp);
|
||||
|
||||
while (!ct.IsCancellationRequested)
|
||||
{
|
||||
controller.WaitForEvent(pin, PinEventTypes.Falling, ct);
|
||||
if(!ct.IsCancellationRequested)
|
||||
{
|
||||
Console.WriteLine("Beep boop");
|
||||
alarm.Value.Set(true);
|
||||
}
|
||||
}
|
||||
Console.WriteLine("Task cancelled");
|
||||
controller.ClosePin(pin);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#region Initialize Logging
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
|
||||
<PackageReference Include="Serilog.Sinks.RollingFile" Version="3.3.0" />
|
||||
<PackageReference Include="StandardStorage" Version="0.1.1" />
|
||||
<PackageReference Include="System.Device.Gpio" Version="1.5.0" />
|
||||
<PackageReference Include="Unosquare.RaspberryIO.Peripherals" Version="0.5.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
156
RSTP_DSLink/RSTP_DSLink/TcpConnection.cs
Normální soubor
156
RSTP_DSLink/RSTP_DSLink/TcpConnection.cs
Normální soubor
|
@ -0,0 +1,156 @@
|
|||
using System;
|
||||
using System.Net.Sockets;
|
||||
|
||||
namespace Iot.Device.Pigpio
|
||||
{
|
||||
internal class TcpConnection
|
||||
{
|
||||
#region # event
|
||||
|
||||
public event EventHandler StreamChanged;
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region # private field
|
||||
|
||||
private TcpClient tcp = null;
|
||||
private string ipOrHost;
|
||||
private int port;
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region # public property
|
||||
|
||||
public bool IsOpened
|
||||
{
|
||||
get
|
||||
{
|
||||
return tcp != null;
|
||||
}
|
||||
}
|
||||
|
||||
private NetworkStream _stream = null;
|
||||
public NetworkStream Stream
|
||||
{
|
||||
get
|
||||
{
|
||||
return _stream;
|
||||
}
|
||||
set
|
||||
{
|
||||
_stream = value;
|
||||
if (StreamChanged != null)
|
||||
{
|
||||
StreamChanged.Invoke(this, new EventArgs());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region # Implementation of IDisposable
|
||||
|
||||
bool disposed = false;
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
if (disposed)
|
||||
return;
|
||||
|
||||
if (disposing)
|
||||
{
|
||||
// Release managed objects
|
||||
Close();
|
||||
}
|
||||
|
||||
// Release unmanaged objects
|
||||
|
||||
disposed = true;
|
||||
}
|
||||
~TcpConnection()
|
||||
{
|
||||
Dispose(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region # public method
|
||||
|
||||
public bool Open(string ipOrHost, int port)
|
||||
{
|
||||
if (tcp == null)
|
||||
{
|
||||
try
|
||||
{
|
||||
this.ipOrHost = ipOrHost;
|
||||
this.port = port;
|
||||
|
||||
tcp = new TcpClient();
|
||||
tcp.BeginConnect(ipOrHost, port, new AsyncCallback(NetConnectCallback), null);
|
||||
|
||||
Console.WriteLine("Connecting to {0}:{1}...", ipOrHost, port);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("Connection failed({0}).", ex.Message);
|
||||
Close();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
if (Stream != null)
|
||||
{
|
||||
// Execute handlers of StreamChanged event, and call Dispose()
|
||||
var stream = Stream;
|
||||
Stream = null;
|
||||
stream.Dispose();
|
||||
}
|
||||
if (tcp != null)
|
||||
{
|
||||
tcp.Close();
|
||||
tcp = null;
|
||||
|
||||
Console.WriteLine("{0}:{1} was disconnected.", ipOrHost, port);
|
||||
}
|
||||
ipOrHost = string.Empty;
|
||||
port = 0;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region # private method
|
||||
|
||||
private void NetConnectCallback(IAsyncResult result)
|
||||
{
|
||||
if (tcp == null)
|
||||
return;
|
||||
|
||||
if (tcp.Connected)
|
||||
{
|
||||
Console.WriteLine("Connected to LAN {0}:{1}.",
|
||||
((System.Net.IPEndPoint)tcp.Client.RemoteEndPoint).Address,
|
||||
((System.Net.IPEndPoint)tcp.Client.RemoteEndPoint).Port);
|
||||
|
||||
var stream = tcp.GetStream();
|
||||
stream.ReadTimeout = 10000;
|
||||
stream.WriteTimeout = 10000;
|
||||
Stream = stream;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
1
RSTP_DSLink/RSTP_DSLink/bin/Debug/netcoreapp3.1/.keys
Normální soubor
1
RSTP_DSLink/RSTP_DSLink/bin/Debug/netcoreapp3.1/.keys
Normální soubor
|
@ -0,0 +1 @@
|
|||
AO39Mq3F7NNBl0JDFl0Vz5c99i8+xKqU6Z+X4IZqHLxN BB55A01yuewbt8+/lKZ9hNVvpvEAv9BAuY/y/M0KjvHxUzcFdGdmGrftSjQVtITmD5c83eFyBRMUeK9Ca7Eybn8=
|
binární
RSTP_DSLink/RSTP_DSLink/bin/Debug/netcoreapp3.1/Microsoft.Win32.Registry.dll
Normální soubor
binární
RSTP_DSLink/RSTP_DSLink/bin/Debug/netcoreapp3.1/Microsoft.Win32.Registry.dll
Normální soubor
Binární soubor nebyl zobrazen.
Rozdílový obsah nebyl zobrazen, protože je příliš veliký
Načíst porovnání
Binární soubor nebyl zobrazen.
Binární soubor nebyl zobrazen.
binární
RSTP_DSLink/RSTP_DSLink/bin/Debug/netcoreapp3.1/Swan.Lite.dll
Normální soubor
binární
RSTP_DSLink/RSTP_DSLink/bin/Debug/netcoreapp3.1/Swan.Lite.dll
Normální soubor
Binární soubor nebyl zobrazen.
binární
RSTP_DSLink/RSTP_DSLink/bin/Debug/netcoreapp3.1/Swan.dll
Normální soubor
binární
RSTP_DSLink/RSTP_DSLink/bin/Debug/netcoreapp3.1/Swan.dll
Normální soubor
Binární soubor nebyl zobrazen.
binární
RSTP_DSLink/RSTP_DSLink/bin/Debug/netcoreapp3.1/System.Device.Gpio.dll
Normální soubor
binární
RSTP_DSLink/RSTP_DSLink/bin/Debug/netcoreapp3.1/System.Device.Gpio.dll
Normální soubor
Binární soubor nebyl zobrazen.
binární
RSTP_DSLink/RSTP_DSLink/bin/Debug/netcoreapp3.1/System.Security.AccessControl.dll
Normální soubor
binární
RSTP_DSLink/RSTP_DSLink/bin/Debug/netcoreapp3.1/System.Security.AccessControl.dll
Normální soubor
Binární soubor nebyl zobrazen.
binární
RSTP_DSLink/RSTP_DSLink/bin/Debug/netcoreapp3.1/System.Security.Principal.Windows.dll
Normální soubor
binární
RSTP_DSLink/RSTP_DSLink/bin/Debug/netcoreapp3.1/System.Security.Principal.Windows.dll
Normální soubor
Binární soubor nebyl zobrazen.
binární
RSTP_DSLink/RSTP_DSLink/bin/Debug/netcoreapp3.1/Unosquare.Raspberry.Abstractions.dll
Normální soubor
binární
RSTP_DSLink/RSTP_DSLink/bin/Debug/netcoreapp3.1/Unosquare.Raspberry.Abstractions.dll
Normální soubor
Binární soubor nebyl zobrazen.
binární
RSTP_DSLink/RSTP_DSLink/bin/Debug/netcoreapp3.1/Unosquare.RaspberryIO.Peripherals.dll
Normální soubor
binární
RSTP_DSLink/RSTP_DSLink/bin/Debug/netcoreapp3.1/Unosquare.RaspberryIO.Peripherals.dll
Normální soubor
Binární soubor nebyl zobrazen.
binární
RSTP_DSLink/RSTP_DSLink/bin/Debug/netcoreapp3.1/Unosquare.RaspberryIO.dll
Normální soubor
binární
RSTP_DSLink/RSTP_DSLink/bin/Debug/netcoreapp3.1/Unosquare.RaspberryIO.dll
Normální soubor
Binární soubor nebyl zobrazen.
5
RSTP_DSLink/RSTP_DSLink/bin/Debug/netcoreapp3.1/log-20210730.txt
Normální soubor
5
RSTP_DSLink/RSTP_DSLink/bin/Debug/netcoreapp3.1/log-20210730.txt
Normální soubor
|
@ -0,0 +1,5 @@
|
|||
2021-07-30 09:43:15.793 +02:00 [Information] Handshaking with http://localhost:8080/conn?dsId=RSTP_Test3-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs
|
||||
2021-07-30 09:43:18.537 +02:00 [Information] Handshake successful
|
||||
2021-07-30 09:43:19.001 +02:00 [Information] Connecting
|
||||
2021-07-30 09:43:19.031 +02:00 [Information] WebSocket connecting to ws://localhost:8080/ws?dsId=RSTP_Test3-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs&auth=ZI0S3FYjOpJ6RFGUB0AJdQz1L66DY40JexmnWbFRdW0&format=msgpack
|
||||
2021-07-30 09:43:21.172 +02:00 [Information] Connected to ws://localhost:8080/ws?dsId=RSTP_Test3-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs&auth=ZI0S3FYjOpJ6RFGUB0AJdQz1L66DY40JexmnWbFRdW0&format=msgpack
|
137
RSTP_DSLink/RSTP_DSLink/bin/Debug/netcoreapp3.1/log-20210802.txt
Normální soubor
137
RSTP_DSLink/RSTP_DSLink/bin/Debug/netcoreapp3.1/log-20210802.txt
Normální soubor
|
@ -0,0 +1,137 @@
|
|||
2021-08-02 13:50:42.944 +02:00 [Information] Handshaking with http://localhost:8080/conn?dsId=RSTP_Test3-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs
|
||||
2021-08-02 13:51:41.611 +02:00 [Information] Handshaking with http://192.168.1.54:8080/conn?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs
|
||||
2021-08-02 13:51:42.663 +02:00 [Information] Handshake successful
|
||||
2021-08-02 13:51:43.442 +02:00 [Information] Connecting
|
||||
2021-08-02 13:51:43.489 +02:00 [Information] WebSocket connecting to ws://192.168.1.54:8080/ws?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs&auth=uhl97qol-LJctTsc1JFBBvNw_sEimFGBhB3faZZJtnU&format=msgpack
|
||||
2021-08-02 13:51:43.635 +02:00 [Information] Connected to ws://192.168.1.54:8080/ws?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs&auth=uhl97qol-LJctTsc1JFBBvNw_sEimFGBhB3faZZJtnU&format=msgpack
|
||||
2021-08-02 14:34:19.228 +02:00 [Warning] Failed to load nodes.json
|
||||
2021-08-02 14:34:19.348 +02:00 [Warning] File does not exist: C:\Users\l.farina\Desktop\UCRM_stage\RSTP_DSLink\RSTP_DSLink\bin\Debug\netcoreapp3.1\nodes.json
|
||||
2021-08-02 14:34:19.565 +02:00 [Warning] at StandardStorage.Folder.GetFileAsync(String name, CancellationToken cancellationToken)
|
||||
at DSLink.VFS.SystemVFS._getFile(String fileName)
|
||||
at DSLink.VFS.SystemVFS.ReadAsync(String fileName)
|
||||
at DSLink.Respond.DiskSerializer.DeserializeFromDisk()
|
||||
2021-08-02 14:34:19.708 +02:00 [Information] Handshaking with http://192.168.1.54:8080/conn?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs
|
||||
2021-08-02 14:34:20.422 +02:00 [Information] Handshake successful
|
||||
2021-08-02 14:34:21.158 +02:00 [Information] Connecting
|
||||
2021-08-02 14:34:21.216 +02:00 [Information] WebSocket connecting to ws://192.168.1.54:8080/ws?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs&auth=ODxOscstQta0tvbEL7qP9asNm-ruY0cO5FS59ic3iLg&format=msgpack
|
||||
2021-08-02 14:34:21.361 +02:00 [Information] Connected to ws://192.168.1.54:8080/ws?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs&auth=ODxOscstQta0tvbEL7qP9asNm-ruY0cO5FS59ic3iLg&format=msgpack
|
||||
2021-08-02 14:35:38.680 +02:00 [Information] Handshaking with http://192.168.1.54:8080/conn?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs
|
||||
2021-08-02 14:35:39.471 +02:00 [Information] Handshake successful
|
||||
2021-08-02 14:35:39.956 +02:00 [Information] Connecting
|
||||
2021-08-02 14:35:40.030 +02:00 [Information] WebSocket connecting to ws://192.168.1.54:8080/ws?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs&auth=imEeLF8hF0q7ChooQmo5CsGjIf25PFZcRNR1EozTcog&format=msgpack
|
||||
2021-08-02 14:35:40.142 +02:00 [Information] Connected to ws://192.168.1.54:8080/ws?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs&auth=imEeLF8hF0q7ChooQmo5CsGjIf25PFZcRNR1EozTcog&format=msgpack
|
||||
2021-08-02 14:36:55.341 +02:00 [Warning] Failed to load nodes.json
|
||||
2021-08-02 14:36:55.501 +02:00 [Warning] File does not exist: C:\Users\l.farina\Desktop\UCRM_stage\RSTP_DSLink\RSTP_DSLink\bin\Debug\netcoreapp3.1\nodes.json
|
||||
2021-08-02 14:36:55.670 +02:00 [Warning] at StandardStorage.Folder.GetFileAsync(String name, CancellationToken cancellationToken)
|
||||
at DSLink.VFS.SystemVFS._getFile(String fileName)
|
||||
at DSLink.VFS.SystemVFS.ReadAsync(String fileName)
|
||||
at DSLink.Respond.DiskSerializer.DeserializeFromDisk()
|
||||
2021-08-02 14:36:55.743 +02:00 [Information] Handshaking with http://192.168.1.54:8080/conn?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs
|
||||
2021-08-02 14:36:56.450 +02:00 [Information] Handshake successful
|
||||
2021-08-02 14:36:56.788 +02:00 [Information] Connecting
|
||||
2021-08-02 14:36:56.867 +02:00 [Information] WebSocket connecting to ws://192.168.1.54:8080/ws?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs&auth=PQrt57OWxkEJODmDyqmYIGr81Cd6LkMSxeMd9IDGNTk&format=msgpack
|
||||
2021-08-02 14:36:57.006 +02:00 [Information] Connected to ws://192.168.1.54:8080/ws?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs&auth=PQrt57OWxkEJODmDyqmYIGr81Cd6LkMSxeMd9IDGNTk&format=msgpack
|
||||
2021-08-02 14:45:15.520 +02:00 [Information] Handshaking with http://192.168.1.54:8080/conn?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs
|
||||
2021-08-02 14:45:16.224 +02:00 [Information] Handshake successful
|
||||
2021-08-02 14:45:16.858 +02:00 [Information] Connecting
|
||||
2021-08-02 14:45:16.953 +02:00 [Information] WebSocket connecting to ws://192.168.1.54:8080/ws?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs&auth=LliHPiJv3YLrT1AwlAPUj3s52vEcvswjBMhX3n9hsIQ&format=msgpack
|
||||
2021-08-02 14:45:17.043 +02:00 [Information] Connected to ws://192.168.1.54:8080/ws?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs&auth=LliHPiJv3YLrT1AwlAPUj3s52vEcvswjBMhX3n9hsIQ&format=msgpack
|
||||
2021-08-02 15:05:11.773 +02:00 [Warning] Failed to load nodes.json
|
||||
2021-08-02 15:05:11.895 +02:00 [Warning] File does not exist: C:\Users\l.farina\Desktop\UCRM_stage\RSTP_DSLink\RSTP_DSLink\bin\Debug\netcoreapp3.1\nodes.json
|
||||
2021-08-02 15:05:12.135 +02:00 [Warning] at StandardStorage.Folder.GetFileAsync(String name, CancellationToken cancellationToken)
|
||||
at DSLink.VFS.SystemVFS._getFile(String fileName)
|
||||
at DSLink.VFS.SystemVFS.ReadAsync(String fileName)
|
||||
at DSLink.Respond.DiskSerializer.DeserializeFromDisk()
|
||||
2021-08-02 15:05:12.216 +02:00 [Information] Handshaking with http://192.168.1.54:8080/conn?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs
|
||||
2021-08-02 15:05:12.775 +02:00 [Information] Handshake successful
|
||||
2021-08-02 15:05:13.146 +02:00 [Information] Connecting
|
||||
2021-08-02 15:05:13.200 +02:00 [Information] WebSocket connecting to ws://192.168.1.54:8080/ws?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs&auth=8_IBgIIzs9F0GftK--bSy47OJ47V8iQZQbu5Zn_HdC0&format=msgpack
|
||||
2021-08-02 15:05:13.301 +02:00 [Information] Connected to ws://192.168.1.54:8080/ws?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs&auth=8_IBgIIzs9F0GftK--bSy47OJ47V8iQZQbu5Zn_HdC0&format=msgpack
|
||||
2021-08-02 15:23:30.345 +02:00 [Warning] Failed to load nodes.json
|
||||
2021-08-02 15:23:30.945 +02:00 [Warning] File does not exist: C:\Users\l.farina\Desktop\UCRM_stage\RSTP_DSLink\RSTP_DSLink\bin\Debug\netcoreapp3.1\nodes.json
|
||||
2021-08-02 15:23:31.041 +02:00 [Warning] at StandardStorage.Folder.GetFileAsync(String name, CancellationToken cancellationToken)
|
||||
at DSLink.VFS.SystemVFS._getFile(String fileName)
|
||||
at DSLink.VFS.SystemVFS.ReadAsync(String fileName)
|
||||
at DSLink.Respond.DiskSerializer.DeserializeFromDisk()
|
||||
2021-08-02 15:23:31.147 +02:00 [Information] Handshaking with http://192.168.1.54:8080/conn?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs
|
||||
2021-08-02 15:23:32.012 +02:00 [Information] Handshake successful
|
||||
2021-08-02 15:23:32.694 +02:00 [Information] Connecting
|
||||
2021-08-02 15:23:32.783 +02:00 [Information] WebSocket connecting to ws://192.168.1.54:8080/ws?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs&auth=MqtkDt1G1TO0CnxkbQrTNvU3LGNOeqsBHeI_XL_M6Q4&format=msgpack
|
||||
2021-08-02 15:23:33.134 +02:00 [Information] Connected to ws://192.168.1.54:8080/ws?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs&auth=MqtkDt1G1TO0CnxkbQrTNvU3LGNOeqsBHeI_XL_M6Q4&format=msgpack
|
||||
2021-08-02 15:24:27.414 +02:00 [Warning] Failed to load nodes.json
|
||||
2021-08-02 15:24:27.517 +02:00 [Warning] File does not exist: C:\Users\l.farina\Desktop\UCRM_stage\RSTP_DSLink\RSTP_DSLink\bin\Debug\netcoreapp3.1\nodes.json
|
||||
2021-08-02 15:24:27.624 +02:00 [Warning] at StandardStorage.Folder.GetFileAsync(String name, CancellationToken cancellationToken)
|
||||
at DSLink.VFS.SystemVFS._getFile(String fileName)
|
||||
at DSLink.VFS.SystemVFS.ReadAsync(String fileName)
|
||||
at DSLink.Respond.DiskSerializer.DeserializeFromDisk()
|
||||
2021-08-02 15:24:27.720 +02:00 [Information] Handshaking with http://192.168.1.54:8080/conn?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs
|
||||
2021-08-02 15:24:28.544 +02:00 [Information] Handshake successful
|
||||
2021-08-02 15:24:28.956 +02:00 [Information] Connecting
|
||||
2021-08-02 15:24:29.016 +02:00 [Information] WebSocket connecting to ws://192.168.1.54:8080/ws?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs&auth=91NDc7aEGIm0ZaI1idI5PZcvlzF2NJlKp0vqN5zGk_A&format=msgpack
|
||||
2021-08-02 15:24:29.156 +02:00 [Information] Connected to ws://192.168.1.54:8080/ws?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs&auth=91NDc7aEGIm0ZaI1idI5PZcvlzF2NJlKp0vqN5zGk_A&format=msgpack
|
||||
2021-08-02 15:36:07.616 +02:00 [Information] Handshaking with http://192.168.1.54:8080/conn?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs
|
||||
2021-08-02 15:36:08.470 +02:00 [Information] Handshake successful
|
||||
2021-08-02 15:36:08.910 +02:00 [Information] Connecting
|
||||
2021-08-02 15:36:08.971 +02:00 [Information] WebSocket connecting to ws://192.168.1.54:8080/ws?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs&auth=kNXRX8md71HUGQYqMdfmhFkEiC7SsQeVn87VyuxajK8&format=msgpack
|
||||
2021-08-02 15:36:09.047 +02:00 [Information] Connected to ws://192.168.1.54:8080/ws?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs&auth=kNXRX8md71HUGQYqMdfmhFkEiC7SsQeVn87VyuxajK8&format=msgpack
|
||||
2021-08-02 15:37:13.892 +02:00 [Information] Handshaking with http://192.168.1.54:8080/conn?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs
|
||||
2021-08-02 15:37:14.418 +02:00 [Information] Handshake successful
|
||||
2021-08-02 15:37:14.765 +02:00 [Information] Connecting
|
||||
2021-08-02 15:37:14.819 +02:00 [Information] WebSocket connecting to ws://192.168.1.54:8080/ws?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs&auth=8zvw8rDqIFXrIKvqE1ftulG7BM_rLNb7bb-AdHK37ks&format=msgpack
|
||||
2021-08-02 15:37:14.947 +02:00 [Information] Connected to ws://192.168.1.54:8080/ws?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs&auth=8zvw8rDqIFXrIKvqE1ftulG7BM_rLNb7bb-AdHK37ks&format=msgpack
|
||||
2021-08-02 15:37:59.300 +02:00 [Information] Handshaking with http://192.168.1.54:8080/conn?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs
|
||||
2021-08-02 15:37:59.804 +02:00 [Information] Handshake successful
|
||||
2021-08-02 15:38:00.225 +02:00 [Information] Connecting
|
||||
2021-08-02 15:38:00.299 +02:00 [Information] WebSocket connecting to ws://192.168.1.54:8080/ws?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs&auth=p1_Cwft2j9YTdcwyz2KcIDSZXii5JQUNSUkT4FQwUUA&format=msgpack
|
||||
2021-08-02 15:38:00.365 +02:00 [Information] Connected to ws://192.168.1.54:8080/ws?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs&auth=p1_Cwft2j9YTdcwyz2KcIDSZXii5JQUNSUkT4FQwUUA&format=msgpack
|
||||
2021-08-02 15:40:46.878 +02:00 [Information] Handshaking with http://192.168.1.54:8080/conn?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs
|
||||
2021-08-02 15:40:47.752 +02:00 [Information] Handshake successful
|
||||
2021-08-02 15:40:48.027 +02:00 [Information] Connecting
|
||||
2021-08-02 15:40:48.090 +02:00 [Information] WebSocket connecting to ws://192.168.1.54:8080/ws?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs&auth=hmcLWMoqCo7LV889eG8XN-epvd8iyxXAwUPgIE49bk0&format=msgpack
|
||||
2021-08-02 15:40:48.145 +02:00 [Information] Connected to ws://192.168.1.54:8080/ws?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs&auth=hmcLWMoqCo7LV889eG8XN-epvd8iyxXAwUPgIE49bk0&format=msgpack
|
||||
2021-08-02 15:42:44.204 +02:00 [Information] Handshaking with http://192.168.1.54:8080/conn?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs
|
||||
2021-08-02 15:42:44.899 +02:00 [Information] Handshake successful
|
||||
2021-08-02 15:42:45.251 +02:00 [Information] Connecting
|
||||
2021-08-02 15:42:45.317 +02:00 [Information] WebSocket connecting to ws://192.168.1.54:8080/ws?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs&auth=BBaRuoEhEOnDNHdd225-F9s2w_BWRaiFU7RvoHNye70&format=msgpack
|
||||
2021-08-02 15:42:45.419 +02:00 [Information] Connected to ws://192.168.1.54:8080/ws?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs&auth=BBaRuoEhEOnDNHdd225-F9s2w_BWRaiFU7RvoHNye70&format=msgpack
|
||||
2021-08-02 15:44:48.828 +02:00 [Information] Handshaking with http://192.168.1.54:8080/conn?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs
|
||||
2021-08-02 15:44:49.600 +02:00 [Information] Handshake successful
|
||||
2021-08-02 15:44:49.997 +02:00 [Information] Connecting
|
||||
2021-08-02 15:44:50.084 +02:00 [Information] WebSocket connecting to ws://192.168.1.54:8080/ws?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs&auth=-w52j8pLBXA9LKUVoeIMzIjQLBLC3cfaU4UcBsscqAI&format=msgpack
|
||||
2021-08-02 15:44:50.248 +02:00 [Information] Connected to ws://192.168.1.54:8080/ws?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs&auth=-w52j8pLBXA9LKUVoeIMzIjQLBLC3cfaU4UcBsscqAI&format=msgpack
|
||||
2021-08-02 16:04:38.986 +02:00 [Information] Handshaking with http://192.168.1.54:8080/conn?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs
|
||||
2021-08-02 16:04:39.683 +02:00 [Information] Handshake successful
|
||||
2021-08-02 16:04:39.993 +02:00 [Information] Connecting
|
||||
2021-08-02 16:04:40.036 +02:00 [Information] WebSocket connecting to ws://192.168.1.54:8080/ws?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs&auth=MKQAEE5Jis75YBh0JZDlzVoj6ug03k22oVjNtKWXlRc&format=msgpack
|
||||
2021-08-02 16:04:40.124 +02:00 [Information] Connected to ws://192.168.1.54:8080/ws?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs&auth=MKQAEE5Jis75YBh0JZDlzVoj6ug03k22oVjNtKWXlRc&format=msgpack
|
||||
2021-08-02 16:07:26.733 +02:00 [Information] Handshaking with http://192.168.1.54:8080/conn?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs
|
||||
2021-08-02 16:07:27.487 +02:00 [Information] Handshake successful
|
||||
2021-08-02 16:07:28.240 +02:00 [Information] Connecting
|
||||
2021-08-02 16:07:28.320 +02:00 [Information] WebSocket connecting to ws://192.168.1.54:8080/ws?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs&auth=xU27aIt1tzrE-2jGTf3f10AGbRHl4Kpiormd5gRmDhU&format=msgpack
|
||||
2021-08-02 16:07:28.421 +02:00 [Information] Connected to ws://192.168.1.54:8080/ws?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs&auth=xU27aIt1tzrE-2jGTf3f10AGbRHl4Kpiormd5gRmDhU&format=msgpack
|
||||
2021-08-02 16:10:00.222 +02:00 [Warning] Failed to load nodes.json
|
||||
2021-08-02 16:10:00.334 +02:00 [Warning] File does not exist: C:\Users\l.farina\Desktop\UCRM_stage\RSTP_DSLink\RSTP_DSLink\bin\Debug\netcoreapp3.1\nodes.json
|
||||
2021-08-02 16:10:00.499 +02:00 [Warning] at StandardStorage.Folder.GetFileAsync(String name, CancellationToken cancellationToken)
|
||||
at DSLink.VFS.SystemVFS._getFile(String fileName)
|
||||
at DSLink.VFS.SystemVFS.ReadAsync(String fileName)
|
||||
at DSLink.Respond.DiskSerializer.DeserializeFromDisk()
|
||||
2021-08-02 16:10:00.566 +02:00 [Information] Handshaking with http://192.168.1.54:8080/conn?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs
|
||||
2021-08-02 16:10:01.090 +02:00 [Information] Handshake successful
|
||||
2021-08-02 16:10:01.437 +02:00 [Information] Connecting
|
||||
2021-08-02 16:10:01.466 +02:00 [Information] WebSocket connecting to ws://192.168.1.54:8080/ws?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs&auth=t09OJX_lXJF71GtOiQjXu-V6kEfCxohRpXqGKTRfOsA&format=msgpack
|
||||
2021-08-02 16:10:01.525 +02:00 [Information] Connected to ws://192.168.1.54:8080/ws?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs&auth=t09OJX_lXJF71GtOiQjXu-V6kEfCxohRpXqGKTRfOsA&format=msgpack
|
||||
2021-08-02 16:12:57.439 +02:00 [Information] Handshaking with http://192.168.1.54:8080/conn?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs
|
||||
2021-08-02 16:12:58.046 +02:00 [Information] Handshake successful
|
||||
2021-08-02 16:12:58.325 +02:00 [Information] Connecting
|
||||
2021-08-02 16:12:58.438 +02:00 [Information] WebSocket connecting to ws://192.168.1.54:8080/ws?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs&auth=JQUHQceTDOsUz3-5IWBWgSVznZ8o_bpsBxRFR2WGSNY&format=msgpack
|
||||
2021-08-02 16:12:58.580 +02:00 [Information] Connected to ws://192.168.1.54:8080/ws?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs&auth=JQUHQceTDOsUz3-5IWBWgSVznZ8o_bpsBxRFR2WGSNY&format=msgpack
|
||||
2021-08-02 16:13:57.017 +02:00 [Information] Handshaking with http://192.168.1.54:8080/conn?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs
|
||||
2021-08-02 16:13:57.507 +02:00 [Information] Handshake successful
|
||||
2021-08-02 16:13:57.873 +02:00 [Information] Connecting
|
||||
2021-08-02 16:13:58.022 +02:00 [Information] WebSocket connecting to ws://192.168.1.54:8080/ws?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs&auth=KEgjreMZ8LATOlDfPf1a0v2s0XPAx6wBhQKJpXTMuYg&format=msgpack
|
||||
2021-08-02 16:13:58.174 +02:00 [Information] Connected to ws://192.168.1.54:8080/ws?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs&auth=KEgjreMZ8LATOlDfPf1a0v2s0XPAx6wBhQKJpXTMuYg&format=msgpack
|
||||
2021-08-02 16:15:10.931 +02:00 [Information] Handshaking with http://192.168.1.54:8080/conn?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs
|
||||
2021-08-02 16:15:11.735 +02:00 [Information] Handshake successful
|
||||
2021-08-02 16:15:11.937 +02:00 [Information] Connecting
|
||||
2021-08-02 16:15:11.984 +02:00 [Information] WebSocket connecting to ws://192.168.1.54:8080/ws?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs&auth=8BcKgvQO1DR6vVdJO0GeIuubq7_80xDV-zpxb6ZVhXI&format=msgpack
|
||||
2021-08-02 16:15:12.087 +02:00 [Information] Connected to ws://192.168.1.54:8080/ws?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs&auth=8BcKgvQO1DR6vVdJO0GeIuubq7_80xDV-zpxb6ZVhXI&format=msgpack
|
129
RSTP_DSLink/RSTP_DSLink/bin/Debug/netcoreapp3.1/log-20210803.txt
Normální soubor
129
RSTP_DSLink/RSTP_DSLink/bin/Debug/netcoreapp3.1/log-20210803.txt
Normální soubor
|
@ -0,0 +1,129 @@
|
|||
2021-08-03 11:03:44.122 +02:00 [Information] Handshaking with http://192.168.1.54:8080/conn?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs
|
||||
2021-08-03 11:03:45.752 +02:00 [Information] Handshake successful
|
||||
2021-08-03 11:03:46.945 +02:00 [Information] Connecting
|
||||
2021-08-03 11:03:47.010 +02:00 [Information] WebSocket connecting to ws://192.168.1.54:8080/ws?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs&auth=B0sKiYxR4Q-MphyQBZJEF9-5YYiOtHyJGAAXimqympI&format=msgpack
|
||||
2021-08-03 11:03:47.254 +02:00 [Information] Connected to ws://192.168.1.54:8080/ws?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs&auth=B0sKiYxR4Q-MphyQBZJEF9-5YYiOtHyJGAAXimqympI&format=msgpack
|
||||
2021-08-03 11:30:52.942 +02:00 [Information] Handshaking with http://192.168.1.54:8080/conn?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs
|
||||
2021-08-03 11:30:53.558 +02:00 [Information] Handshake successful
|
||||
2021-08-03 11:30:53.749 +02:00 [Information] Connecting
|
||||
2021-08-03 11:30:53.791 +02:00 [Information] WebSocket connecting to ws://192.168.1.54:8080/ws?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs&auth=VhcS9rCG3lgMQWshLxv2rHK0XRwZTgl3WuHzfxqncSQ&format=msgpack
|
||||
2021-08-03 11:30:53.856 +02:00 [Information] Connected to ws://192.168.1.54:8080/ws?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs&auth=VhcS9rCG3lgMQWshLxv2rHK0XRwZTgl3WuHzfxqncSQ&format=msgpack
|
||||
2021-08-03 11:31:27.638 +02:00 [Warning] Failed to load nodes.json
|
||||
2021-08-03 11:31:27.724 +02:00 [Warning] File does not exist: C:\Users\l.farina\Desktop\UCRM_stage\RSTP_DSLink\RSTP_DSLink\bin\Debug\netcoreapp3.1\nodes.json
|
||||
2021-08-03 11:31:28.350 +02:00 [Warning] at StandardStorage.Folder.GetFileAsync(String name, CancellationToken cancellationToken)
|
||||
at DSLink.VFS.SystemVFS._getFile(String fileName)
|
||||
at DSLink.VFS.SystemVFS.ReadAsync(String fileName)
|
||||
at DSLink.Respond.DiskSerializer.DeserializeFromDisk()
|
||||
2021-08-03 11:31:28.416 +02:00 [Information] Handshaking with http://192.168.1.54:8080/conn?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs
|
||||
2021-08-03 11:31:29.164 +02:00 [Information] Handshake successful
|
||||
2021-08-03 11:31:29.535 +02:00 [Information] Connecting
|
||||
2021-08-03 11:31:29.647 +02:00 [Information] WebSocket connecting to ws://192.168.1.54:8080/ws?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs&auth=gpv5jA0dwOIVN0zc439RLXHK0GXBSxInZeKmYucTRUU&format=msgpack
|
||||
2021-08-03 11:31:29.867 +02:00 [Information] Connected to ws://192.168.1.54:8080/ws?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs&auth=gpv5jA0dwOIVN0zc439RLXHK0GXBSxInZeKmYucTRUU&format=msgpack
|
||||
2021-08-03 11:33:10.676 +02:00 [Warning] Failed to load nodes.json
|
||||
2021-08-03 11:33:10.790 +02:00 [Warning] File does not exist: C:\Users\l.farina\Desktop\UCRM_stage\RSTP_DSLink\RSTP_DSLink\bin\Debug\netcoreapp3.1\nodes.json
|
||||
2021-08-03 11:33:10.939 +02:00 [Warning] at StandardStorage.Folder.GetFileAsync(String name, CancellationToken cancellationToken)
|
||||
at DSLink.VFS.SystemVFS._getFile(String fileName)
|
||||
at DSLink.VFS.SystemVFS.ReadAsync(String fileName)
|
||||
at DSLink.Respond.DiskSerializer.DeserializeFromDisk()
|
||||
2021-08-03 11:33:11.166 +02:00 [Information] Handshaking with http://192.168.1.54:8080/conn?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs
|
||||
2021-08-03 11:33:12.404 +02:00 [Information] Handshake successful
|
||||
2021-08-03 11:33:12.778 +02:00 [Information] Connecting
|
||||
2021-08-03 11:33:12.812 +02:00 [Information] WebSocket connecting to ws://192.168.1.54:8080/ws?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs&auth=Bli_OxHVHntLF9zADsjwqEbn8EhWQ-CGJmK9WIDLf10&format=msgpack
|
||||
2021-08-03 11:33:12.930 +02:00 [Information] Connected to ws://192.168.1.54:8080/ws?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs&auth=Bli_OxHVHntLF9zADsjwqEbn8EhWQ-CGJmK9WIDLf10&format=msgpack
|
||||
2021-08-03 11:35:36.583 +02:00 [Warning] Failed to load nodes.json
|
||||
2021-08-03 11:35:36.671 +02:00 [Warning] File does not exist: C:\Users\l.farina\Desktop\UCRM_stage\RSTP_DSLink\RSTP_DSLink\bin\Debug\netcoreapp3.1\nodes.json
|
||||
2021-08-03 11:35:36.770 +02:00 [Warning] at StandardStorage.Folder.GetFileAsync(String name, CancellationToken cancellationToken)
|
||||
at DSLink.VFS.SystemVFS._getFile(String fileName)
|
||||
at DSLink.VFS.SystemVFS.ReadAsync(String fileName)
|
||||
at DSLink.Respond.DiskSerializer.DeserializeFromDisk()
|
||||
2021-08-03 11:35:36.833 +02:00 [Information] Handshaking with http://192.168.1.54:8080/conn?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs
|
||||
2021-08-03 11:35:37.483 +02:00 [Information] Handshake successful
|
||||
2021-08-03 11:35:37.965 +02:00 [Information] Connecting
|
||||
2021-08-03 11:35:38.069 +02:00 [Information] WebSocket connecting to ws://192.168.1.54:8080/ws?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs&auth=N3aAK1S7jWsz6Xeixb3agtCf8MXr0x-e7HATwPWPX1o&format=msgpack
|
||||
2021-08-03 11:35:38.136 +02:00 [Information] Connected to ws://192.168.1.54:8080/ws?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs&auth=N3aAK1S7jWsz6Xeixb3agtCf8MXr0x-e7HATwPWPX1o&format=msgpack
|
||||
2021-08-03 11:37:18.243 +02:00 [Warning] Failed to load nodes.json
|
||||
2021-08-03 11:37:18.376 +02:00 [Warning] File does not exist: C:\Users\l.farina\Desktop\UCRM_stage\RSTP_DSLink\RSTP_DSLink\bin\Debug\netcoreapp3.1\nodes.json
|
||||
2021-08-03 11:37:18.465 +02:00 [Warning] at StandardStorage.Folder.GetFileAsync(String name, CancellationToken cancellationToken)
|
||||
at DSLink.VFS.SystemVFS._getFile(String fileName)
|
||||
at DSLink.VFS.SystemVFS.ReadAsync(String fileName)
|
||||
at DSLink.Respond.DiskSerializer.DeserializeFromDisk()
|
||||
2021-08-03 11:37:18.539 +02:00 [Information] Handshaking with http://192.168.1.54:8080/conn?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs
|
||||
2021-08-03 11:37:19.334 +02:00 [Information] Handshake successful
|
||||
2021-08-03 11:37:19.657 +02:00 [Information] Connecting
|
||||
2021-08-03 11:37:19.696 +02:00 [Information] WebSocket connecting to ws://192.168.1.54:8080/ws?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs&auth=betMIA8Xy-p4Z0R9lN1fKBUZJNled2t8JabU8eH2GAk&format=msgpack
|
||||
2021-08-03 11:37:19.827 +02:00 [Information] Connected to ws://192.168.1.54:8080/ws?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs&auth=betMIA8Xy-p4Z0R9lN1fKBUZJNled2t8JabU8eH2GAk&format=msgpack
|
||||
2021-08-03 11:40:24.309 +02:00 [Warning] Failed to load nodes.json
|
||||
2021-08-03 11:40:24.489 +02:00 [Warning] File does not exist: C:\Users\l.farina\Desktop\UCRM_stage\RSTP_DSLink\RSTP_DSLink\bin\Debug\netcoreapp3.1\nodes.json
|
||||
2021-08-03 11:40:24.607 +02:00 [Warning] at StandardStorage.Folder.GetFileAsync(String name, CancellationToken cancellationToken)
|
||||
at DSLink.VFS.SystemVFS._getFile(String fileName)
|
||||
at DSLink.VFS.SystemVFS.ReadAsync(String fileName)
|
||||
at DSLink.Respond.DiskSerializer.DeserializeFromDisk()
|
||||
2021-08-03 11:40:25.009 +02:00 [Information] Handshaking with http://192.168.1.54:8080/conn?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs
|
||||
2021-08-03 11:40:25.869 +02:00 [Information] Handshake successful
|
||||
2021-08-03 11:40:26.442 +02:00 [Information] Connecting
|
||||
2021-08-03 11:40:26.566 +02:00 [Information] WebSocket connecting to ws://192.168.1.54:8080/ws?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs&auth=fdos6OENq6v54imFbTDefeYyc3_m5841nu8NI-hcF58&format=msgpack
|
||||
2021-08-03 11:40:26.656 +02:00 [Information] Connected to ws://192.168.1.54:8080/ws?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs&auth=fdos6OENq6v54imFbTDefeYyc3_m5841nu8NI-hcF58&format=msgpack
|
||||
2021-08-03 11:41:08.851 +02:00 [Warning] Failed to load nodes.json
|
||||
2021-08-03 11:41:09.031 +02:00 [Warning] File does not exist: C:\Users\l.farina\Desktop\UCRM_stage\RSTP_DSLink\RSTP_DSLink\bin\Debug\netcoreapp3.1\nodes.json
|
||||
2021-08-03 11:41:09.144 +02:00 [Warning] at StandardStorage.Folder.GetFileAsync(String name, CancellationToken cancellationToken)
|
||||
at DSLink.VFS.SystemVFS._getFile(String fileName)
|
||||
at DSLink.VFS.SystemVFS.ReadAsync(String fileName)
|
||||
at DSLink.Respond.DiskSerializer.DeserializeFromDisk()
|
||||
2021-08-03 11:41:09.385 +02:00 [Information] Handshaking with http://192.168.1.54:8080/conn?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs
|
||||
2021-08-03 11:41:10.111 +02:00 [Information] Handshake successful
|
||||
2021-08-03 11:41:10.598 +02:00 [Information] Connecting
|
||||
2021-08-03 11:41:10.692 +02:00 [Information] WebSocket connecting to ws://192.168.1.54:8080/ws?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs&auth=vr8C6A6On9Xh-q70n8L-RfXcmOBdfraXoOykU3cwUQA&format=msgpack
|
||||
2021-08-03 11:41:10.825 +02:00 [Information] Connected to ws://192.168.1.54:8080/ws?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs&auth=vr8C6A6On9Xh-q70n8L-RfXcmOBdfraXoOykU3cwUQA&format=msgpack
|
||||
2021-08-03 11:42:10.520 +02:00 [Information] Handshaking with http://192.168.1.54:8080/conn?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs
|
||||
2021-08-03 11:42:10.898 +02:00 [Information] Handshake successful
|
||||
2021-08-03 11:42:11.108 +02:00 [Information] Connecting
|
||||
2021-08-03 11:42:11.177 +02:00 [Information] WebSocket connecting to ws://192.168.1.54:8080/ws?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs&auth=ojurIILA78q0aJt4grkJzFbgw3DwfS2r_WC5R8pwpSo&format=msgpack
|
||||
2021-08-03 11:42:11.297 +02:00 [Information] Connected to ws://192.168.1.54:8080/ws?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs&auth=ojurIILA78q0aJt4grkJzFbgw3DwfS2r_WC5R8pwpSo&format=msgpack
|
||||
2021-08-03 11:42:29.808 +02:00 [Warning] Failed to load nodes.json
|
||||
2021-08-03 11:42:29.898 +02:00 [Warning] File does not exist: C:\Users\l.farina\Desktop\UCRM_stage\RSTP_DSLink\RSTP_DSLink\bin\Debug\netcoreapp3.1\nodes.json
|
||||
2021-08-03 11:42:29.967 +02:00 [Warning] at StandardStorage.Folder.GetFileAsync(String name, CancellationToken cancellationToken)
|
||||
at DSLink.VFS.SystemVFS._getFile(String fileName)
|
||||
at DSLink.VFS.SystemVFS.ReadAsync(String fileName)
|
||||
at DSLink.Respond.DiskSerializer.DeserializeFromDisk()
|
||||
2021-08-03 11:42:30.137 +02:00 [Information] Handshaking with http://192.168.1.54:8080/conn?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs
|
||||
2021-08-03 11:42:30.532 +02:00 [Information] Handshake successful
|
||||
2021-08-03 11:42:30.906 +02:00 [Information] Connecting
|
||||
2021-08-03 11:42:30.985 +02:00 [Information] WebSocket connecting to ws://192.168.1.54:8080/ws?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs&auth=tKi9TXyt1wXcsIjPytryaX6sHgpTDBzJElA1hEl2zu8&format=msgpack
|
||||
2021-08-03 11:42:31.134 +02:00 [Information] Connected to ws://192.168.1.54:8080/ws?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs&auth=tKi9TXyt1wXcsIjPytryaX6sHgpTDBzJElA1hEl2zu8&format=msgpack
|
||||
2021-08-03 11:43:35.267 +02:00 [Warning] Failed to load nodes.json
|
||||
2021-08-03 11:43:35.366 +02:00 [Warning] File does not exist: C:\Users\l.farina\Desktop\UCRM_stage\RSTP_DSLink\RSTP_DSLink\bin\Debug\netcoreapp3.1\nodes.json
|
||||
2021-08-03 11:43:35.434 +02:00 [Warning] at StandardStorage.Folder.GetFileAsync(String name, CancellationToken cancellationToken)
|
||||
at DSLink.VFS.SystemVFS._getFile(String fileName)
|
||||
at DSLink.VFS.SystemVFS.ReadAsync(String fileName)
|
||||
at DSLink.Respond.DiskSerializer.DeserializeFromDisk()
|
||||
2021-08-03 11:43:35.867 +02:00 [Information] Handshaking with http://192.168.1.54:8080/conn?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs
|
||||
2021-08-03 11:43:36.274 +02:00 [Information] Handshake successful
|
||||
2021-08-03 11:43:36.493 +02:00 [Information] Connecting
|
||||
2021-08-03 11:43:36.530 +02:00 [Information] WebSocket connecting to ws://192.168.1.54:8080/ws?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs&auth=bubQ2UGVXRlMIbYSrt2gA4KZAuS0kKos4x5vjlx__Rc&format=msgpack
|
||||
2021-08-03 11:43:36.663 +02:00 [Information] Connected to ws://192.168.1.54:8080/ws?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs&auth=bubQ2UGVXRlMIbYSrt2gA4KZAuS0kKos4x5vjlx__Rc&format=msgpack
|
||||
2021-08-03 11:46:24.951 +02:00 [Information] Handshaking with http://192.168.1.54:8080/conn?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs
|
||||
2021-08-03 11:46:25.564 +02:00 [Information] Handshake successful
|
||||
2021-08-03 11:46:25.871 +02:00 [Information] Connecting
|
||||
2021-08-03 11:46:25.945 +02:00 [Information] WebSocket connecting to ws://192.168.1.54:8080/ws?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs&auth=bpl3In8B0JhkN53rTf4afrZMF0tA-NEHz3pfcSpwkB8&format=msgpack
|
||||
2021-08-03 11:46:26.102 +02:00 [Information] Connected to ws://192.168.1.54:8080/ws?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs&auth=bpl3In8B0JhkN53rTf4afrZMF0tA-NEHz3pfcSpwkB8&format=msgpack
|
||||
2021-08-03 11:56:02.197 +02:00 [Information] Handshaking with http://192.168.1.54:8080/conn?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs
|
||||
2021-08-03 11:56:02.727 +02:00 [Information] Handshake successful
|
||||
2021-08-03 11:56:03.109 +02:00 [Information] Connecting
|
||||
2021-08-03 11:56:03.172 +02:00 [Information] WebSocket connecting to ws://192.168.1.54:8080/ws?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs&auth=4IsqPIISg-NycVkNpVfgaULTURZ6Sdi-Zh3B5X9pmwM&format=msgpack
|
||||
2021-08-03 11:56:03.418 +02:00 [Information] Connected to ws://192.168.1.54:8080/ws?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs&auth=4IsqPIISg-NycVkNpVfgaULTURZ6Sdi-Zh3B5X9pmwM&format=msgpack
|
||||
2021-08-03 11:56:48.024 +02:00 [Warning] Failed to load nodes.json
|
||||
2021-08-03 11:56:48.146 +02:00 [Warning] File does not exist: C:\Users\l.farina\Desktop\UCRM_stage\RSTP_DSLink\RSTP_DSLink\bin\Debug\netcoreapp3.1\nodes.json
|
||||
2021-08-03 11:56:48.307 +02:00 [Warning] at StandardStorage.Folder.GetFileAsync(String name, CancellationToken cancellationToken)
|
||||
at DSLink.VFS.SystemVFS._getFile(String fileName)
|
||||
at DSLink.VFS.SystemVFS.ReadAsync(String fileName)
|
||||
at DSLink.Respond.DiskSerializer.DeserializeFromDisk()
|
||||
2021-08-03 11:56:48.628 +02:00 [Information] Handshaking with http://192.168.1.54:8080/conn?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs
|
||||
2021-08-03 11:56:49.971 +02:00 [Information] Handshake successful
|
||||
2021-08-03 11:56:50.534 +02:00 [Information] Connecting
|
||||
2021-08-03 11:56:50.874 +02:00 [Information] WebSocket connecting to ws://192.168.1.54:8080/ws?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs&auth=ypWQIh8FPOQNhPAXbRN1meG0gWc_sw2va2g3Cg0nMd4&format=msgpack
|
||||
2021-08-03 11:56:51.227 +02:00 [Information] Connected to ws://192.168.1.54:8080/ws?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs&auth=ypWQIh8FPOQNhPAXbRN1meG0gWc_sw2va2g3Cg0nMd4&format=msgpack
|
||||
2021-08-03 12:02:42.774 +02:00 [Information] Handshaking with http://192.168.1.54:8080/conn?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs
|
||||
2021-08-03 12:02:43.276 +02:00 [Information] Handshake successful
|
||||
2021-08-03 12:02:43.454 +02:00 [Information] Connecting
|
||||
2021-08-03 12:02:43.489 +02:00 [Information] WebSocket connecting to ws://192.168.1.54:8080/ws?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs&auth=Fz0kksH0XedbyZ5rz1bOhD5ET8QuDRpvOK88ot6khuA&format=msgpack
|
||||
2021-08-03 12:02:43.562 +02:00 [Information] Connected to ws://192.168.1.54:8080/ws?dsId=RTSP-OMdrHg0avIBTMlApcGJyO6F7_WThL5P0aIxLoTJwYrs&auth=Fz0kksH0XedbyZ5rz1bOhD5ET8QuDRpvOK88ot6khuA&format=msgpack
|
46
RSTP_DSLink/RSTP_DSLink/bin/Debug/netcoreapp3.1/nodes.json
Normální soubor
46
RSTP_DSLink/RSTP_DSLink/bin/Debug/netcoreapp3.1/nodes.json
Normální soubor
|
@ -0,0 +1,46 @@
|
|||
{
|
||||
"$is": "node",
|
||||
"privateConfigs": {},
|
||||
"createStream": {
|
||||
"$is": "streamAdd",
|
||||
"$name": "Add Stream",
|
||||
"$params": [
|
||||
{
|
||||
"name": "RSTP URL",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "Stream name",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"$invokable": "config",
|
||||
"privateConfigs": {},
|
||||
"?class": "streamAdd"
|
||||
},
|
||||
"createAlarm": {
|
||||
"$is": "alarmAdd",
|
||||
"$name": "Add Alarm",
|
||||
"$params": [
|
||||
{
|
||||
"name": "Alarm name",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "Raspberry Pi IP Address",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "Port Number",
|
||||
"type": "number"
|
||||
},
|
||||
{
|
||||
"name": "GPIO Pin",
|
||||
"type": "number"
|
||||
}
|
||||
],
|
||||
"$invokable": "config",
|
||||
"privateConfigs": {},
|
||||
"?class": "alarmAdd"
|
||||
}
|
||||
}
|
Binární soubor nebyl zobrazen.
Binární soubor nebyl zobrazen.
Binární soubor nebyl zobrazen.
Binární soubor nebyl zobrazen.
Binární soubor nebyl zobrazen.
|
@ -1 +1 @@
|
|||
28da4aa5ebde6007021646d01b238b1b362bbd7c
|
||||
38f2e3c6f718af46c0bc45eb96010e1b0699066e
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
C:\Users\l.farina\Desktop\UCRM_stage\RSTP_DSLink\RSTP_DSLink\obj\Debug\netcoreapp3.1\RSTP_DSLink.csproj.AssemblyReference.cache
|
||||
C:\Users\l.farina\Desktop\UCRM_stage\RSTP_DSLink\RSTP_DSLink\obj\Debug\netcoreapp3.1\RSTP_DSLink.AssemblyInfoInputs.cache
|
||||
C:\Users\l.farina\Desktop\UCRM_stage\RSTP_DSLink\RSTP_DSLink\obj\Debug\netcoreapp3.1\RSTP_DSLink.AssemblyInfo.cs
|
||||
C:\Users\l.farina\Desktop\UCRM_stage\RSTP_DSLink\RSTP_DSLink\obj\Debug\netcoreapp3.1\RSTP_DSLink.csproj.CoreCompileInputs.cache
|
||||
C:\Users\l.farina\Desktop\UCRM_stage\RSTP_DSLink\RSTP_DSLink\bin\Debug\netcoreapp3.1\RSTP_DSLink.exe
|
||||
C:\Users\l.farina\Desktop\UCRM_stage\RSTP_DSLink\RSTP_DSLink\bin\Debug\netcoreapp3.1\RSTP_DSLink.deps.json
|
||||
C:\Users\l.farina\Desktop\UCRM_stage\RSTP_DSLink\RSTP_DSLink\bin\Debug\netcoreapp3.1\RSTP_DSLink.runtimeconfig.json
|
||||
|
@ -21,7 +17,23 @@ C:\Users\l.farina\Desktop\UCRM_stage\RSTP_DSLink\RSTP_DSLink\bin\Debug\netcoreap
|
|||
C:\Users\l.farina\Desktop\UCRM_stage\RSTP_DSLink\RSTP_DSLink\bin\Debug\netcoreapp3.1\System.CodeDom.dll
|
||||
C:\Users\l.farina\Desktop\UCRM_stage\RSTP_DSLink\RSTP_DSLink\bin\Debug\netcoreapp3.1\System.Security.Permissions.dll
|
||||
C:\Users\l.farina\Desktop\UCRM_stage\RSTP_DSLink\RSTP_DSLink\bin\Debug\netcoreapp3.1\DSLink.dll
|
||||
C:\Users\l.farina\Desktop\UCRM_stage\RSTP_DSLink\RSTP_DSLink\obj\Debug\netcoreapp3.1\RSTP_DSLink.AssemblyInfoInputs.cache
|
||||
C:\Users\l.farina\Desktop\UCRM_stage\RSTP_DSLink\RSTP_DSLink\obj\Debug\netcoreapp3.1\RSTP_DSLink.AssemblyInfo.cs
|
||||
C:\Users\l.farina\Desktop\UCRM_stage\RSTP_DSLink\RSTP_DSLink\obj\Debug\netcoreapp3.1\RSTP_DSLink.csproj.CoreCompileInputs.cache
|
||||
C:\Users\l.farina\Desktop\UCRM_stage\RSTP_DSLink\RSTP_DSLink\obj\Debug\netcoreapp3.1\RSTP_DSLink.csproj.CopyComplete
|
||||
C:\Users\l.farina\Desktop\UCRM_stage\RSTP_DSLink\RSTP_DSLink\obj\Debug\netcoreapp3.1\RSTP_DSLink.dll
|
||||
C:\Users\l.farina\Desktop\UCRM_stage\RSTP_DSLink\RSTP_DSLink\obj\Debug\netcoreapp3.1\RSTP_DSLink.pdb
|
||||
C:\Users\l.farina\Desktop\UCRM_stage\RSTP_DSLink\RSTP_DSLink\obj\Debug\netcoreapp3.1\RSTP_DSLink.genruntimeconfig.cache
|
||||
C:\Users\l.farina\Desktop\UCRM_stage\RSTP_DSLink\RSTP_DSLink\bin\Debug\netcoreapp3.1\Unosquare.Raspberry.Abstractions.dll
|
||||
C:\Users\l.farina\Desktop\UCRM_stage\RSTP_DSLink\RSTP_DSLink\bin\Debug\netcoreapp3.1\Unosquare.RaspberryIO.dll
|
||||
C:\Users\l.farina\Desktop\UCRM_stage\RSTP_DSLink\RSTP_DSLink\bin\Debug\netcoreapp3.1\Unosquare.RaspberryIO.Peripherals.dll
|
||||
C:\Users\l.farina\Desktop\UCRM_stage\RSTP_DSLink\RSTP_DSLink\bin\Debug\netcoreapp3.1\Swan.dll
|
||||
C:\Users\l.farina\Desktop\UCRM_stage\RSTP_DSLink\RSTP_DSLink\bin\Debug\netcoreapp3.1\Swan.Lite.dll
|
||||
C:\Users\l.farina\Desktop\UCRM_stage\RSTP_DSLink\RSTP_DSLink\bin\Debug\netcoreapp3.1\Microsoft.Win32.Registry.dll
|
||||
C:\Users\l.farina\Desktop\UCRM_stage\RSTP_DSLink\RSTP_DSLink\bin\Debug\netcoreapp3.1\System.Device.Gpio.dll
|
||||
C:\Users\l.farina\Desktop\UCRM_stage\RSTP_DSLink\RSTP_DSLink\bin\Debug\netcoreapp3.1\System.Security.AccessControl.dll
|
||||
C:\Users\l.farina\Desktop\UCRM_stage\RSTP_DSLink\RSTP_DSLink\bin\Debug\netcoreapp3.1\System.Security.Principal.Windows.dll
|
||||
C:\Users\l.farina\Desktop\UCRM_stage\RSTP_DSLink\RSTP_DSLink\bin\Debug\netcoreapp3.1\runtimes\win\lib\netstandard2.0\Microsoft.Win32.Registry.dll
|
||||
C:\Users\l.farina\Desktop\UCRM_stage\RSTP_DSLink\RSTP_DSLink\bin\Debug\netcoreapp3.1\runtimes\win\lib\netcoreapp2.0\System.Security.AccessControl.dll
|
||||
C:\Users\l.farina\Desktop\UCRM_stage\RSTP_DSLink\RSTP_DSLink\bin\Debug\netcoreapp3.1\runtimes\unix\lib\netcoreapp2.1\System.Security.Principal.Windows.dll
|
||||
C:\Users\l.farina\Desktop\UCRM_stage\RSTP_DSLink\RSTP_DSLink\bin\Debug\netcoreapp3.1\runtimes\win\lib\netcoreapp2.1\System.Security.Principal.Windows.dll
|
||||
|
|
Binární soubor nebyl zobrazen.
Binární soubor nebyl zobrazen.
|
@ -93,6 +93,14 @@
|
|||
"StandardStorage": {
|
||||
"target": "Package",
|
||||
"version": "[0.1.1, )"
|
||||
},
|
||||
"System.Device.Gpio": {
|
||||
"target": "Package",
|
||||
"version": "[1.5.0, )"
|
||||
},
|
||||
"Unosquare.RaspberryIO.Peripherals": {
|
||||
"target": "Package",
|
||||
"version": "[0.5.0, )"
|
||||
}
|
||||
},
|
||||
"imports": [
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
// <autogenerated />
|
||||
using System;
|
||||
using System.Reflection;
|
||||
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v3.1", FrameworkDisplayName = "")]
|
|
@ -0,0 +1,33 @@
|
|||
// <auto-generated/>
|
||||
// ReSharper disable CheckNamespace
|
||||
namespace RSTP_DSLink.Logging
|
||||
{
|
||||
using System;
|
||||
|
||||
/// <summary>
|
||||
/// Simple interface that represent a logger.
|
||||
/// </summary>
|
||||
#if LIBLOG_PUBLIC
|
||||
public
|
||||
#else
|
||||
internal
|
||||
#endif
|
||||
interface ILog
|
||||
{
|
||||
/// <summary>
|
||||
/// Log a message the specified log level.
|
||||
/// </summary>
|
||||
/// <param name="logLevel">The log level.</param>
|
||||
/// <param name="messageFunc">The message function.</param>
|
||||
/// <param name="exception">An optional exception.</param>
|
||||
/// <param name="formatParameters">Optional format parameters for the message generated by the messagefunc. </param>
|
||||
/// <returns>true if the message was logged. Otherwise false.</returns>
|
||||
/// <remarks>
|
||||
/// Note to implementers: the message func should not be called if the loglevel is not enabled
|
||||
/// so as not to incur performance penalties.
|
||||
/// To check IsEnabled call Log with only LogLevel and check the return value, no event will be written.
|
||||
/// </remarks>
|
||||
bool Log(LogLevel logLevel, Func<string> messageFunc, Exception exception = null,
|
||||
params object[] formatParameters);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
// <auto-generated/>
|
||||
// ReSharper disable CheckNamespace
|
||||
using System;
|
||||
|
||||
namespace RSTP_DSLink.Logging
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a way to get a <see cref="Logger"/>
|
||||
/// </summary>
|
||||
#if LIBLOG_PROVIDERS_ONLY
|
||||
internal
|
||||
#else
|
||||
public
|
||||
#endif
|
||||
interface ILogProvider
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the specified named logger.
|
||||
/// </summary>
|
||||
/// <param name="name">Name of the logger.</param>
|
||||
/// <returns>The logger reference.</returns>
|
||||
Logger GetLogger(string name);
|
||||
|
||||
/// <summary>
|
||||
/// Opens a nested diagnostics context. Not supported in EntLib logging.
|
||||
/// </summary>
|
||||
/// <param name="message">The message to add to the diagnostics context.</param>
|
||||
/// <returns>A disposable that when disposed removes the message from the context.</returns>
|
||||
IDisposable OpenNestedContext(string message);
|
||||
|
||||
/// <summary>
|
||||
/// Opens a mapped diagnostics context. Not supported in EntLib logging.
|
||||
/// </summary>
|
||||
/// <param name="key">A key.</param>
|
||||
/// <param name="value">A value.</param>
|
||||
/// <param name="destructure">Determines whether to call the destructor or not.</param>
|
||||
/// <returns>A disposable that when disposed removes the map from the context.</returns>
|
||||
IDisposable OpenMappedContext(string key, object value, bool destructure = false);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,562 @@
|
|||
// <auto-generated/>
|
||||
// ReSharper disable CheckNamespace
|
||||
namespace RSTP_DSLink.Logging
|
||||
{
|
||||
using System;
|
||||
#if LIBLOG_EXCLUDE_CODE_COVERAGE
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Extension methods for the <see cref="ILog"/> interface.
|
||||
/// </summary>
|
||||
#if LIBLOG_EXCLUDE_CODE_COVERAGE
|
||||
[ExcludeFromCodeCoverage]
|
||||
#endif
|
||||
#if LIBLOG_PUBLIC
|
||||
public
|
||||
#else
|
||||
internal
|
||||
#endif
|
||||
static class LogExtensions
|
||||
{
|
||||
internal static readonly object[] EmptyParams = new object[0];
|
||||
|
||||
/// <summary>
|
||||
/// Check if the <see cref="LogLevel.Debug"/> log level is enabled.
|
||||
/// </summary>
|
||||
/// <param name="logger">The <see cref="ILog"/> to check with.</param>
|
||||
/// <returns>True if the log level is enabled; false otherwise.</returns>
|
||||
public static bool IsDebugEnabled(this ILog logger)
|
||||
{
|
||||
GuardAgainstNullLogger(logger);
|
||||
return logger.Log(LogLevel.Debug, null, null, EmptyParams);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check if the <see cref="LogLevel.Error"/> log level is enabled.
|
||||
/// </summary>
|
||||
/// <param name="logger">The <see cref="ILog"/> to check with.</param>
|
||||
/// <returns>True if the log level is enabled; false otherwise.</returns>
|
||||
public static bool IsErrorEnabled(this ILog logger)
|
||||
{
|
||||
GuardAgainstNullLogger(logger);
|
||||
return logger.Log(LogLevel.Error, null, null, EmptyParams);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check if the <see cref="LogLevel.Fatal"/> log level is enabled.
|
||||
/// </summary>
|
||||
/// <param name="logger">The <see cref="ILog"/> to check with.</param>
|
||||
/// <returns>True if the log level is enabled; false otherwise.</returns>
|
||||
public static bool IsFatalEnabled(this ILog logger)
|
||||
{
|
||||
GuardAgainstNullLogger(logger);
|
||||
return logger.Log(LogLevel.Fatal, null, null, EmptyParams);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check if the <see cref="LogLevel.Info"/> log level is enabled.
|
||||
/// </summary>
|
||||
/// <param name="logger">The <see cref="ILog"/> to check with.</param>
|
||||
/// <returns>True if the log level is enabled; false otherwise.</returns>
|
||||
public static bool IsInfoEnabled(this ILog logger)
|
||||
{
|
||||
GuardAgainstNullLogger(logger);
|
||||
return logger.Log(LogLevel.Info, null, null, EmptyParams);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check if the <see cref="LogLevel.Trace"/> log level is enabled.
|
||||
/// </summary>
|
||||
/// <param name="logger">The <see cref="ILog"/> to check with.</param>
|
||||
/// <returns>True if the log level is enabled; false otherwise.</returns>
|
||||
public static bool IsTraceEnabled(this ILog logger)
|
||||
{
|
||||
GuardAgainstNullLogger(logger);
|
||||
return logger.Log(LogLevel.Trace, null, null, EmptyParams);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check if the <see cref="LogLevel.Warn"/> log level is enabled.
|
||||
/// </summary>
|
||||
/// <param name="logger">The <see cref="ILog"/> to check with.</param>
|
||||
/// <returns>True if the log level is enabled; false otherwise.</returns>
|
||||
public static bool IsWarnEnabled(this ILog logger)
|
||||
{
|
||||
GuardAgainstNullLogger(logger);
|
||||
return logger.Log(LogLevel.Warn, null, null, EmptyParams);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Logs a message at the <see cref="LogLevel.Debug"/> log level, if enabled.
|
||||
/// </summary>
|
||||
/// <param name="logger">The <see cref="ILog"/> to use.</param>
|
||||
/// <param name="messageFunc">The message function.</param>
|
||||
public static void Debug(this ILog logger, Func<string> messageFunc)
|
||||
{
|
||||
GuardAgainstNullLogger(logger);
|
||||
logger.Log(LogLevel.Debug, WrapLogInternal(messageFunc), null, EmptyParams);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Logs a message at the <see cref="LogLevel.Debug"/> log level, if enabled.
|
||||
/// </summary>
|
||||
/// <param name="logger">The <see cref="ILog"/> to use.</param>
|
||||
/// <param name="message">The message.</param>
|
||||
public static void Debug(this ILog logger, string message)
|
||||
{
|
||||
if (logger.IsDebugEnabled()) logger.Log(LogLevel.Debug, message.AsFunc(), null, EmptyParams);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Logs a message at the <see cref="LogLevel.Debug"/> log level, if enabled.
|
||||
/// </summary>
|
||||
/// <param name="logger">The <see cref="ILog"/> to use.</param>
|
||||
/// <param name="message">The message.</param>
|
||||
/// <param name="args">Optional format parameters for the message.</param>
|
||||
public static void Debug(this ILog logger, string message, params object[] args)
|
||||
{
|
||||
logger.DebugFormat(message, args);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Logs an exception at the <see cref="LogLevel.Debug"/> log level, if enabled.
|
||||
/// </summary>
|
||||
/// <param name="logger">The <see cref="ILog"/> to use.</param>
|
||||
/// <param name="exception">The exception.</param>
|
||||
/// <param name="message">The message.</param>
|
||||
/// <param name="args">Optional format parameters for the message.</param>
|
||||
public static void Debug(this ILog logger, Exception exception, string message, params object[] args)
|
||||
{
|
||||
logger.DebugException(message, exception, args);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Logs a message at the <see cref="LogLevel.Debug"/> log level, if enabled.
|
||||
/// </summary>
|
||||
/// <param name="logger">The <see cref="ILog"/> to use.</param>
|
||||
/// <param name="message">The message.</param>
|
||||
/// <param name="args">Optional format parameters for the message.</param>
|
||||
public static void DebugFormat(this ILog logger, string message, params object[] args)
|
||||
{
|
||||
if (logger.IsDebugEnabled()) logger.LogFormat(LogLevel.Debug, message, args);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Logs an exception at the <see cref="LogLevel.Debug"/> log level, if enabled.
|
||||
/// </summary>
|
||||
/// <param name="logger">The <see cref="ILog"/> to use.</param>
|
||||
/// <param name="message">The message.</param>
|
||||
/// <param name="exception">The exception.</param>
|
||||
public static void DebugException(this ILog logger, string message, Exception exception)
|
||||
{
|
||||
if (logger.IsDebugEnabled()) logger.Log(LogLevel.Debug, message.AsFunc(), exception, EmptyParams);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Logs an exception at the <see cref="LogLevel.Debug"/> log level, if enabled.
|
||||
/// </summary>
|
||||
/// <param name="logger">The <see cref="ILog"/> to use.</param>
|
||||
/// <param name="message">The message.</param>
|
||||
/// <param name="exception">The exception.</param>
|
||||
/// <param name="args">Optional format parameters for the message.</param>
|
||||
public static void DebugException(this ILog logger, string message, Exception exception,
|
||||
params object[] args)
|
||||
{
|
||||
if (logger.IsDebugEnabled()) logger.Log(LogLevel.Debug, message.AsFunc(), exception, args);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Logs a message at the <see cref="LogLevel.Error"/> log level, if enabled.
|
||||
/// </summary>
|
||||
/// <param name="logger">The <see cref="ILog"/> to use.</param>
|
||||
/// <param name="messageFunc">The message function.</param>
|
||||
public static void Error(this ILog logger, Func<string> messageFunc)
|
||||
{
|
||||
GuardAgainstNullLogger(logger);
|
||||
logger.Log(LogLevel.Error, WrapLogInternal(messageFunc), null, EmptyParams);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Logs a message at the <see cref="LogLevel.Error"/> log level, if enabled.
|
||||
/// </summary>
|
||||
/// <param name="logger">The <see cref="ILog"/> to use.</param>
|
||||
/// <param name="message">The message.</param>
|
||||
public static void Error(this ILog logger, string message)
|
||||
{
|
||||
if (logger.IsErrorEnabled()) logger.Log(LogLevel.Error, message.AsFunc(), null, EmptyParams);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Logs a message at the <see cref="LogLevel.Error"/> log level, if enabled.
|
||||
/// </summary>
|
||||
/// <param name="logger">The <see cref="ILog"/> to use.</param>
|
||||
/// <param name="message">The message.</param>
|
||||
/// <param name="args">Optional format parameters for the message.</param>
|
||||
public static void Error(this ILog logger, string message, params object[] args)
|
||||
{
|
||||
logger.ErrorFormat(message, args);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Logs an exception at the <see cref="LogLevel.Error"/> log level, if enabled.
|
||||
/// </summary>
|
||||
/// <param name="logger">The <see cref="ILog"/> to use.</param>
|
||||
/// <param name="exception">The exception.</param>
|
||||
/// <param name="message">The message.</param>
|
||||
/// <param name="args">Optional format parameters for the message.</param>
|
||||
public static void Error(this ILog logger, Exception exception, string message, params object[] args)
|
||||
{
|
||||
logger.ErrorException(message, exception, args);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Logs a message at the <see cref="LogLevel.Error"/> log level, if enabled.
|
||||
/// </summary>
|
||||
/// <param name="logger">The <see cref="ILog"/> to use.</param>
|
||||
/// <param name="message">The message.</param>
|
||||
/// <param name="args">Optional format parameters for the message.</param>
|
||||
public static void ErrorFormat(this ILog logger, string message, params object[] args)
|
||||
{
|
||||
if (logger.IsErrorEnabled()) logger.LogFormat(LogLevel.Error, message, args);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Logs an exception at the <see cref="LogLevel.Error"/> log level, if enabled.
|
||||
/// </summary>
|
||||
/// <param name="logger">The <see cref="ILog"/> to use.</param>
|
||||
/// <param name="message">The message.</param>
|
||||
/// <param name="exception">The exception.</param>
|
||||
/// <param name="args">Optional format parameters for the message.</param>
|
||||
public static void ErrorException(this ILog logger, string message, Exception exception,
|
||||
params object[] args)
|
||||
{
|
||||
if (logger.IsErrorEnabled()) logger.Log(LogLevel.Error, message.AsFunc(), exception, args);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Logs a message at the <see cref="LogLevel.Fatal"/> log level, if enabled.
|
||||
/// </summary>
|
||||
/// <param name="logger">The <see cref="ILog"/> to use.</param>
|
||||
/// <param name="messageFunc">The message function.</param>
|
||||
public static void Fatal(this ILog logger, Func<string> messageFunc)
|
||||
{
|
||||
logger.Log(LogLevel.Fatal, WrapLogInternal(messageFunc), null, EmptyParams);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Logs a message at the <see cref="LogLevel.Fatal"/> log level, if enabled.
|
||||
/// </summary>
|
||||
/// <param name="logger">The <see cref="ILog"/> to use.</param>
|
||||
/// <param name="message">The message.</param>
|
||||
public static void Fatal(this ILog logger, string message)
|
||||
{
|
||||
if (logger.IsFatalEnabled()) logger.Log(LogLevel.Fatal, message.AsFunc(), null, EmptyParams);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Logs a message at the <see cref="LogLevel.Fatal"/> log level, if enabled.
|
||||
/// </summary>
|
||||
/// <param name="logger">The <see cref="ILog"/> to use.</param>
|
||||
/// <param name="message">The message.</param>
|
||||
/// <param name="args">Optional format parameters for the message.</param>
|
||||
public static void Fatal(this ILog logger, string message, params object[] args)
|
||||
{
|
||||
logger.FatalFormat(message, args);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Logs an exception at the <see cref="LogLevel.Fatal"/> log level, if enabled.
|
||||
/// </summary>
|
||||
/// <param name="logger">The <see cref="ILog"/> to use.</param>
|
||||
/// <param name="exception">The exception.</param>
|
||||
/// <param name="message">The message.</param>
|
||||
/// <param name="args">Optional format parameters for the message.</param>
|
||||
public static void Fatal(this ILog logger, Exception exception, string message, params object[] args)
|
||||
{
|
||||
logger.FatalException(message, exception, args);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Logs a message at the <see cref="LogLevel.Fatal"/> log level, if enabled.
|
||||
/// </summary>
|
||||
/// <param name="logger">The <see cref="ILog"/> to use.</param>
|
||||
/// <param name="message">The message.</param>
|
||||
/// <param name="args">Optional format parameters for the message.</param>
|
||||
public static void FatalFormat(this ILog logger, string message, params object[] args)
|
||||
{
|
||||
if (logger.IsFatalEnabled()) logger.LogFormat(LogLevel.Fatal, message, args);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Logs an exception at the <see cref="LogLevel.Fatal"/> log level, if enabled.
|
||||
/// </summary>
|
||||
/// <param name="logger">The <see cref="ILog"/> to use.</param>
|
||||
/// <param name="message">The message.</param>
|
||||
/// <param name="exception">The exception.</param>
|
||||
/// <param name="args">Optional format parameters for the message.</param>
|
||||
public static void FatalException(this ILog logger, string message, Exception exception,
|
||||
params object[] args)
|
||||
{
|
||||
if (logger.IsFatalEnabled()) logger.Log(LogLevel.Fatal, message.AsFunc(), exception, args);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Logs a message at the <see cref="LogLevel.Info"/> log level, if enabled.
|
||||
/// </summary>
|
||||
/// <param name="logger">The <see cref="ILog"/> to use.</param>
|
||||
/// <param name="messageFunc">The message function.</param>
|
||||
public static void Info(this ILog logger, Func<string> messageFunc)
|
||||
{
|
||||
GuardAgainstNullLogger(logger);
|
||||
logger.Log(LogLevel.Info, WrapLogInternal(messageFunc), null, EmptyParams);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Logs a message at the <see cref="LogLevel.Info"/> log level, if enabled.
|
||||
/// </summary>
|
||||
/// <param name="logger">The <see cref="ILog"/> to use.</param>
|
||||
/// <param name="message">The message.</param>
|
||||
public static void Info(this ILog logger, string message)
|
||||
{
|
||||
if (logger.IsInfoEnabled()) logger.Log(LogLevel.Info, message.AsFunc(), null, EmptyParams);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Logs a message at the <see cref="LogLevel.Info"/> log level, if enabled.
|
||||
/// </summary>
|
||||
/// <param name="logger">The <see cref="ILog"/> to use.</param>
|
||||
/// <param name="message">The message.</param>
|
||||
/// <param name="args">Optional format parameters for the message.</param>
|
||||
public static void Info(this ILog logger, string message, params object[] args)
|
||||
{
|
||||
logger.InfoFormat(message, args);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Logs an exception at the <see cref="LogLevel.Info"/> log level, if enabled.
|
||||
/// </summary>
|
||||
/// <param name="logger">The <see cref="ILog"/> to use.</param>
|
||||
/// <param name="exception">The exception.</param>
|
||||
/// <param name="message">The message.</param>
|
||||
/// <param name="args">Optional format parameters for the message.</param>
|
||||
public static void Info(this ILog logger, Exception exception, string message, params object[] args)
|
||||
{
|
||||
logger.InfoException(message, exception, args);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Logs a message at the <see cref="LogLevel.Info"/> log level, if enabled.
|
||||
/// </summary>
|
||||
/// <param name="logger">The <see cref="ILog"/> to use.</param>
|
||||
/// <param name="message">The message.</param>
|
||||
/// <param name="args">Optional format parameters for the message.</param>
|
||||
public static void InfoFormat(this ILog logger, string message, params object[] args)
|
||||
{
|
||||
if (logger.IsInfoEnabled()) logger.LogFormat(LogLevel.Info, message, args);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Logs an exception at the <see cref="LogLevel.Info"/> log level, if enabled.
|
||||
/// </summary>
|
||||
/// <param name="logger">The <see cref="ILog"/> to use.</param>
|
||||
/// <param name="message">The message.</param>
|
||||
/// <param name="exception">The exception.</param>
|
||||
/// <param name="args">Optional format parameters for the message.</param>
|
||||
public static void InfoException(this ILog logger, string message, Exception exception,
|
||||
params object[] args)
|
||||
{
|
||||
if (logger.IsInfoEnabled()) logger.Log(LogLevel.Info, message.AsFunc(), exception, args);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Logs a message at the <see cref="LogLevel.Trace"/> log level, if enabled.
|
||||
/// </summary>
|
||||
/// <param name="logger">The <see cref="ILog"/> to use.</param>
|
||||
/// <param name="messageFunc">The message function.</param>
|
||||
public static void Trace(this ILog logger, Func<string> messageFunc)
|
||||
{
|
||||
GuardAgainstNullLogger(logger);
|
||||
logger.Log(LogLevel.Trace, WrapLogInternal(messageFunc), null, EmptyParams);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Logs a message at the <see cref="LogLevel.Trace"/> log level, if enabled.
|
||||
/// </summary>
|
||||
/// <param name="logger">The <see cref="ILog"/> to use.</param>
|
||||
/// <param name="message">The message.</param>
|
||||
public static void Trace(this ILog logger, string message)
|
||||
{
|
||||
if (logger.IsTraceEnabled()) logger.Log(LogLevel.Trace, message.AsFunc(), null, EmptyParams);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Logs a message at the <see cref="LogLevel.Trace"/> log level, if enabled.
|
||||
/// </summary>
|
||||
/// <param name="logger">The <see cref="ILog"/> to use.</param>
|
||||
/// <param name="message">The message.</param>
|
||||
/// <param name="args">Optional format parameters for the message.</param>
|
||||
public static void Trace(this ILog logger, string message, params object[] args)
|
||||
{
|
||||
logger.TraceFormat(message, args);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Logs an exception at the <see cref="LogLevel.Trace"/> log level, if enabled.
|
||||
/// </summary>
|
||||
/// <param name="logger">The <see cref="ILog"/> to use.</param>
|
||||
/// <param name="exception">The exception.</param>
|
||||
/// <param name="message">The message.</param>
|
||||
/// <param name="args">Optional format parameters for the message.</param>
|
||||
public static void Trace(this ILog logger, Exception exception, string message, params object[] args)
|
||||
{
|
||||
logger.TraceException(message, exception, args);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Logs a message at the <see cref="LogLevel.Trace"/> log level, if enabled.
|
||||
/// </summary>
|
||||
/// <param name="logger">The <see cref="ILog"/> to use.</param>
|
||||
/// <param name="message">The message.</param>
|
||||
/// <param name="args">Optional format parameters for the message.</param>
|
||||
public static void TraceFormat(this ILog logger, string message, params object[] args)
|
||||
{
|
||||
if (logger.IsTraceEnabled()) logger.LogFormat(LogLevel.Trace, message, args);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Logs an exception at the <see cref="LogLevel.Trace"/> log level, if enabled.
|
||||
/// </summary>
|
||||
/// <param name="logger">The <see cref="ILog"/> to use.</param>
|
||||
/// <param name="message">The message.</param>
|
||||
/// <param name="exception">The exception.</param>
|
||||
/// <param name="args">Optional format parameters for the message.</param>
|
||||
public static void TraceException(this ILog logger, string message, Exception exception,
|
||||
params object[] args)
|
||||
{
|
||||
if (logger.IsTraceEnabled()) logger.Log(LogLevel.Trace, message.AsFunc(), exception, args);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Logs a message at the <see cref="LogLevel.Warn"/> log level, if enabled.
|
||||
/// </summary>
|
||||
/// <param name="logger">The <see cref="ILog"/> to use.</param>
|
||||
/// <param name="messageFunc">The message function.</param>
|
||||
public static void Warn(this ILog logger, Func<string> messageFunc)
|
||||
{
|
||||
GuardAgainstNullLogger(logger);
|
||||
logger.Log(LogLevel.Warn, WrapLogInternal(messageFunc), null, EmptyParams);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Logs a message at the <see cref="LogLevel.Warn"/> log level, if enabled.
|
||||
/// </summary>
|
||||
/// <param name="logger">The <see cref="ILog"/> to use.</param>
|
||||
/// <param name="message">The message.</param>
|
||||
public static void Warn(this ILog logger, string message)
|
||||
{
|
||||
if (logger.IsWarnEnabled()) logger.Log(LogLevel.Warn, message.AsFunc(), null, EmptyParams);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Logs a message at the <see cref="LogLevel.Warn"/> log level, if enabled.
|
||||
/// </summary>
|
||||
/// <param name="logger">The <see cref="ILog"/> to use.</param>
|
||||
/// <param name="message">The message.</param>
|
||||
/// <param name="args">Optional format parameters for the message.</param>
|
||||
public static void Warn(this ILog logger, string message, params object[] args)
|
||||
{
|
||||
logger.WarnFormat(message, args);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Logs an exception at the <see cref="LogLevel.Warn"/> log level, if enabled.
|
||||
/// </summary>
|
||||
/// <param name="logger">The <see cref="ILog"/> to use.</param>
|
||||
/// <param name="exception">The exception.</param>
|
||||
/// <param name="message">The message.</param>
|
||||
/// <param name="args">Optional format parameters for the message.</param>
|
||||
public static void Warn(this ILog logger, Exception exception, string message, params object[] args)
|
||||
{
|
||||
logger.WarnException(message, exception, args);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Logs a message at the <see cref="LogLevel.Warn"/> log level, if enabled.
|
||||
/// </summary>
|
||||
/// <param name="logger">The <see cref="ILog"/> to use.</param>
|
||||
/// <param name="message">The message.</param>
|
||||
/// <param name="args">Optional format parameters for the message.</param>
|
||||
public static void WarnFormat(this ILog logger, string message, params object[] args)
|
||||
{
|
||||
if (logger.IsWarnEnabled()) logger.LogFormat(LogLevel.Warn, message, args);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Logs an exception at the <see cref="LogLevel.Warn"/> log level, if enabled.
|
||||
/// </summary>
|
||||
/// <param name="logger">The <see cref="ILog"/> to use.</param>
|
||||
/// <param name="message">The message.</param>
|
||||
/// <param name="exception">The exception.</param>
|
||||
/// <param name="args">Optional format parameters for the message.</param>
|
||||
public static void WarnException(this ILog logger, string message, Exception exception,
|
||||
params object[] args)
|
||||
{
|
||||
if (logger.IsWarnEnabled()) logger.Log(LogLevel.Warn, message.AsFunc(), exception, args);
|
||||
}
|
||||
|
||||
// ReSharper disable once UnusedParameter.Local
|
||||
private static void GuardAgainstNullLogger(ILog logger)
|
||||
{
|
||||
if (logger == null) throw new ArgumentNullException("logger");
|
||||
}
|
||||
|
||||
private static void LogFormat(this ILog logger, LogLevel logLevel, string message, params object[] args)
|
||||
{
|
||||
logger.Log(logLevel, message.AsFunc(), null, args);
|
||||
}
|
||||
|
||||
// Avoid the closure allocation, see https://gist.github.com/AArnott/d285feef75c18f6ecd2b
|
||||
private static Func<T> AsFunc<T>(this T value) where T : class
|
||||
{
|
||||
return value.Return;
|
||||
}
|
||||
|
||||
private static T Return<T>(this T value)
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
// Allow passing callsite-logger-type to LogProviderBase using messageFunc
|
||||
internal static Func<string> WrapLogSafeInternal(LoggerExecutionWrapper logger, Func<string> messageFunc)
|
||||
{
|
||||
var WrappedMessageFunc = new Func<string>(() => {
|
||||
try
|
||||
{
|
||||
return messageFunc();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.WrappedLogger(LogLevel.Error, () => LoggerExecutionWrapper.FailedToGenerateLogMessage, ex,
|
||||
EmptyParams);
|
||||
}
|
||||
|
||||
return null;
|
||||
});
|
||||
|
||||
return WrappedMessageFunc;
|
||||
}
|
||||
|
||||
// Allow passing callsite-logger-type to LogProviderBase using messageFunc
|
||||
private static Func<string> WrapLogInternal(Func<string> messageFunc)
|
||||
{
|
||||
var WrappedMessageFunc = new Func<string>(() =>
|
||||
{
|
||||
return messageFunc();
|
||||
});
|
||||
|
||||
return WrappedMessageFunc;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
// <auto-generated/>
|
||||
// ReSharper disable CheckNamespace
|
||||
namespace RSTP_DSLink.Logging
|
||||
{
|
||||
/// <summary>
|
||||
/// The log level.
|
||||
/// </summary>
|
||||
#if LIBLOG_PROVIDERS_ONLY
|
||||
internal
|
||||
#else
|
||||
public
|
||||
#endif
|
||||
enum LogLevel
|
||||
{
|
||||
/// <summary>
|
||||
/// Trace
|
||||
/// </summary>
|
||||
Trace,
|
||||
|
||||
/// <summary>
|
||||
/// Debug
|
||||
/// </summary>
|
||||
Debug,
|
||||
|
||||
/// <summary>
|
||||
/// Info
|
||||
/// </summary>
|
||||
Info,
|
||||
|
||||
/// <summary>
|
||||
/// Warn
|
||||
/// </summary>
|
||||
Warn,
|
||||
|
||||
/// <summary>
|
||||
/// Error
|
||||
/// </summary>
|
||||
Error,
|
||||
|
||||
/// <summary>
|
||||
/// Fatal
|
||||
/// </summary>
|
||||
Fatal
|
||||
}
|
||||
}
|
|
@ -0,0 +1,318 @@
|
|||
// <auto-generated/>
|
||||
// ReSharper disable CheckNamespace
|
||||
//===============================================================================
|
||||
// LibLog
|
||||
//
|
||||
// https://github.com/damianh/LibLog
|
||||
//===============================================================================
|
||||
// Copyright © 2011-2017 Damian Hickey. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
//===============================================================================
|
||||
|
||||
// @formatter:off — disable resharper formatter after this line
|
||||
// ReSharper disable PossibleNullReferenceException
|
||||
|
||||
// Define LIBLOG_PUBLIC to enable ability to GET a logger (LogProvider.For<>() etc) from outside this library. NOTE:
|
||||
// this can have unintended consequences of consumers of your library using your library to resolve a logger. If the
|
||||
// reason is because you want to open this functionality to other projects within your solution,
|
||||
// consider [InternalsVisibleTo] instead.
|
||||
//
|
||||
// Define LIBLOG_PROVIDERS_ONLY if your library provides its own logging API and you just want to use the
|
||||
// LibLog providers internally to provide built in support for popular logging frameworks.
|
||||
|
||||
#pragma warning disable 1591
|
||||
|
||||
using global::System.Diagnostics.CodeAnalysis;
|
||||
|
||||
[assembly: SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "RSTP_DSLink.Logging")]
|
||||
[assembly: SuppressMessage("Microsoft.Design", "CA1026:DefaultParametersShouldNotBeUsed", Scope = "member", Target = "RSTP_DSLink.Logging.Logger.#Invoke(RSTP_DSLink.Logging.LogLevel,System.Func`1<System.String>,System.Exception,System.Object[])")]
|
||||
|
||||
// If you copied this file manually, you need to change all "YourRootNameSpace" so not to clash with other libraries
|
||||
// that use LibLog
|
||||
namespace RSTP_DSLink.Logging
|
||||
{
|
||||
using global::System.Collections.Generic;
|
||||
using global::System.Diagnostics.CodeAnalysis;
|
||||
using global::RSTP_DSLink.Logging.LogProviders;
|
||||
using global::System;
|
||||
#if !LIBLOG_PROVIDERS_ONLY
|
||||
using global::System.Diagnostics;
|
||||
using global::System.Runtime.CompilerServices;
|
||||
#endif
|
||||
|
||||
#if LIBLOG_EXCLUDE_CODE_COVERAGE
|
||||
[ExcludeFromCodeCoverage]
|
||||
#endif
|
||||
#if LIBLOG_PROVIDERS_ONLY
|
||||
/// <summary>
|
||||
/// Provides a mechanism to set the <see cref="ILogProvider" />
|
||||
/// and create instances of <see cref="ILog" /> objects.
|
||||
/// </summary>
|
||||
internal
|
||||
#else
|
||||
/// <summary>
|
||||
/// Provides a mechanism to set the <see cref="ILogProvider" />.
|
||||
/// </summary>
|
||||
public
|
||||
#endif
|
||||
static class LogProvider
|
||||
{
|
||||
private static readonly Lazy<ILogProvider> ResolvedLogProvider = new Lazy<ILogProvider>(ForceResolveLogProvider);
|
||||
#if !LIBLOG_PROVIDERS_ONLY
|
||||
private static ILogProvider s_currentLogProvider;
|
||||
private static Action<ILogProvider> s_onCurrentLogProviderSet;
|
||||
|
||||
[SuppressMessage("Microsoft.Performance", "CA1810:InitializeReferenceTypeStaticFieldsInline")]
|
||||
static LogProvider()
|
||||
{
|
||||
IsDisabled = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the current log provider.
|
||||
/// </summary>
|
||||
/// <param name="logProvider">The log provider.</param>
|
||||
public static void SetCurrentLogProvider(ILogProvider logProvider)
|
||||
{
|
||||
s_currentLogProvider = logProvider;
|
||||
|
||||
RaiseOnCurrentLogProviderSet();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether this is logging is disabled.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// <c>true</c> if logging is disabled; otherwise, <c>false</c>.
|
||||
/// </value>
|
||||
public static bool IsDisabled { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Sets an action that is invoked when a consumer of your library has called SetCurrentLogProvider. It is
|
||||
/// important that hook into this if you are using child libraries (especially ilmerged ones) that are using
|
||||
/// LibLog (or other logging abstraction) so you adapt and delegate to them.
|
||||
/// <see cref="SetCurrentLogProvider"/>
|
||||
/// </summary>
|
||||
internal static Action<ILogProvider> OnCurrentLogProviderSet
|
||||
{
|
||||
set
|
||||
{
|
||||
s_onCurrentLogProviderSet = value;
|
||||
RaiseOnCurrentLogProviderSet();
|
||||
}
|
||||
}
|
||||
|
||||
internal static ILogProvider CurrentLogProvider
|
||||
{
|
||||
get { return s_currentLogProvider; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a logger for the specified type.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type whose name will be used for the logger.</typeparam>
|
||||
/// <returns>An instance of <see cref="ILog"/></returns>
|
||||
#if LIBLOG_PUBLIC
|
||||
public
|
||||
#else
|
||||
internal
|
||||
#endif
|
||||
static ILog For<T>()
|
||||
{
|
||||
return GetLogger(typeof(T));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a logger for the current class.
|
||||
/// </summary>
|
||||
/// <returns>An instance of <see cref="ILog"/></returns>
|
||||
[MethodImpl(MethodImplOptions.NoInlining)]
|
||||
#if LIBLOG_PUBLIC
|
||||
public
|
||||
#else
|
||||
internal
|
||||
#endif
|
||||
static ILog GetCurrentClassLogger()
|
||||
{
|
||||
var stackFrame = new StackFrame(1, false);
|
||||
return GetLogger(stackFrame.GetMethod().DeclaringType);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a logger for the specified type.
|
||||
/// </summary>
|
||||
/// <param name="type">The type whose name will be used for the logger.</param>
|
||||
/// <param name="fallbackTypeName">If the type is null then this name will be used as the log name instead</param>
|
||||
/// <returns>An instance of <see cref="ILog"/></returns>
|
||||
#if LIBLOG_PUBLIC
|
||||
public
|
||||
#else
|
||||
internal
|
||||
#endif
|
||||
static ILog GetLogger(Type type, string fallbackTypeName = "System.Object")
|
||||
{
|
||||
// If the type passed in is null then fallback to the type name specified
|
||||
return GetLogger(type != null ? type.ToString() : fallbackTypeName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a logger with the specified name.
|
||||
/// </summary>
|
||||
/// <param name="name">The name.</param>
|
||||
/// <returns>An instance of <see cref="ILog"/></returns>
|
||||
#if LIBLOG_PUBLIC
|
||||
public
|
||||
#else
|
||||
internal
|
||||
#endif
|
||||
static ILog GetLogger(string name)
|
||||
{
|
||||
var logProvider = CurrentLogProvider ?? ResolveLogProvider();
|
||||
return logProvider == null
|
||||
? NoOpLogger.Instance
|
||||
: (ILog)new LoggerExecutionWrapper(logProvider.GetLogger(name), () => IsDisabled);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Opens a nested diagnostics context.
|
||||
/// </summary>
|
||||
/// <param name="message">A message.</param>
|
||||
/// <returns>An <see cref="IDisposable"/> that closes context when disposed.</returns>
|
||||
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly", MessageId = "SetCurrentLogProvider")]
|
||||
#if LIBLOG_PUBLIC
|
||||
public
|
||||
#else
|
||||
internal
|
||||
#endif
|
||||
static IDisposable OpenNestedContext(string message)
|
||||
{
|
||||
var logProvider = CurrentLogProvider ?? ResolveLogProvider();
|
||||
|
||||
return logProvider == null
|
||||
? new DisposableAction(() => { })
|
||||
: logProvider.OpenNestedContext(message);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Opens a mapped diagnostics context.
|
||||
/// </summary>
|
||||
/// <param name="key">A key.</param>
|
||||
/// <param name="value">A value.</param>
|
||||
/// <param name="destructure">A optional paramater to indicate message should be destructured.</param>
|
||||
/// <returns>An <see cref="IDisposable"/> that closes context when disposed.</returns>
|
||||
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly", MessageId = "SetCurrentLogProvider")]
|
||||
#if LIBLOG_PUBLIC
|
||||
public
|
||||
#else
|
||||
internal
|
||||
#endif
|
||||
static IDisposable OpenMappedContext(string key, object value, bool destructure = false)
|
||||
{
|
||||
var logProvider = CurrentLogProvider ?? ResolveLogProvider();
|
||||
|
||||
return logProvider == null
|
||||
? new DisposableAction(() => { })
|
||||
: logProvider.OpenMappedContext(key, value, destructure);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if LIBLOG_PROVIDERS_ONLY
|
||||
private
|
||||
#else
|
||||
internal
|
||||
#endif
|
||||
delegate bool IsLoggerAvailable();
|
||||
|
||||
#if LIBLOG_PROVIDERS_ONLY
|
||||
private
|
||||
#else
|
||||
internal
|
||||
#endif
|
||||
delegate ILogProvider CreateLogProvider();
|
||||
|
||||
#if LIBLOG_PROVIDERS_ONLY
|
||||
private
|
||||
#else
|
||||
internal
|
||||
#endif
|
||||
static readonly List<Tuple<IsLoggerAvailable, CreateLogProvider>> LogProviderResolvers =
|
||||
new List<Tuple<IsLoggerAvailable, CreateLogProvider>>
|
||||
{
|
||||
new Tuple<IsLoggerAvailable, CreateLogProvider>(SerilogLogProvider.IsLoggerAvailable, () => new SerilogLogProvider()),
|
||||
new Tuple<IsLoggerAvailable, CreateLogProvider>(NLogLogProvider.IsLoggerAvailable, () => new NLogLogProvider()),
|
||||
new Tuple<IsLoggerAvailable, CreateLogProvider>(Log4NetLogProvider.IsLoggerAvailable, () => new Log4NetLogProvider()),
|
||||
new Tuple<IsLoggerAvailable, CreateLogProvider>(LoupeLogProvider.IsLoggerAvailable, () => new LoupeLogProvider()),
|
||||
};
|
||||
|
||||
#if !LIBLOG_PROVIDERS_ONLY
|
||||
private static void RaiseOnCurrentLogProviderSet()
|
||||
{
|
||||
if (s_onCurrentLogProviderSet != null)
|
||||
{
|
||||
s_onCurrentLogProviderSet(s_currentLogProvider);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
internal static ILogProvider ResolveLogProvider()
|
||||
{
|
||||
return ResolvedLogProvider.Value;
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Globalization", "CA1303:Do not pass literals as localized parameters", MessageId = "System.Console.WriteLine(System.String,System.Object,System.Object)")]
|
||||
[SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes")]
|
||||
internal static ILogProvider ForceResolveLogProvider()
|
||||
{
|
||||
try
|
||||
{
|
||||
foreach (var providerResolver in LogProviderResolvers)
|
||||
{
|
||||
if (providerResolver.Item1())
|
||||
{
|
||||
return providerResolver.Item2();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(
|
||||
"Exception occurred resolving a log provider. Logging for this assembly {0} is disabled. {1}",
|
||||
typeof(LogProvider).Assembly.FullName,
|
||||
ex);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
#if !LIBLOG_PROVIDERS_ONLY
|
||||
#if LIBLOG_EXCLUDE_CODE_COVERAGE
|
||||
[ExcludeFromCodeCoverage]
|
||||
#endif
|
||||
internal class NoOpLogger : ILog
|
||||
{
|
||||
internal static readonly NoOpLogger Instance = new NoOpLogger();
|
||||
|
||||
public bool Log(LogLevel logLevel, Func<string> messageFunc, Exception exception, params object[] formatParameters)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
// <auto-generated/>
|
||||
// ReSharper disable CheckNamespace
|
||||
namespace RSTP_DSLink.Logging.LogProviders
|
||||
{
|
||||
using System;
|
||||
|
||||
#if LIBLOG_EXCLUDE_CODE_COVERAGE
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
[ExcludeFromCodeCoverage]
|
||||
#endif
|
||||
internal class DisposableAction : IDisposable
|
||||
{
|
||||
private readonly Action _onDispose;
|
||||
|
||||
public DisposableAction(Action onDispose = null)
|
||||
{
|
||||
_onDispose = onDispose;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if(_onDispose != null) _onDispose.Invoke();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
// <auto-generated/>
|
||||
// ReSharper disable CheckNamespace
|
||||
namespace RSTP_DSLink.Logging.LogProviders
|
||||
{
|
||||
using System;
|
||||
#if LIBLOG_EXCLUDE_CODE_COVERAGE
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
#endif
|
||||
|
||||
#if LIBLOG_EXCLUDE_CODE_COVERAGE
|
||||
[ExcludeFromCodeCoverage]
|
||||
#endif
|
||||
#if !LIBLOG_PROVIDERS_ONLY || LIBLOG_PUBLIC
|
||||
/// <summary>
|
||||
/// Exception thrown by LibLog.
|
||||
/// </summary>
|
||||
public
|
||||
#else
|
||||
internal
|
||||
#endif
|
||||
class LibLogException : Exception
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new LibLogException with the specified message.
|
||||
/// </summary>
|
||||
/// <param name="message">The message</param>
|
||||
public LibLogException(string message)
|
||||
: base(message)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new LibLogException with the specified message and inner exception.
|
||||
/// </summary>
|
||||
/// <param name="message">The message.</param>
|
||||
/// <param name="inner">The inner exception.</param>
|
||||
public LibLogException(string message, Exception inner)
|
||||
: base(message, inner)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,381 @@
|
|||
// <auto-generated/>
|
||||
// ReSharper disable CheckNamespace
|
||||
namespace RSTP_DSLink.Logging.LogProviders
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
|
||||
#if LIBLOG_EXCLUDE_CODE_COVERAGE
|
||||
[ExcludeFromCodeCoverage]
|
||||
#endif
|
||||
internal class Log4NetLogProvider : LogProviderBase
|
||||
{
|
||||
private readonly Func<string, object> _getLoggerByNameDelegate;
|
||||
|
||||
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly", MessageId = "LogManager")]
|
||||
public Log4NetLogProvider()
|
||||
{
|
||||
if (!IsLoggerAvailable()) throw new LibLogException("log4net.LogManager not found");
|
||||
_getLoggerByNameDelegate = GetGetLoggerMethodCall();
|
||||
}
|
||||
|
||||
public static bool ProviderIsAvailableOverride { get; set; } = true;
|
||||
|
||||
public override Logger GetLogger(string name)
|
||||
{
|
||||
return new Log4NetLogger(_getLoggerByNameDelegate(name)).Log;
|
||||
}
|
||||
|
||||
internal static bool IsLoggerAvailable()
|
||||
{
|
||||
return ProviderIsAvailableOverride && GetLogManagerType() != null;
|
||||
}
|
||||
|
||||
protected override OpenNdc GetOpenNdcMethod()
|
||||
{
|
||||
var logicalThreadContextType = FindType("log4net.LogicalThreadContext", "log4net");
|
||||
var stacksProperty = logicalThreadContextType.GetProperty("Stacks");
|
||||
var logicalThreadContextStacksType = stacksProperty.PropertyType;
|
||||
var stacksIndexerProperty = logicalThreadContextStacksType.GetProperty("Item");
|
||||
var stackType = stacksIndexerProperty.PropertyType;
|
||||
var pushMethod = stackType.GetMethod("Push");
|
||||
|
||||
var messageParameter =
|
||||
Expression.Parameter(typeof(string), "message");
|
||||
|
||||
// message => LogicalThreadContext.Stacks.Item["NDC"].Push(message);
|
||||
var callPushBody =
|
||||
Expression.Call(
|
||||
Expression.Property(Expression.Property(null, stacksProperty),
|
||||
stacksIndexerProperty,
|
||||
Expression.Constant("NDC")),
|
||||
pushMethod,
|
||||
messageParameter);
|
||||
|
||||
var result =
|
||||
Expression.Lambda<OpenNdc>(callPushBody, messageParameter)
|
||||
.Compile();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
protected override OpenMdc GetOpenMdcMethod()
|
||||
{
|
||||
var logicalThreadContextType = FindType("log4net.LogicalThreadContext", "log4net");
|
||||
var propertiesProperty = logicalThreadContextType.GetProperty("Properties");
|
||||
var logicalThreadContextPropertiesType = propertiesProperty.PropertyType;
|
||||
var propertiesIndexerProperty = logicalThreadContextPropertiesType.GetProperty("Item");
|
||||
|
||||
var removeMethod = logicalThreadContextPropertiesType.GetMethod("Remove");
|
||||
|
||||
var keyParam = Expression.Parameter(typeof(string), "key");
|
||||
var valueParam = Expression.Parameter(typeof(string), "value");
|
||||
|
||||
var propertiesExpression = Expression.Property(null, propertiesProperty);
|
||||
|
||||
// (key, value) => LogicalThreadContext.Properties.Item[key] = value;
|
||||
var setProperties =
|
||||
Expression.Assign(Expression.Property(propertiesExpression, propertiesIndexerProperty, keyParam),
|
||||
valueParam);
|
||||
|
||||
// key => LogicalThreadContext.Properties.Remove(key);
|
||||
var removeMethodCall = Expression.Call(propertiesExpression, removeMethod, keyParam);
|
||||
|
||||
var set = Expression
|
||||
.Lambda<Action<string, string>>(setProperties, keyParam, valueParam)
|
||||
.Compile();
|
||||
|
||||
var remove = Expression
|
||||
.Lambda<Action<string>>(removeMethodCall, keyParam)
|
||||
.Compile();
|
||||
|
||||
return (key, value, _) =>
|
||||
{
|
||||
set(key, value.ToString());
|
||||
return new DisposableAction(() => remove(key));
|
||||
};
|
||||
}
|
||||
|
||||
private static Type GetLogManagerType()
|
||||
{
|
||||
return FindType("log4net.LogManager", "log4net");
|
||||
}
|
||||
|
||||
private static Func<string, object> GetGetLoggerMethodCall()
|
||||
{
|
||||
var logManagerType = GetLogManagerType();
|
||||
var log4netAssembly = Assembly.GetAssembly(logManagerType);
|
||||
var method = logManagerType.GetMethod("GetLogger", typeof(Assembly), typeof(string));
|
||||
var repositoryAssemblyParam = Expression.Parameter(typeof(Assembly), "repositoryAssembly");
|
||||
var nameParam = Expression.Parameter(typeof(string), "name");
|
||||
var methodCall = Expression.Call(null, method, repositoryAssemblyParam, nameParam);
|
||||
var lambda = Expression
|
||||
.Lambda<Func<Assembly, string, object>>(methodCall, repositoryAssemblyParam, nameParam).Compile();
|
||||
return name => lambda(log4netAssembly, name);
|
||||
}
|
||||
|
||||
#if LIBLOG_EXCLUDE_CODE_COVERAGE
|
||||
[ExcludeFromCodeCoverage]
|
||||
#endif
|
||||
internal class Log4NetLogger
|
||||
{
|
||||
private static object s_levelAll;
|
||||
private static object s_levelDebug;
|
||||
private static object s_levelInfo;
|
||||
private static object s_levelWarn;
|
||||
private static object s_levelError;
|
||||
private static object s_levelFatal;
|
||||
private static Func<object, object, bool> s_isEnabledForDelegate;
|
||||
private static Action<object, object> s_logDelegate;
|
||||
private static Func<object, Type, object, string, Exception, object> s_createLoggingEvent;
|
||||
private static Action<object, string, object> s_loggingEventPropertySetter;
|
||||
|
||||
private static readonly Lazy<bool> Initialized =
|
||||
new Lazy<bool>(Initialize, LazyThreadSafetyMode.ExecutionAndPublication);
|
||||
|
||||
private static Exception s_initializeException;
|
||||
private readonly object _logger;
|
||||
|
||||
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly", MessageId = "ILogger")]
|
||||
internal Log4NetLogger(object logger)
|
||||
{
|
||||
_logger = logger.GetType().GetProperty("Logger").GetValue(logger);
|
||||
}
|
||||
|
||||
private static bool Initialize()
|
||||
{
|
||||
try
|
||||
{
|
||||
var logEventLevelType = FindType("log4net.Core.Level", "log4net");
|
||||
if (logEventLevelType == null) throw new LibLogException("Type log4net.Core.Level was not found.");
|
||||
|
||||
var levelFields = logEventLevelType.GetFields().ToList();
|
||||
s_levelAll = levelFields.First(x => x.Name == "All").GetValue(null);
|
||||
s_levelDebug = levelFields.First(x => x.Name == "Debug").GetValue(null);
|
||||
s_levelInfo = levelFields.First(x => x.Name == "Info").GetValue(null);
|
||||
s_levelWarn = levelFields.First(x => x.Name == "Warn").GetValue(null);
|
||||
s_levelError = levelFields.First(x => x.Name == "Error").GetValue(null);
|
||||
s_levelFatal = levelFields.First(x => x.Name == "Fatal").GetValue(null);
|
||||
|
||||
// Func<object, object, bool> isEnabledFor = (logger, level) => { return ((log4net.Core.ILogger)logger).IsEnabled(level); }
|
||||
var loggerType = FindType("log4net.Core.ILogger", "log4net");
|
||||
if (loggerType == null) throw new LibLogException("Type log4net.Core.ILogger, was not found.");
|
||||
var instanceParam = Expression.Parameter(typeof(object));
|
||||
var instanceCast = Expression.Convert(instanceParam, loggerType);
|
||||
var levelParam = Expression.Parameter(typeof(object));
|
||||
var levelCast = Expression.Convert(levelParam, logEventLevelType);
|
||||
s_isEnabledForDelegate = GetIsEnabledFor(loggerType, logEventLevelType, instanceCast, levelCast,
|
||||
instanceParam, levelParam);
|
||||
|
||||
var loggingEventType = FindType("log4net.Core.LoggingEvent", "log4net");
|
||||
|
||||
s_createLoggingEvent = GetCreateLoggingEvent(instanceParam, instanceCast, levelParam, levelCast,
|
||||
loggingEventType);
|
||||
|
||||
s_logDelegate = GetLogDelegate(loggerType, loggingEventType, instanceCast, instanceParam);
|
||||
|
||||
s_loggingEventPropertySetter = GetLoggingEventPropertySetter(loggingEventType);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
s_initializeException = ex;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private static Action<object, object> GetLogDelegate(Type loggerType, Type loggingEventType,
|
||||
UnaryExpression instanceCast,
|
||||
ParameterExpression instanceParam)
|
||||
{
|
||||
//Action<object, object, string, Exception> Log =
|
||||
//(logger, callerStackBoundaryDeclaringType, level, message, exception) => { ((ILogger)logger).Log(new LoggingEvent(callerStackBoundaryDeclaringType, logger.Repository, logger.Name, level, message, exception)); }
|
||||
var writeExceptionMethodInfo = loggerType.GetMethod("Log",
|
||||
loggingEventType);
|
||||
|
||||
var loggingEventParameter =
|
||||
Expression.Parameter(typeof(object), "loggingEvent");
|
||||
|
||||
var loggingEventCasted =
|
||||
Expression.Convert(loggingEventParameter, loggingEventType);
|
||||
|
||||
var writeMethodExp = Expression.Call(
|
||||
instanceCast,
|
||||
writeExceptionMethodInfo,
|
||||
loggingEventCasted);
|
||||
|
||||
var logDelegate = Expression.Lambda<Action<object, object>>(
|
||||
writeMethodExp,
|
||||
instanceParam,
|
||||
loggingEventParameter).Compile();
|
||||
|
||||
return logDelegate;
|
||||
}
|
||||
|
||||
private static Func<object, Type, object, string, Exception, object> GetCreateLoggingEvent(
|
||||
ParameterExpression instanceParam, UnaryExpression instanceCast, ParameterExpression levelParam,
|
||||
UnaryExpression levelCast, Type loggingEventType)
|
||||
{
|
||||
var callerStackBoundaryDeclaringTypeParam = Expression.Parameter(typeof(Type));
|
||||
var messageParam = Expression.Parameter(typeof(string));
|
||||
var exceptionParam = Expression.Parameter(typeof(Exception));
|
||||
|
||||
var repositoryProperty = loggingEventType.GetProperty("Repository");
|
||||
var levelProperty = loggingEventType.GetProperty("Level");
|
||||
|
||||
var loggingEventConstructor =
|
||||
loggingEventType.GetConstructorPortable(typeof(Type), repositoryProperty.PropertyType,
|
||||
typeof(string), levelProperty.PropertyType, typeof(object), typeof(Exception));
|
||||
|
||||
//Func<object, object, string, Exception, object> Log =
|
||||
//(logger, callerStackBoundaryDeclaringType, level, message, exception) => new LoggingEvent(callerStackBoundaryDeclaringType, ((ILogger)logger).Repository, ((ILogger)logger).Name, (Level)level, message, exception); }
|
||||
var newLoggingEventExpression =
|
||||
Expression.New(loggingEventConstructor,
|
||||
callerStackBoundaryDeclaringTypeParam,
|
||||
Expression.Property(instanceCast, "Repository"),
|
||||
Expression.Property(instanceCast, "Name"),
|
||||
levelCast,
|
||||
messageParam,
|
||||
exceptionParam);
|
||||
|
||||
var createLoggingEvent =
|
||||
Expression.Lambda<Func<object, Type, object, string, Exception, object>>(
|
||||
newLoggingEventExpression,
|
||||
instanceParam,
|
||||
callerStackBoundaryDeclaringTypeParam,
|
||||
levelParam,
|
||||
messageParam,
|
||||
exceptionParam)
|
||||
.Compile();
|
||||
|
||||
return createLoggingEvent;
|
||||
}
|
||||
|
||||
private static Func<object, object, bool> GetIsEnabledFor(Type loggerType, Type logEventLevelType,
|
||||
UnaryExpression instanceCast,
|
||||
UnaryExpression levelCast,
|
||||
ParameterExpression instanceParam,
|
||||
ParameterExpression levelParam)
|
||||
{
|
||||
var isEnabledMethodInfo = loggerType.GetMethod("IsEnabledFor", logEventLevelType);
|
||||
var isEnabledMethodCall = Expression.Call(instanceCast, isEnabledMethodInfo, levelCast);
|
||||
|
||||
var result =
|
||||
Expression.Lambda<Func<object, object, bool>>(isEnabledMethodCall, instanceParam, levelParam)
|
||||
.Compile();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private static Action<object, string, object> GetLoggingEventPropertySetter(Type loggingEventType)
|
||||
{
|
||||
var loggingEventParameter = Expression.Parameter(typeof(object), "loggingEvent");
|
||||
var keyParameter = Expression.Parameter(typeof(string), "key");
|
||||
var valueParameter = Expression.Parameter(typeof(object), "value");
|
||||
|
||||
var propertiesProperty = loggingEventType.GetProperty("Properties");
|
||||
var item = propertiesProperty.PropertyType.GetProperty("Item");
|
||||
|
||||
// ((LoggingEvent)loggingEvent).Properties[key] = value;
|
||||
var body =
|
||||
Expression.Assign(
|
||||
Expression.Property(
|
||||
Expression.Property(Expression.Convert(loggingEventParameter, loggingEventType),
|
||||
propertiesProperty), item, keyParameter), valueParameter);
|
||||
|
||||
var result =
|
||||
Expression.Lambda<Action<object, string, object>>
|
||||
(body, loggingEventParameter, keyParameter,
|
||||
valueParameter)
|
||||
.Compile();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public bool Log(LogLevel logLevel, Func<string> messageFunc, Exception exception,
|
||||
params object[] formatParameters)
|
||||
{
|
||||
if (!Initialized.Value)
|
||||
throw new LibLogException(ErrorInitializingProvider, s_initializeException);
|
||||
|
||||
if (messageFunc == null) return IsLogLevelEnable(logLevel);
|
||||
|
||||
if (!IsLogLevelEnable(logLevel)) return false;
|
||||
|
||||
var formattedMessage =
|
||||
LogMessageFormatter.FormatStructuredMessage(messageFunc(),
|
||||
formatParameters,
|
||||
out var patternMatches);
|
||||
|
||||
var callerStackBoundaryType = typeof(Log4NetLogger);
|
||||
// Callsite HACK - Extract the callsite-logger-type from the messageFunc
|
||||
var methodType = messageFunc.Method.DeclaringType;
|
||||
if (methodType == typeof(LogExtensions) ||
|
||||
methodType != null && methodType.DeclaringType == typeof(LogExtensions))
|
||||
callerStackBoundaryType = typeof(LogExtensions);
|
||||
else if (methodType == typeof(LoggerExecutionWrapper) ||
|
||||
methodType != null && methodType.DeclaringType == typeof(LoggerExecutionWrapper))
|
||||
callerStackBoundaryType = typeof(LoggerExecutionWrapper);
|
||||
|
||||
var translatedLevel = TranslateLevel(logLevel);
|
||||
|
||||
object loggingEvent = s_createLoggingEvent(_logger, callerStackBoundaryType, translatedLevel,
|
||||
formattedMessage, exception);
|
||||
|
||||
PopulateProperties(loggingEvent, patternMatches, formatParameters);
|
||||
|
||||
s_logDelegate(_logger, loggingEvent);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void PopulateProperties(object loggingEvent, IEnumerable<string> patternMatches,
|
||||
IEnumerable<object> formatParameters)
|
||||
{
|
||||
var enumerable = patternMatches as string[] ?? patternMatches.ToArray();
|
||||
if (enumerable.Any())
|
||||
{
|
||||
var keyToValue =
|
||||
enumerable.Zip(formatParameters,
|
||||
(key, value) => new KeyValuePair<string, object>(key, value));
|
||||
|
||||
foreach (var keyValuePair in keyToValue)
|
||||
s_loggingEventPropertySetter(loggingEvent, keyValuePair.Key, keyValuePair.Value);
|
||||
}
|
||||
}
|
||||
|
||||
private bool IsLogLevelEnable(LogLevel logLevel)
|
||||
{
|
||||
var level = TranslateLevel(logLevel);
|
||||
return s_isEnabledForDelegate(_logger, level);
|
||||
}
|
||||
|
||||
private object TranslateLevel(LogLevel logLevel)
|
||||
{
|
||||
switch (logLevel)
|
||||
{
|
||||
case LogLevel.Trace:
|
||||
return s_levelAll;
|
||||
case LogLevel.Debug:
|
||||
return s_levelDebug;
|
||||
case LogLevel.Info:
|
||||
return s_levelInfo;
|
||||
case LogLevel.Warn:
|
||||
return s_levelWarn;
|
||||
case LogLevel.Error:
|
||||
return s_levelError;
|
||||
case LogLevel.Fatal:
|
||||
return s_levelFatal;
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException("logLevel", logLevel, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,96 @@
|
|||
// <auto-generated/>
|
||||
// ReSharper disable CheckNamespace
|
||||
namespace RSTP_DSLink.Logging.LogProviders
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
#if LIBLOG_EXCLUDE_CODE_COVERAGE
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
[ExcludeFromCodeCoverage]
|
||||
#endif
|
||||
internal static class LogMessageFormatter
|
||||
{
|
||||
private static readonly Regex Pattern = new Regex(@"(?<!{){@?(?<arg>[^ :{}]+)(?<format>:[^}]+)?}",
|
||||
RegexOptions.Compiled);
|
||||
|
||||
/// <summary>
|
||||
/// Some logging frameworks support structured logging, such as serilog. This will allow you to add names to structured
|
||||
/// data in a format string:
|
||||
/// For example: Log("Log message to {user}", user). This only works with serilog, but as the user of LibLog, you don't
|
||||
/// know if serilog is actually
|
||||
/// used. So, this class simulates that. it will replace any text in {curly braces} with an index number.
|
||||
/// "Log {message} to {user}" would turn into => "Log {0} to {1}". Then the format parameters are handled using regular
|
||||
/// .net string.Format.
|
||||
/// </summary>
|
||||
/// <param name="messageBuilder">The message builder.</param>
|
||||
/// <param name="formatParameters">The format parameters.</param>
|
||||
/// <returns></returns>
|
||||
public static Func<string> SimulateStructuredLogging(Func<string> messageBuilder, object[] formatParameters)
|
||||
{
|
||||
if (formatParameters == null || formatParameters.Length == 0) return messageBuilder;
|
||||
|
||||
return () =>
|
||||
{
|
||||
var targetMessage = messageBuilder();
|
||||
IEnumerable<string> _;
|
||||
return FormatStructuredMessage(targetMessage, formatParameters, out _);
|
||||
};
|
||||
}
|
||||
|
||||
private static string ReplaceFirst(string text, string search, string replace)
|
||||
{
|
||||
var pos = text.IndexOf(search, StringComparison.Ordinal);
|
||||
if (pos < 0) return text;
|
||||
return text.Substring(0, pos) + replace + text.Substring(pos + search.Length);
|
||||
}
|
||||
|
||||
public static string FormatStructuredMessage(string targetMessage, object[] formatParameters,
|
||||
out IEnumerable<string> patternMatches)
|
||||
{
|
||||
if (formatParameters == null || formatParameters.Length == 0)
|
||||
{
|
||||
patternMatches = Enumerable.Empty<string>();
|
||||
return targetMessage;
|
||||
}
|
||||
|
||||
List<string> processedArguments = null;
|
||||
|
||||
foreach (Match match in Pattern.Matches(targetMessage))
|
||||
{
|
||||
var arg = match.Groups["arg"].Value;
|
||||
|
||||
int result;
|
||||
if (!int.TryParse(arg, out result))
|
||||
{
|
||||
processedArguments = processedArguments ?? new List<string>(formatParameters.Length);
|
||||
var argumentIndex = processedArguments.IndexOf(arg);
|
||||
if (argumentIndex == -1)
|
||||
{
|
||||
argumentIndex = processedArguments.Count;
|
||||
processedArguments.Add(arg);
|
||||
}
|
||||
|
||||
targetMessage = ReplaceFirst(targetMessage, match.Value,
|
||||
string.Concat("{", argumentIndex.ToString(), match.Groups["format"].Value, "}"));
|
||||
}
|
||||
}
|
||||
|
||||
patternMatches = processedArguments ?? Enumerable.Empty<string>();
|
||||
|
||||
try
|
||||
{
|
||||
return string.Format(CultureInfo.InvariantCulture, targetMessage, formatParameters);
|
||||
}
|
||||
catch (FormatException ex)
|
||||
{
|
||||
throw new FormatException(
|
||||
"The input string '" + targetMessage + "' could not be formatted using string.Format", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,135 @@
|
|||
// <auto-generated/>
|
||||
// ReSharper disable CheckNamespace
|
||||
namespace RSTP_DSLink.Logging.LogProviders
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
#if LIBLOG_EXCLUDE_CODE_COVERAGE
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Base class for specific log providers.
|
||||
/// </summary>
|
||||
#if LIBLOG_EXCLUDE_CODE_COVERAGE
|
||||
[ExcludeFromCodeCoverage]
|
||||
#endif
|
||||
#if LIBLOG_PUBLIC
|
||||
public
|
||||
#else
|
||||
internal
|
||||
#endif
|
||||
abstract class LogProviderBase : ILogProvider
|
||||
{
|
||||
private static readonly IDisposable NoopDisposableInstance = new DisposableAction();
|
||||
private readonly Lazy<OpenMdc> _lazyOpenMdcMethod;
|
||||
|
||||
/// <summary>
|
||||
/// Error message should initializing the log provider fail.
|
||||
/// </summary>
|
||||
protected const string ErrorInitializingProvider = "Unable to log due to problem initializing the log provider. See inner exception for details.";
|
||||
|
||||
private readonly Lazy<OpenNdc> _lazyOpenNdcMethod;
|
||||
|
||||
/// <summary>
|
||||
/// Initialize an instance of the <see cref="LogProviderBase"/> class by initializing the references
|
||||
/// to the nested and mapped diagnostics context-obtaining functions.
|
||||
/// </summary>
|
||||
protected LogProviderBase()
|
||||
{
|
||||
_lazyOpenNdcMethod
|
||||
= new Lazy<OpenNdc>(GetOpenNdcMethod);
|
||||
_lazyOpenMdcMethod
|
||||
= new Lazy<OpenMdc>(GetOpenMdcMethod);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the specified named logger.
|
||||
/// </summary>
|
||||
/// <param name="name">Name of the logger.</param>
|
||||
/// <returns>The logger reference.</returns>
|
||||
public abstract Logger GetLogger(string name);
|
||||
|
||||
/// <summary>
|
||||
/// Opens a nested diagnostics context. Not supported in EntLib logging.
|
||||
/// </summary>
|
||||
/// <param name="message">The message to add to the diagnostics context.</param>
|
||||
/// <returns>A disposable that when disposed removes the message from the context.</returns>
|
||||
public IDisposable OpenNestedContext(string message)
|
||||
{
|
||||
return _lazyOpenNdcMethod.Value(message);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Opens a mapped diagnostics context. Not supported in EntLib logging.
|
||||
/// </summary>
|
||||
/// <param name="key">A key.</param>
|
||||
/// <param name="value">A value.</param>
|
||||
/// <param name="destructure">Determines whether to call the destructor or not.</param>
|
||||
/// <returns>A disposable that when disposed removes the map from the context.</returns>
|
||||
public IDisposable OpenMappedContext(string key, object value, bool destructure = false)
|
||||
{
|
||||
return _lazyOpenMdcMethod.Value(key, value, destructure);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the provider-specific method to open a nested diagnostics context.
|
||||
/// </summary>
|
||||
/// <returns>A provider-specific method to open a nested diagnostics context.</returns>
|
||||
protected virtual OpenNdc GetOpenNdcMethod()
|
||||
{
|
||||
return (_) => NoopDisposableInstance;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the provider-specific method to open a mapped diagnostics context.
|
||||
/// </summary>
|
||||
/// <returns>A provider-specific method to open a mapped diagnostics context.</returns>
|
||||
protected virtual OpenMdc GetOpenMdcMethod()
|
||||
{
|
||||
return (_, __, ___) => NoopDisposableInstance;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Delegate defining the signature of the method opening a nested diagnostics context.
|
||||
/// </summary>
|
||||
/// <param name="message">The message to add to the diagnostics context.</param>
|
||||
/// <returns>A disposable that when disposed removes the message from the context.</returns>
|
||||
protected delegate IDisposable OpenNdc(string message);
|
||||
|
||||
/// <summary>
|
||||
/// Delegate defining the signature of the method opening a mapped diagnostics context.
|
||||
/// </summary>
|
||||
/// <param name="key">A key.</param>
|
||||
/// <param name="value">A value.</param>
|
||||
/// <param name="destructure">Determines whether to call the destructor or not.</param>
|
||||
/// <returns>A disposable that when disposed removes the map from the context.</returns>
|
||||
protected delegate IDisposable OpenMdc(string key, object value, bool destructure);
|
||||
|
||||
/// <summary>
|
||||
/// Finds a type using a type name and assembly name.
|
||||
/// </summary>
|
||||
/// <param name="typeName">The name of the type.</param>
|
||||
/// <param name="assemblyName">The name of the assembly.</param>
|
||||
/// <returns>The requested type or null if it was not found.</returns>
|
||||
protected static Type FindType(string typeName, string assemblyName)
|
||||
{
|
||||
return FindType(typeName, new[] {assemblyName});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Finds a type using a type name and a list of assembly names to search.
|
||||
/// </summary>
|
||||
/// <param name="typeName">The name of the type.</param>
|
||||
/// <param name="assemblyNames">A list of assembly names to search.</param>
|
||||
/// <returns>The request type or null if it was not found.</returns>
|
||||
protected static Type FindType(string typeName, IReadOnlyList<string> assemblyNames)
|
||||
{
|
||||
return assemblyNames
|
||||
.Select(assemblyName => Type.GetType($"{typeName}, {assemblyName}"))
|
||||
.FirstOrDefault(type => type != null) ?? Type.GetType(typeName);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,142 @@
|
|||
// <auto-generated/>
|
||||
// ReSharper disable CheckNamespace
|
||||
namespace RSTP_DSLink.Logging.LogProviders
|
||||
{
|
||||
using System;
|
||||
|
||||
#if LIBLOG_EXCLUDE_CODE_COVERAGE
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
[ExcludeFromCodeCoverage]
|
||||
#endif
|
||||
internal class LoupeLogProvider : LogProviderBase
|
||||
{
|
||||
/// <summary>
|
||||
/// The form of the Loupe Log.Write method we're using
|
||||
/// </summary>
|
||||
internal delegate void WriteDelegate(
|
||||
int severity,
|
||||
string logSystem,
|
||||
int skipFrames,
|
||||
Exception exception,
|
||||
bool attributeToException,
|
||||
int writeMode,
|
||||
string detailsXml,
|
||||
string category,
|
||||
string caption,
|
||||
string description,
|
||||
params object[] args
|
||||
);
|
||||
|
||||
private readonly WriteDelegate _logWriteDelegate;
|
||||
private const string LoupeAgentNetCoreDll = "Loupe.Agent.NETCore";
|
||||
private const string LoupeAgentNetFrameworkDll = "Gibraltar.Agent";
|
||||
|
||||
public LoupeLogProvider()
|
||||
{
|
||||
if (!IsLoggerAvailable()) throw new LibLogException("Gibraltar.Agent.Log (Loupe) not found");
|
||||
|
||||
_logWriteDelegate = GetLogWriteDelegate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether [provider is available override]. Used in tests.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// <c>true</c> if [provider is available override]; otherwise, <c>false</c>.
|
||||
/// </value>
|
||||
public static bool ProviderIsAvailableOverride { get; set; } = true;
|
||||
|
||||
public override Logger GetLogger(string name)
|
||||
{
|
||||
return new LoupeLogger(name, _logWriteDelegate).Log;
|
||||
}
|
||||
|
||||
public static bool IsLoggerAvailable()
|
||||
{
|
||||
return ProviderIsAvailableOverride && GetLogManagerType() != null;
|
||||
}
|
||||
|
||||
private static Type GetTypeFromCoreOrFrameworkDll(string typeName)
|
||||
{
|
||||
return FindType(typeName, new[] {LoupeAgentNetCoreDll, LoupeAgentNetFrameworkDll});
|
||||
}
|
||||
|
||||
private static Type GetLogManagerType()
|
||||
{
|
||||
return GetTypeFromCoreOrFrameworkDll("Gibraltar.Agent.Log");
|
||||
}
|
||||
|
||||
private static WriteDelegate GetLogWriteDelegate()
|
||||
{
|
||||
var logManagerType = GetLogManagerType();
|
||||
var logMessageSeverityType = GetTypeFromCoreOrFrameworkDll("Gibraltar.Agent.LogMessageSeverity");
|
||||
var logWriteModeType = GetTypeFromCoreOrFrameworkDll("Gibraltar.Agent.LogWriteMode");
|
||||
|
||||
var method = logManagerType.GetMethod(
|
||||
"Write",
|
||||
logMessageSeverityType, typeof(string), typeof(int), typeof(Exception), typeof(bool),
|
||||
logWriteModeType, typeof(string), typeof(string), typeof(string), typeof(string), typeof(object[]));
|
||||
|
||||
var callDelegate = (WriteDelegate) method.CreateDelegate(typeof(WriteDelegate));
|
||||
return callDelegate;
|
||||
}
|
||||
|
||||
#if LIBLOG_EXCLUDE_CODE_COVERAGE
|
||||
[ExcludeFromCodeCoverage]
|
||||
#endif
|
||||
internal class LoupeLogger
|
||||
{
|
||||
private const string LogSystem = "LibLog";
|
||||
|
||||
private readonly string _category;
|
||||
private readonly WriteDelegate _logWriteDelegate;
|
||||
private readonly int _skipLevel;
|
||||
|
||||
internal LoupeLogger(string category, WriteDelegate logWriteDelegate)
|
||||
{
|
||||
_category = category;
|
||||
_logWriteDelegate = logWriteDelegate;
|
||||
#if DEBUG
|
||||
_skipLevel = 2;
|
||||
#else
|
||||
_skipLevel = 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
public bool Log(LogLevel logLevel, Func<string> messageFunc, Exception exception,
|
||||
params object[] formatParameters)
|
||||
{
|
||||
if (messageFunc == null) return true;
|
||||
|
||||
messageFunc = LogMessageFormatter.SimulateStructuredLogging(messageFunc, formatParameters);
|
||||
|
||||
_logWriteDelegate(ToLogMessageSeverity(logLevel), LogSystem, _skipLevel, exception, true, 0, null,
|
||||
_category, null, messageFunc.Invoke());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private static int ToLogMessageSeverity(LogLevel logLevel)
|
||||
{
|
||||
switch (logLevel)
|
||||
{
|
||||
case LogLevel.Trace:
|
||||
return TraceEventTypeValues.Verbose;
|
||||
case LogLevel.Debug:
|
||||
return TraceEventTypeValues.Verbose;
|
||||
case LogLevel.Info:
|
||||
return TraceEventTypeValues.Information;
|
||||
case LogLevel.Warn:
|
||||
return TraceEventTypeValues.Warning;
|
||||
case LogLevel.Error:
|
||||
return TraceEventTypeValues.Error;
|
||||
case LogLevel.Fatal:
|
||||
return TraceEventTypeValues.Critical;
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException(nameof(logLevel));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,539 @@
|
|||
// <auto-generated/>
|
||||
// ReSharper disable CheckNamespace
|
||||
namespace RSTP_DSLink.Logging.LogProviders
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
|
||||
#if LIBLOG_EXCLUDE_CODE_COVERAGE
|
||||
[ExcludeFromCodeCoverage]
|
||||
#endif
|
||||
internal class NLogLogProvider : LogProviderBase
|
||||
{
|
||||
private readonly Func<string, object> _getLoggerByNameDelegate;
|
||||
|
||||
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly", MessageId = "LogManager")]
|
||||
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly", MessageId = "NLog")]
|
||||
public NLogLogProvider()
|
||||
{
|
||||
if (!IsLoggerAvailable()) throw new LibLogException("NLog.LogManager not found");
|
||||
_getLoggerByNameDelegate = GetGetLoggerMethodCall();
|
||||
}
|
||||
|
||||
static NLogLogProvider()
|
||||
{
|
||||
ProviderIsAvailableOverride = true;
|
||||
}
|
||||
|
||||
public static bool ProviderIsAvailableOverride { get; set; }
|
||||
|
||||
public override Logger GetLogger(string name)
|
||||
{
|
||||
return new NLogLogger(_getLoggerByNameDelegate(name)).Log;
|
||||
}
|
||||
|
||||
public static bool IsLoggerAvailable()
|
||||
{
|
||||
return ProviderIsAvailableOverride && GetLogManagerType() != null;
|
||||
}
|
||||
|
||||
protected override OpenNdc GetOpenNdcMethod()
|
||||
{
|
||||
var messageParam = Expression.Parameter(typeof(string), "message");
|
||||
|
||||
var ndlcContextType = FindType("NLog.NestedDiagnosticsLogicalContext", "NLog");
|
||||
if (ndlcContextType != null)
|
||||
{
|
||||
var pushObjectMethod = ndlcContextType.GetMethod("PushObject", typeof(object));
|
||||
if (pushObjectMethod != null)
|
||||
{
|
||||
// NLog 4.6 introduces PushObject with correct handling of logical callcontext (NDLC)
|
||||
var pushObjectMethodCall = Expression.Call(null, pushObjectMethod, messageParam);
|
||||
return Expression.Lambda<OpenNdc>(pushObjectMethodCall, messageParam).Compile();
|
||||
}
|
||||
}
|
||||
|
||||
var ndcContextType = FindType("NLog.NestedDiagnosticsContext", "NLog");
|
||||
var pushMethod = ndcContextType.GetMethod("Push", typeof(string));
|
||||
|
||||
var pushMethodCall = Expression.Call(null, pushMethod, messageParam);
|
||||
return Expression.Lambda<OpenNdc>(pushMethodCall, messageParam).Compile();
|
||||
}
|
||||
|
||||
protected override OpenMdc GetOpenMdcMethod()
|
||||
{
|
||||
var keyParam = Expression.Parameter(typeof(string), "key");
|
||||
|
||||
var ndlcContextType = FindType("NLog.NestedDiagnosticsLogicalContext", "NLog");
|
||||
if (ndlcContextType != null)
|
||||
{
|
||||
var pushObjectMethod = ndlcContextType.GetMethod("PushObject", typeof(object));
|
||||
if (pushObjectMethod != null)
|
||||
{
|
||||
// NLog 4.6 introduces SetScoped with correct handling of logical callcontext (MDLC)
|
||||
var mdlcContextType = FindType("NLog.MappedDiagnosticsLogicalContext", "NLog");
|
||||
if (mdlcContextType != null)
|
||||
{
|
||||
var setScopedMethod = mdlcContextType.GetMethod("SetScoped", typeof(string), typeof(object));
|
||||
if (setScopedMethod != null)
|
||||
{
|
||||
var valueObjParam = Expression.Parameter(typeof(object), "value");
|
||||
var setScopedMethodCall = Expression.Call(null, setScopedMethod, keyParam, valueObjParam);
|
||||
var setMethodLambda = Expression.Lambda<Func<string, object, IDisposable>>(setScopedMethodCall, keyParam, valueObjParam).Compile();
|
||||
return (key, value, _) => setMethodLambda(key, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var mdcContextType = FindType("NLog.MappedDiagnosticsContext", "NLog");
|
||||
var setMethod = mdcContextType.GetMethod("Set", typeof(string), typeof(string));
|
||||
var removeMethod = mdcContextType.GetMethod("Remove", typeof(string));
|
||||
var valueParam = Expression.Parameter(typeof(string), "value");
|
||||
var setMethodCall = Expression.Call(null, setMethod, keyParam, valueParam);
|
||||
var removeMethodCall = Expression.Call(null, removeMethod, keyParam);
|
||||
|
||||
var set = Expression
|
||||
.Lambda<Action<string, string>>(setMethodCall, keyParam, valueParam)
|
||||
.Compile();
|
||||
var remove = Expression
|
||||
.Lambda<Action<string>>(removeMethodCall, keyParam)
|
||||
.Compile();
|
||||
|
||||
return (key, value, _) =>
|
||||
{
|
||||
set(key, value.ToString());
|
||||
return new DisposableAction(() => remove(key));
|
||||
};
|
||||
}
|
||||
|
||||
private static Type GetLogManagerType()
|
||||
{
|
||||
return FindType("NLog.LogManager", "NLog");
|
||||
}
|
||||
|
||||
private static Func<string, object> GetGetLoggerMethodCall()
|
||||
{
|
||||
var logManagerType = GetLogManagerType();
|
||||
var method = logManagerType.GetMethod("GetLogger", typeof(string));
|
||||
var nameParam = Expression.Parameter(typeof(string), "name");
|
||||
var methodCall = Expression.Call(null, method, nameParam);
|
||||
return Expression.Lambda<Func<string, object>>(methodCall, nameParam).Compile();
|
||||
}
|
||||
|
||||
#if LIBLOG_EXCLUDE_CODE_COVERAGE
|
||||
[ExcludeFromCodeCoverage]
|
||||
#endif
|
||||
internal class NLogLogger
|
||||
{
|
||||
private static Func<string, object, string, object[], Exception, object> s_logEventInfoFact;
|
||||
|
||||
private static object s_levelTrace;
|
||||
private static object s_levelDebug;
|
||||
private static object s_levelInfo;
|
||||
private static object s_levelWarn;
|
||||
private static object s_levelError;
|
||||
private static object s_levelFatal;
|
||||
|
||||
private static bool s_structuredLoggingEnabled;
|
||||
private static readonly Lazy<bool> Initialized = new Lazy<bool>(Initialize);
|
||||
private static Exception s_initializeException;
|
||||
|
||||
delegate string LoggerNameDelegate(object logger);
|
||||
delegate void LogEventDelegate(object logger, Type wrapperType, object logEvent);
|
||||
delegate bool IsEnabledDelegate(object logger);
|
||||
delegate void LogDelegate(object logger, string message);
|
||||
delegate void LogExceptionDelegate(object logger, string message, Exception exception);
|
||||
|
||||
private static LoggerNameDelegate s_loggerNameDelegate;
|
||||
private static LogEventDelegate s_logEventDelegate;
|
||||
|
||||
private static IsEnabledDelegate s_isTraceEnabledDelegate;
|
||||
private static IsEnabledDelegate s_isDebugEnabledDelegate;
|
||||
private static IsEnabledDelegate s_isInfoEnabledDelegate;
|
||||
private static IsEnabledDelegate s_isWarnEnabledDelegate;
|
||||
private static IsEnabledDelegate s_isErrorEnabledDelegate;
|
||||
private static IsEnabledDelegate s_isFatalEnabledDelegate;
|
||||
|
||||
private static LogDelegate s_traceDelegate;
|
||||
private static LogDelegate s_debugDelegate;
|
||||
private static LogDelegate s_infoDelegate;
|
||||
private static LogDelegate s_warnDelegate;
|
||||
private static LogDelegate s_errorDelegate;
|
||||
private static LogDelegate s_fatalDelegate;
|
||||
|
||||
private static LogExceptionDelegate s_traceExceptionDelegate;
|
||||
private static LogExceptionDelegate s_debugExceptionDelegate;
|
||||
private static LogExceptionDelegate s_infoExceptionDelegate;
|
||||
private static LogExceptionDelegate s_warnExceptionDelegate;
|
||||
private static LogExceptionDelegate s_errorExceptionDelegate;
|
||||
private static LogExceptionDelegate s_fatalExceptionDelegate;
|
||||
|
||||
private readonly object _logger;
|
||||
|
||||
internal NLogLogger(object logger)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
private static bool Initialize()
|
||||
{
|
||||
try
|
||||
{
|
||||
var logEventLevelType = FindType("NLog.LogLevel", "NLog");
|
||||
if (logEventLevelType == null) throw new LibLogException("Type NLog.LogLevel was not found.");
|
||||
|
||||
var levelFields = logEventLevelType.GetFields().ToList();
|
||||
s_levelTrace = levelFields.First(x => x.Name == "Trace").GetValue(null);
|
||||
s_levelDebug = levelFields.First(x => x.Name == "Debug").GetValue(null);
|
||||
s_levelInfo = levelFields.First(x => x.Name == "Info").GetValue(null);
|
||||
s_levelWarn = levelFields.First(x => x.Name == "Warn").GetValue(null);
|
||||
s_levelError = levelFields.First(x => x.Name == "Error").GetValue(null);
|
||||
s_levelFatal = levelFields.First(x => x.Name == "Fatal").GetValue(null);
|
||||
|
||||
var logEventInfoType = FindType("NLog.LogEventInfo", "NLog");
|
||||
if (logEventInfoType == null) throw new LibLogException("Type NLog.LogEventInfo was not found.");
|
||||
|
||||
var loggingEventConstructor =
|
||||
logEventInfoType.GetConstructorPortable(logEventLevelType, typeof(string),
|
||||
typeof(IFormatProvider), typeof(string), typeof(object[]), typeof(Exception));
|
||||
|
||||
var loggerNameParam = Expression.Parameter(typeof(string));
|
||||
var levelParam = Expression.Parameter(typeof(object));
|
||||
var messageParam = Expression.Parameter(typeof(string));
|
||||
var messageArgsParam = Expression.Parameter(typeof(object[]));
|
||||
var exceptionParam = Expression.Parameter(typeof(Exception));
|
||||
var levelCast = Expression.Convert(levelParam, logEventLevelType);
|
||||
|
||||
var newLoggingEventExpression =
|
||||
Expression.New(loggingEventConstructor,
|
||||
levelCast,
|
||||
loggerNameParam,
|
||||
Expression.Constant(null, typeof(IFormatProvider)),
|
||||
messageParam,
|
||||
messageArgsParam,
|
||||
exceptionParam
|
||||
);
|
||||
|
||||
s_logEventInfoFact = Expression.Lambda<Func<string, object, string, object[], Exception, object>>(
|
||||
newLoggingEventExpression,
|
||||
loggerNameParam, levelParam, messageParam, messageArgsParam, exceptionParam).Compile();
|
||||
|
||||
var loggerType = FindType("NLog.Logger", "NLog");
|
||||
|
||||
s_loggerNameDelegate = GetLoggerNameDelegate(loggerType);
|
||||
|
||||
s_logEventDelegate = GetLogEventDelegate(loggerType, logEventInfoType);
|
||||
|
||||
s_isTraceEnabledDelegate = GetIsEnabledDelegate(loggerType, "IsTraceEnabled");
|
||||
s_isDebugEnabledDelegate = GetIsEnabledDelegate(loggerType, "IsDebugEnabled");
|
||||
s_isInfoEnabledDelegate = GetIsEnabledDelegate(loggerType, "IsInfoEnabled");
|
||||
s_isWarnEnabledDelegate = GetIsEnabledDelegate(loggerType, "IsWarnEnabled");
|
||||
s_isErrorEnabledDelegate = GetIsEnabledDelegate(loggerType, "IsErrorEnabled");
|
||||
s_isFatalEnabledDelegate = GetIsEnabledDelegate(loggerType, "IsFatalEnabled");
|
||||
|
||||
s_traceDelegate = GetLogDelegate(loggerType, "Trace");
|
||||
s_debugDelegate = GetLogDelegate(loggerType, "Debug");
|
||||
s_infoDelegate = GetLogDelegate(loggerType, "Info");
|
||||
s_warnDelegate = GetLogDelegate(loggerType, "Warn");
|
||||
s_errorDelegate = GetLogDelegate(loggerType, "Error");
|
||||
s_fatalDelegate = GetLogDelegate(loggerType, "Fatal");
|
||||
|
||||
s_traceExceptionDelegate = GetLogExceptionDelegate(loggerType, "TraceException");
|
||||
s_debugExceptionDelegate = GetLogExceptionDelegate(loggerType, "DebugException");
|
||||
s_infoExceptionDelegate = GetLogExceptionDelegate(loggerType, "InfoException");
|
||||
s_warnExceptionDelegate = GetLogExceptionDelegate(loggerType, "WarnException");
|
||||
s_errorExceptionDelegate = GetLogExceptionDelegate(loggerType, "ErrorException");
|
||||
s_fatalExceptionDelegate = GetLogExceptionDelegate(loggerType, "FatalException");
|
||||
|
||||
s_structuredLoggingEnabled = IsStructuredLoggingEnabled();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
s_initializeException = ex;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private static IsEnabledDelegate GetIsEnabledDelegate(Type loggerType, string propertyName)
|
||||
{
|
||||
var isEnabledPropertyInfo = loggerType.GetProperty(propertyName);
|
||||
var instanceParam = Expression.Parameter(typeof(object));
|
||||
var instanceCast = Expression.Convert(instanceParam, loggerType);
|
||||
var propertyCall = Expression.Property(instanceCast, isEnabledPropertyInfo);
|
||||
return Expression.Lambda<IsEnabledDelegate>(propertyCall, instanceParam).Compile();
|
||||
}
|
||||
|
||||
private static LoggerNameDelegate GetLoggerNameDelegate(Type loggerType)
|
||||
{
|
||||
var isEnabledPropertyInfo = loggerType.GetProperty("Name");
|
||||
var instanceParam = Expression.Parameter(typeof(object));
|
||||
var instanceCast = Expression.Convert(instanceParam, loggerType);
|
||||
var propertyCall = Expression.Property(instanceCast, isEnabledPropertyInfo);
|
||||
return Expression.Lambda<LoggerNameDelegate>(propertyCall, instanceParam).Compile();
|
||||
}
|
||||
|
||||
private static LogDelegate GetLogDelegate(Type loggerType, string name)
|
||||
{
|
||||
var logMethodInfo = loggerType.GetMethod(name, new Type[] { typeof(string) });
|
||||
var instanceParam = Expression.Parameter(typeof(object));
|
||||
var instanceCast = Expression.Convert(instanceParam, loggerType);
|
||||
var messageParam = Expression.Parameter(typeof(string));
|
||||
var logCall = Expression.Call(instanceCast, logMethodInfo, messageParam);
|
||||
return Expression.Lambda<LogDelegate>(logCall, instanceParam, messageParam).Compile();
|
||||
}
|
||||
|
||||
private static LogEventDelegate GetLogEventDelegate(Type loggerType, Type logEventType)
|
||||
{
|
||||
var logMethodInfo = loggerType.GetMethod("Log", new Type[] { typeof(Type), logEventType });
|
||||
var instanceParam = Expression.Parameter(typeof(object));
|
||||
var instanceCast = Expression.Convert(instanceParam, loggerType);
|
||||
var loggerTypeParam = Expression.Parameter(typeof(Type));
|
||||
var logEventParam = Expression.Parameter(typeof(object));
|
||||
var logEventCast = Expression.Convert(logEventParam, logEventType);
|
||||
var logCall = Expression.Call(instanceCast, logMethodInfo, loggerTypeParam, logEventCast);
|
||||
return Expression.Lambda<LogEventDelegate>(logCall, instanceParam, loggerTypeParam, logEventParam).Compile();
|
||||
}
|
||||
|
||||
private static LogExceptionDelegate GetLogExceptionDelegate(Type loggerType, string name)
|
||||
{
|
||||
var logMethodInfo = loggerType.GetMethod(name, new Type[] { typeof(string), typeof(Exception) });
|
||||
var instanceParam = Expression.Parameter(typeof(object));
|
||||
var instanceCast = Expression.Convert(instanceParam, loggerType);
|
||||
var messageParam = Expression.Parameter(typeof(string));
|
||||
var exceptionParam = Expression.Parameter(typeof(Exception));
|
||||
var logCall = Expression.Call(instanceCast, logMethodInfo, messageParam, exceptionParam);
|
||||
return Expression.Lambda<LogExceptionDelegate>(logCall, instanceParam, messageParam, exceptionParam).Compile();
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")]
|
||||
public bool Log(LogLevel logLevel, Func<string> messageFunc, Exception exception,
|
||||
params object[] formatParameters)
|
||||
{
|
||||
if (!Initialized.Value)
|
||||
throw new LibLogException(ErrorInitializingProvider, s_initializeException);
|
||||
|
||||
if (messageFunc == null) return IsLogLevelEnable(logLevel);
|
||||
|
||||
if (s_logEventInfoFact != null)
|
||||
{
|
||||
if (IsLogLevelEnable(logLevel))
|
||||
{
|
||||
var formatMessage = messageFunc();
|
||||
if (!s_structuredLoggingEnabled)
|
||||
{
|
||||
IEnumerable<string> _;
|
||||
formatMessage =
|
||||
LogMessageFormatter.FormatStructuredMessage(formatMessage,
|
||||
formatParameters,
|
||||
out _);
|
||||
formatParameters = null; // Has been formatted, no need for parameters
|
||||
}
|
||||
|
||||
var callsiteLoggerType = typeof(NLogLogger);
|
||||
// Callsite HACK - Extract the callsite-logger-type from the messageFunc
|
||||
var methodType = messageFunc.Method.DeclaringType;
|
||||
if (methodType == typeof(LogExtensions) ||
|
||||
methodType != null && methodType.DeclaringType == typeof(LogExtensions))
|
||||
callsiteLoggerType = typeof(LogExtensions);
|
||||
else if (methodType == typeof(LoggerExecutionWrapper) || methodType != null &&
|
||||
methodType.DeclaringType == typeof(LoggerExecutionWrapper))
|
||||
callsiteLoggerType = typeof(LoggerExecutionWrapper);
|
||||
var nlogLevel = TranslateLevel(logLevel);
|
||||
var nlogEvent = s_logEventInfoFact(s_loggerNameDelegate(_logger), nlogLevel, formatMessage, formatParameters,
|
||||
exception);
|
||||
s_logEventDelegate(_logger, callsiteLoggerType, nlogEvent);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
messageFunc = LogMessageFormatter.SimulateStructuredLogging(messageFunc, formatParameters);
|
||||
if (exception != null) return LogException(logLevel, messageFunc, exception);
|
||||
|
||||
switch (logLevel)
|
||||
{
|
||||
case LogLevel.Debug:
|
||||
if (s_isDebugEnabledDelegate(_logger))
|
||||
{
|
||||
s_debugDelegate(_logger, messageFunc());
|
||||
return true;
|
||||
}
|
||||
|
||||
break;
|
||||
case LogLevel.Info:
|
||||
if (s_isInfoEnabledDelegate(_logger))
|
||||
{
|
||||
s_infoDelegate(_logger, messageFunc());
|
||||
return true;
|
||||
}
|
||||
|
||||
break;
|
||||
case LogLevel.Warn:
|
||||
if (s_isWarnEnabledDelegate(_logger))
|
||||
{
|
||||
s_warnDelegate(_logger, messageFunc());
|
||||
return true;
|
||||
}
|
||||
|
||||
break;
|
||||
case LogLevel.Error:
|
||||
if (s_isErrorEnabledDelegate(_logger))
|
||||
{
|
||||
s_errorDelegate(_logger, messageFunc());
|
||||
return true;
|
||||
}
|
||||
|
||||
break;
|
||||
case LogLevel.Fatal:
|
||||
if (s_isFatalEnabledDelegate(_logger))
|
||||
{
|
||||
s_fatalDelegate(_logger, messageFunc());
|
||||
return true;
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
if (s_isTraceEnabledDelegate(_logger))
|
||||
{
|
||||
s_traceDelegate(_logger, messageFunc());
|
||||
return true;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")]
|
||||
private bool LogException(LogLevel logLevel, Func<string> messageFunc, Exception exception)
|
||||
{
|
||||
switch (logLevel)
|
||||
{
|
||||
case LogLevel.Debug:
|
||||
if (s_isDebugEnabledDelegate(_logger))
|
||||
{
|
||||
s_debugExceptionDelegate(_logger, messageFunc(), exception);
|
||||
return true;
|
||||
}
|
||||
|
||||
break;
|
||||
case LogLevel.Info:
|
||||
if (s_isInfoEnabledDelegate(_logger))
|
||||
{
|
||||
s_infoExceptionDelegate(_logger, messageFunc(), exception);
|
||||
return true;
|
||||
}
|
||||
|
||||
break;
|
||||
case LogLevel.Warn:
|
||||
if (s_isWarnEnabledDelegate(_logger))
|
||||
{
|
||||
s_warnExceptionDelegate(_logger, messageFunc(), exception);
|
||||
return true;
|
||||
}
|
||||
|
||||
break;
|
||||
case LogLevel.Error:
|
||||
if (s_isErrorEnabledDelegate(_logger))
|
||||
{
|
||||
s_errorExceptionDelegate(_logger, messageFunc(), exception);
|
||||
return true;
|
||||
}
|
||||
|
||||
break;
|
||||
case LogLevel.Fatal:
|
||||
if (s_isFatalEnabledDelegate(_logger))
|
||||
{
|
||||
s_fatalExceptionDelegate(_logger, messageFunc(), exception);
|
||||
return true;
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
if (s_isTraceEnabledDelegate(_logger))
|
||||
{
|
||||
s_traceExceptionDelegate(_logger, messageFunc(), exception);
|
||||
return true;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private bool IsLogLevelEnable(LogLevel logLevel)
|
||||
{
|
||||
switch (logLevel)
|
||||
{
|
||||
case LogLevel.Debug:
|
||||
return s_isDebugEnabledDelegate(_logger);
|
||||
case LogLevel.Info:
|
||||
return s_isInfoEnabledDelegate(_logger);
|
||||
case LogLevel.Warn:
|
||||
return s_isWarnEnabledDelegate(_logger);
|
||||
case LogLevel.Error:
|
||||
return s_isErrorEnabledDelegate(_logger);
|
||||
case LogLevel.Fatal:
|
||||
return s_isFatalEnabledDelegate(_logger);
|
||||
default:
|
||||
return s_isTraceEnabledDelegate(_logger);
|
||||
}
|
||||
}
|
||||
|
||||
private object TranslateLevel(LogLevel logLevel)
|
||||
{
|
||||
switch (logLevel)
|
||||
{
|
||||
case LogLevel.Trace:
|
||||
return s_levelTrace;
|
||||
case LogLevel.Debug:
|
||||
return s_levelDebug;
|
||||
case LogLevel.Info:
|
||||
return s_levelInfo;
|
||||
case LogLevel.Warn:
|
||||
return s_levelWarn;
|
||||
case LogLevel.Error:
|
||||
return s_levelError;
|
||||
case LogLevel.Fatal:
|
||||
return s_levelFatal;
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException(nameof(logLevel), logLevel, null);
|
||||
}
|
||||
}
|
||||
|
||||
private static bool IsStructuredLoggingEnabled()
|
||||
{
|
||||
var configFactoryType = FindType("NLog.Config.ConfigurationItemFactory", "NLog");
|
||||
if (configFactoryType != null)
|
||||
{
|
||||
var parseMessagesProperty = configFactoryType.GetProperty("ParseMessageTemplates");
|
||||
if (parseMessagesProperty != null)
|
||||
{
|
||||
var defaultProperty = configFactoryType.GetProperty("Default");
|
||||
if (defaultProperty != null)
|
||||
{
|
||||
var configFactoryDefault = defaultProperty.GetValue(null, null);
|
||||
if (configFactoryDefault != null)
|
||||
{
|
||||
var parseMessageTemplates =
|
||||
parseMessagesProperty.GetValue(configFactoryDefault, null) as bool?;
|
||||
if (parseMessageTemplates != false) return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,246 @@
|
|||
// <auto-generated/>
|
||||
// ReSharper disable CheckNamespace
|
||||
namespace RSTP_DSLink.Logging.LogProviders
|
||||
{
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq.Expressions;
|
||||
|
||||
#if LIBLOG_EXCLUDE_CODE_COVERAGE
|
||||
[ExcludeFromCodeCoverage]
|
||||
#endif
|
||||
internal class SerilogLogProvider : LogProviderBase
|
||||
{
|
||||
private readonly Func<string, object> _getLoggerByNameDelegate;
|
||||
private static Func<string, object, bool, IDisposable> s_pushProperty;
|
||||
|
||||
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly", MessageId = "Serilog")]
|
||||
public SerilogLogProvider()
|
||||
{
|
||||
if (!IsLoggerAvailable()) throw new LibLogException("Serilog.Log not found");
|
||||
_getLoggerByNameDelegate = GetForContextMethodCall();
|
||||
s_pushProperty = GetPushProperty();
|
||||
}
|
||||
|
||||
public static bool ProviderIsAvailableOverride { get; set; } = true;
|
||||
|
||||
public override Logger GetLogger(string name)
|
||||
=> new SerilogLogger(_getLoggerByNameDelegate(name)).Log;
|
||||
|
||||
internal static bool IsLoggerAvailable()
|
||||
=> ProviderIsAvailableOverride && GetLogManagerType() != null;
|
||||
|
||||
protected override OpenNdc GetOpenNdcMethod()
|
||||
=> message => s_pushProperty("NDC", message, false);
|
||||
|
||||
protected override OpenMdc GetOpenMdcMethod()
|
||||
=> (key, value, destructure) => s_pushProperty(key, value, destructure);
|
||||
|
||||
private static Func<string, object, bool, IDisposable> GetPushProperty()
|
||||
{
|
||||
var ndcContextType = FindType("Serilog.Context.LogContext", new[] {"Serilog", "Serilog.FullNetFx"});
|
||||
|
||||
var pushPropertyMethod = ndcContextType.GetMethod(
|
||||
"PushProperty",
|
||||
typeof(string),
|
||||
typeof(object),
|
||||
typeof(bool));
|
||||
|
||||
var nameParam = Expression.Parameter(typeof(string), "name");
|
||||
var valueParam = Expression.Parameter(typeof(object), "value");
|
||||
var destructureObjectParam = Expression.Parameter(typeof(bool), "destructureObjects");
|
||||
var pushPropertyMethodCall = Expression
|
||||
.Call(null, pushPropertyMethod, nameParam, valueParam, destructureObjectParam);
|
||||
var pushProperty = Expression
|
||||
.Lambda<Func<string, object, bool, IDisposable>>(
|
||||
pushPropertyMethodCall,
|
||||
nameParam,
|
||||
valueParam,
|
||||
destructureObjectParam)
|
||||
.Compile();
|
||||
|
||||
return (key, value, destructure) => pushProperty(key, value, destructure);
|
||||
}
|
||||
|
||||
private static Type GetLogManagerType()
|
||||
=> FindType("Serilog.Log", "Serilog");
|
||||
|
||||
private static Func<string, object> GetForContextMethodCall()
|
||||
{
|
||||
var logManagerType = GetLogManagerType();
|
||||
var method = logManagerType.GetMethod("ForContext", typeof(string), typeof(object), typeof(bool));
|
||||
var propertyNameParam = Expression.Parameter(typeof(string), "propertyName");
|
||||
var valueParam = Expression.Parameter(typeof(object), "value");
|
||||
var destructureObjectsParam = Expression.Parameter(typeof(bool), "destructureObjects");
|
||||
var methodCall = Expression.Call(null, method, new Expression[]
|
||||
{
|
||||
propertyNameParam,
|
||||
valueParam,
|
||||
destructureObjectsParam
|
||||
});
|
||||
var func = Expression.Lambda<Func<string, object, bool, object>>(
|
||||
methodCall,
|
||||
propertyNameParam,
|
||||
valueParam,
|
||||
destructureObjectsParam)
|
||||
.Compile();
|
||||
return name => func("SourceContext", name, false);
|
||||
}
|
||||
|
||||
#if LIBLOG_EXCLUDE_CODE_COVERAGE
|
||||
[ExcludeFromCodeCoverage]
|
||||
#endif
|
||||
internal class SerilogLogger
|
||||
{
|
||||
private static object s_debugLevel;
|
||||
private static object s_errorLevel;
|
||||
private static object s_fatalLevel;
|
||||
private static object s_informationLevel;
|
||||
private static object s_verboseLevel;
|
||||
private static object s_warningLevel;
|
||||
private static Func<object, object, bool> s_isEnabled;
|
||||
private static Action<object, object, string, object[]> s_write;
|
||||
private static Action<object, object, Exception, string, object[]> s_writeException;
|
||||
private static readonly Lazy<bool> Initialized = new Lazy<bool>(Initialize);
|
||||
private static Exception s_initializeException;
|
||||
private readonly object _logger;
|
||||
|
||||
internal SerilogLogger(object logger)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Performance", "CA1810:InitializeReferenceTypeStaticFieldsInline")]
|
||||
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly", MessageId = "ILogger")]
|
||||
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly", MessageId =
|
||||
"LogEventLevel")]
|
||||
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly", MessageId = "Serilog")]
|
||||
private static bool Initialize()
|
||||
{
|
||||
try
|
||||
{
|
||||
var logEventLevelType = FindType("Serilog.Events.LogEventLevel", "Serilog");
|
||||
if (logEventLevelType == null)
|
||||
throw new LibLogException("Type Serilog.Events.LogEventLevel was not found.");
|
||||
s_debugLevel = Enum.Parse(logEventLevelType, "Debug", false);
|
||||
s_errorLevel = Enum.Parse(logEventLevelType, "Error", false);
|
||||
s_fatalLevel = Enum.Parse(logEventLevelType, "Fatal", false);
|
||||
s_informationLevel = Enum.Parse(logEventLevelType, "Information", false);
|
||||
s_verboseLevel = Enum.Parse(logEventLevelType, "Verbose", false);
|
||||
s_warningLevel = Enum.Parse(logEventLevelType, "Warning", false);
|
||||
|
||||
// Func<object, object, bool> isEnabled = (logger, level) => { return ((SeriLog.ILogger)logger).IsEnabled(level); }
|
||||
var loggerType = FindType("Serilog.ILogger", "Serilog");
|
||||
if (loggerType == null) throw new LibLogException("Type Serilog.ILogger was not found.");
|
||||
var isEnabledMethodInfo = loggerType.GetMethod("IsEnabled", logEventLevelType);
|
||||
var instanceParam = Expression.Parameter(typeof(object));
|
||||
var instanceCast = Expression.Convert(instanceParam, loggerType);
|
||||
var levelParam = Expression.Parameter(typeof(object));
|
||||
var levelCast = Expression.Convert(levelParam, logEventLevelType);
|
||||
var isEnabledMethodCall = Expression.Call(instanceCast, isEnabledMethodInfo, levelCast);
|
||||
s_isEnabled = Expression
|
||||
.Lambda<Func<object, object, bool>>(isEnabledMethodCall, instanceParam, levelParam).Compile();
|
||||
|
||||
// Action<object, object, string> Write =
|
||||
// (logger, level, message, params) => { ((SeriLog.ILoggerILogger)logger).Write(level, message, params); }
|
||||
var writeMethodInfo =
|
||||
loggerType.GetMethod("Write", logEventLevelType, typeof(string), typeof(object[]));
|
||||
var messageParam = Expression.Parameter(typeof(string));
|
||||
var propertyValuesParam = Expression.Parameter(typeof(object[]));
|
||||
var writeMethodExp = Expression.Call(
|
||||
instanceCast,
|
||||
writeMethodInfo,
|
||||
levelCast,
|
||||
messageParam,
|
||||
propertyValuesParam);
|
||||
var expression = Expression.Lambda<Action<object, object, string, object[]>>(
|
||||
writeMethodExp,
|
||||
instanceParam,
|
||||
levelParam,
|
||||
messageParam,
|
||||
propertyValuesParam);
|
||||
s_write = expression.Compile();
|
||||
|
||||
// Action<object, object, string, Exception> WriteException =
|
||||
// (logger, level, exception, message) => { ((ILogger)logger).Write(level, exception, message, new object[]); }
|
||||
var writeExceptionMethodInfo = loggerType.GetMethod("Write",
|
||||
logEventLevelType,
|
||||
typeof(Exception),
|
||||
typeof(string),
|
||||
typeof(object[]));
|
||||
var exceptionParam = Expression.Parameter(typeof(Exception));
|
||||
writeMethodExp = Expression.Call(
|
||||
instanceCast,
|
||||
writeExceptionMethodInfo,
|
||||
levelCast,
|
||||
exceptionParam,
|
||||
messageParam,
|
||||
propertyValuesParam);
|
||||
s_writeException = Expression.Lambda<Action<object, object, Exception, string, object[]>>(
|
||||
writeMethodExp,
|
||||
instanceParam,
|
||||
levelParam,
|
||||
exceptionParam,
|
||||
messageParam,
|
||||
propertyValuesParam).Compile();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
s_initializeException = ex;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Log(LogLevel logLevel, Func<string> messageFunc, Exception exception,
|
||||
params object[] formatParameters)
|
||||
{
|
||||
if (!Initialized.Value)
|
||||
throw new LibLogException(ErrorInitializingProvider, s_initializeException);
|
||||
|
||||
var translatedLevel = TranslateLevel(logLevel);
|
||||
if (messageFunc == null) return s_isEnabled(_logger, translatedLevel);
|
||||
|
||||
if (!s_isEnabled(_logger, translatedLevel)) return false;
|
||||
|
||||
if (exception != null)
|
||||
LogException(translatedLevel, messageFunc, exception, formatParameters);
|
||||
else
|
||||
LogMessage(translatedLevel, messageFunc, formatParameters);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void LogMessage(object translatedLevel, Func<string> messageFunc, object[] formatParameters)
|
||||
{
|
||||
s_write(_logger, translatedLevel, messageFunc(), formatParameters);
|
||||
}
|
||||
|
||||
private void LogException(object logLevel, Func<string> messageFunc, Exception exception,
|
||||
object[] formatParams)
|
||||
{
|
||||
s_writeException(_logger, logLevel, exception, messageFunc(), formatParams);
|
||||
}
|
||||
|
||||
private static object TranslateLevel(LogLevel logLevel)
|
||||
{
|
||||
switch (logLevel)
|
||||
{
|
||||
case LogLevel.Fatal:
|
||||
return s_fatalLevel;
|
||||
case LogLevel.Error:
|
||||
return s_errorLevel;
|
||||
case LogLevel.Warn:
|
||||
return s_warningLevel;
|
||||
case LogLevel.Info:
|
||||
return s_informationLevel;
|
||||
case LogLevel.Trace:
|
||||
return s_verboseLevel;
|
||||
default:
|
||||
return s_debugLevel;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
// <auto-generated/>
|
||||
// ReSharper disable CheckNamespace
|
||||
namespace RSTP_DSLink.Logging.LogProviders
|
||||
{
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
#if LIBLOG_EXCLUDE_CODE_COVERAGE
|
||||
[ExcludeFromCodeCoverage]
|
||||
#endif
|
||||
internal static class TraceEventTypeValues
|
||||
{
|
||||
internal static readonly Type Type;
|
||||
internal static readonly int Verbose;
|
||||
internal static readonly int Information;
|
||||
internal static readonly int Warning;
|
||||
internal static readonly int Error;
|
||||
internal static readonly int Critical;
|
||||
|
||||
[SuppressMessage("Microsoft.Performance", "CA1810:InitializeReferenceTypeStaticFieldsInline")]
|
||||
static TraceEventTypeValues()
|
||||
{
|
||||
var assembly = typeof(Uri).Assembly;
|
||||
Type = assembly.GetType("System.Diagnostics.TraceEventType");
|
||||
if (Type == null) return;
|
||||
Verbose = (int) Enum.Parse(Type, "Verbose", false);
|
||||
Information = (int) Enum.Parse(Type, "Information", false);
|
||||
Warning = (int) Enum.Parse(Type, "Warning", false);
|
||||
Error = (int) Enum.Parse(Type, "Error", false);
|
||||
Critical = (int) Enum.Parse(Type, "Critical", false);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
// <auto-generated/>
|
||||
// ReSharper disable CheckNamespace
|
||||
namespace RSTP_DSLink.Logging.LogProviders
|
||||
{
|
||||
using System;
|
||||
using System.Reflection;
|
||||
|
||||
#if LIBLOG_EXCLUDE_CODE_COVERAGE
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
[ExcludeFromCodeCoverage]
|
||||
#endif
|
||||
internal static class TypeExtensions
|
||||
{
|
||||
internal static ConstructorInfo GetConstructorPortable(this Type type, params Type[] types)
|
||||
{
|
||||
return type.GetConstructor(types);
|
||||
}
|
||||
|
||||
internal static MethodInfo GetMethod(this Type type, string name, params Type[] types)
|
||||
{
|
||||
return type.GetMethod(name, types);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
// <auto-generated/>
|
||||
// ReSharper disable CheckNamespace
|
||||
namespace RSTP_DSLink.Logging
|
||||
{
|
||||
using System;
|
||||
|
||||
#if !LIBLOG_PROVIDERS_ONLY || LIBLOG_PUBLIC
|
||||
/// <summary>
|
||||
/// Logger delegate.
|
||||
/// </summary>
|
||||
/// <param name="logLevel">The log level</param>
|
||||
/// <param name="messageFunc">The message function</param>
|
||||
/// <param name="exception">The exception</param>
|
||||
/// <param name="formatParameters">The format parameters</param>
|
||||
/// <returns>A boolean.</returns>
|
||||
public
|
||||
#else
|
||||
internal
|
||||
#endif
|
||||
delegate bool Logger(LogLevel logLevel, Func<string> messageFunc, Exception exception = null, params object[] formatParameters);
|
||||
}
|
|
@ -0,0 +1,85 @@
|
|||
// <auto-generated/>
|
||||
// ReSharper disable CheckNamespace
|
||||
namespace RSTP_DSLink.Logging
|
||||
{
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
#if LIBLOG_EXCLUDE_CODE_COVERAGE
|
||||
[ExcludeFromCodeCoverage]
|
||||
#endif
|
||||
internal class LoggerExecutionWrapper : ILog
|
||||
{
|
||||
internal const string FailedToGenerateLogMessage = "Failed to generate log message";
|
||||
private readonly ICallSiteExtension _callsiteLogger;
|
||||
private readonly Func<bool> _getIsDisabled;
|
||||
private Func<string> _lastExtensionMethod;
|
||||
|
||||
internal LoggerExecutionWrapper(Logger logger, Func<bool> getIsDisabled = null)
|
||||
{
|
||||
WrappedLogger = logger;
|
||||
_callsiteLogger = new CallSiteExtension();
|
||||
_getIsDisabled = getIsDisabled ?? (() => false);
|
||||
}
|
||||
|
||||
internal Logger WrappedLogger { get; }
|
||||
|
||||
[SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes")]
|
||||
public bool Log(LogLevel logLevel, Func<string> messageFunc, Exception exception = null,
|
||||
params object[] formatParameters)
|
||||
{
|
||||
if (_getIsDisabled()) return false;
|
||||
if (messageFunc == null) return WrappedLogger(logLevel, null, null, LogExtensions.EmptyParams);
|
||||
|
||||
// Callsite HACK - Using the messageFunc to provide the callsite-logger-type
|
||||
var lastExtensionMethod = _lastExtensionMethod;
|
||||
if (lastExtensionMethod == null || !lastExtensionMethod.Equals(messageFunc))
|
||||
{
|
||||
// Callsite HACK - Cache the last validated messageFunc as Equals is faster than type-check
|
||||
lastExtensionMethod = null;
|
||||
var methodType = messageFunc.Method.DeclaringType;
|
||||
if (methodType == typeof(LogExtensions) ||
|
||||
methodType != null && methodType.DeclaringType == typeof(LogExtensions))
|
||||
lastExtensionMethod = messageFunc;
|
||||
}
|
||||
|
||||
if (lastExtensionMethod != null)
|
||||
{
|
||||
// Callsite HACK - LogExtensions has called virtual ILog interface method to get here, callsite-stack is good
|
||||
_lastExtensionMethod = lastExtensionMethod;
|
||||
return WrappedLogger(logLevel, LogExtensions.WrapLogSafeInternal(this, messageFunc), exception,
|
||||
formatParameters);
|
||||
}
|
||||
|
||||
var WrappedMessageFunc = new Func<string>(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
return messageFunc();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
WrappedLogger(LogLevel.Error, () => FailedToGenerateLogMessage, ex);
|
||||
}
|
||||
|
||||
return null;
|
||||
});
|
||||
|
||||
// Callsite HACK - Need to ensure proper callsite stack without inlining, so calling the logger within a virtual interface method
|
||||
return _callsiteLogger.Log(WrappedLogger, logLevel, WrappedMessageFunc, exception, formatParameters);
|
||||
}
|
||||
|
||||
private interface ICallSiteExtension
|
||||
{
|
||||
bool Log(Logger logger, LogLevel logLevel, Func<string> messageFunc, Exception exception, object[] formatParameters);
|
||||
}
|
||||
|
||||
private class CallSiteExtension : ICallSiteExtension
|
||||
{
|
||||
bool ICallSiteExtension.Log(Logger logger, LogLevel logLevel, Func<string> messageFunc, Exception exception, object[] formatParameters)
|
||||
{
|
||||
return logger(logLevel, messageFunc, exception, formatParameters);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// Ce code a été généré par un outil.
|
||||
// Version du runtime :4.0.30319.42000
|
||||
//
|
||||
// Les modifications apportées à ce fichier peuvent provoquer un comportement incorrect et seront perdues si
|
||||
// le code est régénéré.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Reflection;
|
||||
|
||||
[assembly: System.Reflection.AssemblyCompanyAttribute("RSTP_DSLink")]
|
||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Release")]
|
||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("RSTP_DSLink")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("RSTP_DSLink")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
||||
// Généré par la classe MSBuild WriteCodeFragment.
|
||||
|
|
@ -0,0 +1 @@
|
|||
b2e87d2230e73cfc4aca10f0e8b0b734524fec61
|
binární
RSTP_DSLink/RSTP_DSLink/obj/Release/netcoreapp3.1/RSTP_DSLink.assets.cache
Normální soubor
binární
RSTP_DSLink/RSTP_DSLink/obj/Release/netcoreapp3.1/RSTP_DSLink.assets.cache
Normální soubor
Binární soubor nebyl zobrazen.
Rozdílový obsah nebyl zobrazen, protože je příliš veliký
Načíst porovnání
|
@ -1,18 +1,35 @@
|
|||
{
|
||||
"version": 2,
|
||||
"dgSpecHash": "p93DWVlIreOhMiKICOvM553HiyS7BkFL8VBKcoai0hLZPGo2yxkwr0EARlt7be9Vd7d6a6mXbbQi+O7kkowbtg==",
|
||||
"dgSpecHash": "6bGrOIwLmVcZdY28FpLhqCmDVcKT1a9UFfcKsq3NqAVd9UXDfdJiqBBN/K3NQxmKIoFplWy1+IMVDSsoJo0iDQ==",
|
||||
"success": true,
|
||||
"projectFilePath": "C:\\Users\\l.farina\\Desktop\\UCRM_stage\\RSTP_DSLink\\RSTP_DSLink\\RSTP_DSLink.csproj",
|
||||
"expectedPackageFiles": [
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\commandlineparser\\2.8.0\\commandlineparser.2.8.0.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\liblog\\5.0.8\\liblog.5.0.8.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\microsoft.csharp\\4.7.0\\microsoft.csharp.4.7.0.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\microsoft.netcore.platforms\\2.0.0\\microsoft.netcore.platforms.2.0.0.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\microsoft.netcore.platforms\\5.0.0\\microsoft.netcore.platforms.5.0.0.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\microsoft.netcore.targets\\1.1.0\\microsoft.netcore.targets.1.1.0.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\microsoft.win32.primitives\\4.3.0\\microsoft.win32.primitives.4.3.0.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\microsoft.win32.registry\\5.0.0\\microsoft.win32.registry.5.0.0.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\msgpack.cli\\1.0.1\\msgpack.cli.1.0.1.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\netstandard.library\\2.0.3\\netstandard.library.2.0.3.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\newtonsoft.json\\13.0.1\\newtonsoft.json.13.0.1.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\portable.bouncycastle\\1.8.10\\portable.bouncycastle.1.8.10.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\runtime.debian.8-x64.runtime.native.system.security.cryptography.openssl\\4.3.2\\runtime.debian.8-x64.runtime.native.system.security.cryptography.openssl.4.3.2.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\runtime.fedora.23-x64.runtime.native.system.security.cryptography.openssl\\4.3.2\\runtime.fedora.23-x64.runtime.native.system.security.cryptography.openssl.4.3.2.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\runtime.fedora.24-x64.runtime.native.system.security.cryptography.openssl\\4.3.2\\runtime.fedora.24-x64.runtime.native.system.security.cryptography.openssl.4.3.2.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\runtime.native.system\\4.3.0\\runtime.native.system.4.3.0.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\runtime.native.system.net.http\\4.3.0\\runtime.native.system.net.http.4.3.0.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\runtime.native.system.security.cryptography.apple\\4.3.0\\runtime.native.system.security.cryptography.apple.4.3.0.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\runtime.native.system.security.cryptography.openssl\\4.3.2\\runtime.native.system.security.cryptography.openssl.4.3.2.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\runtime.opensuse.13.2-x64.runtime.native.system.security.cryptography.openssl\\4.3.2\\runtime.opensuse.13.2-x64.runtime.native.system.security.cryptography.openssl.4.3.2.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\runtime.opensuse.42.1-x64.runtime.native.system.security.cryptography.openssl\\4.3.2\\runtime.opensuse.42.1-x64.runtime.native.system.security.cryptography.openssl.4.3.2.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\runtime.osx.10.10-x64.runtime.native.system.security.cryptography.apple\\4.3.0\\runtime.osx.10.10-x64.runtime.native.system.security.cryptography.apple.4.3.0.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\runtime.osx.10.10-x64.runtime.native.system.security.cryptography.openssl\\4.3.2\\runtime.osx.10.10-x64.runtime.native.system.security.cryptography.openssl.4.3.2.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\runtime.rhel.7-x64.runtime.native.system.security.cryptography.openssl\\4.3.2\\runtime.rhel.7-x64.runtime.native.system.security.cryptography.openssl.4.3.2.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\runtime.ubuntu.14.04-x64.runtime.native.system.security.cryptography.openssl\\4.3.2\\runtime.ubuntu.14.04-x64.runtime.native.system.security.cryptography.openssl.4.3.2.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\runtime.ubuntu.16.04-x64.runtime.native.system.security.cryptography.openssl\\4.3.2\\runtime.ubuntu.16.04-x64.runtime.native.system.security.cryptography.openssl.4.3.2.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\runtime.ubuntu.16.10-x64.runtime.native.system.security.cryptography.openssl\\4.3.2\\runtime.ubuntu.16.10-x64.runtime.native.system.security.cryptography.openssl.4.3.2.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\serilog\\2.10.0\\serilog.2.10.0.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\serilog.sinks.console\\4.0.0\\serilog.sinks.console.4.0.0.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\serilog.sinks.debug\\2.0.0\\serilog.sinks.debug.2.0.0.nupkg.sha512",
|
||||
|
@ -20,9 +37,24 @@
|
|||
"C:\\Users\\l.farina\\.nuget\\packages\\serilog.sinks.rollingfile\\3.3.0\\serilog.sinks.rollingfile.3.3.0.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\standardstorage\\0.1.1\\standardstorage.0.1.1.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\system.codedom\\4.4.0\\system.codedom.4.4.0.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\system.collections\\4.3.0\\system.collections.4.3.0.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\system.collections.concurrent\\4.3.0\\system.collections.concurrent.4.3.0.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\system.device.gpio\\1.5.0\\system.device.gpio.1.5.0.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\system.diagnostics.debug\\4.3.0\\system.diagnostics.debug.4.3.0.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\system.diagnostics.diagnosticsource\\4.3.0\\system.diagnostics.diagnosticsource.4.3.0.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\system.diagnostics.tracing\\4.3.0\\system.diagnostics.tracing.4.3.0.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\system.globalization\\4.3.0\\system.globalization.4.3.0.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\system.globalization.calendars\\4.3.0\\system.globalization.calendars.4.3.0.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\system.globalization.extensions\\4.3.0\\system.globalization.extensions.4.3.0.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\system.io\\4.3.0\\system.io.4.3.0.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\system.io.filesystem.primitives\\4.0.1\\system.io.filesystem.primitives.4.0.1.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\system.io.filesystem\\4.3.0\\system.io.filesystem.4.3.0.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\system.io.filesystem.primitives\\4.3.0\\system.io.filesystem.primitives.4.3.0.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\system.linq\\4.3.0\\system.linq.4.3.0.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\system.memory\\4.5.4\\system.memory.4.5.4.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\system.net.http\\4.3.4\\system.net.http.4.3.4.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\system.net.networkinformation\\4.3.0\\system.net.networkinformation.4.3.0.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\system.net.primitives\\4.3.0\\system.net.primitives.4.3.0.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\system.net.sockets\\4.3.0\\system.net.sockets.4.3.0.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\system.numerics.vectors\\4.3.0\\system.numerics.vectors.4.3.0.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\system.reflection\\4.3.0\\system.reflection.4.3.0.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\system.reflection.emit\\4.3.0\\system.reflection.emit.4.3.0.nupkg.sha512",
|
||||
|
@ -31,15 +63,37 @@
|
|||
"C:\\Users\\l.farina\\.nuget\\packages\\system.reflection.primitives\\4.3.0\\system.reflection.primitives.4.3.0.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\system.resources.resourcemanager\\4.3.0\\system.resources.resourcemanager.4.3.0.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\system.runtime\\4.3.0\\system.runtime.4.3.0.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\system.runtime.compilerservices.unsafe\\4.5.2\\system.runtime.compilerservices.unsafe.4.5.2.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\system.runtime.extensions\\4.3.0\\system.runtime.extensions.4.3.0.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\system.runtime.handles\\4.0.1\\system.runtime.handles.4.0.1.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\system.runtime.interopservices\\4.1.0\\system.runtime.interopservices.4.1.0.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\system.security.accesscontrol\\4.4.0\\system.security.accesscontrol.4.4.0.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\system.runtime.handles\\4.3.0\\system.runtime.handles.4.3.0.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\system.runtime.interopservices\\4.3.0\\system.runtime.interopservices.4.3.0.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\system.runtime.interopservices.windowsruntime\\4.3.0\\system.runtime.interopservices.windowsruntime.4.3.0.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\system.runtime.numerics\\4.3.0\\system.runtime.numerics.4.3.0.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\system.runtime.windowsruntime\\4.6.0\\system.runtime.windowsruntime.4.6.0.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\system.security.accesscontrol\\5.0.0\\system.security.accesscontrol.5.0.0.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\system.security.cryptography.algorithms\\4.3.0\\system.security.cryptography.algorithms.4.3.0.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\system.security.cryptography.cng\\4.3.0\\system.security.cryptography.cng.4.3.0.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\system.security.cryptography.csp\\4.3.0\\system.security.cryptography.csp.4.3.0.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\system.security.cryptography.encoding\\4.3.0\\system.security.cryptography.encoding.4.3.0.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\system.security.cryptography.openssl\\4.3.0\\system.security.cryptography.openssl.4.3.0.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\system.security.cryptography.primitives\\4.3.0\\system.security.cryptography.primitives.4.3.0.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\system.security.cryptography.x509certificates\\4.3.0\\system.security.cryptography.x509certificates.4.3.0.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\system.security.permissions\\4.4.1\\system.security.permissions.4.4.1.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\system.security.principal.windows\\4.4.0\\system.security.principal.windows.4.4.0.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\system.security.principal.windows\\5.0.0\\system.security.principal.windows.5.0.0.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\system.text.encoding\\4.3.0\\system.text.encoding.4.3.0.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\system.text.encoding.codepages\\4.5.1\\system.text.encoding.codepages.4.5.1.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\system.text.encoding.extensions\\4.0.11\\system.text.encoding.extensions.4.0.11.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\system.threading.tasks\\4.3.0\\system.threading.tasks.4.3.0.nupkg.sha512"
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\system.threading\\4.3.0\\system.threading.4.3.0.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\system.threading.overlapped\\4.3.0\\system.threading.overlapped.4.3.0.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\system.threading.tasks\\4.3.0\\system.threading.tasks.4.3.0.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\system.threading.tasks.extensions\\4.5.4\\system.threading.tasks.extensions.4.5.4.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\system.threading.thread\\4.3.0\\system.threading.thread.4.3.0.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\system.threading.threadpool\\4.3.0\\system.threading.threadpool.4.3.0.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\unosquare.raspberry.abstractions\\0.4.0\\unosquare.raspberry.abstractions.0.4.0.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\unosquare.raspberry.io\\0.25.0\\unosquare.raspberry.io.0.25.0.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\unosquare.raspberryio.peripherals\\0.5.0\\unosquare.raspberryio.peripherals.0.5.0.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\unosquare.swan\\2.0.1\\unosquare.swan.2.0.1.nupkg.sha512",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages\\unosquare.swan.lite\\2.0.0\\unosquare.swan.lite.2.0.0.nupkg.sha512"
|
||||
],
|
||||
"logs": []
|
||||
}
|
binární
Test_GPIO/.vs/Test_GPIO/DesignTimeBuild/.dtbcache.v2
Normální soubor
binární
Test_GPIO/.vs/Test_GPIO/DesignTimeBuild/.dtbcache.v2
Normální soubor
Binární soubor nebyl zobrazen.
binární
Test_GPIO/.vs/Test_GPIO/v16/.suo
Normální soubor
binární
Test_GPIO/.vs/Test_GPIO/v16/.suo
Normální soubor
Binární soubor nebyl zobrazen.
25
Test_GPIO/Test_GPIO.sln
Normální soubor
25
Test_GPIO/Test_GPIO.sln
Normální soubor
|
@ -0,0 +1,25 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.31424.327
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test_GPIO", "Test_GPIO\Test_GPIO.csproj", "{65E063DE-75B9-447F-A680-C2AE241F3E14}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{65E063DE-75B9-447F-A680-C2AE241F3E14}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{65E063DE-75B9-447F-A680-C2AE241F3E14}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{65E063DE-75B9-447F-A680-C2AE241F3E14}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{65E063DE-75B9-447F-A680-C2AE241F3E14}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {EAC4D879-223A-4F9A-90A1-CEDD38CC28F6}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
169
Test_GPIO/Test_GPIO/Driver.cs
Normální soubor
169
Test_GPIO/Test_GPIO/Driver.cs
Normální soubor
|
@ -0,0 +1,169 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Device.Gpio;
|
||||
using System.Net;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Iot.Device.Pigpio
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class Driver : GpioDriver
|
||||
{
|
||||
private readonly IPEndPoint _endpoint;
|
||||
private readonly PigpiodIf _proxy;
|
||||
private readonly List<int> _openPins;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="endpoint"></param>
|
||||
public Driver(IPEndPoint endpoint)
|
||||
{
|
||||
_endpoint = endpoint;
|
||||
_proxy = new PigpiodIf();
|
||||
|
||||
_openPins = new List<int>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Task ConnectAsync()
|
||||
{
|
||||
_proxy.pigpio_start(_endpoint.Address.ToString(), _endpoint.Port.ToString());
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
protected override int PinCount => PigpiodIf.PI_MAX_USER_GPIO;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="pinNumber"></param>
|
||||
/// <param name="eventTypes"></param>
|
||||
/// <param name="callback"></param>
|
||||
protected override void AddCallbackForPinValueChangedEvent(int pinNumber, PinEventTypes eventTypes, PinChangeEventHandler callback)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
protected override void ClosePin(int pinNumber)
|
||||
{
|
||||
if (_openPins.Contains(pinNumber))
|
||||
{
|
||||
_openPins.Remove(pinNumber);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new InvalidOperationException($"Pin '{pinNumber}' hasn't been opened");
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
protected override int ConvertPinNumberToLogicalNumberingScheme(int pinNumber)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
protected override PinMode GetPinMode(int pinNumber)
|
||||
{
|
||||
var mode = _proxy.get_mode((uint)pinNumber);
|
||||
|
||||
switch (mode)
|
||||
{
|
||||
case PigpiodIf.PI_INPUT: return PinMode.Input;
|
||||
case PigpiodIf.PI_OUTPUT: return PinMode.Output;
|
||||
default: throw new ArgumentException($"Unknown PinMode value '{mode}'");
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
protected override bool IsPinModeSupported(int pinNumber, PinMode mode)
|
||||
{
|
||||
switch (mode)
|
||||
{
|
||||
case PinMode.Input: return true;
|
||||
case PinMode.InputPullUp: return true;
|
||||
case PinMode.InputPullDown: return true;
|
||||
case PinMode.Output: return true;
|
||||
default: return false; // Only input & output supported ATM. Should be increased to support input-pullup/pulldown
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
protected override void OpenPin(int pinNumber)
|
||||
{
|
||||
if (!_openPins.Contains(pinNumber))
|
||||
{
|
||||
_openPins.Add(pinNumber);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new InvalidOperationException($"Pin '{pinNumber}' is already been open");
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
protected override PinValue Read(int pinNumber)
|
||||
{
|
||||
return _proxy.gpio_read((uint)pinNumber);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
protected override void RemoveCallbackForPinValueChangedEvent(int pinNumber, PinChangeEventHandler callback)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
protected override void SetPinMode(int pinNumber, PinMode pinMode)
|
||||
{
|
||||
var mode = pinMode.AsMode();
|
||||
var pud = pinMode.AsPullUpDown();
|
||||
|
||||
_proxy.set_mode((uint)pinNumber, mode);
|
||||
_proxy.set_pull_up_down((uint)pinNumber, pud);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
protected override WaitForEventResult WaitForEvent(int pinNumber, PinEventTypes eventTypes, CancellationToken cancellationToken)
|
||||
{
|
||||
bool eventDetected = false;
|
||||
int oldValue = _proxy.gpio_read((uint)pinNumber);
|
||||
int newValue;
|
||||
while (!eventDetected)
|
||||
{
|
||||
newValue = _proxy.gpio_read ((uint)pinNumber);
|
||||
//Console.WriteLine(newValue);
|
||||
|
||||
if ((eventTypes == PinEventTypes.Rising && newValue == 1 && oldValue == 0)
|
||||
|| (eventTypes == PinEventTypes.Falling && newValue == 0 && oldValue == 1))
|
||||
eventDetected = true;
|
||||
|
||||
oldValue = newValue;
|
||||
//System.Threading.Thread.Sleep(500);
|
||||
}
|
||||
|
||||
WaitForEventResult result;
|
||||
result.EventTypes = eventTypes;
|
||||
result.TimedOut = false;
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
protected override void Write(int pinNumber, PinValue pinValue)
|
||||
{
|
||||
var value = pinValue.AsValue();
|
||||
|
||||
_proxy.gpio_write((uint)pinNumber, value);
|
||||
}
|
||||
}
|
||||
}
|
36
Test_GPIO/Test_GPIO/Helpers.cs
Normální soubor
36
Test_GPIO/Test_GPIO/Helpers.cs
Normální soubor
|
@ -0,0 +1,36 @@
|
|||
using System;
|
||||
using System.Device.Gpio;
|
||||
|
||||
namespace Iot.Device.Pigpio
|
||||
{
|
||||
internal static class Helpers
|
||||
{
|
||||
public static uint AsMode(this PinMode mode)
|
||||
{
|
||||
switch (mode)
|
||||
{
|
||||
case PinMode.Input: return PigpiodIf.PI_INPUT;
|
||||
case PinMode.InputPullUp: return PigpiodIf.PI_INPUT;
|
||||
case PinMode.InputPullDown: return PigpiodIf.PI_INPUT;
|
||||
case PinMode.Output: return PigpiodIf.PI_OUTPUT;
|
||||
default: throw new ArgumentException($"PinMode value of '{mode}' is not valid");
|
||||
}
|
||||
}
|
||||
|
||||
public static uint AsPullUpDown(this PinMode mode)
|
||||
{
|
||||
switch (mode)
|
||||
{
|
||||
case PinMode.InputPullUp: return PigpiodIf.PI_PUD_UP;
|
||||
case PinMode.InputPullDown: return PigpiodIf.PI_PUD_DOWN;
|
||||
default: return PigpiodIf.PI_PUD_OFF;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static uint AsValue(this PinValue value)
|
||||
{
|
||||
return (uint)(int)value;
|
||||
}
|
||||
}
|
||||
}
|
2789
Test_GPIO/Test_GPIO/PigpiodIf.cs
Normální soubor
2789
Test_GPIO/Test_GPIO/PigpiodIf.cs
Normální soubor
Rozdílový obsah nebyl zobrazen, protože je příliš veliký
Načíst porovnání
42
Test_GPIO/Test_GPIO/Program.cs
Normální soubor
42
Test_GPIO/Test_GPIO/Program.cs
Normální soubor
|
@ -0,0 +1,42 @@
|
|||
using Iot.Device.Pigpio;
|
||||
using System;
|
||||
using System.Device.Gpio;
|
||||
using System.Net;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ConsoleApp9
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static async Task Main(string[] args)
|
||||
{
|
||||
var addr = "80.11.204.244";
|
||||
var port = 9031;
|
||||
var pin = 12;
|
||||
// var blinks = 5;
|
||||
|
||||
using (var driver = new Driver(new IPEndPoint(IPAddress.Parse(addr), port)))
|
||||
{
|
||||
await driver.ConnectAsync();
|
||||
await Task.Delay(TimeSpan.FromSeconds(1)); //Give the socket time to get connected
|
||||
|
||||
Console.WriteLine("Connected");
|
||||
|
||||
using (var controller = new GpioController(PinNumberingScheme.Logical, driver))
|
||||
{
|
||||
controller.OpenPin(pin);
|
||||
controller.SetPinMode(pin, PinMode.InputPullUp);
|
||||
|
||||
while (true)
|
||||
{
|
||||
controller.WaitForEvent(pin, PinEventTypes.Falling, new CancellationToken(false));
|
||||
Console.WriteLine("Beep boop");
|
||||
}
|
||||
|
||||
controller.ClosePin(pin);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
24
Test_GPIO/Test_GPIO/ReadMe.md
Normální soubor
24
Test_GPIO/Test_GPIO/ReadMe.md
Normální soubor
|
@ -0,0 +1,24 @@
|
|||
# Pigpio
|
||||
|
||||
This GpioDriver implementation allows you to remotely control a Raspberry Pi's GPIO pins via a wired or wireless network connection. It is compatible with (at time of writing) every Raspberry Pi including Model A, A+, B, B+, Zero, ZeroW, Pi2B, Pi3B (Pi4 support is currently experimental).
|
||||
|
||||
## Setting up the Raspberry Pi
|
||||
|
||||
1. Install a recent version of Raspbian onto the Pi; Stretch or Buster is fine.
|
||||
2. Make sure the Pi has network access so either via a wired or wireless connection
|
||||
3. Configured the raspberry pi to allow remote GPIO control by following the steps in section 4.1 [here](https://gpiozero.readthedocs.io/en/stable/remote_gpio.html#preparing-the-raspberry-pi).
|
||||
|
||||
And you're done.
|
||||
|
||||
## Running the sample
|
||||
|
||||
The sample application (Pigpio.Sample) will periodically set GPIO4 high then low. If you connected an LED (with a current limiting resistor) to GPIO4 you then run the application you should see if turn on or off every second.
|
||||
|
||||
To run the sample you'll need to determine the IP address of the Pi you configured above and specify it as the first argument to the application; for example:
|
||||
|
||||
```
|
||||
Pigpio.Sample.exe 192.168.1.101
|
||||
```
|
||||
|
||||
If all goes to plan, you should see something like [this](https://www.youtube.com/watch?v=F9m0fqZjOGQ)
|
||||
|
156
Test_GPIO/Test_GPIO/TcpConnection.cs
Normální soubor
156
Test_GPIO/Test_GPIO/TcpConnection.cs
Normální soubor
|
@ -0,0 +1,156 @@
|
|||
using System;
|
||||
using System.Net.Sockets;
|
||||
|
||||
namespace Iot.Device.Pigpio
|
||||
{
|
||||
internal class TcpConnection
|
||||
{
|
||||
#region # event
|
||||
|
||||
public event EventHandler StreamChanged;
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region # private field
|
||||
|
||||
private TcpClient tcp = null;
|
||||
private string ipOrHost;
|
||||
private int port;
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region # public property
|
||||
|
||||
public bool IsOpened
|
||||
{
|
||||
get
|
||||
{
|
||||
return tcp != null;
|
||||
}
|
||||
}
|
||||
|
||||
private NetworkStream _stream = null;
|
||||
public NetworkStream Stream
|
||||
{
|
||||
get
|
||||
{
|
||||
return _stream;
|
||||
}
|
||||
set
|
||||
{
|
||||
_stream = value;
|
||||
if (StreamChanged != null)
|
||||
{
|
||||
StreamChanged.Invoke(this, new EventArgs());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region # Implementation of IDisposable
|
||||
|
||||
bool disposed = false;
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
if (disposed)
|
||||
return;
|
||||
|
||||
if (disposing)
|
||||
{
|
||||
// Release managed objects
|
||||
Close();
|
||||
}
|
||||
|
||||
// Release unmanaged objects
|
||||
|
||||
disposed = true;
|
||||
}
|
||||
~TcpConnection()
|
||||
{
|
||||
Dispose(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region # public method
|
||||
|
||||
public bool Open(string ipOrHost, int port)
|
||||
{
|
||||
if (tcp == null)
|
||||
{
|
||||
try
|
||||
{
|
||||
this.ipOrHost = ipOrHost;
|
||||
this.port = port;
|
||||
|
||||
tcp = new TcpClient();
|
||||
tcp.BeginConnect(ipOrHost, port, new AsyncCallback(NetConnectCallback), null);
|
||||
|
||||
Console.WriteLine("Connecting to {0}:{1}...", ipOrHost, port);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("Connection failed({0}).", ex.Message);
|
||||
Close();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
if (Stream != null)
|
||||
{
|
||||
// Execute handlers of StreamChanged event, and call Dispose()
|
||||
var stream = Stream;
|
||||
Stream = null;
|
||||
stream.Dispose();
|
||||
}
|
||||
if (tcp != null)
|
||||
{
|
||||
tcp.Close();
|
||||
tcp = null;
|
||||
|
||||
Console.WriteLine("{0}:{1} was disconnected.", ipOrHost, port);
|
||||
}
|
||||
ipOrHost = string.Empty;
|
||||
port = 0;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region # private method
|
||||
|
||||
private void NetConnectCallback(IAsyncResult result)
|
||||
{
|
||||
if (tcp == null)
|
||||
return;
|
||||
|
||||
if (tcp.Connected)
|
||||
{
|
||||
Console.WriteLine("Connected to LAN {0}:{1}.",
|
||||
((System.Net.IPEndPoint)tcp.Client.RemoteEndPoint).Address,
|
||||
((System.Net.IPEndPoint)tcp.Client.RemoteEndPoint).Port);
|
||||
|
||||
var stream = tcp.GetStream();
|
||||
stream.ReadTimeout = 10000;
|
||||
stream.WriteTimeout = 10000;
|
||||
Stream = stream;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
14
Test_GPIO/Test_GPIO/Test_GPIO.csproj
Normální soubor
14
Test_GPIO/Test_GPIO/Test_GPIO.csproj
Normální soubor
|
@ -0,0 +1,14 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Iot.Device.Bindings" Version="1.5.0" />
|
||||
<PackageReference Include="System.Device.Gpio" Version="1.5.0" />
|
||||
<PackageReference Include="Unosquare.PiGpio" Version="0.3.1" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
binární
Test_GPIO/Test_GPIO/bin/Debug/net5.0/Iot.Device.Bindings.dll
Normální soubor
binární
Test_GPIO/Test_GPIO/bin/Debug/net5.0/Iot.Device.Bindings.dll
Normální soubor
Binární soubor nebyl zobrazen.
binární
Test_GPIO/Test_GPIO/bin/Debug/net5.0/Microsoft.Extensions.Logging.Abstractions.dll
Normální soubor
binární
Test_GPIO/Test_GPIO/bin/Debug/net5.0/Microsoft.Extensions.Logging.Abstractions.dll
Normální soubor
Binární soubor nebyl zobrazen.
binární
Test_GPIO/Test_GPIO/bin/Debug/net5.0/Microsoft.Win32.SystemEvents.dll
Normální soubor
binární
Test_GPIO/Test_GPIO/bin/Debug/net5.0/Microsoft.Win32.SystemEvents.dll
Normální soubor
Binární soubor nebyl zobrazen.
binární
Test_GPIO/Test_GPIO/bin/Debug/net5.0/SixLabors.ImageSharp.dll
Normální soubor
binární
Test_GPIO/Test_GPIO/bin/Debug/net5.0/SixLabors.ImageSharp.dll
Normální soubor
Binární soubor nebyl zobrazen.
binární
Test_GPIO/Test_GPIO/bin/Debug/net5.0/Swan.Lite.dll
Normální soubor
binární
Test_GPIO/Test_GPIO/bin/Debug/net5.0/Swan.Lite.dll
Normální soubor
Binární soubor nebyl zobrazen.
binární
Test_GPIO/Test_GPIO/bin/Debug/net5.0/Swan.dll
Normální soubor
binární
Test_GPIO/Test_GPIO/bin/Debug/net5.0/Swan.dll
Normální soubor
Binární soubor nebyl zobrazen.
binární
Test_GPIO/Test_GPIO/bin/Debug/net5.0/System.CodeDom.dll
Normální soubor
binární
Test_GPIO/Test_GPIO/bin/Debug/net5.0/System.CodeDom.dll
Normální soubor
Binární soubor nebyl zobrazen.
binární
Test_GPIO/Test_GPIO/bin/Debug/net5.0/System.Device.Gpio.dll
Normální soubor
binární
Test_GPIO/Test_GPIO/bin/Debug/net5.0/System.Device.Gpio.dll
Normální soubor
Binární soubor nebyl zobrazen.
binární
Test_GPIO/Test_GPIO/bin/Debug/net5.0/System.Drawing.Common.dll
Normální soubor
binární
Test_GPIO/Test_GPIO/bin/Debug/net5.0/System.Drawing.Common.dll
Normální soubor
Binární soubor nebyl zobrazen.
binární
Test_GPIO/Test_GPIO/bin/Debug/net5.0/System.IO.Ports.dll
Normální soubor
binární
Test_GPIO/Test_GPIO/bin/Debug/net5.0/System.IO.Ports.dll
Normální soubor
Binární soubor nebyl zobrazen.
binární
Test_GPIO/Test_GPIO/bin/Debug/net5.0/System.Management.dll
Normální soubor
binární
Test_GPIO/Test_GPIO/bin/Debug/net5.0/System.Management.dll
Normální soubor
Binární soubor nebyl zobrazen.
1321
Test_GPIO/Test_GPIO/bin/Debug/net5.0/Test_GPIO.deps.json
Normální soubor
1321
Test_GPIO/Test_GPIO/bin/Debug/net5.0/Test_GPIO.deps.json
Normální soubor
Rozdílový obsah nebyl zobrazen, protože je příliš veliký
Načíst porovnání
binární
Test_GPIO/Test_GPIO/bin/Debug/net5.0/Test_GPIO.dll
Normální soubor
binární
Test_GPIO/Test_GPIO/bin/Debug/net5.0/Test_GPIO.dll
Normální soubor
Binární soubor nebyl zobrazen.
binární
Test_GPIO/Test_GPIO/bin/Debug/net5.0/Test_GPIO.exe
Normální soubor
binární
Test_GPIO/Test_GPIO/bin/Debug/net5.0/Test_GPIO.exe
Normální soubor
Binární soubor nebyl zobrazen.
binární
Test_GPIO/Test_GPIO/bin/Debug/net5.0/Test_GPIO.pdb
Normální soubor
binární
Test_GPIO/Test_GPIO/bin/Debug/net5.0/Test_GPIO.pdb
Normální soubor
Binární soubor nebyl zobrazen.
8
Test_GPIO/Test_GPIO/bin/Debug/net5.0/Test_GPIO.runtimeconfig.dev.json
Normální soubor
8
Test_GPIO/Test_GPIO/bin/Debug/net5.0/Test_GPIO.runtimeconfig.dev.json
Normální soubor
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"runtimeOptions": {
|
||||
"additionalProbingPaths": [
|
||||
"C:\\Users\\l.farina\\.dotnet\\store\\|arch|\\|tfm|",
|
||||
"C:\\Users\\l.farina\\.nuget\\packages"
|
||||
]
|
||||
}
|
||||
}
|
9
Test_GPIO/Test_GPIO/bin/Debug/net5.0/Test_GPIO.runtimeconfig.json
Normální soubor
9
Test_GPIO/Test_GPIO/bin/Debug/net5.0/Test_GPIO.runtimeconfig.json
Normální soubor
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"runtimeOptions": {
|
||||
"tfm": "net5.0",
|
||||
"framework": {
|
||||
"name": "Microsoft.NETCore.App",
|
||||
"version": "5.0.0"
|
||||
}
|
||||
}
|
||||
}
|
binární
Test_GPIO/Test_GPIO/bin/Debug/net5.0/UnitsNet.dll
Normální soubor
binární
Test_GPIO/Test_GPIO/bin/Debug/net5.0/UnitsNet.dll
Normální soubor
Binární soubor nebyl zobrazen.
binární
Test_GPIO/Test_GPIO/bin/Debug/net5.0/Unosquare.PiGpio.dll
Normální soubor
binární
Test_GPIO/Test_GPIO/bin/Debug/net5.0/Unosquare.PiGpio.dll
Normální soubor
Binární soubor nebyl zobrazen.
binární
Test_GPIO/Test_GPIO/bin/Debug/net5.0/Unosquare.Raspberry.Abstractions.dll
Normální soubor
binární
Test_GPIO/Test_GPIO/bin/Debug/net5.0/Unosquare.Raspberry.Abstractions.dll
Normální soubor
Binární soubor nebyl zobrazen.
binární
Test_GPIO/Test_GPIO/bin/Debug/net5.0/ref/Test_GPIO.dll
Normální soubor
binární
Test_GPIO/Test_GPIO/bin/Debug/net5.0/ref/Test_GPIO.dll
Normální soubor
Binární soubor nebyl zobrazen.
binární
Test_GPIO/Test_GPIO/bin/Debug/net5.0/runtimes/linux-arm/native/libSystem.IO.Ports.Native.so
Normální soubor
binární
Test_GPIO/Test_GPIO/bin/Debug/net5.0/runtimes/linux-arm/native/libSystem.IO.Ports.Native.so
Normální soubor
Binární soubor nebyl zobrazen.
binární
Test_GPIO/Test_GPIO/bin/Debug/net5.0/runtimes/linux-arm64/native/libSystem.IO.Ports.Native.so
Normální soubor
binární
Test_GPIO/Test_GPIO/bin/Debug/net5.0/runtimes/linux-arm64/native/libSystem.IO.Ports.Native.so
Normální soubor
Binární soubor nebyl zobrazen.
binární
Test_GPIO/Test_GPIO/bin/Debug/net5.0/runtimes/linux-x64/native/libSystem.IO.Ports.Native.so
Normální soubor
binární
Test_GPIO/Test_GPIO/bin/Debug/net5.0/runtimes/linux-x64/native/libSystem.IO.Ports.Native.so
Normální soubor
Binární soubor nebyl zobrazen.
binární
Test_GPIO/Test_GPIO/bin/Debug/net5.0/runtimes/linux/lib/netstandard2.0/System.IO.Ports.dll
Normální soubor
binární
Test_GPIO/Test_GPIO/bin/Debug/net5.0/runtimes/linux/lib/netstandard2.0/System.IO.Ports.dll
Normální soubor
Binární soubor nebyl zobrazen.
binární
Test_GPIO/Test_GPIO/bin/Debug/net5.0/runtimes/osx-x64/native/libSystem.IO.Ports.Native.dylib
Normální soubor
binární
Test_GPIO/Test_GPIO/bin/Debug/net5.0/runtimes/osx-x64/native/libSystem.IO.Ports.Native.dylib
Normální soubor
Binární soubor nebyl zobrazen.
binární
Test_GPIO/Test_GPIO/bin/Debug/net5.0/runtimes/osx/lib/netstandard2.0/System.IO.Ports.dll
Normální soubor
binární
Test_GPIO/Test_GPIO/bin/Debug/net5.0/runtimes/osx/lib/netstandard2.0/System.IO.Ports.dll
Normální soubor
Binární soubor nebyl zobrazen.
binární
Test_GPIO/Test_GPIO/bin/Debug/net5.0/runtimes/unix/lib/netcoreapp3.0/System.Drawing.Common.dll
Normální soubor
binární
Test_GPIO/Test_GPIO/bin/Debug/net5.0/runtimes/unix/lib/netcoreapp3.0/System.Drawing.Common.dll
Normální soubor
Binární soubor nebyl zobrazen.
Některé soubory nejsou zobrazny, neboť je v této revizi změněno mnoho souborů Zobrazit více
Načítání…
Odkázat v novém problému