Initial commit
This commit is contained in:
0
Core/Dictionary.cs
Normal file
0
Core/Dictionary.cs
Normal file
18
Core/Message.cs
Normal file
18
Core/Message.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
|
||||
namespace PhotonLogger.Core;
|
||||
|
||||
public enum MessageType
|
||||
{
|
||||
Event,
|
||||
OperationRequest,
|
||||
OperationResponse
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class Message
|
||||
{
|
||||
public long Time { get; set; }
|
||||
public MessageType Type { get; set; }
|
||||
public object Data { get; set; }
|
||||
}
|
||||
24
Core/Plugin.cs
Normal file
24
Core/Plugin.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using BepInEx.Logging;
|
||||
using HarmonyLib;
|
||||
|
||||
namespace PhotonLogger.Core;
|
||||
|
||||
public static class LoggerPlugin
|
||||
{
|
||||
public static ManualLogSource Log = Logger.CreateLogSource("PhotonLogger");
|
||||
|
||||
public static Harmony harmony = new("dev.proxnet.photon.logger");
|
||||
|
||||
public static void Load()
|
||||
{
|
||||
harmony.PatchAll();
|
||||
SocketProvider.Instance.Connect();
|
||||
}
|
||||
|
||||
public static void Unload()
|
||||
{
|
||||
harmony.UnpatchSelf();
|
||||
SocketProvider.Instance.Close();
|
||||
Log.LogInfo("Unloading");
|
||||
}
|
||||
}
|
||||
25
Core/Socket.cs
Normal file
25
Core/Socket.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using WebSocketSharp;
|
||||
|
||||
namespace PhotonLogger.Core;
|
||||
|
||||
public class SocketProvider
|
||||
{
|
||||
public static readonly SocketProvider Instance = new();
|
||||
|
||||
private readonly WebSocket socket = new("wss://photonlogger.proxnet.dev");
|
||||
|
||||
public void Write(string msg)
|
||||
{
|
||||
socket.Send(msg);
|
||||
}
|
||||
|
||||
public void Connect()
|
||||
{
|
||||
socket.Connect();
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
socket.Close();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user