Skip to content
This repository has been archived by the owner on May 20, 2024. It is now read-only.

Commit

Permalink
v1.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
shells-dw committed Jan 14, 2023
1 parent bbc1407 commit 9bfc5f4
Show file tree
Hide file tree
Showing 26 changed files with 105 additions and 145 deletions.
6 changes: 4 additions & 2 deletions PiholePlugin/Actions/AdsBlockedPercentage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ protected override Boolean OnLoad()
{
this._plugin = base.Plugin as PiholePlugin;
if (this._plugin is null)
{
return false;
}

this._plugin.UpdatedStatus += (sender, e) => this.ActionImageChanged("");
return base.OnLoad();
Expand All @@ -44,15 +46,15 @@ protected override BitmapImage GetCommandImage(String actionParameter, PluginIma
return bitmapBuilder.ToImage();
}
}
var currentState = Globals.PiDump.Status == "enabled";
var currentState = Globals.PiDump.status == "enabled";
using (var bitmapBuilder = new BitmapBuilder(imageSize))
{
bitmapBuilder.DrawRectangle(0, 0, 80, 80, BitmapColor.Black);
bitmapBuilder.FillRectangle(0, 0, 80, 80, BitmapColor.Black);
bitmapBuilder.SetBackgroundImage(currentState ? EmbeddedResources.ReadImage(EmbeddedResources.FindFile("piholeOn.png")) : EmbeddedResources.ReadImage(EmbeddedResources.FindFile("piholeOff.png")));
bitmapBuilder.DrawRectangle(0, 0, 80, 80, BitmapColor.Transparent);
bitmapBuilder.FillRectangle(0, 0, 80, 80, color: new BitmapColor(0, 0, 0, 140));
bitmapBuilder.DrawText($"{Double.Parse(Globals.PiDump.AdsPercentageToday, CultureInfo.InvariantCulture).ToString("0.0")}%", x: 40, y: 5, width: 0, height: 40, fontSize: 15, color: BitmapColor.White);
bitmapBuilder.DrawText($"{Double.Parse(Globals.PiDump.ads_percentage_today, CultureInfo.InvariantCulture):0.0}%", x: 40, y: 5, width: 0, height: 40, fontSize: 15, color: BitmapColor.White);
bitmapBuilder.DrawText("% blocked\ntoday", x: 5, y: 35, width: 70, height: 40, fontSize: 12, color: BitmapColor.White);

return bitmapBuilder.ToImage();
Expand Down
6 changes: 4 additions & 2 deletions PiholePlugin/Actions/AdsBlockedToday.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ protected override Boolean OnLoad()
{
this._plugin = base.Plugin as PiholePlugin;
if (this._plugin is null)
{
return false;
}

this._plugin.UpdatedStatus += (sender, e) => this.ActionImageChanged("");
return base.OnLoad();
Expand All @@ -42,15 +44,15 @@ protected override BitmapImage GetCommandImage(String actionParameter, PluginIma
return bitmapBuilder.ToImage();
}
}
var currentState = Globals.PiDump.Status == "enabled";
var currentState = Globals.PiDump.status == "enabled";
using (var bitmapBuilder = new BitmapBuilder(imageSize))
{
bitmapBuilder.DrawRectangle(0, 0, 80, 80, BitmapColor.Black);
bitmapBuilder.FillRectangle(0, 0, 80, 80, BitmapColor.Black);
bitmapBuilder.SetBackgroundImage(currentState ? EmbeddedResources.ReadImage(EmbeddedResources.FindFile("piholeOn.png")) : EmbeddedResources.ReadImage(EmbeddedResources.FindFile("piholeOff.png")));
bitmapBuilder.DrawRectangle(0, 0, 80, 80, BitmapColor.Transparent);
bitmapBuilder.FillRectangle(0, 0, 80, 80, color: new BitmapColor(0, 0, 0, 140));
bitmapBuilder.DrawText(String.Format("{0:n0}", Int32.Parse(Globals.PiDump.AdsBlockedToday)), x: 40, y: 5, width: 0, height: 40, fontSize: 15, color: BitmapColor.White);
bitmapBuilder.DrawText(String.Format("{0:n0}", Int32.Parse(Globals.PiDump.ads_blocked_today)), x: 40, y: 5, width: 0, height: 40, fontSize: 15, color: BitmapColor.White);
bitmapBuilder.DrawText("Ads blocked\ntoday", x: 5, y: 35, width: 70, height: 40, fontSize: 12, color: BitmapColor.White);

return bitmapBuilder.ToImage();
Expand Down
6 changes: 4 additions & 2 deletions PiholePlugin/Actions/ClientsEverSeen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ protected override Boolean OnLoad()
{
this._plugin = base.Plugin as PiholePlugin;
if (this._plugin is null)
{
return false;
}

this._plugin.UpdatedStatus += (sender, e) => this.ActionImageChanged("");
return base.OnLoad();
Expand All @@ -42,15 +44,15 @@ protected override BitmapImage GetCommandImage(String actionParameter, PluginIma
return bitmapBuilder.ToImage();
}
}
var currentState = Globals.PiDump.Status == "enabled";
var currentState = Globals.PiDump.status == "enabled";
using (var bitmapBuilder = new BitmapBuilder(imageSize))
{
bitmapBuilder.DrawRectangle(0, 0, 80, 80, BitmapColor.Black);
bitmapBuilder.FillRectangle(0, 0, 80, 80, BitmapColor.Black);
bitmapBuilder.SetBackgroundImage(currentState ? EmbeddedResources.ReadImage(EmbeddedResources.FindFile("piholeOn.png")) : EmbeddedResources.ReadImage(EmbeddedResources.FindFile("piholeOff.png")));
bitmapBuilder.DrawRectangle(0, 0, 80, 80, BitmapColor.Transparent);
bitmapBuilder.FillRectangle(0, 0, 80, 80, color: new BitmapColor(0, 0, 0, 140));
bitmapBuilder.DrawText(String.Format("{0:n0}", Int32.Parse(Globals.PiDump.ClientsEverSeen)), x: 40, y: 5, width: 0, height: 40, fontSize: 15, color: BitmapColor.White);
bitmapBuilder.DrawText(String.Format("{0:n0}", Int32.Parse(Globals.PiDump.clients_ever_seen)), x: 40, y: 5, width: 0, height: 40, fontSize: 15, color: BitmapColor.White);
bitmapBuilder.DrawText("Clients\never seen", x: 5, y: 35, width: 70, height: 40, fontSize: 12, color: BitmapColor.White);

return bitmapBuilder.ToImage();
Expand Down
2 changes: 1 addition & 1 deletion PiholePlugin/Actions/Disable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ protected override BitmapImage GetCommandImage(String actionParameter, PluginIma
}
}

var currentState = Globals.PiDump.Status == "enabled";
var currentState = Globals.PiDump.status == "enabled";
var disabled = actionParameter != "0" ? $"Disable for\n{actionParameter}s" : $"Disable\nindefinitely";

using (var bitmapBuilder = new BitmapBuilder(imageSize))
Expand Down
6 changes: 4 additions & 2 deletions PiholePlugin/Actions/DnsQueriesAllTypes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ protected override Boolean OnLoad()
{
this._plugin = base.Plugin as PiholePlugin;
if (this._plugin is null)
{
return false;
}

this._plugin.UpdatedStatus += (sender, e) => this.ActionImageChanged("");
return base.OnLoad();
Expand All @@ -42,15 +44,15 @@ protected override BitmapImage GetCommandImage(String actionParameter, PluginIma
return bitmapBuilder.ToImage();
}
}
var currentState = Globals.PiDump.Status == "enabled";
var currentState = Globals.PiDump.status == "enabled";
using (var bitmapBuilder = new BitmapBuilder(imageSize))
{
bitmapBuilder.DrawRectangle(0, 0, 80, 80, BitmapColor.Black);
bitmapBuilder.FillRectangle(0, 0, 80, 80, BitmapColor.Black);
bitmapBuilder.SetBackgroundImage(currentState ? EmbeddedResources.ReadImage(EmbeddedResources.FindFile("piholeOn.png")) : EmbeddedResources.ReadImage(EmbeddedResources.FindFile("piholeOff.png")));
bitmapBuilder.DrawRectangle(0, 0, 80, 80, BitmapColor.Transparent);
bitmapBuilder.FillRectangle(0, 0, 80, 80, color: new BitmapColor(0, 0, 0, 140));
bitmapBuilder.DrawText(String.Format("{0:n0}", Int32.Parse(Globals.PiDump.DnsQueriesAllTypes)), x: 40, y: 5, width: 0, height: 40, fontSize: 15, color: BitmapColor.White);
bitmapBuilder.DrawText(String.Format("{0:n0}", Int32.Parse(Globals.PiDump.dns_queries_all_types)), x: 40, y: 5, width: 0, height: 40, fontSize: 15, color: BitmapColor.White);
bitmapBuilder.DrawText("DNS queries\nall types", x: 5, y: 35, width: 70, height: 40, fontSize: 12, color: BitmapColor.White);

return bitmapBuilder.ToImage();
Expand Down
6 changes: 4 additions & 2 deletions PiholePlugin/Actions/DnsQueriesToday.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ protected override Boolean OnLoad()
{
this._plugin = base.Plugin as PiholePlugin;
if (this._plugin is null)
{
return false;
}

this._plugin.UpdatedStatus += (sender, e) => this.ActionImageChanged("");
return base.OnLoad();
Expand All @@ -41,15 +43,15 @@ protected override BitmapImage GetCommandImage(String actionParameter, PluginIma
return bitmapBuilder.ToImage();
}
}
var currentState = Globals.PiDump.Status == "enabled";
var currentState = Globals.PiDump.status == "enabled";
using (var bitmapBuilder = new BitmapBuilder(imageSize))
{
bitmapBuilder.DrawRectangle(0, 0, 80, 80, BitmapColor.Black);
bitmapBuilder.FillRectangle(0, 0, 80, 80, BitmapColor.Black);
bitmapBuilder.SetBackgroundImage(currentState ? EmbeddedResources.ReadImage(EmbeddedResources.FindFile("piholeOn.png")) : EmbeddedResources.ReadImage(EmbeddedResources.FindFile("piholeOff.png")));
bitmapBuilder.DrawRectangle(0, 0, 80, 80, BitmapColor.Transparent);
bitmapBuilder.FillRectangle(0, 0, 80, 80, color: new BitmapColor(0, 0, 0, 140));
bitmapBuilder.DrawText(String.Format("{0:n0}", Int32.Parse(Globals.PiDump.DnsQueriesToday)), x: 40, y: 5, width: 0, height: 40, fontSize: 15, color: BitmapColor.White);
bitmapBuilder.DrawText(String.Format("{0:n0}", Int32.Parse(Globals.PiDump.dns_queries_today)), x: 40, y: 5, width: 0, height: 40, fontSize: 15, color: BitmapColor.White);
bitmapBuilder.DrawText("DNS queries\ntoday", x: 5, y: 35, width: 70, height: 40, fontSize: 12, color: BitmapColor.White);

return bitmapBuilder.ToImage();
Expand Down
6 changes: 4 additions & 2 deletions PiholePlugin/Actions/DomainsBlocked.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ protected override Boolean OnLoad()
{
this._plugin = base.Plugin as PiholePlugin;
if (this._plugin is null)
{
return false;
}

this._plugin.UpdatedStatus += (sender, e) => this.ActionImageChanged("");
return base.OnLoad();
Expand All @@ -42,15 +44,15 @@ protected override BitmapImage GetCommandImage(String actionParameter, PluginIma
return bitmapBuilder.ToImage();
}
}
var currentState = Globals.PiDump.Status == "enabled";
var currentState = Globals.PiDump.status == "enabled";
using (var bitmapBuilder = new BitmapBuilder(imageSize))
{
bitmapBuilder.DrawRectangle(0, 0, 80, 80, BitmapColor.Black);
bitmapBuilder.FillRectangle(0, 0, 80, 80, BitmapColor.Black);
bitmapBuilder.SetBackgroundImage(currentState ? EmbeddedResources.ReadImage(EmbeddedResources.FindFile("piholeOn.png")) : EmbeddedResources.ReadImage(EmbeddedResources.FindFile("piholeOff.png")));
bitmapBuilder.DrawRectangle(0, 0, 80, 80, BitmapColor.Transparent);
bitmapBuilder.FillRectangle(0, 0, 80, 80, color: new BitmapColor(0, 0, 0, 140));
bitmapBuilder.DrawText(String.Format("{0:n0}", Int32.Parse(Globals.PiDump.DomainsBeingBlocked)), x: 40, y: 5, width: 0, height: 40, color: BitmapColor.White);
bitmapBuilder.DrawText(String.Format("{0:n0}", Int32.Parse(Globals.PiDump.domains_being_blocked)), x: 40, y: 5, width: 0, height: 40, color: BitmapColor.White);
bitmapBuilder.DrawText("Domains\nblocked", x: 5, y: 35, width: 70, height: 40, fontSize: 12, color: BitmapColor.White);

return bitmapBuilder.ToImage();
Expand Down
2 changes: 1 addition & 1 deletion PiholePlugin/Actions/Enable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ protected override BitmapImage GetCommandImage(String actionParameter, PluginIma
return bitmapBuilder.ToImage();
}
}
currentState = Globals.PiDump.Status == "enabled";
currentState = Globals.PiDump.status == "enabled";
using (var bitmapBuilder = new BitmapBuilder(imageSize))
{
bitmapBuilder.DrawRectangle(0, 0, 80, 80, BitmapColor.Black);
Expand Down
6 changes: 4 additions & 2 deletions PiholePlugin/Actions/GravityLastUpdated.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ protected override Boolean OnLoad()
{
this._plugin = base.Plugin as PiholePlugin;
if (this._plugin is null)
{
return false;
}

this._plugin.UpdatedStatus += (sender, e) => this.ActionImageChanged("");
return base.OnLoad();
Expand All @@ -42,15 +44,15 @@ protected override BitmapImage GetCommandImage(String actionParameter, PluginIma
return bitmapBuilder.ToImage();
}
}
var currentState = Globals.PiDump.Status == "enabled";
var currentState = Globals.PiDump.status == "enabled";
using (var bitmapBuilder = new BitmapBuilder(imageSize))
{
bitmapBuilder.DrawRectangle(0, 0, 80, 80, BitmapColor.Black);
bitmapBuilder.FillRectangle(0, 0, 80, 80, BitmapColor.Black);
bitmapBuilder.SetBackgroundImage(currentState ? EmbeddedResources.ReadImage(EmbeddedResources.FindFile("piholeOn.png")) : EmbeddedResources.ReadImage(EmbeddedResources.FindFile("piholeOff.png")));
bitmapBuilder.DrawRectangle(0, 0, 80, 80, BitmapColor.Transparent);
bitmapBuilder.FillRectangle(0, 0, 80, 80, color: new BitmapColor(0, 0, 0, 140));
bitmapBuilder.DrawText($"{Globals.PiDump.GravityLastUpdated.Relative.Days}d {Globals.PiDump.GravityLastUpdated.Relative.Hours}h {Globals.PiDump.GravityLastUpdated.Relative.Minutes}m", x: 0, y: 5, width: 80, height: 40, fontSize: 15, color: BitmapColor.White);
bitmapBuilder.DrawText($"{Globals.PiDump.gravity_last_updated.relative.days}d {Globals.PiDump.gravity_last_updated.relative.hours}h {Globals.PiDump.gravity_last_updated.relative.minutes}m", x: 0, y: 5, width: 80, height: 40, fontSize: 15, color: BitmapColor.White);
bitmapBuilder.DrawText("Gravity last\nupdated", x: 5, y: 35, width: 70, height: 40, fontSize: 12, color: BitmapColor.White);

return bitmapBuilder.ToImage();
Expand Down
6 changes: 4 additions & 2 deletions PiholePlugin/Actions/PrivacyLevel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ protected override Boolean OnLoad()
{
this._plugin = base.Plugin as PiholePlugin;
if (this._plugin is null)
{
return false;
}

this._plugin.UpdatedStatus += (sender, e) => this.ActionImageChanged("");
return base.OnLoad();
Expand All @@ -42,15 +44,15 @@ protected override BitmapImage GetCommandImage(String actionParameter, PluginIma
return bitmapBuilder.ToImage();
}
}
var currentState = Globals.PiDump.Status == "enabled";
var currentState = Globals.PiDump.status == "enabled";
using (var bitmapBuilder = new BitmapBuilder(imageSize))
{
bitmapBuilder.DrawRectangle(0, 0, 80, 80, BitmapColor.Black);
bitmapBuilder.FillRectangle(0, 0, 80, 80, BitmapColor.Black);
bitmapBuilder.SetBackgroundImage(currentState ? EmbeddedResources.ReadImage(EmbeddedResources.FindFile("piholeOn.png")) : EmbeddedResources.ReadImage(EmbeddedResources.FindFile("piholeOff.png")));
bitmapBuilder.DrawRectangle(0, 0, 80, 80, BitmapColor.Transparent);
bitmapBuilder.FillRectangle(0, 0, 80, 80, color: new BitmapColor(0, 0, 0, 140));
bitmapBuilder.DrawText(String.Format("{0:n0}", Int32.Parse(Globals.PiDump.PrivacyLevel)), x: 40, y: 5, width: 0, height: 40, fontSize: 15, color: BitmapColor.White);
bitmapBuilder.DrawText(String.Format("{0:n0}", Int32.Parse(Globals.PiDump.privacy_level)), x: 40, y: 5, width: 0, height: 40, fontSize: 15, color: BitmapColor.White);
bitmapBuilder.DrawText("Privacy\nlevel", x: 5, y: 35, width: 70, height: 40, fontSize: 12, color: BitmapColor.White);

return bitmapBuilder.ToImage();
Expand Down
6 changes: 4 additions & 2 deletions PiholePlugin/Actions/QueriesCached.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ protected override Boolean OnLoad()
{
this._plugin = base.Plugin as PiholePlugin;
if (this._plugin is null)
{
return false;
}

this._plugin.UpdatedStatus += (sender, e) => this.ActionImageChanged("");
return base.OnLoad();
Expand All @@ -42,15 +44,15 @@ protected override BitmapImage GetCommandImage(String actionParameter, PluginIma
return bitmapBuilder.ToImage();
}
}
var currentState = Globals.PiDump.Status == "enabled";
var currentState = Globals.PiDump.status == "enabled";
using (var bitmapBuilder = new BitmapBuilder(imageSize))
{
bitmapBuilder.DrawRectangle(0, 0, 80, 80, BitmapColor.Black);
bitmapBuilder.FillRectangle(0, 0, 80, 80, BitmapColor.Black);
bitmapBuilder.SetBackgroundImage(currentState ? EmbeddedResources.ReadImage(EmbeddedResources.FindFile("piholeOn.png")) : EmbeddedResources.ReadImage(EmbeddedResources.FindFile("piholeOff.png")));
bitmapBuilder.DrawRectangle(0, 0, 80, 80, BitmapColor.Transparent);
bitmapBuilder.FillRectangle(0, 0, 80, 80, color: new BitmapColor(0, 0, 0, 140));
bitmapBuilder.DrawText(String.Format("{0:n0}", Int32.Parse(Globals.PiDump.QueriesCached)), x: 40, y: 5, width: 0, height: 40, fontSize: 15, color: BitmapColor.White);
bitmapBuilder.DrawText(String.Format("{0:n0}", Int32.Parse(Globals.PiDump.queries_cached)), x: 40, y: 5, width: 0, height: 40, fontSize: 15, color: BitmapColor.White);
bitmapBuilder.DrawText("Queries\ncached", x: 5, y: 35, width: 70, height: 40, fontSize: 12, color: BitmapColor.White);

return bitmapBuilder.ToImage();
Expand Down
6 changes: 4 additions & 2 deletions PiholePlugin/Actions/QueriesForwarded.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ protected override Boolean OnLoad()
{
this._plugin = base.Plugin as PiholePlugin;
if (this._plugin is null)
{
return false;
}

this._plugin.UpdatedStatus += (sender, e) => this.ActionImageChanged("");
return base.OnLoad();
Expand All @@ -42,15 +44,15 @@ protected override BitmapImage GetCommandImage(String actionParameter, PluginIma
return bitmapBuilder.ToImage();
}
}
var currentState = Globals.PiDump.Status == "enabled";
var currentState = Globals.PiDump.status == "enabled";
using (var bitmapBuilder = new BitmapBuilder(imageSize))
{
bitmapBuilder.DrawRectangle(0, 0, 80, 80, BitmapColor.Black);
bitmapBuilder.FillRectangle(0, 0, 80, 80, BitmapColor.Black);
bitmapBuilder.SetBackgroundImage(currentState ? EmbeddedResources.ReadImage(EmbeddedResources.FindFile("piholeOn.png")) : EmbeddedResources.ReadImage(EmbeddedResources.FindFile("piholeOff.png")));
bitmapBuilder.DrawRectangle(0, 0, 80, 80, BitmapColor.Transparent);
bitmapBuilder.FillRectangle(0, 0, 80, 80, color: new BitmapColor(0, 0, 0, 140));
bitmapBuilder.DrawText(String.Format("{0:n0}", Int32.Parse(Globals.PiDump.QueriesForwarded)), x: 40, y: 5, width: 0, height: 40, fontSize: 15, color: BitmapColor.White);
bitmapBuilder.DrawText(String.Format("{0:n0}", Int32.Parse(Globals.PiDump.queries_forwarded)), x: 40, y: 5, width: 0, height: 40, fontSize: 15, color: BitmapColor.White);
bitmapBuilder.DrawText("Queries\nforwarded", x: 5, y: 35, width: 70, height: 40, fontSize: 12, color: BitmapColor.White);

return bitmapBuilder.ToImage();
Expand Down
Loading

0 comments on commit 9bfc5f4

Please sign in to comment.