Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Logoff function for Multi run job #1142

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
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
7 changes: 6 additions & 1 deletion OpenBullet2.Core/Models/Jobs/MultiRunJobOptions.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using OpenBullet2.Core.Models.Data;
using OpenBullet2.Core.Models.Data;
using OpenBullet2.Core.Models.Hits;
using OpenBullet2.Core.Models.Proxies;
using RuriLib.Models.Jobs;
Expand Down Expand Up @@ -30,6 +30,11 @@ public class MultiRunJobOptions : JobOptions
/// <summary>
/// The proxy mode.
/// </summary>
public bool Logoff { get; set; } = false;

/// <summary>
/// disable log
/// </summary>
public JobProxyMode ProxyMode { get; set; } = JobProxyMode.Default;

/// <summary>
Expand Down
3 changes: 2 additions & 1 deletion OpenBullet2.Core/Services/JobFactoryService.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using OpenBullet2.Core.Models.Hits;
using OpenBullet2.Core.Models.Jobs;
Expand Down Expand Up @@ -107,6 +107,7 @@ private MultiRunJob MakeMultiRunJob(MultiRunJobOptions options)
BotLimit = BotLimit,
CurrentBotDatas = new BotData[BotLimit],
Skip = options.Skip,
Logoff = options.Logoff,
HitOutputs = options.HitOutputs.Select(o => hitOutputsFactory.FromOptions(o)).ToList(),
ProxySources = options.ProxySources.Select(s => proxySourceFactory.FromOptions(s).Result).ToList(),
Providers = new(_settingsService)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Page x:Class="OpenBullet2.Native.Views.Dialogs.MultiRunJobOptionsDialog"
<Page x:Class="OpenBullet2.Native.Views.Dialogs.MultiRunJobOptionsDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Expand Down Expand Up @@ -117,6 +117,10 @@
Value="{Binding Skip, Mode=TwoWay}"
Width="100"/>
</StackPanel>
<CheckBox
Margin="5 5 0 0"
Content="Disable writing logs"
IsChecked="{Binding Logoff}" />
<StackPanel Orientation="Horizontal" Margin="0 5 0 0">
<Label>Proxy mode</Label>
<ComboBox
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using Microsoft.Win32;
using OpenBullet2.Core.Entities;
using OpenBullet2.Core.Models.Data;
Expand Down Expand Up @@ -304,6 +304,16 @@ public int Skip
}
}

public bool Logoff
{
get => Options.Logoff;
set
{
Options.Logoff = value;
OnPropertyChanged();
}
}

public IEnumerable<JobProxyMode> ProxyModes => Enum.GetValues(typeof(JobProxyMode)).Cast<JobProxyMode>();

public JobProxyMode ProxyMode
Expand Down
3 changes: 2 additions & 1 deletion RuriLib/Models/Jobs/MultiRunJob.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public class MultiRunJob : Job
public int Bots { get; set; } = 1;
public int BotLimit { get; init; } = 200;
public int Skip { get; set; } = 0;
public bool Logoff { get; set; } = false;
public Config Config { get; set; }
public DataPool DataPool { get; set; }
public List<ProxySource> ProxySources { get; set; } = new List<ProxySource>();
Expand Down Expand Up @@ -925,7 +926,7 @@ private void DataProcessed(object sender, ResultDetails<MultiRunInput, CheckResu
{
var botData = details.Result.BotData;

if (IsHitStatus(botData.STATUS))
if (IsHitStatus(botData.STATUS)&&!Logoff)
{
// Fire and forget
RegisterHit(details.Result).ConfigureAwait(false);
Expand Down