/// <summary>
        /// Initializes a new instance of the <see cref="IssuerToCardScriptProcessor"/> class.
        /// </summary>
        /// <param name="value">The value.</param>
        public IssuerToCardScriptProcessor(byte[] value)
        {
            stream   = new MemoryStream(value);
            ScriptId = (byte)stream.ReadByte();
            var l = stream.ReadByte();

            var pos  = stream.Position;
            var guff = new byte[2];

            stream.Read(guff, 0, 2);

            byte[] buffer;
            if (guff[0] == 0x9f && guff[1] == 0x18)
            {
                var len = stream.ReadByte();
                if (len == 0)
                {
                    buffer = new byte[l - 3];
                    stream.Read(buffer, 0, buffer.Length);
                }
                else
                {
                    stream.Position += len;
                    buffer           = new byte[l - (3 + len)];
                    stream.Read(buffer, 0, buffer.Length);
                }
            }
            else
            {
                buffer          = new byte[l];
                stream.Position = pos;
                stream.Read(buffer, 0, buffer.Length);
            }

            //buffer.ForEach(x => Console.Write(x.ToString("X2")));
            //Console.WriteLine();

            ScriptData = buffer;
            Parse(new MemoryStream(ScriptData));
            NumberOfScripts = Scripts.Count();
        }
 private bool MoveScriptDownCommandCanExecute()
 {
     return(Scripts.Count(script => script.IsSelected) == 1 &&
            Scripts.IndexOf(Scripts.Single(script => script.IsSelected)) < Scripts.Count - 1);
 }