chroma-sdk / Colore
Showing 32 of 34 files from the diff.
Other files ignored by Codecov

@@ -497,7 +497,9 @@
Loading
497 497
        private void ReleaseUnmanagedResources()
498 498
        {
499 499
            if (_chromaSdkPointer != IntPtr.Zero)
500 +
            {
500 501
                Kernel32.NativeMethods.FreeLibrary(_chromaSdkPointer);
502 +
            }
501 503
        }
502 504
    }
503 505
}

@@ -226,7 +226,9 @@
Loading
226 226
        public override bool Equals(object? other)
227 227
        {
228 228
            if (other is null)
229 +
            {
229 230
                return false;
231 +
            }
230 232
231 233
            switch (other)
232 234
            {

@@ -214,7 +214,9 @@
Loading
214 214
        public override bool Equals(object? obj)
215 215
        {
216 216
            if (obj is null)
217 +
            {
217 218
                return false;
219 +
            }
218 220
219 221
            return obj is DeathstalkerGridEffect custom && Equals(custom);
220 222
        }
@@ -233,7 +235,9 @@
Loading
233 235
            for (var index = 0; index < KeyboardConstants.MaxKeys; index++)
234 236
            {
235 237
                if (_colors[index] != other._colors[index])
238 +
                {
236 239
                    return false;
240 +
                }
237 241
            }
238 242
239 243
            return true;

@@ -107,7 +107,9 @@
Loading
107 107
        public override bool Equals(object? obj)
108 108
        {
109 109
            if (obj is null)
110 +
            {
110 111
                return false;
112 +
            }
111 113
112 114
            return obj is StaticHeadsetEffect effect && Equals(effect);
113 115
        }

@@ -93,7 +93,7 @@
Loading
93 93
            {
94 94
                using (var key = Registry.LocalMachine.OpenSubKey(SdkRegKeyPath, false))
95 95
                {
96 -
                    if (key == null)
96 +
                    if (key is null)
97 97
                    {
98 98
                        Log.Warn("Failed to open registry key to read SDK version.");
99 99
                        ver = new SdkVersion(0, 0, 0);
@@ -190,7 +190,7 @@
Loading
190 190
                {
191 191
                    using (var key = Registry.LocalMachine.OpenSubKey(SdkRegKeyPath))
192 192
                    {
193 -
                        if (key == null)
193 +
                        if (key is null)
194 194
                        {
195 195
                            return false;
196 196
                        }
@@ -203,7 +203,7 @@
Loading
203 203
204 204
                            using (var appsSubKey = key.OpenSubKey(AppsSubKeyPath))
205 205
                            {
206 -
                                if (appsSubKey != null)
206 +
                                if (appsSubKey is not null)
207 207
                                {
208 208
                                    value = appsSubKey.GetValue("Enable");
209 209
                                }

@@ -45,10 +45,14 @@
Loading
45 45
        internal static Uri Append(this Uri uri, Uri resource)
46 46
        {
47 47
            if (uri is null)
48 +
            {
48 49
                throw new ArgumentNullException(nameof(uri));
50 +
            }
49 51
50 52
            if (resource is null)
53 +
            {
51 54
                throw new ArgumentNullException(nameof(resource));
55 +
            }
52 56
53 57
            var left = uri.ToString().TrimEnd('/');
54 58
            var right = resource.ToString().TrimStart('/');

@@ -105,7 +105,10 @@
Loading
105 105
        public override bool Equals(object? obj)
106 106
        {
107 107
            if (ReferenceEquals(null, obj))
108 +
            {
108 109
                return false;
110 +
            }
111 +
109 112
            return obj is StaticKeyboardEffect effect && Equals(effect);
110 113
        }
111 114

@@ -256,7 +256,9 @@
Loading
256 256
        public async Task InitializeAsync(AppInfo? info)
257 257
        {
258 258
            if (Initialized)
259 +
            {
259 260
                return;
261 +
            }
260 262
261 263
            Log.Info("Chroma is initializing.");
262 264
@@ -264,9 +266,13 @@
Loading
264 266
            var versionSuccess = RegistryHelper.TryGetSdkVersion(out _sdkVersion);
265 267
266 268
            if (versionSuccess)
269 +
            {
267 270
                Log.InfoFormat("Colore is running against SDK version {0}.", SdkVersion);
271 +
            }
268 272
            else
273 +
            {
269 274
                Log.Warn("Failed to retrieve SDK version from registry!");
275 +
            }
270 276
271 277
            Log.Debug("Calling SDK Init function");
272 278
            await _api.InitializeAsync(info).ConfigureAwait(false);
@@ -291,25 +297,39 @@
Loading
291 297
        public async Task UninitializeAsync()
292 298
        {
293 299
            if (!Initialized)
300 +
            {
294 301
                return;
302 +
            }
295 303
296 304
            if (_keyboard is not null)
305 +
            {
297 306
                await _keyboard.DeleteCurrentEffectAsync().ConfigureAwait(false);
307 +
            }
298 308
299 309
            if (_mouse is not null)
310 +
            {
300 311
                await _mouse.DeleteCurrentEffectAsync().ConfigureAwait(false);
312 +
            }
301 313
302 314
            if (_keypad is not null)
315 +
            {
303 316
                await _keypad.DeleteCurrentEffectAsync().ConfigureAwait(false);
317 +
            }
304 318
305 319
            if (_mousepad is not null)
320 +
            {
306 321
                await _mousepad.DeleteCurrentEffectAsync().ConfigureAwait(false);
322 +
            }
307 323
308 324
            if (_headset is not null)
325 +
            {
309 326
                await _headset.DeleteCurrentEffectAsync().ConfigureAwait(false);
327 +
            }
310 328
311 329
            if (_chromaLink is not null)
330 +
            {
312 331
                await _chromaLink.DeleteCurrentEffectAsync().ConfigureAwait(false);
332 +
            }
313 333
314 334
            Unregister();
315 335
            await _api.UninitializeAsync().ConfigureAwait(false);
@@ -326,7 +346,9 @@
Loading
326 346
        public async Task<DeviceInfo> QueryAsync(Guid deviceId)
327 347
        {
328 348
            if (!Devices.IsValidId(deviceId))
349 +
            {
329 350
                throw new ArgumentException("The specified ID does not match any of the valid IDs.", nameof(deviceId));
351 +
            }
330 352
331 353
            Log.DebugFormat("Information for {0} requested", deviceId);
332 354
@@ -349,8 +371,12 @@
Loading
349 371
        public Task<IGenericDevice> GetDeviceAsync(Guid deviceId)
350 372
        {
351 373
            Log.DebugFormat("Device {0} requested", deviceId);
374 +
352 375
            if (_deviceInstances.ContainsKey(deviceId))
376 +
            {
353 377
                return Task.FromResult(_deviceInstances[deviceId]);
378 +
            }
379 +
354 380
            IGenericDevice device = new GenericDeviceImplementation(deviceId, _api);
355 381
            _deviceInstances[deviceId] = device;
356 382
            return Task.FromResult(device);
@@ -458,7 +484,9 @@
Loading
458 484
        public void Unregister()
459 485
        {
460 486
            if (!_registered)
487 +
            {
461 488
                return;
489 +
            }
462 490
463 491
            Log.Debug("Unregistering from Chroma event notifications");
464 492

@@ -293,7 +293,9 @@
Loading
293 293
        public override bool Equals(object? obj)
294 294
        {
295 295
            if (obj is null)
296 +
            {
296 297
                return false;
298 +
            }
297 299
298 300
            return obj is CustomKeyboardEffect custom && Equals(custom);
299 301
        }
@@ -312,7 +314,9 @@
Loading
312 314
            for (var index = 0; index < KeyboardConstants.MaxKeys; index++)
313 315
            {
314 316
                if (_colors[index] != other._colors[index] || _keys[index] != other._keys[index])
317 +
                {
315 318
                    return false;
319 +
                }
316 320
            }
317 321
318 322
            return true;

@@ -105,7 +105,10 @@
Loading
105 105
        public override bool Equals(object? obj)
106 106
        {
107 107
            if (ReferenceEquals(null, obj))
108 +
            {
108 109
                return false;
110 +
            }
111 +
109 112
            return obj is StaticKeypadEffect effect && Equals(effect);
110 113
        }
111 114

@@ -348,7 +348,9 @@
Loading
348 348
        public override bool Equals(object? obj)
349 349
        {
350 350
            if (obj is null)
351 +
            {
351 352
                return false;
353 +
            }
352 354
353 355
            switch (obj)
354 356
            {

@@ -336,7 +336,9 @@
Loading
336 336
                for (var col = 0; col < KeypadConstants.MaxColumns; col++)
337 337
                {
338 338
                    if (this[row, col] != other[row, col])
339 +
                    {
339 340
                        return false;
341 +
                    }
340 342
                }
341 343
            }
342 344

@@ -349,7 +349,9 @@
Loading
349 349
                for (var col = 0; col < MouseConstants.MaxColumns; col++)
350 350
                {
351 351
                    if (this[row, col] != other[row, col])
352 +
                    {
352 353
                        return false;
354 +
                    }
353 355
                }
354 356
            }
355 357

@@ -83,7 +83,9 @@
Loading
83 83
        public T? Deserialize<T>()
84 84
        {
85 85
            if (string.IsNullOrWhiteSpace(Content))
86 +
            {
86 87
                return default;
88 +
            }
87 89
88 90
            try
89 91
            {

@@ -120,7 +120,7 @@
Loading
120 120
121 121
            var uriString = info.GetString($"{nameof(RestException)}.{nameof(Uri)}");
122 122
            var uriKind = (UriKind)info.GetInt32($"{nameof(RestException)}.{nameof(UriKind)}");
123 -
            Uri = uriString == null ? null : new Uri(uriString, uriKind);
123 +
            Uri = uriString is null ? null : new Uri(uriString, uriKind);
124 124
            StatusCode = (HttpStatusCode)info.GetInt32($"{nameof(RestException)}.{nameof(StatusCode)}");
125 125
            RestData = info.GetString($"{nameof(RestException)}.{nameof(RestData)}");
126 126
        }

@@ -107,8 +107,10 @@
Loading
107 107
        /// <exception cref="RestException">Thrown if there is an error calling the REST API.</exception>
108 108
        public async Task InitializeAsync(AppInfo? info)
109 109
        {
110 -
            if (info == null)
110 +
            if (info is null)
111 +
            {
111 112
                throw new ArgumentNullException(nameof(info));
113 +
            }
112 114
113 115
            Log.Info("Initializing SDK via /razer/chromasdk endpoint");
114 116
@@ -129,7 +131,7 @@
Loading
129 131
130 132
            var data = response.Data;
131 133
132 -
            if (data == null)
134 +
            if (data is null)
133 135
            {
134 136
                var ex = new RestException(
135 137
                    "REST API returned NULL data",
@@ -197,11 +199,15 @@
Loading
197 199
198 200
            var data = response.Data;
199 201
200 -
            if (data == null)
202 +
            if (data is null)
203 +
            {
201 204
                throw new ApiException("Uninitialize API returned NULL response");
205 +
            }
202 206
203 207
            if (!data.Result)
208 +
            {
204 209
                throw new ApiException("Exception when calling uninitialize API", data.Result);
210 +
            }
205 211
206 212
            Log.Debug("Stopping heartbeat timer");
207 213
            _heartbeatTimer.Change(Timeout.Infinite, Timeout.Infinite);
@@ -239,11 +245,15 @@
Loading
239 245
240 246
            var data = response.Data;
241 247
242 -
            if (data == null)
248 +
            if (data is null)
249 +
            {
243 250
                throw new ApiException("SetEffect API returned NULL response");
251 +
            }
244 252
245 253
            if (!data.Result)
254 +
            {
246 255
                throw new ApiException("Exception when calling SetEffect API", data.Result);
256 +
            }
247 257
        }
248 258
249 259
        /// <inheritdoc />
@@ -272,11 +282,15 @@
Loading
272 282
273 283
            var data = response.Data;
274 284
275 -
            if (data == null)
285 +
            if (data is null)
286 +
            {
276 287
                throw new ApiException("DeleteEffect API returned NULL response");
288 +
            }
277 289
278 290
            if (!data.Result)
291 +
            {
279 292
                throw new ApiException("Exception when calling DeleteEffect API", data.Result);
293 +
            }
280 294
        }
281 295
282 296
        /// <inheritdoc />
@@ -480,7 +494,7 @@
Loading
480 494
                throw ex;
481 495
            }
482 496
483 -
            if (response.Data == null)
497 +
            if (response.Data is null)
484 498
            {
485 499
                var ex = new RestException(
486 500
                    "Got NULL data from heartbeat call",
@@ -522,14 +536,20 @@
Loading
522 536
523 537
            var responseData = response.Data;
524 538
525 -
            if (responseData == null)
539 +
            if (responseData is null)
540 +
            {
526 541
                throw new ApiException("Effect creation API returned NULL response");
542 +
            }
527 543
528 544
            if (!responseData.Result)
545 +
            {
529 546
                throw new ApiException("Exception when calling SetEffect API", responseData.Result);
547 +
            }
530 548
531 -
            if (responseData.EffectId == null)
549 +
            if (responseData.EffectId is null)
550 +
            {
532 551
                throw new ApiException("Got NULL GUID from creating effect", responseData.Result);
552 +
            }
533 553
534 554
            return responseData.EffectId.Value;
535 555
        }

@@ -229,7 +229,9 @@
Loading
229 229
        public override bool Equals(object? obj)
230 230
        {
231 231
            if (obj is null)
232 +
            {
232 233
                return false;
234 +
            }
233 235
234 236
            return obj is CustomHeadsetEffect custom && Equals(custom);
235 237
        }
@@ -247,7 +249,9 @@
Loading
247 249
            for (var i = 0; i < HeadsetConstants.MaxLeds; i++)
248 250
            {
249 251
                if (this[i] != other[i])
252 +
                {
250 253
                    return false;
254 +
                }
251 255
            }
252 256
253 257
            return true;

@@ -106,7 +106,9 @@
Loading
106 106
        public override bool Equals(object? obj)
107 107
        {
108 108
            if (obj is null)
109 +
            {
109 110
                return false;
111 +
            }
110 112
111 113
            return obj is NoneEffect none && Equals(none);
112 114
        }

@@ -212,7 +212,9 @@
Loading
212 212
        public int CompareTo(SdkVersion other)
213 213
        {
214 214
            if (Major != other.Major)
215 +
            {
215 216
                return Major.CompareTo(other.Major);
217 +
            }
216 218
217 219
            return Minor != other.Minor ? Minor.CompareTo(other.Minor) : Revision.CompareTo(other.Revision);
218 220
        }

@@ -311,7 +311,9 @@
Loading
311 311
        public override bool Equals(object? obj)
312 312
        {
313 313
            if (obj is null)
314 +
            {
314 315
                return false;
316 +
            }
315 317
316 318
            return obj is ExtendedCustomKeyboardEffect custom && Equals(custom);
317 319
        }

@@ -107,7 +107,10 @@
Loading
107 107
        public override bool Equals(object? obj)
108 108
        {
109 109
            if (ReferenceEquals(null, obj))
110 +
            {
110 111
                return false;
112 +
            }
113 +
111 114
            return obj is StaticMousepadEffect effect && Equals(effect);
112 115
        }
113 116

@@ -88,7 +88,9 @@
Loading
88 88
        internal async Task DeleteCurrentEffectAsync()
89 89
        {
90 90
            if (CurrentEffectId == Guid.Empty)
91 +
            {
91 92
                return;
93 +
            }
92 94
93 95
            await Api.DeleteEffectAsync(CurrentEffectId).ConfigureAwait(false);
94 96
            CurrentEffectId = Guid.Empty;

@@ -249,7 +249,9 @@
Loading
249 249
        public async Task<Guid> SetPositionAsync(int row, int column, Color color, bool clear = false)
250 250
        {
251 251
            if (clear)
252 +
            {
252 253
                _grid.Clear();
254 +
            }
253 255
254 256
            _grid[row, column] = color;
255 257
            return await SetEffectAsync(
@@ -267,7 +269,9 @@
Loading
267 269
        public async Task<Guid> SetKeyAsync(Key key, Color color, bool clear = false)
268 270
        {
269 271
            if (clear)
272 +
            {
270 273
                _grid.Clear();
274 +
            }
271 275
272 276
            _grid[key] = color;
273 277
            return await SetEffectAsync(
@@ -306,7 +310,9 @@
Loading
306 310
            var guid = Guid.Empty;
307 311
308 312
            if (clear)
313 +
            {
309 314
                guid = await ClearAsync().ConfigureAwait(false);
315 +
            }
310 316
311 317
            foreach (var key in keys)
312 318
                guid = await SetKeyAsync(key, color).ConfigureAwait(false);
@@ -337,7 +343,9 @@
Loading
337 343
        public async Task<Guid> SetDeathstalkerZoneAsync(int zoneIndex, Color color, bool clear = false)
338 344
        {
339 345
            if (clear)
346 +
            {
340 347
                _deathstalkerGrid.Clear();
348 +
            }
341 349
342 350
            _deathstalkerGrid[zoneIndex] = color;
343 351
            return await SetEffectAsync(

@@ -71,7 +71,10 @@
Loading
71 71
        {
72 72
            var result = _nativeSdkMethods.Init();
73 73
            if (!result)
74 +
            {
74 75
                throw new NativeCallException("Init", result);
76 +
            }
77 +
75 78
            return TaskHelper.CompletedTask;
76 79
        }
77 80
@@ -83,7 +86,9 @@
Loading
83 86
        {
84 87
            var result = _nativeSdkMethods.UnInit();
85 88
            if (!result)
89 +
            {
86 90
                throw new NativeCallException("UnInit", result);
91 +
            }
87 92
88 93
            return TaskHelper.CompletedTask;
89 94
        }
@@ -113,7 +118,9 @@
Loading
113 118
                }
114 119
115 120
                if (ptr == IntPtr.Zero)
121 +
                {
116 122
                    throw new ColoreException("Device query failed, ptr NULL.");
123 +
                }
117 124
118 125
                var info = Marshal.PtrToStructure<SdkDeviceInfo>(ptr);
119 126
@@ -134,12 +141,18 @@
Loading
134 141
        {
135 142
            var result = _nativeSdkMethods.SetEffect(effectId);
136 143
            if (result)
144 +
            {
137 145
                return TaskHelper.CompletedTask;
146 +
            }
138 147
139 148
            if (result == Result.RzResourceDisabled || result == Result.RzAccessDenied)
149 +
            {
140 150
                Log.WarnFormat("Ambiguous {0} error thrown from call to native function SetEffect.", result);
151 +
            }
141 152
            else
153 +
            {
142 154
                throw new NativeCallException("SetEffect", result);
155 +
            }
143 156
144 157
            return TaskHelper.CompletedTask;
145 158
        }
@@ -153,7 +166,10 @@
Loading
153 166
        {
154 167
            var result = _nativeSdkMethods.DeleteEffect(effectId);
155 168
            if (!result)
169 +
            {
156 170
                throw new NativeCallException("DeleteEffect", result);
171 +
            }
172 +
157 173
            return TaskHelper.CompletedTask;
158 174
        }
159 175
@@ -404,7 +420,9 @@
Loading
404 420
        {
405 421
            var result = _nativeSdkMethods.RegisterEventNotification(hwnd);
406 422
            if (!result)
423 +
            {
407 424
                throw new NativeCallException("RegisterEventNotification", result);
425 +
            }
408 426
        }
409 427
410 428
        /// <inheritdoc />
@@ -415,7 +433,9 @@
Loading
415 433
        {
416 434
            var result = _nativeSdkMethods.UnregisterEventNotification();
417 435
            if (!result)
436 +
            {
418 437
                throw new NativeCallException("UnregisterEventNotification", result);
438 +
            }
419 439
        }
420 440
421 441
        /// <summary>
@@ -430,8 +450,12 @@
Loading
430 450
        {
431 451
            var guid = Guid.Empty;
432 452
            var result = _nativeSdkMethods.CreateEffect(device, effectType, param, ref guid);
453 +
433 454
            if (!result)
455 +
            {
434 456
                throw new NativeCallException("CreateEffect", result);
457 +
            }
458 +
435 459
            return guid;
436 460
        }
437 461
@@ -446,8 +470,12 @@
Loading
446 470
        {
447 471
            var guid = Guid.Empty;
448 472
            var result = _nativeSdkMethods.CreateKeyboardEffect(effectType, param, ref guid);
473 +
449 474
            if (!result)
475 +
            {
450 476
                throw new NativeCallException("CreateKeyboardEffect", result);
477 +
            }
478 +
451 479
            return guid;
452 480
        }
453 481
@@ -462,8 +490,12 @@
Loading
462 490
        {
463 491
            var guid = Guid.Empty;
464 492
            var result = _nativeSdkMethods.CreateMouseEffect(effectType, param, ref guid);
493 +
465 494
            if (!result)
495 +
            {
466 496
                throw new NativeCallException("CreateMouseEffect", result);
497 +
            }
498 +
467 499
            return guid;
468 500
        }
469 501
@@ -477,8 +509,12 @@
Loading
477 509
        {
478 510
            var guid = Guid.Empty;
479 511
            var result = _nativeSdkMethods.CreateHeadsetEffect(effectType, param, ref guid);
512 +
480 513
            if (!result)
514 +
            {
481 515
                throw new NativeCallException("CreateHeadsetEffect", result);
516 +
            }
517 +
482 518
            return guid;
483 519
        }
484 520
@@ -492,8 +528,12 @@
Loading
492 528
        {
493 529
            var guid = Guid.Empty;
494 530
            var result = _nativeSdkMethods.CreateMousepadEffect(effectType, param, ref guid);
531 +
495 532
            if (!result)
533 +
            {
496 534
                throw new NativeCallException("CreateMousepadEffect", result);
535 +
            }
536 +
497 537
            return guid;
498 538
        }
499 539
@@ -507,8 +547,12 @@
Loading
507 547
        {
508 548
            var guid = Guid.Empty;
509 549
            var result = _nativeSdkMethods.CreateKeypadEffect(effectType, param, ref guid);
550 +
510 551
            if (!result)
552 +
            {
511 553
                throw new NativeCallException("CreateKeypadEffect", result);
554 +
            }
555 +
512 556
            return guid;
513 557
        }
514 558
@@ -522,8 +566,12 @@
Loading
522 566
        {
523 567
            var guid = Guid.Empty;
524 568
            var result = _nativeSdkMethods.CreateChromaLinkEffect(effectType, param, ref guid);
569 +
525 570
            if (!result)
571 +
            {
526 572
                throw new NativeCallException("CreateChromaLinkEffect", result);
573 +
            }
574 +
527 575
            return guid;
528 576
        }
529 577
    }

@@ -118,7 +118,9 @@
Loading
118 118
        public override bool Equals(object? obj)
119 119
        {
120 120
            if (obj is null)
121 +
            {
121 122
                return false;
123 +
            }
122 124
123 125
            return obj is SdkDeviceInfo info && Equals(info);
124 126
        }

@@ -101,8 +101,8 @@
Loading
101 101
        /// <returns>An instance of <see cref="IRestResponse{TData}"/>.</returns>
102 102
        public async Task<IRestResponse<T>> PostAsync<T>(string resource, object? data)
103 103
        {
104 -
            var json = data == null ? null : JsonConvert.SerializeObject(data);
105 -
            using var content = json == null
104 +
            var json = data is null ? null : JsonConvert.SerializeObject(data);
105 +
            using var content = json is null
106 106
                ? null
107 107
                : new StringContent(json, Encoding.UTF8, "application/json");
108 108
@@ -137,7 +137,7 @@
Loading
137 137
        /// <returns>An instance of <see cref="IRestResponse{TData}" />.</returns>
138 138
        public async Task<IRestResponse<T>> PutAsync<T>(string resource, object? data)
139 139
        {
140 -
            using var content = data == null
140 +
            using var content = data is null
141 141
                ? null
142 142
                : new StringContent(JsonConvert.SerializeObject(data), Encoding.UTF8, "application/json");
143 143
@@ -172,7 +172,7 @@
Loading
172 172
        /// <returns>An instance of <see cref="IRestResponse{TData}" />.</returns>
173 173
        public async Task<IRestResponse<T>> DeleteAsync<T>(string resource, object? data)
174 174
        {
175 -
            var content = data == null
175 +
            var content = data is null
176 176
                ? null
177 177
                : new StringContent(JsonConvert.SerializeObject(data), Encoding.UTF8, "application/json");
178 178

@@ -60,7 +60,9 @@
Loading
60 60
            Log.InfoFormat("New generic device initializing: {0}", deviceId);
61 61
62 62
            if (!Devices.IsValidId(deviceId))
63 +
            {
63 64
                throw new UnsupportedDeviceException(deviceId);
65 +
            }
64 66
65 67
            DeviceId = deviceId;
66 68
        }

@@ -241,7 +241,9 @@
Loading
241 241
            for (var i = 0; i < MousepadConstants.MaxLeds; i++)
242 242
            {
243 243
                if (this[i] != other[i])
244 +
                {
244 245
                    return false;
246 +
                }
245 247
            }
246 248
247 249
            return true;

@@ -126,7 +126,10 @@
Loading
126 126
        public override bool Equals(object? other)
127 127
        {
128 128
            if (other is null)
129 +
            {
129 130
                return false;
131 +
            }
132 +
130 133
            return other is StaticMouseEffect effect && Equals(effect);
131 134
        }
132 135

@@ -127,8 +127,10 @@
Loading
127 127
        /// <returns>An object representing the progress of this asynchronous task.</returns>
128 128
        private static async Task ClearCurrentAsync()
129 129
        {
130 -
            if (_instance == null)
130 +
            if (_instance is null)
131 +
            {
131 132
                return;
133 +
            }
132 134
133 135
            Log.Debug("Uninitializing current IChroma instance");
134 136
            await _instance.UninitializeAsync().ConfigureAwait(false);

@@ -258,7 +258,9 @@
Loading
258 258
        public override bool Equals(object? obj)
259 259
        {
260 260
            if (obj is null)
261 +
            {
261 262
                return false;
263 +
            }
262 264
263 265
            return obj is CustomChromaLinkEffect custom && Equals(custom);
264 266
        }
@@ -277,7 +279,9 @@
Loading
277 279
            for (var index = 0; index < ChromaLinkConstants.MaxLeds; index++)
278 280
            {
279 281
                if (this[index] != other[index])
282 +
                {
280 283
                    return false;
284 +
                }
281 285
            }
282 286
283 287
            return true;

@@ -269,7 +269,9 @@
Loading
269 269
        private static void BuildMetadataCache()
270 270
        {
271 271
            if (_cacheBuilt)
272 +
            {
272 273
                return;
274 +
            }
273 275
274 276
            var fields = typeof(Devices).GetFields(BindingFlags.Static | BindingFlags.Public)
275 277
                                        .Where(p => p.FieldType == typeof(Guid));
@@ -287,7 +289,9 @@
Loading
287 289
            foreach (var mapping in mappings)
288 290
            {
289 291
                if (!MetadataCache.TryAdd(mapping.Key, mapping.Value))
292 +
                {
290 293
                    success = false;
294 +
                }
291 295
            }
292 296
293 297
            _cacheBuilt = success;
@@ -303,7 +307,9 @@
Loading
303 307
            BuildMetadataCache();
304 308
305 309
            if (MetadataCache.ContainsKey(deviceId))
310 +
            {
306 311
                return MetadataCache[deviceId];
312 +
            }
307 313
308 314
            throw new ArgumentException(
309 315
                "The specified device ID was not found in the known devices.",
Files Coverage
src/Colore 61.90%
Project Totals (75 files) 61.90%

No yaml found.

Create your codecov.yml to customize your Codecov experience

Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading