diff --git a/EZBlocker/EZBlocker/EZBlocker.csproj b/EZBlocker/EZBlocker/EZBlocker.csproj index 73388ef2..7fe9b2d4 100644 --- a/EZBlocker/EZBlocker/EZBlocker.csproj +++ b/EZBlocker/EZBlocker/EZBlocker.csproj @@ -106,10 +106,6 @@ EZBlockerMain.cs Designer - - - - ResXFileCodeGenerator strings.Designer.cs diff --git a/EZBlocker/EZBlocker/EZBlockerMain.cs b/EZBlocker/EZBlocker/EZBlockerMain.cs index 7ee34682..d90b6885 100644 --- a/EZBlocker/EZBlocker/EZBlockerMain.cs +++ b/EZBlocker/EZBlocker/EZBlockerMain.cs @@ -49,7 +49,7 @@ private void MainTimer_Tick(object sender, EventArgs e) try { if (hook.IsRunning()) { - if (listener.Message.Equals("true")) + if (hook.IsAdPlaying()) { if (MainTimer.Interval != 1000) MainTimer.Interval = 1000; if (!muted) Mute(true); @@ -88,7 +88,7 @@ private void MainTimer_Tick(object sender, EventArgs e) LogAction("/play/" + artist); } } - else + else if (hook.WindowName.Equals("Spotify")) { string message = Properties.strings.StatusPaused; if (lastMessage != message) @@ -176,7 +176,6 @@ private void LogAction(string action) **/ private void Heartbeat_Tick(object sender, EventArgs e) { - CheckPatch(false); if (DateTime.Now - lastRequest > TimeSpan.FromMinutes(5)) { LogAction("/heartbeat"); @@ -216,10 +215,6 @@ private void Main_Load(object sender, EventArgs e) return; } - // Patch Spotify - patcher = new SpotifyPatcher(); - CheckPatch(true); - // Start Spotify and give EZBlocker higher priority try { @@ -263,9 +258,9 @@ private void Main_Load(object sender, EventArgs e) // Start Spotify hook hook = new SpotifyHook(); - // Start EZBlocker listener + /* Start EZBlocker listener listener = new Listener(); - Task.Run(() => listener.Listen()); + Task.Run(() => listener.Listen()); */ MainTimer.Enabled = true; @@ -459,7 +454,6 @@ protected override void OnFormClosing(FormClosingEventArgs e) Properties.Settings.Default.Save(); } } - listener.Stop(); } [DllImport("shell32.dll")] diff --git a/EZBlocker/EZBlocker/EZBlockerMain.resx b/EZBlocker/EZBlocker/EZBlockerMain.resx index b2e6b8b0..06e87711 100644 --- a/EZBlocker/EZBlocker/EZBlockerMain.resx +++ b/EZBlocker/EZBlocker/EZBlockerMain.resx @@ -127,23 +127,8 @@ 348, 16 - - 289, 24 - - - 289, 24 - - - 289, 24 - - - 286, 6 - - - 289, 24 - - 290, 106 + 319, 122 NotifyIconContextMenu @@ -7367,15 +7352,36 @@ True + + 318, 28 + + + 318, 28 + + + 318, 28 + + + False + + + 315, 6 + + + 318, 28 + True + + Microsoft Sans Serif, 8.059701pt + NoControl - 179, 133 + 173, 134 4, 0, 4, 0 @@ -7384,7 +7390,7 @@ Yes - 107, 17 + 113, 18 5 @@ -7407,6 +7413,9 @@ 242, 16 + + Microsoft Sans Serif, 8.059701pt + NoControl @@ -7438,19 +7447,19 @@ True - Microsoft Sans Serif, 8.25pt + Microsoft Sans Serif, 8.059701pt NoControl - 13, 133 + 13, 134 4, 0, 4, 0 - 71, 17 + 72, 18 9 @@ -7473,6 +7482,9 @@ True + + Microsoft Sans Serif, 8.059701pt + NoControl @@ -7483,7 +7495,7 @@ 4, 4, 4, 4 - 139, 21 + 148, 22 10 @@ -7503,6 +7515,9 @@ True + + Microsoft Sans Serif, 8.059701pt + NoControl @@ -7513,7 +7528,7 @@ 4, 4, 4, 4 - 185, 21 + 196, 22 11 @@ -7533,6 +7548,9 @@ True + + Microsoft Sans Serif, 8.059701pt + NoControl @@ -7543,7 +7561,7 @@ 4, 4, 4, 4 - 201, 21 + 214, 22 12 @@ -7567,7 +7585,7 @@ 8, 16 - 298, 160 + 291, 163 diff --git a/EZBlocker/EZBlocker/Properties/AssemblyInfo.cs b/EZBlocker/EZBlocker/Properties/AssemblyInfo.cs index 845d81b9..e2395f7e 100644 --- a/EZBlocker/EZBlocker/Properties/AssemblyInfo.cs +++ b/EZBlocker/EZBlocker/Properties/AssemblyInfo.cs @@ -31,5 +31,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.7.2.5")] -[assembly: AssemblyFileVersion("1.7.2.5")] +[assembly: AssemblyVersion("1.7.3.0")] +[assembly: AssemblyFileVersion("1.7.3.0")] diff --git a/EZBlocker/EZBlocker/Properties/strings.de.resx b/EZBlocker/EZBlocker/Properties/strings.de.resx deleted file mode 100644 index 0aaf0cb9..00000000 --- a/EZBlocker/EZBlocker/Properties/strings.de.resx +++ /dev/null @@ -1,239 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Block Banner Ads - On main form - - - You may need to restart Spotify or your computer for this setting to take effect. - BlockBannersCheckbox - - - Enabling/Disabling this option requires Administrator privileges. - -Please reopen EZBlocker with "Run as Administrator". - BlockBannersCheckbox - - - EZBlocker is hidden. Double-click this icon to restore. - NotifyIcon - - - Spotify ads will not be muted if EZBlocker is not running. - -Are you sure you want to exit? - OnFormClosing - - - Error patching Spotify. EZBlocker may not work. - On startup - - - EZBlocker Version: {0} -Spotify Version: {1} - ReportProblemLink - - - Please leave a comment clearly describing your problem. - -Paste this information (already copied to your clipboard): -EZBlocker Version: {0} -Spotify Version: {1} - ReportProblemLink - - - Start Spotify with EZBlocker - On main form - - - Spotify is not installed or you have the Windows Store version. - -Click 'OK' to install the normal desktop version of Spotify. - On startup - - - Start EZBlocker on Login - On main form - - - Loading... - On main form - - - Muting: - Status label - - - Spotify not found. - Status label - - - Spotify is paused - Status label - - - Playing: - Status label - - - Exit - In tray menu - - - Open EZBlocker - In tray menu - - - Remove Patch - In tray menu - - - EZBlocker Website - In tray menu - - - Failed to uninstall patch. - RemovePatch - - - EZBlocker patch uninstalled. - RemovePatch - - - Error checking for update. - CheckUpdate - - - There is a newer version of EZBlocker available. Would you like to upgrade? - CheckUpdate - - - Open Volume Control - On main form - - - Could not open Volume Mixer. - VolumeMixerButton - - - Report Problem - On main form - - \ No newline at end of file diff --git a/EZBlocker/EZBlocker/Properties/strings.es.resx b/EZBlocker/EZBlocker/Properties/strings.es.resx deleted file mode 100644 index 6e42612a..00000000 --- a/EZBlocker/EZBlocker/Properties/strings.es.resx +++ /dev/null @@ -1,239 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Block Banner Ads - On main form - - - You may need to restart Spotify or your computer for this setting to take effect. - BlockBannersCheckbox - - - Enabling/Disabling this option requires Administrator privileges. - -Please reopen EZBlocker with "Run as Administrator". - BlockBannersCheckbox - - - EZBlocker is hidden. Double-click this icon to restore. - NotifyIcon - - - Spotify ads will not be muted if EZBlocker is not running. - -Are you sure you want to exit? - OnFormClosing - - - Error patching Spotify. EZBlocker may not work. - On startup - - - EZBlocker Version: {0} -Spotify Version: {1} - ReportProblemLink - - - Please leave a comment clearly describing your problem. - -Paste this information (already copied to your clipboard): -EZBlocker Version: {0} -Spotify Version: {1} - ReportProblemLink - - - Start Spotify with EZBlocker - On main form - - - Spotify is not installed or you have the Windows Store version. - -Click 'OK' to install the normal desktop version of Spotify. - On startup - - - Start EZBlocker on Login - On main form - - - Loading... - On main form - - - Muting: - Status label - - - Spotify not found. - Status label - - - Spotify is paused - Status label - - - Playing: - Status label - - - Exit - In tray menu - - - Open EZBlocker - In tray menu - - - Remove Patch - In tray menu - - - EZBlocker Website - In tray menu - - - Failed to uninstall patch. - RemovePatch - - - EZBlocker patch uninstalled. - RemovePatch - - - Error checking for update. - CheckUpdate - - - There is a newer version of EZBlocker available. Would you like to upgrade? - CheckUpdate - - - Open Volume Control - On main form - - - Could not open Volume Mixer. - VolumeMixerButton - - - Report Problem - On main form - - \ No newline at end of file diff --git a/EZBlocker/EZBlocker/Properties/strings.fr.resx b/EZBlocker/EZBlocker/Properties/strings.fr.resx deleted file mode 100644 index 0aa59c9f..00000000 --- a/EZBlocker/EZBlocker/Properties/strings.fr.resx +++ /dev/null @@ -1,239 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Block Banner Ads - On main form - - - You may need to restart Spotify or your computer for this setting to take effect. - BlockBannersCheckbox - - - Enabling/Disabling this option requires Administrator privileges. - -Please reopen EZBlocker with "Run as Administrator". - BlockBannersCheckbox - - - EZBlocker is hidden. Double-click this icon to restore. - NotifyIcon - - - Spotify ads will not be muted if EZBlocker is not running. - -Are you sure you want to exit? - OnFormClosing - - - Error patching Spotify. EZBlocker may not work. - On startup - - - EZBlocker Version: {0} -Spotify Version: {1} - ReportProblemLink - - - Please leave a comment clearly describing your problem. - -Paste this information (already copied to your clipboard): -EZBlocker Version: {0} -Spotify Version: {1} - ReportProblemLink - - - Start Spotify with EZBlocker - On main form - - - Spotify is not installed or you have the Windows Store version. - -Click 'OK' to install the normal desktop version of Spotify. - On startup - - - Start EZBlocker on Login - On main form - - - Loading... - On main form - - - Muting: - Status label - - - Spotify not found. - Status label - - - Spotify is paused - Status label - - - Playing: - Status label - - - Exit - In tray menu - - - Open EZBlocker - In tray menu - - - Remove Patch - In tray menu - - - EZBlocker Website - In tray menu - - - Failed to uninstall patch. - RemovePatch - - - EZBlocker patch uninstalled. - RemovePatch - - - Error checking for update. - CheckUpdate - - - There is a newer version of EZBlocker available. Would you like to upgrade? - CheckUpdate - - - Open Volume Control - On main form - - - Could not open Volume Mixer. - VolumeMixerButton - - - Report Problem - On main form - - \ No newline at end of file diff --git a/EZBlocker/EZBlocker/Properties/strings.pt.resx b/EZBlocker/EZBlocker/Properties/strings.pt.resx deleted file mode 100644 index 04f8de28..00000000 --- a/EZBlocker/EZBlocker/Properties/strings.pt.resx +++ /dev/null @@ -1,242 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Bloquear Banners - On main form - - - Talvez voce precise reiniciar o Spotify ou seu computador para aplicar as configurações. - BlockBannersCheckbox - - - Habilitar/Desabilitar essa opção precisa de privilegios de Administrador. - -Por favor reabra o EZBlocker com "Executar como administrador". - BlockBannersCheckbox - - - EZBlocker esta escondido. Duplo clique nesse icone para restaurar. - NotifyIcon - - - Ads do Spotify nao serao bloqueados/mutados se o EZBlocker nao estiver sendo executado. - -Tem certeza? - OnFormClosing - - - Erro ao crackear Spotify. EZBlocker talvez nao funcione. - On startup - - - EZBlocker Versão:{0} -Spotify Versão:{1} - ReportProblemLink - - - Por favor deixe um comentário claro sobre a descrição do seu problema. - -Cole essa informação (Ja foi copiada para sua area de transferencia): -EZBlocker Versão: {0} -Spotfiy Versão : {1} - ReportProblemLink - - - Iniciar Spotify com Ezblocker - On main form - - - Spotify não esta instalado ou você possui a versão da Windows Store. - -Clique "OK" para instalar a versão desktop do Spotfiy. - On startup - - - Iniciar EZBlocker ao Logar-se - On main form - - - Carregando... - On main form - - - Mutando: - Status label - - - Spotify nao encontrado - Status label - - - Spotify esta pausado - Status label - - - Tocando: - Status label - - - Sair - In tray menu - - - Mostrar Janela EZBlocker - In tray menu - - - Remover EZBlocker do Spotfiy - In tray menu - - - Abrir EZBlocker Website - In tray menu - - - Falha ao remover EZBlocker do Spotfiy. - RemovePatch - - - Ezblocker removido do Spotfiy. - RemovePatch - - - Erro ao checar update. - CheckUpdate - - - Nova versão do EZBlocker disponível. Gostaria de atualizar? - CheckUpdate - - - Abrir Controle de Volume - On main form - - - Não foi possivel abrir o Controle de Volume. - VolumeMixerButton - - - Reportar Problema - On main form - - - Traduzido por Raí was here xD - - \ No newline at end of file diff --git a/EZBlocker/EZBlocker/SpotifyHook.cs b/EZBlocker/EZBlocker/SpotifyHook.cs index adaba625..4bbc3ba5 100644 --- a/EZBlocker/EZBlocker/SpotifyHook.cs +++ b/EZBlocker/EZBlocker/SpotifyHook.cs @@ -15,7 +15,6 @@ class SpotifyHook public IntPtr Handle { get; private set; } private readonly Timer RefreshTimer; - private int SpotifyTolerance = 0; private float peak = 0f; private float lastPeak = 0f; @@ -47,26 +46,24 @@ public SpotifyHook() public bool IsPlaying() { - return peak + lastPeak > 0; + return peak > 0 && lastPeak > 0; } public bool IsAdPlaying() { if (!WindowName.Equals("") && !WindowName.Equals("Drag") && IsPlaying()) { - if (WindowName.Equals("Spotify") && SpotifyTolerance < 3) // Prevent user pausing Spotify from being detected as ad (PeakVolume needs time to adjust) + if (WindowName.Equals("Spotify")) // Prevent user pausing Spotify from being detected as ad (PeakVolume needs time to adjust) { - Debug.WriteLine("Tolerance " + SpotifyTolerance); - SpotifyTolerance++; - return false; + Debug.WriteLine("Ad1: " + lastPeak.ToString() + " " + peak.ToString()); + return true; } else if (!WindowName.Contains(" - ")) { - SpotifyTolerance = 0; + Debug.WriteLine("Ad2: " + lastPeak.ToString() + " " + peak.ToString()); return true; } } - SpotifyTolerance = 0; return false; }