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

Correctly use ref parameter when flashing taskbar icon #1236

Merged
merged 1 commit into from
Oct 28, 2024
Merged
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
4 changes: 2 additions & 2 deletions TwitchDownloaderWPF/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -153,7 +153,7 @@ private async void FlashTaskbarIconIfNotForeground(TimeSpan flashDuration)
FlashCount = uint.MaxValue,
Timeout = 0
};
_ = NativeFunctions.FlashWindowEx(flashWInfo);
_ = NativeFunctions.FlashWindowEx(ref flashWInfo);

await Task.Delay(flashDuration);

@@ -165,7 +165,7 @@ private async void FlashTaskbarIconIfNotForeground(TimeSpan flashDuration)
FlashCount = 0,
Timeout = 0
};
_ = NativeFunctions.FlashWindowEx(stopFlashWInfo);
_ = NativeFunctions.FlashWindowEx(ref stopFlashWInfo);
}

private class FfmpegDownloadProgress : IProgress<ProgressInfo>
2 changes: 1 addition & 1 deletion TwitchDownloaderWPF/Services/NativeFunctions.cs
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@ public static unsafe class NativeFunctions

[DllImport("user32.dll", EntryPoint = "FlashWindowEx", PreserveSig = true)]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool FlashWindowEx(FlashWInfo info);
public static extern bool FlashWindowEx([In] ref FlashWInfo info);

// https://learn.microsoft.com/en-us/windows/win32/api/winuser/ns-winuser-flashwinfo
[StructLayout(LayoutKind.Sequential)]

Unchanged files with check annotations Beta

