mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 11:48:06 +01:00
[PreviewPane] Enable analyzer and fix warnings (#16995)
This commit is contained in:
committed by
GitHub
parent
bf3e427017
commit
7365ba14d0
@@ -3,6 +3,7 @@
|
|||||||
// See the LICENSE file in the project root for more information.
|
// See the LICENSE file in the project root for more information.
|
||||||
|
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using Common;
|
||||||
using Microsoft.PowerToys.STATestExtension;
|
using Microsoft.PowerToys.STATestExtension;
|
||||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||||
using PreviewHandlerCommon;
|
using PreviewHandlerCommon;
|
||||||
|
|||||||
@@ -18,6 +18,8 @@
|
|||||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||||
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
|
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
|
||||||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
||||||
|
<EnableNETAnalyzers>true</EnableNETAnalyzers>
|
||||||
|
<AnalysisMode>Recommended</AnalysisMode>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ namespace Common.Utilities
|
|||||||
|
|
||||||
if (buffer == null)
|
if (buffer == null)
|
||||||
{
|
{
|
||||||
throw new NullReferenceException("buffer is null");
|
throw new ArgumentNullException(nameof(buffer), "buffer is null");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (offset < 0 || count < 0 || (offset + count) > buffer.Length)
|
if (offset < 0 || count < 0 || (offset + count) > buffer.Length)
|
||||||
|
|||||||
@@ -4,106 +4,109 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
/// <summary>
|
namespace Common
|
||||||
/// Flags to control download and execution in Web Browser Control.
|
|
||||||
/// Values of flags are defined in mshtmdid.h in distributed Windows Sdk.
|
|
||||||
/// </summary>
|
|
||||||
[Flags]
|
|
||||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1707:Identifiers should not contain underscores", Justification = "Interop, keeping stuff in sync")]
|
|
||||||
public enum WebBrowserDownloadControlFlags : int
|
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Images will be downloaded from the server if this flag is set.
|
/// Flags to control download and execution in Web Browser Control.
|
||||||
|
/// Values of flags are defined in mshtmdid.h in distributed Windows Sdk.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
DLIMAGES = 0x00000010,
|
[Flags]
|
||||||
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1707:Identifiers should not contain underscores", Justification = "Interop, keeping stuff in sync")]
|
||||||
|
public enum WebBrowserDownloadControlFlags : int
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Images will be downloaded from the server if this flag is set.
|
||||||
|
/// </summary>
|
||||||
|
DLIMAGES = 0x00000010,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Videos will be downloaded from the server if this flag is set.
|
/// Videos will be downloaded from the server if this flag is set.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
VIDEOS = 0x00000020,
|
VIDEOS = 0x00000020,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Background sounds will be downloaded from the server if this flag is set.
|
/// Background sounds will be downloaded from the server if this flag is set.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
BGSOUNDS = 0x00000040,
|
BGSOUNDS = 0x00000040,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Scripts will not be executed.
|
/// Scripts will not be executed.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
NO_SCRIPTS = 0x00000080,
|
NO_SCRIPTS = 0x00000080,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Java applets will not be executed.
|
/// Java applets will not be executed.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
NO_JAVA = 0x00000100,
|
NO_JAVA = 0x00000100,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ActiveX controls will not be executed.
|
/// ActiveX controls will not be executed.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
NO_RUNACTIVEXCTLS = 0x00000200,
|
NO_RUNACTIVEXCTLS = 0x00000200,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ActiveX controls will not be downloaded.
|
/// ActiveX controls will not be downloaded.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
NO_DLACTIVEXCTLS = 0x00000400,
|
NO_DLACTIVEXCTLS = 0x00000400,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The page will only be downloaded, not displayed.
|
/// The page will only be downloaded, not displayed.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
DOWNLOADONLY = 0x00000800,
|
DOWNLOADONLY = 0x00000800,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// WebBrowser Control will download and parse a frameSet, but not the individual frame objects within the frameSet.
|
/// WebBrowser Control will download and parse a frameSet, but not the individual frame objects within the frameSet.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
NO_FRAMEDOWNLOAD = 0x00001000,
|
NO_FRAMEDOWNLOAD = 0x00001000,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The server will be asked for update status. Cached files will be used if the server indicates that the cached information is up-to-date.
|
/// The server will be asked for update status. Cached files will be used if the server indicates that the cached information is up-to-date.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
RESYNCHRONIZE = 0x00002000,
|
RESYNCHRONIZE = 0x00002000,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Files will be re-downloaded from the server regardless of the update status of the files.
|
/// Files will be re-downloaded from the server regardless of the update status of the files.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
PRAGMA_NO_CACHE = 0x00004000,
|
PRAGMA_NO_CACHE = 0x00004000,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Behaviors are not downloaded and are disabled in the document.
|
/// Behaviors are not downloaded and are disabled in the document.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
NO_BEHAVIORS = 0x00008000,
|
NO_BEHAVIORS = 0x00008000,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Character sets specified in meta elements are suppressed.
|
/// Character sets specified in meta elements are suppressed.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
NO_METACHARSET = 0x00010000,
|
NO_METACHARSET = 0x00010000,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The browsing component will disable UTF-8 encoding.
|
/// The browsing component will disable UTF-8 encoding.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
URL_ENCODING_DISABLE_UTF8 = 0x00020000,
|
URL_ENCODING_DISABLE_UTF8 = 0x00020000,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The browsing component will enable UTF-8 encoding.
|
/// The browsing component will enable UTF-8 encoding.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
URL_ENCODING_ENABLE_UTF8 = 0x00040000,
|
URL_ENCODING_ENABLE_UTF8 = 0x00040000,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// No Documentation Available.
|
/// No Documentation Available.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
NOFRAMES = 0x00080000,
|
NOFRAMES = 0x00080000,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// WebBrowser Control always operates in offline mode.
|
/// WebBrowser Control always operates in offline mode.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
FORCEOFFLINE = 0x10000000,
|
FORCEOFFLINE = 0x10000000,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// No client pull operations will be performed.
|
/// No client pull operations will be performed.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
NO_CLIENTPULL = 0x20000000,
|
NO_CLIENTPULL = 0x20000000,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// No user interface will be displayed during downloads.
|
/// No user interface will be displayed during downloads.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
SILENT = 0x40000000,
|
SILENT = 0x40000000,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ using System;
|
|||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
using Common;
|
||||||
|
|
||||||
namespace PreviewHandlerCommon
|
namespace PreviewHandlerCommon
|
||||||
{
|
{
|
||||||
@@ -52,7 +53,7 @@ namespace PreviewHandlerCommon
|
|||||||
{
|
{
|
||||||
object result;
|
object result;
|
||||||
|
|
||||||
if (name != null && name.Equals(DISPIDAMBIENTDLCONTROL, StringComparison.CurrentCulture))
|
if (name != null && name.Equals(DISPIDAMBIENTDLCONTROL, StringComparison.Ordinal))
|
||||||
{
|
{
|
||||||
// Using InvariantCulture since this is used for web browser configurations
|
// Using InvariantCulture since this is used for web browser configurations
|
||||||
result = Convert.ToInt32(
|
result = Convert.ToInt32(
|
||||||
|
|||||||
Reference in New Issue
Block a user