chroma-sdk / Colore

Compare db4fdf0 ... +46 ... a348d6f

Coverage Reach
Effects/Keyboard/ExtendedCustomKeyboardEffect.cs Effects/Keyboard/CustomKeyboardEffect.cs Effects/Keyboard/DeathstalkerGridEffect.cs Effects/Keyboard/PositionData.cs Effects/Keyboard/StaticKeyboardEffect.cs Effects/Mouse/CustomMouseEffect.cs Effects/Mouse/StaticMouseEffect.cs Effects/Keypad/CustomKeypadEffect.cs Effects/Keypad/StaticKeypadEffect.cs Effects/ChromaLink/CustomChromaLinkEffect.cs Effects/ChromaLink/StaticChromaLinkEffect.cs Effects/Headset/CustomHeadsetEffect.cs Effects/Headset/StaticHeadsetEffect.cs Effects/Mousepad/CustomMousepadEffect.cs Effects/Mousepad/StaticMousepadEffect.cs Effects/Generic/NoneEffect.cs Data/Result.cs Data/Devices.cs Data/AppInfo.cs Data/Color.cs Data/SdkVersion.cs Data/Author.cs Data/DeviceInfo.cs Data/SdkDeviceInfo.cs Data/Color.Defines.cs Native/NativeApi.cs Native/NativeSdkMethods.cs Native/NativeCallException.cs Serialization/ResultConverter.cs Serialization/ColorConverter.cs Serialization/KeyboardExtendedCustomConverter.cs Serialization/MouseStaticConverter.cs Serialization/ChromaLinkStaticConverter.cs Serialization/ChromaLinkCustomConverter.cs Serialization/KeypadCustomConverter.cs Serialization/DeathstalkerGridConverter.cs Serialization/KeyboardCustomConverter.cs Serialization/MouseCustomConverter.cs Serialization/HeadsetStaticConverter.cs Serialization/MousepadCustomConverter.cs Serialization/KeyboardStaticConverter.cs Serialization/MousepadStaticConverter.cs Serialization/KeypadStaticConverter.cs Serialization/HeadsetCustomConverter.cs Implementations/ChromaImplementation.cs Implementations/KeyboardImplementation.cs Implementations/MouseImplementation.cs Implementations/KeypadImplementation.cs Implementations/ChromaLinkImplementation.cs Implementations/MousepadImplementation.cs Implementations/HeadsetImplementation.cs Implementations/GenericDeviceImplementation.cs Implementations/DeviceImplementation.cs Rest/RestApi.cs Rest/RestException.cs Rest/Data/SdkInitResponse.cs Rest/Data/SdkResponse.cs Rest/Data/EffectData.cs Rest/Data/HeartbeatResponse.cs Rest/Data/SdkEffectResponse.cs Rest/Data/EffectGroup.cs Rest/RestClient.cs Rest/RestResponse.cs Helpers/RegistryHelper.cs Helpers/UriHelper.cs Helpers/ArrayHelper.cs Helpers/EnvironmentHelper.cs Helpers/TaskHelper.cs Api/ApiException.cs UnsupportedDeviceException.cs Events/ApplicationStateEventArgs.cs Events/SdkSupportEventArgs.cs Events/DeviceAccessEventArgs.cs ColoreException.cs ColoreProvider.cs

No flags found

Use flags to group coverage reports by test type, project and/or folders.
Then setup custom commit statuses and notifications for each flag.

e.g., #unittest #integration

#production #enterprise

#frontend #backend

Learn more about Codecov Flags here.

Showing 59 of 102 files from the diff.
Other files ignored by Codecov
.gitignore has changed.
README.md has changed.
Colore.sln has changed.
.travis.yml was deleted.
travis/.gitignore was deleted.
build.cake has changed.
.editorconfig has changed.
appveyor.yml was deleted.

@@ -34,14 +34,14 @@
Loading
34 34
    /// <summary>
35 35
    /// Contains data for an effect to be sent to the REST API.
36 36
    /// </summary>
37 -
    internal struct EffectData
37 +
    internal readonly struct EffectData
38 38
    {
39 39
        /// <summary>
40 40
        /// Initializes a new instance of the <see cref="EffectData" /> structure.
41 41
        /// </summary>
42 42
        /// <param name="effect">Type of effect to create, should be a value from one of the <c>Effect</c> enumerations.</param>
43 43
        /// <param name="payload">Effect data, if applicable.</param>
44 -
        internal EffectData([NotNull] object effect, [CanBeNull] object payload = null)
44 +
        internal EffectData(object effect, object? payload = null)
45 45
        {
46 46
            Effect = effect ?? throw new ArgumentNullException(nameof(effect));
47 47
            Payload = payload;
@@ -50,18 +50,16 @@
Loading
50 50
        /// <summary>
51 51
        /// Gets the type of the effect.
52 52
        /// </summary>
53 -
        [NotNull]
54 53
        [JsonProperty("effect")]
55 54
        public object Effect { get; }
56 55
57 56
        /// <summary>
58 57
        /// Gets effect data, or <c>null</c> if not applicable for the current effect type.
59 58
        /// </summary>
60 -
        [CanBeNull]
61 59
        [JsonProperty(
62 60
            "param",
63 61
            DefaultValueHandling = DefaultValueHandling.Ignore,
64 62
            NullValueHandling = NullValueHandling.Ignore)]
65 -
        public object Payload { get; }
63 +
        public object? Payload { get; }
66 64
    }
67 65
}

