diff --git a/Core/Handling/ContextMenuBase.cs b/Core/Handling/ContextMenuBase.cs index 357295d1..a3da730f 100644 --- a/Core/Handling/ContextMenuBase.cs +++ b/Core/Handling/ContextMenuBase.cs @@ -195,15 +195,15 @@ public virtual bool RunContextMenu(IWebBrowser browserControl, IBrowser browser, return false; } - protected void DeselectAll(IFrame frame){ + protected static void DeselectAll(IFrame frame){ ScriptLoader.ExecuteScript(frame, "window.getSelection().removeAllRanges()", "gen:deselect"); } - protected void OpenBrowser(Control control, string url){ + protected static void OpenBrowser(Control control, string url){ control.InvokeAsyncSafe(() => BrowserUtils.OpenExternalBrowser(url)); } - protected void SetClipboardText(Control control, string text){ + protected static void SetClipboardText(Control control, string text){ control.InvokeAsyncSafe(() => WindowsUtils.SetClipboard(text, TextDataFormat.UnicodeText)); } diff --git a/Core/Notification/FormNotificationBase.cs b/Core/Notification/FormNotificationBase.cs index 1b951ff0..f60aa20a 100644 --- a/Core/Notification/FormNotificationBase.cs +++ b/Core/Notification/FormNotificationBase.cs @@ -63,7 +63,7 @@ protected virtual Point PrimaryLocation{ } } - public bool IsNotificationVisible => Location != ControlExtensions.InvisibleLocation; + protected bool IsNotificationVisible => Location != ControlExtensions.InvisibleLocation; protected virtual bool CanDragWindow => true; public new Point Location{ @@ -107,8 +107,8 @@ protected virtual FormBorderStyle NotificationBorderStyle{ public string CurrentQuoteUrl => currentNotification?.QuoteUrl; public bool CanViewDetail => currentNotification != null && !string.IsNullOrEmpty(currentNotification.ColumnId) && !string.IsNullOrEmpty(currentNotification.ChirpId); - public bool IsPaused => pauseCounter > 0; + protected bool IsPaused => pauseCounter > 0; protected bool IsCursorOverBrowser => browser.Bounds.Contains(PointToClient(Cursor.Position)); public bool FreezeTimer { get; set; } diff --git a/Resources/PostBuild.ps1 b/Resources/PostBuild.ps1 index a01e0563..3c21c567 100644 --- a/Resources/PostBuild.ps1 +++ b/Resources/PostBuild.ps1 @@ -114,7 +114,7 @@ try{ Write-Host "------------------" $sw.Stop() Write-Host "Finished in" $([math]::Round($sw.Elapsed.TotalMilliseconds)) "ms" - Write-Host ------------------ + Write-Host "------------------" }catch{ Write-Host "Encountered an error while running PostBuild.ps1 on line" $_.InvocationInfo.ScriptLineNumber Write-Host $_ diff --git a/Updates/UpdateInfo.cs b/Updates/UpdateInfo.cs index 567c822e..f92aafd2 100644 --- a/Updates/UpdateInfo.cs +++ b/Updates/UpdateInfo.cs @@ -22,7 +22,7 @@ public UpdateInfo(string versionTag, string releaseNotes, string downloadUrl, st this.VersionTag = versionTag; this.ReleaseNotes = releaseNotes; - this.InstallerPath = Path.Combine(installerFolder, $"TweetDuck.{versionTag}.exe");; + this.InstallerPath = Path.Combine(installerFolder, $"TweetDuck.{versionTag}.exe"); } public void BeginSilentDownload(){ diff --git a/bld/gen_full.iss b/bld/gen_full.iss index 698263a3..dbeb1fa0 100644 --- a/bld/gen_full.iss +++ b/bld/gen_full.iss @@ -82,16 +82,16 @@ begin if (TDGetNetFrameworkVersion() < 379893) and (MsgBox('{#MyAppName} requires .NET Framework 4.5.2 or newer,'+#13+#10+'please visit {#MyAppShortURL} for a download link.'+#13+#10+#13+#10'Do you want to proceed with the setup anyway?', mbCriticalError, MB_YESNO or MB_DEFBUTTON2) = IDNO) then begin - Result := False; - Exit; + Result := False + Exit end; if (TDIsVCMissing() or (ForceRedistPrompt = '1')) and (MsgBox('Microsoft Visual C++ 2015 appears to be missing, would you like to automatically install it?', mbConfirmation, MB_YESNO) = IDYES) then begin - idpAddFile('https://github.com/{#MyAppPublisher}/{#MyAppName}/{#VCRedistLink}', ExpandConstant('{tmp}\{#MyAppName}.VC.exe')); + idpAddFile('https://github.com/{#MyAppPublisher}/{#MyAppName}/{#VCRedistLink}', ExpandConstant('{tmp}\{#MyAppName}.VC.exe')) end; - Result := True; + Result := True end; { Set the installation path if updating, and prepare download plugin if there are any files to download. } @@ -99,12 +99,12 @@ procedure InitializeWizard(); begin if (UpdatePath <> '') then begin - WizardForm.DirEdit.Text := UpdatePath; + WizardForm.DirEdit.Text := UpdatePath end; if (idpFilesCount <> 0) then begin - idpDownloadAfter(wpReady); + idpDownloadAfter(wpReady) end; end; @@ -130,7 +130,7 @@ procedure CurStepChanged(CurStep: TSetupStep); begin if CurStep = ssInstall then begin - TDInstallVCRedist(); + TDInstallVCRedist() end; end; @@ -147,9 +147,9 @@ begin if (DirExists(ProfileDataFolder) or DirExists(PluginDataFolder)) and (MsgBox('Do you also want to delete your {#MyAppName} profile and plugins?', mbConfirmation, MB_YESNO or MB_DEFBUTTON2) = IDYES) then begin - DelTree(ProfileDataFolder, True, True, True); - DelTree(PluginDataFolder, True, True, True); - DelTree(ExpandConstant('{app}'), True, False, False); + DelTree(ProfileDataFolder, True, True, True) + DelTree(PluginDataFolder, True, True, True) + DelTree(ExpandConstant('{app}'), True, False, False) end; end; end; @@ -167,11 +167,11 @@ var FrameworkVersion: Cardinal; begin if RegQueryDWordValue(HKEY_LOCAL_MACHINE, 'Software\Microsoft\NET Framework Setup\NDP\v4\Full', 'Release', FrameworkVersion) then begin - Result := FrameworkVersion; - Exit; + Result := FrameworkVersion + Exit end; - Result := 0; + Result := 0 end; { Check if Visual C++ 2015 or 2017 is installed. } @@ -186,20 +186,20 @@ begin begin for Index := 0 to GetArrayLength(Keys)-1 do begin - Key := Keys[Index]; + Key := Keys[Index] if RegQueryStringValue(HKEY_LOCAL_MACHINE, 'Software\Classes\Installer\Dependencies\'+Key, 'DisplayName', DisplayName) then begin if (Pos('Microsoft Visual C++', DisplayName) = 1) and (Pos('(x86)', DisplayName) > 1) and ((Pos(' 2015 ', DisplayName) > 1) or (Pos(' 2017 ', DisplayName) > 1)) then begin - Result := False; - Exit; + Result := False + Exit end; end; end; end; - Result := True; + Result := True end; { Run the Visual C++ installer if downloaded. } @@ -212,26 +212,26 @@ begin if FileExists(InstallFile) then begin - WizardForm.ProgressGauge.Style := npbstMarquee; + WizardForm.ProgressGauge.Style := npbstMarquee try if Exec(InstallFile, '/passive /norestart', '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then begin if ResultCode <> 0 then begin - DeleteFile(InstallFile); - Exit; + DeleteFile(InstallFile) + Exit end; end else begin MsgBox('Could not run the Visual C++ installer, please visit https://github.com/{#MyAppPublisher}/{#MyAppName}/{#VCRedistLink} and download the latest version manually. Error: '+SysErrorMessage(ResultCode), mbCriticalError, MB_OK); - DeleteFile(InstallFile); - Exit; + DeleteFile(InstallFile) + Exit end; finally - WizardForm.ProgressGauge.Style := npbstNormal; - DeleteFile(InstallFile); + WizardForm.ProgressGauge.Style := npbstNormal + DeleteFile(InstallFile) end; end; end; diff --git a/bld/gen_port.iss b/bld/gen_port.iss index 7069eeb7..f1449d6d 100644 --- a/bld/gen_port.iss +++ b/bld/gen_port.iss @@ -70,16 +70,16 @@ begin if (TDGetNetFrameworkVersion() < 379893) and (MsgBox('{#MyAppName} requires .NET Framework 4.5.2 or newer,'+#13+#10+'please visit {#MyAppShortURL} for a download link.'+#13+#10+#13+#10'Do you want to proceed with the setup anyway?', mbCriticalError, MB_YESNO or MB_DEFBUTTON2) = IDNO) then begin - Result := False; - Exit; + Result := False + Exit end; if (TDIsVCMissing() or (ForceRedistPrompt = '1')) and (MsgBox('Microsoft Visual C++ 2015 appears to be missing, would you like to automatically install it?', mbConfirmation, MB_YESNO) = IDYES) then begin - idpAddFile('https://github.com/{#MyAppPublisher}/{#MyAppName}/{#VCRedistLink}', ExpandConstant('{tmp}\{#MyAppName}.VC.exe')); + idpAddFile('https://github.com/{#MyAppPublisher}/{#MyAppName}/{#VCRedistLink}', ExpandConstant('{tmp}\{#MyAppName}.VC.exe')) end; - Result := True; + Result := True end; { Set the installation path if updating, and prepare download plugin if there are any files to download. } @@ -87,12 +87,12 @@ procedure InitializeWizard(); begin if (UpdatePath <> '') then begin - WizardForm.DirEdit.Text := UpdatePath; + WizardForm.DirEdit.Text := UpdatePath end; if (idpFilesCount <> 0) then begin - idpDownloadAfter(wpReady); + idpDownloadAfter(wpReady) end; end; @@ -124,7 +124,7 @@ begin begin if MsgBox('Could not create a ''makeportable'' file in the installation folder. If the file is not present, the installation will not be fully portable.', mbCriticalError, MB_RETRYCANCEL) <> IDRETRY then begin - break; + break end; end; end; @@ -137,11 +137,11 @@ var FrameworkVersion: Cardinal; begin if RegQueryDWordValue(HKEY_LOCAL_MACHINE, 'Software\Microsoft\NET Framework Setup\NDP\v4\Full', 'Release', FrameworkVersion) then begin - Result := FrameworkVersion; - Exit; + Result := FrameworkVersion + Exit end; - Result := 0; + Result := 0 end; { Check if Visual C++ 2015 or 2017 is installed. } @@ -156,20 +156,20 @@ begin begin for Index := 0 to GetArrayLength(Keys)-1 do begin - Key := Keys[Index]; + Key := Keys[Index] if RegQueryStringValue(HKEY_LOCAL_MACHINE, 'Software\Classes\Installer\Dependencies\'+Key, 'DisplayName', DisplayName) then begin if (Pos('Microsoft Visual C++', DisplayName) = 1) and (Pos('(x86)', DisplayName) > 1) and ((Pos(' 2015 ', DisplayName) > 1) or (Pos(' 2017 ', DisplayName) > 1)) then begin - Result := False; - Exit; + Result := False + Exit end; end; end; end; - Result := True; + Result := True end; { Run the Visual C++ installer if downloaded. } @@ -182,26 +182,26 @@ begin if FileExists(InstallFile) then begin - WizardForm.ProgressGauge.Style := npbstMarquee; + WizardForm.ProgressGauge.Style := npbstMarquee try if Exec(InstallFile, '/passive /norestart', '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then begin if ResultCode <> 0 then begin - DeleteFile(InstallFile); - Exit; + DeleteFile(InstallFile) + Exit end; end else begin MsgBox('Could not run the Visual C++ installer, please visit https://github.com/{#MyAppPublisher}/{#MyAppName}/{#VCRedistLink} and download the latest version manually. Error: '+SysErrorMessage(ResultCode), mbCriticalError, MB_OK); - DeleteFile(InstallFile); - Exit; + DeleteFile(InstallFile) + Exit end; finally - WizardForm.ProgressGauge.Style := npbstNormal; - DeleteFile(InstallFile); + WizardForm.ProgressGauge.Style := npbstNormal + DeleteFile(InstallFile) end; end; end; diff --git a/bld/gen_upd.iss b/bld/gen_upd.iss index 1fe9e00c..96429544 100644 --- a/bld/gen_upd.iss +++ b/bld/gen_upd.iss @@ -139,34 +139,34 @@ begin if UpdatePath = '' then begin - MsgBox('{#MyAppName} installation could not be found on your system.', mbCriticalError, MB_OK); - Result := False; - Exit; + MsgBox('{#MyAppName} installation could not be found on your system.', mbCriticalError, MB_OK) + Result := False + Exit end; if not TDIsMatchingCEFVersion() then begin - idpAddFile('https://github.com/{#MyAppPublisher}/{#MyAppName}/releases/download/'+TDGetAppVersionClean()+'/'+TDGetFullDownloadFileName(), ExpandConstant('{tmp}\{#MyAppName}.Full.exe')); + idpAddFile('https://github.com/{#MyAppPublisher}/{#MyAppName}/releases/download/'+TDGetAppVersionClean()+'/'+TDGetFullDownloadFileName(), ExpandConstant('{tmp}\{#MyAppName}.Full.exe')) end; if (TDGetNetFrameworkVersion() < 379893) and (MsgBox('{#MyAppName} requires .NET Framework 4.5.2 or newer,'+#13+#10+'please visit {#MyAppShortURL} for a download link.'+#13+#10+#13+#10'Do you want to proceed with the setup anyway?', mbCriticalError, MB_YESNO or MB_DEFBUTTON2) = IDNO) then begin - Result := False; - Exit; + Result := False + Exit end; - Result := True; + Result := True end; { Prepare download plugin if there are any files to download, and set the installation path. } procedure InitializeWizard(); begin - WizardForm.Caption := WizardForm.Caption + ' Update'; - WizardForm.DirEdit.Text := UpdatePath; + WizardForm.Caption := WizardForm.Caption + ' Update' + WizardForm.DirEdit.Text := UpdatePath if idpFilesCount <> 0 then begin - idpDownloadAfter(wpReady); + idpDownloadAfter(wpReady) end; end; @@ -178,14 +178,14 @@ var PluginDataFolder: String; begin if CurUninstallStep = usPostUninstall then begin - ProfileDataFolder := ExpandConstant('{localappdata}\{#MyAppName}'); - PluginDataFolder := ExpandConstant('{app}\plugins'); + ProfileDataFolder := ExpandConstant('{localappdata}\{#MyAppName}') + PluginDataFolder := ExpandConstant('{app}\plugins') if (DirExists(ProfileDataFolder) or DirExists(PluginDataFolder)) and (MsgBox('Do you also want to delete your {#MyAppName} profile and plugins?', mbConfirmation, MB_YESNO or MB_DEFBUTTON2) = IDYES) then begin - DelTree(ProfileDataFolder, True, True, True); - DelTree(PluginDataFolder, True, True, True); - DelTree(ExpandConstant('{app}'), True, False, False); + DelTree(ProfileDataFolder, True, True, True) + DelTree(PluginDataFolder, True, True, True) + DelTree(ExpandConstant('{app}'), True, False, False) end; end; end; @@ -195,12 +195,12 @@ procedure CurStepChanged(CurStep: TSetupStep); begin if CurStep = ssInstall then begin - TDExecuteFullDownload(); + TDExecuteFullDownload() if TDIsUninstallable() then begin - DeleteFile(ExpandConstant('{app}\unins000.dat')); - DeleteFile(ExpandConstant('{app}\unins000.exe')); + DeleteFile(ExpandConstant('{app}\unins000.dat')) + DeleteFile(ExpandConstant('{app}\unins000.exe')) end; end; end; @@ -255,11 +255,11 @@ var FrameworkVersion: Cardinal; begin if RegQueryDWordValue(HKEY_LOCAL_MACHINE, 'Software\Microsoft\NET Framework Setup\NDP\v4\Full', 'Release', FrameworkVersion) then begin - Result := FrameworkVersion; - Exit; + Result := FrameworkVersion + Exit end; - Result := 0; + Result := 0 end; { Return the name of the full installer file to download from GitHub. } @@ -276,8 +276,8 @@ var TmpTDVersion: String; begin if GetVersionNumbersString(UpdatePath+'TweetDuck.exe', TmpTDVersion) and (CompareStr(TmpTDVersion, '1.13.0.0') = 0) then begin - Result := False; - Exit; + Result := False + Exit end; Result := (GetVersionNumbersString(UpdatePath+'libcef.dll', CEFVersion) and (CompareStr(CEFVersion, '{#CefVersion}') = 0)) @@ -293,17 +293,17 @@ begin while True do begin - Substr := Copy(CleanVersion, Length(CleanVersion)-1, 2); + Substr := Copy(CleanVersion, Length(CleanVersion)-1, 2) if (CompareStr(Substr, '.0') <> 0) then begin - break; + break end; - CleanVersion := Copy(CleanVersion, 1, Length(CleanVersion)-2); + CleanVersion := Copy(CleanVersion, 1, Length(CleanVersion)-2) end; - Result := CleanVersion; + Result := CleanVersion end; { Run the full package installer if downloaded. } @@ -316,28 +316,28 @@ begin if FileExists(InstallFile) then begin - WizardForm.ProgressGauge.Style := npbstMarquee; + WizardForm.ProgressGauge.Style := npbstMarquee try if Exec(InstallFile, '/SP- /SILENT /UPDATEPATH="'+UpdatePath+'"', '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then begin if ResultCode <> 0 then begin - DeleteFile(InstallFile); - Abort(); - Exit; + DeleteFile(InstallFile) + Abort() + Exit end; end else begin - MsgBox('Could not run the full installer, please visit {#MyAppURL} and download the latest version manually. Error: '+SysErrorMessage(ResultCode), mbCriticalError, MB_OK); + MsgBox('Could not run the full installer, please visit {#MyAppURL} and download the latest version manually. Error: '+SysErrorMessage(ResultCode), mbCriticalError, MB_OK) - DeleteFile(InstallFile); - Abort(); - Exit; + DeleteFile(InstallFile) + Abort() + Exit end; finally - WizardForm.ProgressGauge.Style := npbstNormal; - DeleteFile(InstallFile); + WizardForm.ProgressGauge.Style := npbstNormal + DeleteFile(InstallFile) end; end; end;