// ----------------------------------------------------------------------- // // Copyright (c) Microsoft Corporation. All rights reserved. // // ----------------------------------------------------------------------- namespace Microsoft.Samples.Kinect.Webserver.Sensor { using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using Microsoft.Kinect; /// /// Serializable representation of an skeleton stream message to send to client. /// [SuppressMessage("StyleCop.CSharp.NamingRules", "SA1300:ElementMustBeginWithUpperCaseLetter", Justification = "Lower case names allowed for JSON serialization.")] public class SkeletonStreamMessage : StreamMessage { /// /// Serializable skeleton array. /// [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "skeletons", Justification = "Lower case names allowed for JSON serialization.")] [SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays", Justification = "Array properties allowed for JSON serialization.")] public object[] skeletons { get; set; } /// /// Update hand pointers from specified user info data. /// /// /// Enumeration of UserInfo structures. /// public void UpdateSkeletons(Skeleton[] skeletons) { if (skeletons == null) { throw new ArgumentNullException("skeletons"); } if (this.skeletons == null || this.skeletons.Length != skeletons.Length) { this.skeletons = new object[skeletons.Length]; } for (int i = 0; i < this.skeletons.Length; i ++) { this.skeletons[i] = JsonSerializationExtensions.ExtractSerializableJsonData(skeletons[i]); } } } }