예제 #1
0
        /// <summary>
        /// Inherited from <see cref="ISerializableByteArray"/>. Sets the current <see cref="SizeByte"/> structure from the byte array.
        /// </summary>
        public void FromBytes(byte[] data)
        {
            if (data.Length != SizeInBytes)
            {
                throw new ArgumentException($"Parameter {nameof(data)} must be exactly {SizeInBytes} bytes.");
            }

            this = new SizeByte(data[0], data[1]);
        }
예제 #2
0
 /// <summary>
 /// Offsets a <see cref="PointShort"/> by the specified <see cref="SizeByte"/>.
 /// </summary>
 /// <param name="pt">The <see cref="PointShort"/> that should be offset.</param>
 /// <param name="sz">The <see cref="SizeByte"/> to offset by.</param>
 /// <returns>A new <see cref="PointShort"/> that has been offset.</returns>
 public static PointShort Add(PointShort pt, SizeByte sz) => pt + sz;
예제 #3
0
 /// <summary>
 /// Subtracts a <see cref="PointShort"/> by a <see cref="SizeByte"/>.
 /// </summary>
 /// <param name="pt">The <see cref="PointShort"/> to be subtracted from.</param>
 /// <param name="sz">The <see cref="SizeByte"/> to subtract.</param>
 /// <returns>A <see cref="PointShort"/> representing the difference.</returns>
 public static PointShort Subtract(PointShort pt, SizeByte sz) => pt - sz;
예제 #4
0
 /// <summary>
 /// Subtracs two <see cref="SizeByte"/> values and returns the result.
 /// </summary>
 /// <param name="sz1">The intial <see cref="SizeByte"/>.</param>
 /// <param name="sz2">The <see cref="SizeByte"/> to subtract.</param>
 /// <returns>The difference between the two <see cref="SizeByte"/> structures.</returns>
 public static SizeByte Subtract(SizeByte sz1, SizeByte sz2) => sz1 - sz2;
예제 #5
0
 /// <summary>
 /// Adds two <see cref="SizeByte"/> values together and returns the result.
 /// </summary>
 /// <param name="sz1">The first <see cref="SizeByte"/> to add.</param>
 /// <param name="sz2">The second <see cref="SizeByte"/> to add.</param>
 /// <returns>The sum of the two <see cref="SizeByte"/> structures.</returns>
 public static SizeByte Add(SizeByte sz1, SizeByte sz2) => sz1 + sz2;
예제 #6
0
 /// <summary>
 /// Offsets a <see cref="PointShort"/> by the specified <see cref="SizeByte"/>.
 /// </summary>
 /// <param name="pt">The <see cref="PointShort"/> that should be offset.</param>
 /// <param name="sz">The <see cref="SizeByte"/> to offset by.</param>
 /// <returns>A new <see cref="PointShort"/> that has been offset.</returns>
 public static PointShort Add(PointShort pt, SizeByte sz) => pt + sz;
예제 #7
0
 /// <summary>
 /// Subtracts a <see cref="PointShort"/> by a <see cref="SizeByte"/>.
 /// </summary>
 /// <param name="pt">The <see cref="PointShort"/> to be subtracted from.</param>
 /// <param name="sz">The <see cref="SizeByte"/> to subtract.</param>
 /// <returns>A <see cref="PointShort"/> representing the difference.</returns>
 public static PointShort Subtract(PointShort pt, SizeByte sz) => pt - sz;
예제 #8
0
 /// <summary>
 /// Subtracs two <see cref="SizeByte"/> values and returns the result.
 /// </summary>
 /// <param name="sz1">The intial <see cref="SizeByte"/>.</param>
 /// <param name="sz2">The <see cref="SizeByte"/> to subtract.</param>
 /// <returns>The difference between the two <see cref="SizeByte"/> structures.</returns>
 public static SizeByte Subtract(SizeByte sz1, SizeByte sz2) => sz1 - sz2;
예제 #9
0
 /// <summary>
 /// Adds two <see cref="SizeByte"/> values together and returns the result.
 /// </summary>
 /// <param name="sz1">The first <see cref="SizeByte"/> to add.</param>
 /// <param name="sz2">The second <see cref="SizeByte"/> to add.</param>
 /// <returns>The sum of the two <see cref="SizeByte"/> structures.</returns>
 public static SizeByte Add(SizeByte sz1, SizeByte sz2) => sz1 + sz2;
예제 #10
0
        /// <summary>
        /// Inherited from <see cref="ISerializableByteArray"/>. Sets the current <see cref="SizeByte"/> structure from the byte array.
        /// </summary>
        public void FromBytes(byte[] data)
        {
            if (data.Length != SizeInBytes)
            {
                throw new ArgumentException($"Parameter {nameof(data)} must be exactly {SizeInBytes} bytes.");
            }

            this = new SizeByte(data[0], data[1]);
        }