Suppressing CLS compliance errors

Some functions and procedures require CLS
non-compliance due to file formats and the like.
Suppressing these compiler warnings
This commit is contained in:
Terry MacDonald 2021-01-28 21:19:20 +13:00
parent 0afe349eea
commit 3ecababc73
6 changed files with 46 additions and 26 deletions

View File

@ -52,7 +52,7 @@ namespace DesktopNotifications
{
public class DesktopNotificationManagerCompat
{
public const string TOAST_ACTIVATED_LAUNCH_ARG = "-ToastActivated";
private const string TOAST_ACTIVATED_LAUNCH_ARG = "-ToastActivated";
private static bool _registeredAumidAndComServer;
private static string _aumid;
@ -198,7 +198,9 @@ namespace DesktopNotifications
/// Creates a toast notifier. You must have called <see cref="RegisterActivator{T}"/> first (and also <see cref="RegisterAumidAndComServer(string)"/> if you're a classic Win32 app), or this will throw an exception.
/// </summary>
/// <returns></returns>
#pragma warning disable CS3002 // Return type is not CLS-compliant
public static ToastNotifier CreateToastNotifier()
#pragma warning restore CS3002 // Return type is not CLS-compliant
{
EnsureRegistered();
@ -353,8 +355,9 @@ namespace DesktopNotifications
/// Gets all notifications sent by this app that are currently still in Action Center.
/// </summary>
/// <returns>A collection of toasts.</returns>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
#pragma warning disable CS3002 // Return type is not CLS-compliant
public IReadOnlyList<ToastNotification> GetHistory()
#pragma warning restore CS3002 // Return type is not CLS-compliant
{
return _aumid != null ? _history.GetHistory(_aumid) : _history.GetHistory();
}

View File

@ -8,10 +8,12 @@ using ValveKeyValue;
namespace DisplayMagician.GameLibraries.SteamAppInfoParser
{
#pragma warning disable CS3003 // Type is not CLS-compliant
public class App
{
public uint AppID { get; set; }
public uint Size { get; set; }
public uint InfoState { get; set; }
@ -26,4 +28,6 @@ namespace DisplayMagician.GameLibraries.SteamAppInfoParser
public KVObject Data { get; set; }
}
#pragma warning restore CS3003 // Type is not CLS-compliant
}

View File

@ -269,19 +269,6 @@ namespace DisplayMagician.GameLibraries
}
public static bool ContainsUplayGame(uint uplayGameId)
{
foreach (UplayGame testUplayGame in _allUplayGames)
{
if (uplayGameId == testUplayGame.Id)
return true;
}
return false;
}
public static UplayGame GetUplayGame(string uplayGameNameOrUuid)
{
@ -312,7 +299,7 @@ namespace DisplayMagician.GameLibraries
}
public static UplayGame GetUplayGame(uint uplayGameId)
public static UplayGame GetUplayGame(int uplayGameId)
{
foreach (UplayGame testUplayGame in _allUplayGames)
{

View File

@ -95,11 +95,13 @@ namespace DisplayMagician
private bool _autoName = true;
private bool _isPossible;
private List<StartProgram> _startPrograms;
[JsonIgnore]
public string _originalIconPath;
private Bitmap _shortcutBitmap, _originalLargeBitmap, _originalSmallBitmap;
[JsonIgnore]
#pragma warning disable CS3008 // Identifier is not CLS-compliant
public string _originalIconPath;
[JsonIgnore]
public string _savedShortcutIconCacheFilename;
#pragma warning restore CS3008 // Identifier is not CLS-compliant
public ShortcutItem()
{
@ -129,7 +131,9 @@ namespace DisplayMagician
public ShortcutItem(
string name,
#pragma warning disable CS3001 // Argument type is not CLS-compliant
ProfileItem profile,
#pragma warning restore CS3001 // Argument type is not CLS-compliant
ShortcutPermanence displayPermanence,
ShortcutPermanence audioPermanence,
ShortcutPermanence capturePermanence,
@ -250,7 +254,9 @@ namespace DisplayMagician
public ShortcutItem(
string name,
#pragma warning disable CS3001 // Argument type is not CLS-compliant
ProfileItem profile,
#pragma warning restore CS3001 // Argument type is not CLS-compliant
int gameAppId,
string gameName,
SupportedGameLibrary gameLibrary,
@ -316,7 +322,9 @@ namespace DisplayMagician
public ShortcutItem(
string name,
#pragma warning disable CS3001 // Argument type is not CLS-compliant
ProfileItem profile,
#pragma warning restore CS3001 // Argument type is not CLS-compliant
GameStruct game,
ShortcutPermanence displayPermanence,
ShortcutPermanence audioPermanence,
@ -451,7 +459,9 @@ namespace DisplayMagician
public ShortcutItem(
string name,
#pragma warning disable CS3001 // Argument type is not CLS-compliant
ProfileItem profile,
#pragma warning restore CS3001 // Argument type is not CLS-compliant
string differentExecutableToMonitor,
string executableNameAndPath,
int executableTimeout,
@ -517,7 +527,9 @@ namespace DisplayMagician
public ShortcutItem(
string name,
#pragma warning disable CS3001 // Argument type is not CLS-compliant
ProfileItem profile,
#pragma warning restore CS3001 // Argument type is not CLS-compliant
Executable executable,
ShortcutPermanence displayPermanence,
ShortcutPermanence audioPermanence,
@ -706,7 +718,9 @@ namespace DisplayMagician
[JsonIgnore]
#pragma warning disable CS3003 // Type is not CLS-compliant
public ProfileItem ProfileToUse {
#pragma warning restore CS3003 // Type is not CLS-compliant
get
{
return _profileToUse;
@ -1136,7 +1150,9 @@ namespace DisplayMagician
public void UpdateNoGameShortcut(
string name,
#pragma warning disable CS3001 // Argument type is not CLS-compliant
ProfileItem profile,
#pragma warning restore CS3001 // Argument type is not CLS-compliant
ShortcutPermanence displayPermanence,
ShortcutPermanence audioPermanence,
ShortcutPermanence capturePermanence,
@ -1260,7 +1276,9 @@ namespace DisplayMagician
public void UpdateGameShortcut(
string name,
#pragma warning disable CS3001 // Argument type is not CLS-compliant
ProfileItem profile,
#pragma warning restore CS3001 // Argument type is not CLS-compliant
int gameAppId,
string gameName,
SupportedGameLibrary gameLibrary,
@ -1327,7 +1345,9 @@ namespace DisplayMagician
public void UpdateGameShortcut(
string name,
#pragma warning disable CS3001 // Argument type is not CLS-compliant
ProfileItem profile,
#pragma warning restore CS3001 // Argument type is not CLS-compliant
GameStruct game,
ShortcutPermanence displayPermanence,
ShortcutPermanence audioPermanence,
@ -1465,7 +1485,9 @@ namespace DisplayMagician
public void UpdateExecutableShortcut(
string name,
#pragma warning disable CS3001 // Argument type is not CLS-compliant
ProfileItem profile,
#pragma warning restore CS3001 // Argument type is not CLS-compliant
string differentExecutableToMonitor,
string executableNameAndPath,
int executableTimeout,
@ -1532,7 +1554,9 @@ namespace DisplayMagician
public void UpdateExecutableShortcut(
string name,
#pragma warning disable CS3001 // Argument type is not CLS-compliant
ProfileItem profile,
#pragma warning restore CS3001 // Argument type is not CLS-compliant
Executable executable,
ShortcutPermanence displayPermanence,
ShortcutPermanence audioPermanence,
@ -1872,9 +1896,11 @@ namespace DisplayMagician
return combinedBitmap;
}
#pragma warning disable CS3002 // Return type is not CLS-compliant
public MultiIcon ToIconOverlay()
#pragma warning restore CS3002 // Return type is not CLS-compliant
{
var iconSizes = new[]
Size[] iconSizes = new[]
{
new Size(256, 256),
new Size(64, 64),
@ -1883,10 +1909,10 @@ namespace DisplayMagician
new Size(24, 24),
new Size(16, 16)
};
var multiIcon = new MultiIcon();
var icon = multiIcon.Add("Icon1");
MultiIcon multiIcon = new MultiIcon();
SingleIcon icon = multiIcon.Add("Icon1");
foreach (var size in iconSizes)
foreach (Size size in iconSizes)
{
Bitmap bitmapOverlay = ToBitmapOverlay(_originalLargeBitmap, ProfileToUse.ProfileTightestBitmap, size.Width, size.Height);
icon.Add(bitmapOverlay);

View File

@ -114,11 +114,11 @@ namespace DisplayMagician.UIForms
}
public uint GameTimeout
public int GameTimeout
{
get
{
return (uint)nud_timeout_game.Value;
return (int)nud_timeout_game.Value;
}
set
{
@ -597,7 +597,7 @@ namespace DisplayMagician.UIForms
}
}
private async void ShortcutForm_Load(object sender, EventArgs e)
private void ShortcutForm_Load(object sender, EventArgs e)
{
// Load all the profiles to prepare things

View File

@ -283,7 +283,7 @@ namespace DisplayMagicianShared
{
if (Paths != null &&
ProfileIcon is Bitmap &&
ProfileIcon is ProfileIcon &&
File.Exists(SavedProfileIconCacheFilename) &&
ProfileBitmap is Bitmap &&
ProfileTightestBitmap is Bitmap &&