Skip to content
This repository has been archived by the owner on Oct 28, 2019. It is now read-only.

Added an option to idle games simultaneously, regardless of the hours #247

Open
wants to merge 3 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
16 changes: 14 additions & 2 deletions Source/IdleMaster/Properties/Settings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Source/IdleMaster/Properties/Settings.settings
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@
<Value Profile="(Default)" />
</Setting>
<Setting Name="OneThenMany" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
<Setting Name="AlwaysMany" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
</Settings>
Expand Down
3 changes: 3 additions & 0 deletions Source/IdleMaster/app.config
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@
<value />
</setting>
<setting name="OneThenMany" serializeAs="String">
<value>False</value>
</setting>
<setting name="AlwaysMany" serializeAs="String">
<value>True</value>
</setting>
</IdleMaster.Properties.Settings>
Expand Down
27 changes: 21 additions & 6 deletions Source/IdleMaster/frmMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,19 @@ public void UpdateIdleProcesses()
{
foreach (var badge in CanIdleBadges.Where(b => !Equals(b, CurrentBadge)))
{
if (badge.HoursPlayed >= 2 && badge.InIdle)
badge.StopIdle();
if (!Settings.Default.AlwaysMany)
{
if (badge.HoursPlayed >= 2 && badge.InIdle)
badge.StopIdle();

if (badge.HoursPlayed < 2 && CanIdleBadges.Count(b => b.InIdle) < 30)
badge.Idle();
if (badge.HoursPlayed < 2 && CanIdleBadges.Count(b => b.InIdle) < 30)
badge.Idle();
}
else
{
if (CanIdleBadges.Count(b => b.InIdle) < 30)
badge.Idle();
}
}

RefreshGamesStateListView();
Expand Down Expand Up @@ -221,6 +229,10 @@ private void StartIdle()
StartMultipleIdle();
}
}
else if (Settings.Default.AlwaysMany)
{
StartMultipleIdle();
}
else
{
var multi = CanIdleBadges.Where(b => b.HoursPlayed < 2);
Expand Down Expand Up @@ -306,6 +318,8 @@ public void StartSoloIdle(Badge badge)

public void StartMultipleIdle()
{
CurrentBadge = null;

UpdateIdleProcesses();

// Update label controls
Expand Down Expand Up @@ -861,7 +875,7 @@ private async void tmrCardDropCheck_Tick(object sender, EventArgs e)
await LoadBadgesAsync();
UpdateIdleProcesses();

isMultipleIdle = CanIdleBadges.Any(b => b.HoursPlayed < 2 && b.InIdle);
isMultipleIdle = CanIdleBadges.Any(b => b.HoursPlayed < 2 && b.InIdle) || Settings.Default.AlwaysMany;
if (isMultipleIdle)
TimeLeft = 360;
}
Expand Down Expand Up @@ -923,10 +937,11 @@ private void settingsToolStripMenuItem_Click(object sender, EventArgs e)
String previous = Settings.Default.sort;
Boolean previous_behavior = Settings.Default.OnlyOneGameIdle;
Boolean previous_behavior2 = Settings.Default.OneThenMany;
Boolean previous_behavior3 = Settings.Default.AlwaysMany;
Form frm = new frmSettings();
frm.ShowDialog();

if (previous != Settings.Default.sort || previous_behavior != Settings.Default.OnlyOneGameIdle || previous_behavior2 != Settings.Default.OneThenMany)
if (previous != Settings.Default.sort || previous_behavior != Settings.Default.OnlyOneGameIdle || previous_behavior2 != Settings.Default.OneThenMany || previous_behavior3 != Settings.Default.AlwaysMany)
{
StopIdle();
AllBadges.Clear();
Expand Down
53 changes: 32 additions & 21 deletions Source/IdleMaster/frmSettings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 20 additions & 2 deletions Source/IdleMaster/frmSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,26 @@ private void btnOK_Click(object sender, EventArgs e)
{
Settings.Default.OnlyOneGameIdle = false;
Settings.Default.OneThenMany = true;
Settings.Default.AlwaysMany = false;
}
else
else if (radOneGameOnly.Checked)
{
Settings.Default.OnlyOneGameIdle = radOneGameOnly.Checked && !radManyThenOne.Checked;
Settings.Default.OneThenMany = false;
}
Settings.Default.AlwaysMany = false;
}
else if (radAlwaysMany.Checked)
{
Settings.Default.OnlyOneGameIdle = false;
Settings.Default.OneThenMany = false;
Settings.Default.AlwaysMany = true;
}
else
{
Settings.Default.OnlyOneGameIdle = false;
Settings.Default.OneThenMany = false;
Settings.Default.AlwaysMany = false;
}
Settings.Default.minToTray = chkMinToTray.Checked;
Settings.Default.ignoreclient = chkIgnoreClientStatus.Checked;
Settings.Default.showUsername = chkShowUsername.Checked;
Expand Down Expand Up @@ -133,6 +147,10 @@ private void frmSettings_Load(object sender, EventArgs e)
{
radOneThenMany.Checked = true;
}
else if (Settings.Default.AlwaysMany)
{
radAlwaysMany.Checked = true;
}
else
{
radOneGameOnly.Checked = Settings.Default.OnlyOneGameIdle;
Expand Down