Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions AmazingDebugTool.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.13.35931.197
# Visual Studio Version 18
VisualStudioVersion = 18.3.11312.210 d18.3
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JITDebugTool", "AmazingDebugTool\JITDebugTool.csproj", "{5B5B0766-0319-441F-A074-A4F81E2EFEC7}"
EndProject
Expand All @@ -13,8 +13,8 @@ Global
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{5B5B0766-0319-441F-A074-A4F81E2EFEC7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5B5B0766-0319-441F-A074-A4F81E2EFEC7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5B5B0766-0319-441F-A074-A4F81E2EFEC7}.Debug|Any CPU.ActiveCfg = LabApi|Any CPU
{5B5B0766-0319-441F-A074-A4F81E2EFEC7}.Debug|Any CPU.Build.0 = LabApi|Any CPU
{5B5B0766-0319-441F-A074-A4F81E2EFEC7}.Debug|x64.ActiveCfg = Debug|x64
{5B5B0766-0319-441F-A074-A4F81E2EFEC7}.Debug|x64.Build.0 = Debug|x64
{5B5B0766-0319-441F-A074-A4F81E2EFEC7}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand Down
14 changes: 14 additions & 0 deletions AmazingDebugTool/API/Extensions/LabApiPluginExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using LabApi.Loader;
using System.Reflection;

namespace JITDebugTool.API.Extensions
{
public static class LabApiPluginExtensions
{
public static Assembly GetAssembly(this LabApi.Loader.Features.Plugins.Plugin plugin)
{
PluginLoader.Plugins.TryGetValue(plugin, out var asm);
return asm;
}
}
}
19 changes: 19 additions & 0 deletions AmazingDebugTool/API/Extensions/QueueExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using System.Collections.Generic;

namespace JITDebugTool.API.Extensions
{
public static class QueueExtensions
{
public static bool TryDequeue<T>(this Queue<T> queue, out T element)
{
if (queue.Count > 0)
{
element = queue.Dequeue();
return true;
}

element = default(T);
return false;
}
}
}
11 changes: 7 additions & 4 deletions AmazingDebugTool/API/Features/LogService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
using System.Threading.Tasks;
using WebSocketSharp;
using WebSocketSharp.Server;
#if LABAPI
using static JITDebugTool.API.Extensions.QueueExtensions;
#endif

namespace JITDebugTool.API.Features
{
Expand Down Expand Up @@ -37,7 +40,7 @@ protected override void OnMessage(MessageEventArgs e)
{
if (e.Data == "GET_EVENT_CHRONO")
{
Exiled.API.Features.Log.Info("GETTING CHRONO v2!");
Logger.Info("GETTING CHRONO v2!");
try
{
Task.Run(() =>
Expand All @@ -47,7 +50,7 @@ protected override void OnMessage(MessageEventArgs e)
Queue<CallEntry> queue = new(Plugin.Instance.writer.fullLogs.ToArray());
Queue<SerializedMethod> methods = new(Plugin.Instance.writer.fullMethods.Values.ToArray());

Exiled.API.Features.Log.Info($"PREPPING LOGS AS {queue.Count}! ({Plugin.Instance.writer.fullLogs.Count})");
Logger.Info($"PREPPING LOGS AS {queue.Count}! ({Plugin.Instance.writer.fullLogs.Count})");

while (queue.Count > 0 || methods.Count > 0)
{
Expand All @@ -65,13 +68,13 @@ protected override void OnMessage(MessageEventArgs e)
}
catch (Exception ex)
{
Exiled.API.Features.Log.Error(ex);
Logger.Error(ex);
}
});
}
catch (Exception ex)
{
Exiled.API.Features.Log.Error(ex);
Logger.Error(ex);
}
}
else if (e.Data == "SUBSCRIBE")
Expand Down
7 changes: 5 additions & 2 deletions AmazingDebugTool/API/Features/SocketServer.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using Exiled.API.Features;
#if EXILED
using Exiled.API.Features;
#endif

using System;
using System.Collections.Generic;
using System.Linq;
Expand All @@ -20,7 +23,7 @@ public SocketServer()
Server = new WebSocketServer(IPAddress.Parse("0.0.0.0"), Plugin.Instance.Config.SocketPort);
Server.AddWebSocketService<LogService>("/logs");
Server.Start();
Log.Info($"Socket server is ready and is listening on 0.0.0.0:{Plugin.Instance.Config.SocketPort}");
Logger.Info($"Socket server is ready and is listening on 0.0.0.0:{Plugin.Instance.Config.SocketPort}");
}

public void Stop()
Expand Down
19 changes: 15 additions & 4 deletions AmazingDebugTool/API/SerializedElements/SerializedTargetPlugin.cs
Original file line number Diff line number Diff line change
@@ -1,19 +1,30 @@
using Exiled.API.Interfaces;
#if EXILED
using Exiled.API.Interfaces;
#endif

