コード例 #1
0
        /// <summary>
        /// Creates a copy of the program and sets the name to "init".
        /// </summary>
        /// <returns></returns>
        public SpirePreset CreateBlank()
        {
            var sp = new SpirePreset {
                ProgramName = "init"
            };

            StuffAfterProgramName.CopyTo(sp.StuffAfterProgramName, 0);
            ProgramData.CopyTo(sp.ProgramData, 0);

            return(sp);
        }
コード例 #2
0
        public void SetParameter(int index, byte[] data)
        {
            if (data.Length != 4)
            {
                throw new SpireException(
                          $"The data length for a parameter must be 4 bytes, {data.Length} bytes given.");
            }

            var buf           = ProgramData;
            var desiredLength = (index + 1) * 4;

            if (buf.Length < desiredLength)
            {
                buf = new byte[desiredLength];
                ProgramData.CopyTo(buf, 0);
                data.CopyTo(buf, index * 4);
            }

            ProgramData = buf;
        }