From 4515f79bd7d8ecfe2d6227e8eed517fba4846f8d Mon Sep 17 00:00:00 2001 From: TitleHHHH Date: Tue, 6 Feb 2024 14:38:59 +0500 Subject: [PATCH] fix bug and update nuget packages --- build/_build.csproj | 4 +- .../HolyClient.Abstractions.csproj | 2 + .../StressTest/BaseStressTestBehavior.cs | 18 +++++++ .../StressTest/IStressTestBehavior.cs | 21 +++++++- .../StressTest/IStressTestBot.cs | 5 +- .../HolyClient.Common.csproj | 6 +-- .../HolyClient.Core/Helpers/MapDataHelper.cs | 5 +- .../HolyClient.Core/HolyClient.Core.csproj | 10 ++-- .../HolyClient.SDK/HolyClient.SDK.csproj | 2 +- .../HolyClient.StressTest/DefaultBehavior.cs | 11 +++-- .../HolyClient.StressTest.csproj | 2 +- .../StressTestProfile.cs | 12 ++--- .../TidePVPBehaviorAttack.cs | 49 +++++++++++++++++-- src/HolyClient/HolyClient.csproj | 30 ++++++------ .../StressTest/ExceptionInfoViewModel.cs | 21 ++++++++ .../StressTest/StressTestProcessViewModel.cs | 26 ++-------- .../StressTest/StressTestProfileViewModel.cs | 2 +- .../Pages/StressTest/StressTestViewModel.cs | 21 +++++--- .../StressTest/StressTestProfileView.axaml | 6 ++- .../StressTest/StressTestProfileView.axaml.cs | 4 ++ .../Pages/StressTest/StressTestView.axaml | 11 +++-- .../McProtoNet.Core/McProtoNet.Core.csproj | 2 +- .../McProtoNet.Tests/McProtoNet.Tests.csproj | 8 +-- .../McProtoNet/Client/MinecraftClient.Read.cs | 33 +++++++------ .../McProtoNet/Client/MinecraftClient.cs | 2 + .../McProtoNet/Events/RespawnEventArgs.cs | 1 + .../HolyClient.Console.csproj | 4 +- .../HolyClient.Desktop.csproj | 2 +- .../TestStressTestBehavior/Class2.cs | 5 +- .../TestStressTestBehavior/Class3.cs | 5 +- .../SpammerHelloBehavior.cs | 10 ++-- tasks.md | 13 +++-- 32 files changed, 237 insertions(+), 116 deletions(-) create mode 100644 src/CoreLibs/HolyClient.Abstractions/StressTest/BaseStressTestBehavior.cs create mode 100644 src/HolyClient/ViewModels/Pages/StressTest/ExceptionInfoViewModel.cs diff --git a/build/_build.csproj b/build/_build.csproj index 02de8215..091dd92c 100644 --- a/build/_build.csproj +++ b/build/_build.csproj @@ -19,9 +19,9 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - + - + diff --git a/src/CoreLibs/HolyClient.Abstractions/HolyClient.Abstractions.csproj b/src/CoreLibs/HolyClient.Abstractions/HolyClient.Abstractions.csproj index 7702d026..3741366e 100644 --- a/src/CoreLibs/HolyClient.Abstractions/HolyClient.Abstractions.csproj +++ b/src/CoreLibs/HolyClient.Abstractions/HolyClient.Abstractions.csproj @@ -10,6 +10,8 @@ + + diff --git a/src/CoreLibs/HolyClient.Abstractions/StressTest/BaseStressTestBehavior.cs b/src/CoreLibs/HolyClient.Abstractions/StressTest/BaseStressTestBehavior.cs new file mode 100644 index 00000000..bda17910 --- /dev/null +++ b/src/CoreLibs/HolyClient.Abstractions/StressTest/BaseStressTestBehavior.cs @@ -0,0 +1,18 @@ +using Avalonia.Controls; +using ReactiveUI; +using Serilog; +using System.Reactive.Disposables; + +namespace HolyClient.Abstractions.StressTest +{ + public abstract class BaseStressTestBehavior : IStressTestBehavior + { + public ReactiveObject? DefaultViewModel { get; protected set; } + + public ReactiveObject? ProcessViewModel { get; protected set; } + + public ResourceDictionary? Resources { get; protected set; } + + public abstract Task Activate(CompositeDisposable disposables, IEnumerable bots, ILogger logger, CancellationToken cancellationToken); + } +} diff --git a/src/CoreLibs/HolyClient.Abstractions/StressTest/IStressTestBehavior.cs b/src/CoreLibs/HolyClient.Abstractions/StressTest/IStressTestBehavior.cs index d45815ca..737fcd43 100644 --- a/src/CoreLibs/HolyClient.Abstractions/StressTest/IStressTestBehavior.cs +++ b/src/CoreLibs/HolyClient.Abstractions/StressTest/IStressTestBehavior.cs @@ -1,10 +1,27 @@ -using System.Reactive.Disposables; +using Avalonia.Controls; +using ReactiveUI; +using System.ComponentModel; +using System.Reactive.Disposables; namespace HolyClient.Abstractions.StressTest { + + public interface IStressTestBehavior { - public Task Activate(CompositeDisposable disposables, IEnumerable bots, CancellationToken cancellationToken); + + ReactiveObject? DefaultViewModel { get; } + + ReactiveObject? ProcessViewModel { get; } + + + ResourceDictionary? Resources { get; } + + public Task Activate( + CompositeDisposable disposables, + IEnumerable bots, + Serilog.ILogger logger, + CancellationToken cancellationToken); } } diff --git a/src/CoreLibs/HolyClient.Abstractions/StressTest/IStressTestBot.cs b/src/CoreLibs/HolyClient.Abstractions/StressTest/IStressTestBot.cs index 544964d5..bab22ecd 100644 --- a/src/CoreLibs/HolyClient.Abstractions/StressTest/IStressTestBot.cs +++ b/src/CoreLibs/HolyClient.Abstractions/StressTest/IStressTestBot.cs @@ -1,4 +1,5 @@ -using McProtoNet; +using Avalonia.Controls; +using McProtoNet; namespace HolyClient.Abstractions.StressTest { @@ -6,7 +7,7 @@ namespace HolyClient.Abstractions.StressTest public interface IStressTestBot { public Task Restart(bool changeNickAndProxy); - + public MinecraftClient Client { get; } } diff --git a/src/CoreLibs/HolyClient.Common/HolyClient.Common.csproj b/src/CoreLibs/HolyClient.Common/HolyClient.Common.csproj index e7c29dbb..76a244e1 100644 --- a/src/CoreLibs/HolyClient.Common/HolyClient.Common.csproj +++ b/src/CoreLibs/HolyClient.Common/HolyClient.Common.csproj @@ -10,11 +10,11 @@ - - + + - + diff --git a/src/CoreLibs/HolyClient.Core/Helpers/MapDataHelper.cs b/src/CoreLibs/HolyClient.Core/Helpers/MapDataHelper.cs index fe692d3d..f0ae2b20 100644 --- a/src/CoreLibs/HolyClient.Core/Helpers/MapDataHelper.cs +++ b/src/CoreLibs/HolyClient.Core/Helpers/MapDataHelper.cs @@ -1,4 +1,7 @@ -namespace HolyClient.Core.Helpers +using SixLabors.ImageSharp; +using SixLabors.ImageSharp.PixelFormats; + +namespace HolyClient.Core.Helpers { public class MapDataHelper { diff --git a/src/CoreLibs/HolyClient.Core/HolyClient.Core.csproj b/src/CoreLibs/HolyClient.Core/HolyClient.Core.csproj index c4aae8fd..827729e3 100644 --- a/src/CoreLibs/HolyClient.Core/HolyClient.Core.csproj +++ b/src/CoreLibs/HolyClient.Core/HolyClient.Core.csproj @@ -19,13 +19,13 @@ - - + + - - - + + + diff --git a/src/CoreLibs/HolyClient.SDK/HolyClient.SDK.csproj b/src/CoreLibs/HolyClient.SDK/HolyClient.SDK.csproj index cc761612..e15498ea 100644 --- a/src/CoreLibs/HolyClient.SDK/HolyClient.SDK.csproj +++ b/src/CoreLibs/HolyClient.SDK/HolyClient.SDK.csproj @@ -11,7 +11,7 @@ - + diff --git a/src/CoreLibs/HolyClient.StressTest/DefaultBehavior.cs b/src/CoreLibs/HolyClient.StressTest/DefaultBehavior.cs index a2dcc1d6..ebae034a 100644 --- a/src/CoreLibs/HolyClient.StressTest/DefaultBehavior.cs +++ b/src/CoreLibs/HolyClient.StressTest/DefaultBehavior.cs @@ -1,4 +1,5 @@ using HolyClient.Abstractions.StressTest; +using Serilog; using System.Reactive.Disposables; using System.Reactive.Linq; using System.Reactive.Threading.Tasks; @@ -6,7 +7,7 @@ namespace HolyClient.StressTest { - public class DefaultBehavior : IStressTestBehavior + public class DefaultBehavior : BaseStressTestBehavior { [System.ComponentModel.DisplayName("Spam text")] public string SpamText { get; set; } = "!Hello from Minecraft Holy Client"; @@ -24,7 +25,7 @@ public class DefaultBehavior : IStressTestBehavior private static Regex SayVerifyRegex = new(@"\.say \/verify (\d+)"); - public Task Activate(CompositeDisposable disposables, IEnumerable bots, CancellationToken cancellationToken) + public override Task Activate(CompositeDisposable disposables, IEnumerable bots,ILogger logger, CancellationToken cancellationToken) { foreach (var bot in bots) { @@ -50,7 +51,7 @@ public Task Activate(CompositeDisposable disposables, IEnumerable - + diff --git a/src/CoreLibs/HolyClient.StressTest/StressTestProfile.cs b/src/CoreLibs/HolyClient.StressTest/StressTestProfile.cs index f8a8bba8..f71889a8 100644 --- a/src/CoreLibs/HolyClient.StressTest/StressTestProfile.cs +++ b/src/CoreLibs/HolyClient.StressTest/StressTestProfile.cs @@ -101,7 +101,7 @@ public IStressTestBehavior Behavior [IgnoreMember] public StressTestServiceState CurrentState { get; private set; } - + [IgnoreMember] public ConcurrentDictionary, ExceptionCounter> ExceptionCounter { get; private set; } = new(); @@ -371,7 +371,7 @@ public async Task Start(Serilog.ILogger logger) logger.Information("Запуск поведения"); if (Behavior is not null) { - await Behavior.Activate(disposables, stressTestBots, cancellationTokenSource.Token); + await Behavior.Activate(disposables, stressTestBots, logger, cancellationTokenSource.Token); } logger.Information("Поведение запущено"); @@ -408,22 +408,22 @@ public async Task Start(Serilog.ILogger logger) sources.Add(new UrlProxySource(QuickProxyNet.ProxyType.SOCKS4, "https://raw.githubusercontent.com/TheSpeedX/PROXY-List/master/socks4.txt")); sources.Add(new UrlProxySource(QuickProxyNet.ProxyType.SOCKS5, "https://raw.githubusercontent.com/TheSpeedX/PROXY-List/master/socks5.txt")); } - + List>> tasks = new(); foreach (var s in sources) { tasks.Add(s.GetProxiesAsync()); } - + var result = await Task.WhenAll(tasks); var proxies = result.SelectMany(x => x).ToList(); - + var provider = new ProxyProvider(proxies); var group = proxies.GroupBy(x => x.Type).Select(x => $"{x.Key} - {x.Count()}"); - + logger.Information($"Загружено {proxies.Count} прокси. {string.Join(", ", group)}"); return provider; diff --git a/src/CoreLibs/HolyClient.StressTest/TidePVPBehaviorAttack.cs b/src/CoreLibs/HolyClient.StressTest/TidePVPBehaviorAttack.cs index 459d1d14..3f9b5f35 100644 --- a/src/CoreLibs/HolyClient.StressTest/TidePVPBehaviorAttack.cs +++ b/src/CoreLibs/HolyClient.StressTest/TidePVPBehaviorAttack.cs @@ -1,12 +1,55 @@ -using HolyClient.Abstractions.StressTest; +using Avalonia.Controls; +using HolyClient.Abstractions.StressTest; +using Serilog; using System.Reactive.Disposables; +using System.Reactive.Linq; +using System.Threading.Tasks.Dataflow; namespace HolyClient.StressTest { - public class TidePVPBehaviorAttack : IStressTestBehavior + public class TidePVPBehaviorAttack : BaseStressTestBehavior { - public Task Activate(CompositeDisposable disposables, IEnumerable bots, CancellationToken cancellationToken) + + + public override Task Activate(CompositeDisposable disposables, IEnumerable bots, ILogger logger, CancellationToken cancellationToken) { + foreach (var bot in bots) + { + + + + + + bot.Client.OnDisconnect.Subscribe(async x => + { + bool need = true; + do + { + try + { + await Task.Delay(5000); + + await bot.Restart(true); + need = false; + } + catch + { + + } + } while (need); + }); + + + var d2 = bot.Client.OnJoinGame.Subscribe(async x => + { + + }); + + disposables.Add(d2); + + _ = bot.Restart(true); + + } return Task.CompletedTask; } } diff --git a/src/HolyClient/HolyClient.csproj b/src/HolyClient/HolyClient.csproj index 29b6c8a8..8c8c3b26 100644 --- a/src/HolyClient/HolyClient.csproj +++ b/src/HolyClient/HolyClient.csproj @@ -37,21 +37,21 @@ - - - - - + + + + + - - - - - + + + + + - - - + + + @@ -62,9 +62,9 @@ - + - + diff --git a/src/HolyClient/ViewModels/Pages/StressTest/ExceptionInfoViewModel.cs b/src/HolyClient/ViewModels/Pages/StressTest/ExceptionInfoViewModel.cs new file mode 100644 index 00000000..b173f672 --- /dev/null +++ b/src/HolyClient/ViewModels/Pages/StressTest/ExceptionInfoViewModel.cs @@ -0,0 +1,21 @@ +using System; + + +namespace HolyClient.ViewModels; + +public sealed class ExceptionInfoViewModel +{ + public string Type { get; private set; } + public string Message { get; private set; } + public int Count { get; private set; } + + public Tuple Key { get; private set; } + + public ExceptionInfoViewModel(string type, string message, int count) + { + Type = type; + Message = message; + Count = count; + Key = Tuple.Create(Type, Message); + } +} diff --git a/src/HolyClient/ViewModels/Pages/StressTest/StressTestProcessViewModel.cs b/src/HolyClient/ViewModels/Pages/StressTest/StressTestProcessViewModel.cs index 4abbfadb..627312fd 100644 --- a/src/HolyClient/ViewModels/Pages/StressTest/StressTestProcessViewModel.cs +++ b/src/HolyClient/ViewModels/Pages/StressTest/StressTestProcessViewModel.cs @@ -35,24 +35,6 @@ namespace HolyClient.ViewModels; -public sealed class ExceptionInfo -{ - public string Type { get; private set; } - public string Message { get; private set; } - public int Count { get; private set; } - - public Tuple Key { get; private set; } - - public ExceptionInfo(string type, string message, int count) - { - Type = type; - Message = message; - Count = count; - Key = Tuple.Create(Type, Message); - } -} - - public class StressTestProcessViewModel : ReactiveObject, IStressTestProcessViewModel, IActivatableViewModel { [Reactive] @@ -108,7 +90,7 @@ public class StressTestProcessViewModel : ReactiveObject, IStressTestProcessView #region Exceptions [Reactive] - public ReadOnlyObservableCollection Exceptions { get; private set; } + public ReadOnlyObservableCollection Exceptions { get; private set; } #endregion private readonly DateTimeAxis _botsOnlineAxis; @@ -218,13 +200,13 @@ public StressTestProcessViewModel(ICommand cancel, IStressTestProfile stressTest this.WhenActivated(async d => { - SourceCache> exceptions = new(x => x.Key); + SourceCache> exceptions = new(x => x.Key); exceptions .Connect() - .Sort(SortExpressionComparer.Descending(p => p.Count)) + .Sort(SortExpressionComparer.Descending(p => p.Count)) .Bind(out var _exceptions) .Subscribe() .DisposeWith(d); @@ -262,7 +244,7 @@ public StressTestProcessViewModel(ICommand cancel, IStressTestProfile stressTest .Select(x => { - return stressTest.ExceptionCounter.ToArray().Select(x => new ExceptionInfo(x.Key.Item1, x.Key.Item2, x.Value.Count)); + return stressTest.ExceptionCounter.ToArray().Select(x => new ExceptionInfoViewModel(x.Key.Item1, x.Key.Item2, x.Value.Count)); }) .ObserveOn(RxApp.MainThreadScheduler) diff --git a/src/HolyClient/ViewModels/Pages/StressTest/StressTestProfileViewModel.cs b/src/HolyClient/ViewModels/Pages/StressTest/StressTestProfileViewModel.cs index 6907358c..564a9ec0 100644 --- a/src/HolyClient/ViewModels/Pages/StressTest/StressTestProfileViewModel.cs +++ b/src/HolyClient/ViewModels/Pages/StressTest/StressTestProfileViewModel.cs @@ -33,7 +33,7 @@ private static string GetTr(string key) public ViewModelActivator Activator { get; } = new(); - public string? UrlPathSegment => throw new NotImplementedException(); + public string? UrlPathSegment => "Profile"; public IScreen HostScreen { get; private set; } diff --git a/src/HolyClient/ViewModels/Pages/StressTest/StressTestViewModel.cs b/src/HolyClient/ViewModels/Pages/StressTest/StressTestViewModel.cs index 3d9ca03b..a4259f04 100644 --- a/src/HolyClient/ViewModels/Pages/StressTest/StressTestViewModel.cs +++ b/src/HolyClient/ViewModels/Pages/StressTest/StressTestViewModel.cs @@ -14,7 +14,7 @@ namespace HolyClient.ViewModels; -public class StressTestViewModel : ReactiveObject, IRoutableViewModel, IActivatableViewModel +public partial class StressTestViewModel : ReactiveObject, IRoutableViewModel, IActivatableViewModel { public ViewModelActivator Activator { get; } = new(); @@ -29,6 +29,8 @@ public class StressTestViewModel : ReactiveObject, IRoutableViewModel, IActivata private static int testId = 0; public StressTestViewModel() { + + HostScreen = null; var state = Locator.Current.GetService(); @@ -49,9 +51,14 @@ public StressTestViewModel() .RefCount(); outputCollectionChanges - .Filter(provider => provider.Id == state.SelectedProfileId) + .ObserveOn(RxApp.MainThreadScheduler) - .OnItemAdded(provider => SelectedProfile = provider) + .OnItemAdded(provider => + { + if (provider is null) + throw new Exception("asd"); + SelectedProfile = provider; + }) .Subscribe(); //outputCollectionChanges @@ -61,7 +68,7 @@ public StressTestViewModel() this.WhenAnyValue(x => x.SelectedProfile) .Subscribe(x => { - + }); this.WhenAnyValue(x => x.SelectedProfile) @@ -75,11 +82,11 @@ public StressTestViewModel() int i = 1; string basename = "New profile "; string name = basename + i; - while (state.Profiles.Items.ToArray().Any(x=>x.Name == name)) + while (state.Profiles.Items.ToArray().Any(x => x.Name == name)) { name = basename + (i++); } - + state.Profiles.AddOrUpdate(new StressTestProfile() { Name = name @@ -97,7 +104,7 @@ public StressTestViewModel() var id = SelectedProfile.Id; SelectedProfile = Profiles.FirstOrDefault(); state.Profiles.Remove(id); - + } } }); diff --git a/src/HolyClient/Views/Pages/StressTest/StressTestProfileView.axaml b/src/HolyClient/Views/Pages/StressTest/StressTestProfileView.axaml index f6845537..fec4f096 100644 --- a/src/HolyClient/Views/Pages/StressTest/StressTestProfileView.axaml +++ b/src/HolyClient/Views/Pages/StressTest/StressTestProfileView.axaml @@ -155,7 +155,6 @@ - + + + + + diff --git a/src/HolyClient/Views/Pages/StressTest/StressTestProfileView.axaml.cs b/src/HolyClient/Views/Pages/StressTest/StressTestProfileView.axaml.cs index 3da644a1..faedda85 100644 --- a/src/HolyClient/Views/Pages/StressTest/StressTestProfileView.axaml.cs +++ b/src/HolyClient/Views/Pages/StressTest/StressTestProfileView.axaml.cs @@ -6,6 +6,7 @@ using HolyClient.Localization; using HolyClient.ViewModels; using ReactiveUI; +using System.Diagnostics; using System.Reactive.Disposables; namespace HolyClient.Views; @@ -18,6 +19,9 @@ public StressTestProfileView() this.WhenActivated(d => { + Trace.WriteLine("Activate"); + + var NotificationManager = new Avalonia.Controls.Notifications.WindowNotificationManager(TopLevel.GetTopLevel(this)); diff --git a/src/HolyClient/Views/Pages/StressTest/StressTestView.axaml b/src/HolyClient/Views/Pages/StressTest/StressTestView.axaml index 4d495e62..138bfa5e 100644 --- a/src/HolyClient/Views/Pages/StressTest/StressTestView.axaml +++ b/src/HolyClient/Views/Pages/StressTest/StressTestView.axaml @@ -6,6 +6,7 @@ xmlns:ui="using:FluentAvalonia.UI.Controls" xmlns:reactive="http://reactiveui.net" xmlns:views="using:HolyClient.Views" + xmlns:vm="using:HolyClient.ViewModels" x:Class="HolyClient.Views.StressTestView"> @@ -47,13 +48,13 @@ - - - + + + - - + + diff --git a/src/McProtoNet/McProtoNet.Core/McProtoNet.Core.csproj b/src/McProtoNet/McProtoNet.Core/McProtoNet.Core.csproj index f670ad69..0730ba72 100644 --- a/src/McProtoNet/McProtoNet.Core/McProtoNet.Core.csproj +++ b/src/McProtoNet/McProtoNet.Core/McProtoNet.Core.csproj @@ -13,7 +13,7 @@ - + diff --git a/src/McProtoNet/McProtoNet.Tests/McProtoNet.Tests.csproj b/src/McProtoNet/McProtoNet.Tests/McProtoNet.Tests.csproj index bb382ecf..1ddcb46c 100644 --- a/src/McProtoNet/McProtoNet.Tests/McProtoNet.Tests.csproj +++ b/src/McProtoNet/McProtoNet.Tests/McProtoNet.Tests.csproj @@ -8,10 +8,10 @@ - - - - + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/McProtoNet/McProtoNet/Client/MinecraftClient.Read.cs b/src/McProtoNet/McProtoNet/Client/MinecraftClient.Read.cs index 70f89090..4ddd926d 100644 --- a/src/McProtoNet/McProtoNet/Client/MinecraftClient.Read.cs +++ b/src/McProtoNet/McProtoNet/Client/MinecraftClient.Read.cs @@ -8,17 +8,13 @@ namespace McProtoNet { public partial class MinecraftClient { - private CompositeDisposable disposables = new CompositeDisposable(); + private CompositeDisposable _events = new CompositeDisposable(); [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)] private Subject CreateEvent() { Subject subject = new Subject(); - disposables.Add(Disposable.Create(() => - { - subject.OnCompleted(); - subject.Dispose(); - })); + _events.Add(subject); return subject; } @@ -51,6 +47,8 @@ private void CreateEvents() + + public IObservable OnRespawn => _respawnEvent; public IObservable OnChatMessage => _chatEvent; public IObservable OnDisconnect => _disconnectEvent; @@ -67,19 +65,24 @@ private void OnPacket(IMinecraftPrimitiveReader reader, PacketIn id) { - if (_disconnectEvent.HasObservers && id == PacketIn.Disconnect) + if (id == PacketIn.Disconnect) { + string reason = reader.ReadString(); - var dis = PacketPool.DisconnectEventPool.Get(); - try - { - dis.Reason = reason; - _disconnectEvent.OnNext(dis); - } - finally + if (_disconnectEvent.HasObservers) { - PacketPool.DisconnectEventPool.Return(dis); + var dis = PacketPool.DisconnectEventPool.Get(); + try + { + dis.Reason = reason; + + _disconnectEvent.OnNext(dis); + } + finally + { + PacketPool.DisconnectEventPool.Return(dis); + } } throw new DisconnectException(reason); } diff --git a/src/McProtoNet/McProtoNet/Client/MinecraftClient.cs b/src/McProtoNet/McProtoNet/Client/MinecraftClient.cs index c535e7f8..7444c58a 100644 --- a/src/McProtoNet/McProtoNet/Client/MinecraftClient.cs +++ b/src/McProtoNet/McProtoNet/Client/MinecraftClient.cs @@ -333,6 +333,8 @@ public void Dispose() { } + + _events.Dispose(); pipe = null; diff --git a/src/McProtoNet/McProtoNet/Events/RespawnEventArgs.cs b/src/McProtoNet/McProtoNet/Events/RespawnEventArgs.cs index 163444e7..d660e06a 100644 --- a/src/McProtoNet/McProtoNet/Events/RespawnEventArgs.cs +++ b/src/McProtoNet/McProtoNet/Events/RespawnEventArgs.cs @@ -3,4 +3,5 @@ public class RespawnEventArgs : EventArgs { } + } diff --git a/src/Platforms/HolyClient.Console/HolyClient.Console.csproj b/src/Platforms/HolyClient.Console/HolyClient.Console.csproj index add82c73..499fbb6f 100644 --- a/src/Platforms/HolyClient.Console/HolyClient.Console.csproj +++ b/src/Platforms/HolyClient.Console/HolyClient.Console.csproj @@ -10,8 +10,8 @@ - - + + diff --git a/src/Platforms/HolyClient.Desktop/HolyClient.Desktop.csproj b/src/Platforms/HolyClient.Desktop/HolyClient.Desktop.csproj index 4f32f8bd..1452e357 100644 --- a/src/Platforms/HolyClient.Desktop/HolyClient.Desktop.csproj +++ b/src/Platforms/HolyClient.Desktop/HolyClient.Desktop.csproj @@ -28,7 +28,7 @@ - + diff --git a/src/Samples/StressTest/TestStressTestBehavior/Class2.cs b/src/Samples/StressTest/TestStressTestBehavior/Class2.cs index 5ec5334a..9f9989c3 100644 --- a/src/Samples/StressTest/TestStressTestBehavior/Class2.cs +++ b/src/Samples/StressTest/TestStressTestBehavior/Class2.cs @@ -1,14 +1,15 @@ using HolyClient.Abstractions.StressTest; using HolyClient.SDK.Attributes; +using Serilog; using System.Reactive.Disposables; namespace TestStressTestBehavior { [PluginAuthor("Title")] [PluginDescription("asdasd")] - public class Class2 : IStressTestBehavior + public class Class2 : BaseStressTestBehavior { - public Task Activate(CompositeDisposable disposables, IEnumerable bots, CancellationToken cancellationToken) + public override Task Activate(CompositeDisposable disposables, IEnumerable bots, ILogger logger, CancellationToken cancellationToken) { throw new NotImplementedException(); } diff --git a/src/Samples/StressTest/TestStressTestBehavior/Class3.cs b/src/Samples/StressTest/TestStressTestBehavior/Class3.cs index 0878d7a9..5e09babc 100644 --- a/src/Samples/StressTest/TestStressTestBehavior/Class3.cs +++ b/src/Samples/StressTest/TestStressTestBehavior/Class3.cs @@ -1,5 +1,6 @@ using HolyClient.Abstractions.StressTest; using HolyClient.SDK.Attributes; +using Serilog; using System.Reactive.Disposables; namespace TestStressTestBehavior @@ -7,9 +8,9 @@ namespace TestStressTestBehavior [PluginAuthor("Title")] [PluginDescription("asdasd")] [PluginTitle("ASdasd")] - public class Class3 : IStressTestBehavior + public class Class3 : BaseStressTestBehavior { - public Task Activate(CompositeDisposable disposables, IEnumerable bots, CancellationToken cancellationToken) + public override Task Activate(CompositeDisposable disposables, IEnumerable bots, ILogger logger, CancellationToken cancellationToken) { throw new NotImplementedException(); } diff --git a/src/Samples/StressTest/TestStressTestBehavior/SpammerHelloBehavior.cs b/src/Samples/StressTest/TestStressTestBehavior/SpammerHelloBehavior.cs index ac8e94db..1c92a0f9 100644 --- a/src/Samples/StressTest/TestStressTestBehavior/SpammerHelloBehavior.cs +++ b/src/Samples/StressTest/TestStressTestBehavior/SpammerHelloBehavior.cs @@ -1,21 +1,23 @@ -using HolyClient.Abstractions.StressTest; + +using HolyClient.Abstractions.StressTest; +using Serilog; using System.Reactive.Disposables; namespace TestStressTestBehavior { - public class SpammerHelloBehavior : IStressTestBehavior + public class SpammerHelloBehavior : BaseStressTestBehavior { [System.ComponentModel.DisplayName("Spam text")] public string SpamText { get; set; } = "Hello"; - public Task Activate(CompositeDisposable disposables, IEnumerable bots, CancellationToken cancellationToken) + public override Task Activate(CompositeDisposable disposables, IEnumerable bots, ILogger logger, CancellationToken cancellationToken) { foreach (var bot in bots) { //var d = bot.OnError.Subscribe(async x => //{ - + // await Task.Delay(1500); // await bot.Restart(true); diff --git a/tasks.md b/tasks.md index 36c4b1b7..e8ae7c7b 100644 --- a/tasks.md +++ b/tasks.md @@ -11,13 +11,18 @@ - ✔️ Графики с метриками - ✔️ Популярные исключения -- **Разделение чекинга прокси и стресс-теста** -- **Добавить логгер в плагины** +- ✔️ Добавить логгер в плагины + + + - **Добавить возможность плагинам делать свой UI** +- **Сделать возможность загрузки прокси с логином и паролем** + +- **Разделение чекинга прокси и стресс-теста** +- Перезагрузка плагинов -- Сделать возможность загрузки прокси с логином и паролем - Ввод команд в консоли стресс теста - на главную страницу добавить ссылку на Release Notes @@ -37,7 +42,7 @@ - Генерация отчетов на основе стресс-теста - Добавить вкладку с атакой разными методами -- Динамическая перезагрузка плагинов + - Загрузка плагинов из NuGet - В настройках сделать красиво - Добавить автообновление программы