private static void HandleVodRaw(GqlVideoResponse videoInfo, GqlVideoChapterResponse chapters, string playlistString)
{
var stdOut = Console.OpenStandardOutput();
JsonSerializer.Serialize(stdOut, videoInfo);

Check warning on line 102 in TwitchDownloaderCLI/Modes/InfoHandler.cs

GitHub Actions / build-cli

Using member 'System.Text.Json.JsonSerializer.Serialize<TValue>(Stream, TValue, JsonSerializerOptions)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.

Check warning on line 102 in TwitchDownloaderCLI/Modes/InfoHandler.cs

GitHub Actions / build-cli

Using member 'System.Text.Json.JsonSerializer.Serialize<TValue>(Stream, TValue, JsonSerializerOptions)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.

Check warning on line 102 in TwitchDownloaderCLI/Modes/InfoHandler.cs

GitHub Actions / build-cli

Using member 'System.Text.Json.JsonSerializer.Serialize<TValue>(Stream, TValue, JsonSerializerOptions)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.

Check warning on line 102 in TwitchDownloaderCLI/Modes/InfoHandler.cs

GitHub Actions / build-cli

Using member 'System.Text.Json.JsonSerializer.Serialize<TValue>(Stream, TValue, JsonSerializerOptions)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.

Check warning on line 102 in TwitchDownloaderCLI/Modes/InfoHandler.cs

GitHub Actions / build-cli

Using member 'System.Text.Json.JsonSerializer.Serialize<TValue>(Stream, TValue, JsonSerializerOptions)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.

Check warning on line 102 in TwitchDownloaderCLI/Modes/InfoHandler.cs

GitHub Actions / build-cli-mac

Using member 'System.Text.Json.JsonSerializer.Serialize<TValue>(Stream, TValue, JsonSerializerOptions)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.

Check warning on line 102 in TwitchDownloaderCLI/Modes/InfoHandler.cs

GitHub Actions / build-cli-mac

Using member 'System.Text.Json.JsonSerializer.Serialize<TValue>(Stream, TValue, JsonSerializerOptions)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.
Console.WriteLine();
JsonSerializer.Serialize(stdOut, chapters);

Check warning on line 104 in TwitchDownloaderCLI/Modes/InfoHandler.cs

GitHub Actions / build-cli

Using member 'System.Text.Json.JsonSerializer.Serialize<TValue>(Stream, TValue, JsonSerializerOptions)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.

Check warning on line 104 in TwitchDownloaderCLI/Modes/InfoHandler.cs

GitHub Actions / build-cli

Using member 'System.Text.Json.JsonSerializer.Serialize<TValue>(Stream, TValue, JsonSerializerOptions)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.

Check warning on line 104 in TwitchDownloaderCLI/Modes/InfoHandler.cs

GitHub Actions / build-cli

Using member 'System.Text.Json.JsonSerializer.Serialize<TValue>(Stream, TValue, JsonSerializerOptions)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.

Check warning on line 104 in TwitchDownloaderCLI/Modes/InfoHandler.cs

GitHub Actions / build-cli

Using member 'System.Text.Json.JsonSerializer.Serialize<TValue>(Stream, TValue, JsonSerializerOptions)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.

Check warning on line 104 in TwitchDownloaderCLI/Modes/InfoHandler.cs

GitHub Actions / build-cli

Using member 'System.Text.Json.JsonSerializer.Serialize<TValue>(Stream, TValue, JsonSerializerOptions)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.

Check warning on line 104 in TwitchDownloaderCLI/Modes/InfoHandler.cs

GitHub Actions / build-cli-mac

Using member 'System.Text.Json.JsonSerializer.Serialize<TValue>(Stream, TValue, JsonSerializerOptions)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.

Check warning on line 104 in TwitchDownloaderCLI/Modes/InfoHandler.cs

GitHub Actions / build-cli-mac

Using member 'System.Text.Json.JsonSerializer.Serialize<TValue>(Stream, TValue, JsonSerializerOptions)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.
Console.WriteLine();
Console.Write(playlistString);
}
private static void HandleClipRaw(GqlClipResponse clipInfo, GqlClipTokenResponse clipQualities)
{
var stdOut = Console.OpenStandardOutput();
JsonSerializer.Serialize(stdOut, clipInfo);

Check warning on line 262 in TwitchDownloaderCLI/Modes/InfoHandler.cs

GitHub Actions / build-cli

Using member 'System.Text.Json.JsonSerializer.Serialize<TValue>(Stream, TValue, JsonSerializerOptions)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.

Check warning on line 262 in TwitchDownloaderCLI/Modes/InfoHandler.cs

GitHub Actions / build-cli

Using member 'System.Text.Json.JsonSerializer.Serialize<TValue>(Stream, TValue, JsonSerializerOptions)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.

Check warning on line 262 in TwitchDownloaderCLI/Modes/InfoHandler.cs

GitHub Actions / build-cli

Using member 'System.Text.Json.JsonSerializer.Serialize<TValue>(Stream, TValue, JsonSerializerOptions)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.

Check warning on line 262 in TwitchDownloaderCLI/Modes/InfoHandler.cs

GitHub Actions / build-cli

Using member 'System.Text.Json.JsonSerializer.Serialize<TValue>(Stream, TValue, JsonSerializerOptions)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.

Check warning on line 262 in TwitchDownloaderCLI/Modes/InfoHandler.cs

GitHub Actions / build-cli

Using member 'System.Text.Json.JsonSerializer.Serialize<TValue>(Stream, TValue, JsonSerializerOptions)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.

Check warning on line 262 in TwitchDownloaderCLI/Modes/InfoHandler.cs

GitHub Actions / build-cli-mac

Using member 'System.Text.Json.JsonSerializer.Serialize<TValue>(Stream, TValue, JsonSerializerOptions)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.

Check warning on line 262 in TwitchDownloaderCLI/Modes/InfoHandler.cs

GitHub Actions / build-cli-mac

Using member 'System.Text.Json.JsonSerializer.Serialize<TValue>(Stream, TValue, JsonSerializerOptions)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.
Console.WriteLine();
JsonSerializer.Serialize(stdOut, clipQualities);

Check warning on line 264 in TwitchDownloaderCLI/Modes/InfoHandler.cs

GitHub Actions / build-cli

Using member 'System.Text.Json.JsonSerializer.Serialize<TValue>(Stream, TValue, JsonSerializerOptions)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.

Check warning on line 264 in TwitchDownloaderCLI/Modes/InfoHandler.cs

GitHub Actions / build-cli

Using member 'System.Text.Json.JsonSerializer.Serialize<TValue>(Stream, TValue, JsonSerializerOptions)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.

Check warning on line 264 in TwitchDownloaderCLI/Modes/InfoHandler.cs

GitHub Actions / build-cli

Using member 'System.Text.Json.JsonSerializer.Serialize<TValue>(Stream, TValue, JsonSerializerOptions)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.

Check warning on line 264 in TwitchDownloaderCLI/Modes/InfoHandler.cs

GitHub Actions / build-cli

Using member 'System.Text.Json.JsonSerializer.Serialize<TValue>(Stream, TValue, JsonSerializerOptions)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.

Check warning on line 264 in TwitchDownloaderCLI/Modes/InfoHandler.cs

GitHub Actions / build-cli

Using member 'System.Text.Json.JsonSerializer.Serialize<TValue>(Stream, TValue, JsonSerializerOptions)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.

Check warning on line 264 in TwitchDownloaderCLI/Modes/InfoHandler.cs

GitHub Actions / build-cli-mac

Using member 'System.Text.Json.JsonSerializer.Serialize<TValue>(Stream, TValue, JsonSerializerOptions)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.

Check warning on line 264 in TwitchDownloaderCLI/Modes/InfoHandler.cs

GitHub Actions / build-cli-mac

Using member 'System.Text.Json.JsonSerializer.Serialize<TValue>(Stream, TValue, JsonSerializerOptions)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.
}
private static void HandleClipTable(GqlClipResponse clipInfo, GqlClipTokenResponse clipQualities)