Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Making GetIconFilePath method protected virtual in order to have the possibility to override it #128

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,9 @@ int IShellIconOverlayIdentifier.GetOverlayInfo(IntPtr pwszIconFile, int cchMax,

try
{
int? iconIndex = null;
// Get the icon file path.
var iconFilePath = GetIconFilePath();
var iconFilePath = GetIconFilePath(out iconIndex);

// If we have no file, we must fail.
if (string.IsNullOrEmpty(iconFilePath))
Expand All @@ -98,6 +99,11 @@ int IShellIconOverlayIdentifier.GetOverlayInfo(IntPtr pwszIconFile, int cchMax,

// Set the flags, specifying we'll provide a path.
pdwFlags = ISIOI.ISIOI_ICONFILE;
if (iconIndex != null)
{
pdwFlags |= ISIOI.ISIOI_ICONINDEX;
pIndex = iconIndex.Value;
}

return WinError.S_OK;
}
Expand Down Expand Up @@ -153,9 +159,12 @@ int IShellIconOverlayIdentifier.GetPriority(out int pPriority)
/// <summary>
/// Gets the icon file path, creating the icon file if needed.
/// </summary>
/// <returns>The icon file path.</returns>
private string GetIconFilePath()
/// <param name="index">Index value used to identify the icon in a file that contains multiple icons.</param>
/// <returns>The fully qualified path of the file containing the icon. The .dll, .exe, and .ico file types are all acceptable.</returns>
protected virtual string GetIconFilePath(out int? index)
{
index = null;

// If we're not in debug mode and we've already created the temporary icon file,
// we can return it. If we're in debug mode, we'll always create it.
#if !DEBUG
Expand Down