Beispiel #1
0
        //----------------------------------------------------------

        /// <summary>
        /// Decodifica BufferString.
        /// </summary>
        /// <returns>Array de Intrucciones</returns>
        public classInstruccion[] DecodificarBuffer()
        {
            List <classInstruccion> lIns = new List <classInstruccion>();

            this.Buffer = BufferString.ToString();
            this.Buffer.Replace(' ', 'n');

            //------------------------------------------------------------
            // Si no coincida Agrega caracter final de insttruccion.
            if (this.Buffer.LastIndexOf(this.SeparadorInstrucciones) != (this.BufferString.Length - 1))
            {
                this.Buffer += this.SeparadorInstrucciones;
            }

            this.BufferString.Clear();
            //------------------------------------------------------------
            string PreInstruccion = string.Empty;

            foreach (char Letter in Buffer)
            {
                if (!char.Equals(this.SeparadorInstrucciones, Letter))
                {
                    PreInstruccion += Letter.ToString();
                    this.Buffer.Remove(0, 1);
                }
                else
                {
                    this.SetInstrucciones.Add(PreInstruccion);
                    PreInstruccion = string.Empty;
                }
            }
            //------------------------------------------------------------
            foreach (string Instruccion in SetInstrucciones)
            {
                if (Instruccion.Contains(this.SeparadorIdentificadorValor))
                {
                    classInstruccion Ins = new classInstruccion();
                    Ins.Identificador = Instruccion.Substring(0, Instruccion.IndexOf(this.SeparadorIdentificadorValor));
                    Ins.Valor         = Instruccion.Substring(
                        (Instruccion.IndexOf(this.SeparadorIdentificadorValor) + 1),
                        Instruccion.Length - (Instruccion.IndexOf(this.SeparadorIdentificadorValor) + 1));
                    lIns.Add(Ins);
                }
            }
            return(lIns.ToArray());
        }
Beispiel #2
0
        //----------------------------------------------------------

        /// <summary>
        /// Construye intruccion.
        /// </summary>
        /// <param name="Instrucciones">Instruccion</param>
        /// <returns>Instruccion</returns>
        public string SetIntruccion(classInstruccion Instrucciones)
        {
            return(Instrucciones.Identificador + this.SeparadorIdentificadorValor + Instrucciones.Valor + SeparadorInstrucciones);
        }