Esempio n. 1
0
        public void Load(string FileName)
        {
            int caracter;
            int i;

            if (FileName.Length == 0)
            {
                return;
            }

            FileStream handle = File.OpenRead(FileName);

            caracter = handle.ReadByte();
            for (i = 0; i < getNumElements() - 1 && caracter >= 0; i++)
            {
                ElementoOSD elem = (ElementoOSD)getElement(i);
                elem.tipo  = (byte)caracter;
                elem.fila  = (sbyte)handle.ReadByte();
                elem.col   = (sbyte)handle.ReadByte();
                elem.param = (byte)handle.ReadByte();
                caracter   = handle.ReadByte();
            }

            caracter = handle.ReadByte();

            for (i = 0; i < 16 && caracter >= 0; i++)
            {
                StrNombreHUD += (char)caracter;
                caracter      = handle.ReadByte();
            }

            handle.Close();
        }
Esempio n. 2
0
        public void setByte(int idx, byte dato)
        {
            int numelem = getNumElements() - 1;
            int dir     = idx / 4;

            if (dir >= numelem)
            {
                dir = idx - numelem * 4;
                if (dir < 16)
                {
                    if (dir < StrNombreHUD.Length)
                    {
                        StrNombreHUD += (char)dato;
                    }
                    else
                    {
                        StrNombreHUD = StrNombreHUD.Substring(0, dir) + (char)dato;
                    }
                }
                return;
            }
            else
            {
                ElementoOSD elem = (ElementoOSD)getElement(dir);
                switch (idx % 4)
                {
                case 0:
                    elem.tipo = dato;
                    break;

                case 1:
                    elem.fila = (sbyte)dato;
                    break;

                case 2:
                    elem.col = (sbyte)dato;
                    break;

                case 3:
                    elem.param = dato;
                    break;
                }
            }
        }
Esempio n. 3
0
        public byte getByte(int idx)
        {
            int numelem = getNumElements() - 1;
            int dir     = idx / 4;

            if (dir >= numelem)
            {
                dir = idx - numelem * 4;
                if (dir < StrNombreHUD.Length)
                {
                    return((byte)StrNombreHUD[dir]);
                }
                else
                {
                    return(0);
                }
            }
            else
            {
                ElementoOSD elem = (ElementoOSD)getElement(dir);
                switch (idx % 4)
                {
                case 0:
                    return(elem.tipo);

                case 1:
                    return((byte)elem.fila);

                case 2:
                    return((byte)elem.col);

                case 3:
                    return(elem.param);

                default:
                    return(0);
                }
            }
        }