Esempio n. 1
0
        /// <summary>
        /// Extract a stat object from byte pointer
        /// </summary>
        /// <param name="Buffer"></param>
        /// <returns></returns>
        public static unsafe Stat ExtractStat(ref byte *Buffer)
        {
            Stat returnValue = null;

            // try to parse the stat
            switch ((StatType)Buffer[TypeOffset])
            {
            case StatType.Numeric:
                returnValue = new StatNumeric(ref Buffer);
                break;

            case StatType.List:
                returnValue = new StatList(ref Buffer);
                break;
            }

            return(returnValue);
        }
Esempio n. 2
0
        /// <summary>
        /// Extract a stat object from byte array
        /// </summary>
        /// <param name="Buffer"></param>
        /// <param name="StartIndex"></param>
        /// <returns></returns>
        public static Stat ExtractStat(byte[] Buffer, int StartIndex = 0)
        {
            Stat returnValue = null;

            // try to parse the stat
            switch ((StatType)Buffer[StartIndex + TypeOffset])
            {
            case StatType.Numeric:
                returnValue = new StatNumeric(Buffer, StartIndex);
                break;

            case StatType.List:
                returnValue = new StatList(Buffer, StartIndex);
                break;
            }

            return(returnValue);
        }