@@ -170,7 +170,7 @@
Loading
170 170
        /// <param name="right">Right operand, an <see cref="object" />.</param>
171 171
        /// <returns><c>true</c> if the two instances are equal, <c>false</c> otherwise.</returns>
172 172
        [Pure]
173 -
        public static bool operator ==(Color left, object right)
173 +
        public static bool operator ==(Color left, object? right)
174 174
        {
175 175
            return left.Equals(right);
176 176
        }
@@ -182,7 +182,7 @@
Loading
182 182
        /// <param name="right">Right operand, an <see cref="object" />.</param>
183 183
        /// <returns><c>true</c> if the two instances are not equal, <c>false</c> otherwise.</returns>
184 184
        [Pure]
185 -
        public static bool operator !=(Color left, object right)
185 +
        public static bool operator !=(Color left, object? right)
186 186
        {
187 187
            return !left.Equals(right);
188 188
        }
@@ -223,10 +223,12 @@
Loading
223 223
        /// </summary>
224 224
        /// <param name="other">The <see cref="object" /> to check equality against.</param>
225 225
        /// <returns><c>true</c> if the two are equal, <c>false</c> otherwise.</returns>
226 -
        public override bool Equals(object other)
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
            {

@@ -27,8 +27,6 @@
Loading
27 27
{
28 28
    using System.Net;
29 29
30 -
    using JetBrains.Annotations;
31 -
32 30
    using Newtonsoft.Json;
33 31
34 32
    /// <inheritdoc />
@@ -43,13 +41,13 @@
Loading
43 41
        /// </summary>
44 42
        /// <param name="status">HTTP status returned from the API.</param>
45 43
        /// <param name="content">String content returned from the API.</param>
46 -
        public RestResponse(HttpStatusCode status, [CanBeNull] string content)
44 +
        public RestResponse(HttpStatusCode status, string? content)
47 45
        {
48 46
            Status = status;
49 47
            Content = content;
50 48
51 49
            var code = (int)Status;
52 -
            IsSuccessful = code >= 200 && code < 300;
50 +
            IsSuccessful = code is >= 200 and < 300;
53 51
        }
54 52
55 53
        /// <inheritdoc />
@@ -68,24 +66,26 @@
Loading
68 66
        /// <summary>
69 67
        /// Gets the string content of the response body.
70 68
        /// </summary>
71 -
        public string Content { get; }
69 +
        public string? Content { get; }
72 70
73 71
        /// <inheritdoc />
74 72
        /// <summary>
75 73
        /// Gets the typed data returned from the request.
76 74
        /// </summary>
77 -
        public TData Data => Deserialize<TData>();
75 +
        public TData? Data => Deserialize<TData>();
78 76
79 77
        /// <inheritdoc />
80 78
        /// <summary>
81 79
        /// Attempts to deserialize <see cref="Content" /> into the target type.
82 80
        /// </summary>
83 81
        /// <typeparam name="T">The type to deserialize into.</typeparam>
84 82
        /// <returns>An instance of <typeparamref name="T" />.</returns>
85 -
        public T Deserialize<T>()
83 +
        public T? Deserialize<T>()
86 84
        {
87 85
            if (string.IsNullOrWhiteSpace(Content))
86 +
            {
88 87
                return default;
88 +
            }
89 89
90 90
            try
91 91
            {

@@ -104,10 +104,12 @@
Loading
104 104
        /// <returns>
105 105
        /// <c>true</c> if <paramref name="obj" /> and this instance are the same type and represent the same value; otherwise, <c>false</c>.
106 106
        /// </returns>
107 -
        public override bool Equals(object obj)
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
        }

@@ -50,8 +50,15 @@
Loading
50 50
        /// <param name="writer">The <see cref="JsonWriter" /> to write to.</param>
51 51
        /// <param name="value">The <see cref="CustomKeyboardEffect" /> value.</param>
52 52
        /// <param name="serializer">The calling serializer.</param>
53 -
        public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
53 +
        public override void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer)
54 54
        {
55 +
            if (value is null)
56 +
            {
57 +
                writer.WriteNull();
58 +
59 +
                return;
60 +
            }
61 +
55 62
            var effect = (ExtendedCustomKeyboardEffect)value;
56 63
            var (colors, keys) = effect.ToMultiArrays();
57 64
            var data = new EffectData(KeyboardEffectType.ExtendedCustom, new { color = colors, key = keys });
@@ -62,7 +69,7 @@
Loading
62 69
        public override object ReadJson(
63 70
            JsonReader reader,
64 71
            Type objectType,
65 -
            object existingValue,
72 +
            object? existingValue,
66 73
            JsonSerializer serializer)
67 74
        {
68 75
            throw new NotSupportedException("Only writing of Extended Keyboard Custom objects is supported.");

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Learn more Showing 1 files with coverage changes found.

New file src/Colore/Helpers/EnvironmentHelper.cs
New
Loading file...

48 Commits

Hiding 4 contexual commits Hiding 5 contexual commits
+54
-5
+59
Hiding 2 contexual commits Hiding 5 contexual commits Hiding 1 contexual commits Hiding 3 contexual commits
+1 Files
+3
+3
Hiding 1 contexual commits
Hiding 9 contexual commits
+6
+6
Hiding 1 contexual commits
-6
-6
Files Coverage
src/Colore -2.29% 61.90%
Project Totals (75 files) 61.90%
Loading