using JITDebugTool.API.Extensions;

namespace JITDebugTool.API.SerializedElements
{
#if EXILED
internal class SerializedTargetPlugin(IPlugin<IConfig> plugin)
#else
internal class SerializedTargetPlugin(LabApi.Loader.Features.Plugins.Plugin plugin)
#endif
{
public string Name { get; } = plugin.Name;

#if EXILED
public string Prefix { get; } = plugin.Prefix;
#else
public string Description { get; } = plugin.Description;
#endif

public string Author { get; } = plugin.Author;

public string Version { get; } = plugin.Version.ToString();

public string AssemblyName { get; } = plugin.Assembly.FullName;
public string AssemblyName { get; } = plugin.GetAssembly().FullName;

public string AssemblySimpleName { get; } = plugin.Assembly.GetName().Name;
public string AssemblySimpleName { get; } = plugin.GetAssembly().GetName().Name;
}
}
11 changes: 9 additions & 2 deletions AmazingDebugTool/API/SerializedElements/SerializedWelcome.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
using Exiled.Loader;
#if EXILED
using Exiled.Loader;
#endif

using LabApi.Features;

namespace JITDebugTool.API.SerializedElements
{
Expand All @@ -11,7 +15,10 @@ internal class SerializedWelcome
public string TargetPluginName { get; } = Plugin.Instance.Config.Plugin;

public bool Exiled { get; } = true;

#if EXILED
public string ExiledVersion { get; } = Loader.Version.ToString();
#else
public string ExiledVersion { get; } = LabApiProperties.CompiledVersion;
#endif
}
}
8 changes: 7 additions & 1 deletion AmazingDebugTool/Config.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
using Exiled.API.Interfaces;
#if EXILED
using Exiled.API.Interfaces;
#endif
using System.Collections.Generic;
using System.ComponentModel;

namespace JITDebugTool
{
#if EXILED
internal class Config : IConfig
#else
internal class Config
#endif
{
[Description("Whether the plugin is enabled")]
public bool IsEnabled { get; set; } = true;
Expand Down
107 changes: 24 additions & 83 deletions AmazingDebugTool/JITDebugTool.csproj
Original file line number Diff line number Diff line change
@@ -1,100 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{5B5B0766-0319-441F-A074-A4F81E2EFEC7}</ProjectGuid>
<TargetFramework>net48</TargetFramework>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>JITDebugTool</RootNamespace>
<AssemblyName>JITDebugTool</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<LangVersion>13</LangVersion>
<Deterministic>true</Deterministic>
<FileAlignment>512</FileAlignment>
<Configurations>Exiled;LabApi</Configurations>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">

<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'LabAPI|AnyCPU'">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>embedded</DebugType>
<PlatformTarget>x64</PlatformTarget>
<LangVersion>13</LangVersion>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">

<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Exiled|AnyCPU'">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<LangVersion>13</LangVersion>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>

<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="API\Extensions\MethodBaseExtension.cs" />
<Compile Include="API\Features\CallEntry.cs" />
<Compile Include="API\Features\LogService.cs" />
<Compile Include="API\Features\SocketServer.cs" />
<Compile Include="API\SerializedElements\SerializedCallEntry.cs" />
<Compile Include="API\SerializedElements\SerializedMessage.cs" />
<Compile Include="API\SerializedElements\SerializedMethod.cs" />
<Compile Include="API\SerializedElements\SerializedParamInfo.cs" />
<Compile Include="API\SerializedElements\SerializedPluginData.cs" />
<Compile Include="API\SerializedElements\SerializedStackTraceEntry.cs" />
<Compile Include="API\SerializedElements\SerializedStopwatch.cs" />
<Compile Include="API\SerializedElements\SerializedTargetPlugin.cs" />
<Compile Include="API\SerializedElements\SerializedWelcome.cs" />
<Compile Include="API\SerializedElements\TypedElement.cs" />
<Compile Include="Config.cs" />
<Compile Include="Patch.cs" />
<Compile Include="Patcher.cs" />
<Compile Include="Plugin.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="API\Extensions\StringExtension.cs" />
<Compile Include="Writer.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="ExMod.Exiled">
<Version>9.8.1</Version>
</PackageReference>
<PackageReference Include="Lib.Harmony">
<Version>2.2.2</Version>
</PackageReference>
<PackageReference Include="Newtonsoft.Json">
<Version>13.0.3</Version>
</PackageReference>
<PackageReference Include="websocketsharp.core">
<Version>1.0.1</Version>
</PackageReference>
<PackageReference Include="ExMod.Exiled" Version="9.12.2" Condition="'$(Configuration)' == 'Exiled'" />
<PackageReference Include="Lib.Harmony" Version="2.2.2" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Northwood.LabAPI" Version="1.1.4" />
<PackageReference Include="websocketsharp.core" Version="1.0.1" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

</Project>
Loading