Ejemplo n.º 1
0
        /// <summary>Sorts the offsets to an entire <see cref="Array" />.</summary>
        /// <param name="customOffsets">The custom offsets for the colors to be positioned.</param>
        /// <returns>The <see cref="float" />.</returns>
        public static float[] SortPositions(float[] customOffsets)
        {
            if (!customOffsets.Contains(StartPoint))
            {
                throw new ArgumentNullException(nameof(customOffsets), @"A start position of " + StartPoint + @".0F doesn't exist.");
            }

            if (!customOffsets.Contains(EndPoint))
            {
                throw new ArgumentNullException(nameof(customOffsets), @"A end position of " + EndPoint + @".0F doesn't exist.");
            }

            foreach (float offset in customOffsets)
            {
                if (ExceptionManager.ArgumentOutOfRangeException(offset, 0.0F, 1.0F))
                {
                }

                if (customOffsets.Length != customOffsets.Distinct().Count())
                {
                    throw new ArgumentException(@"Found duplicate offset: " + offset, nameof(offset));
                }
            }

            Array.Sort(customOffsets);
            return(customOffsets);
        }