Esempio n. 1
0
        public bool TryReadUInt(out uint value)
        {
            if (!TryReadObject(out var valueObject))
            {
                value = 0;
                return(false);
            }

            try
            {
                var intValue = (int)valueObject;
                value = BindingUtility.InterpretAsUint(intValue);
                return(true);
            }
            catch (Exception e)
            {
                value = 0;
                Debug.LogWarning(e);
                return(false);
            }
        }
        private int WriteStringList(ArgumentParser parser, MemoryReader memoryReader, List <string> textList)
        {
            if (!parser.TryReadPointer(out uint offset, out uint bufferOffset))
            {
                return(Error);
            }

            foreach (var text in textList)
            {
                if (!memoryReader.TryWrite(offset, BindingUtility.InterpretAsInt(bufferOffset)))
                {
                    return(Error);
                }
                offset += 4;

                if (!memoryReader.TryWriteString(text, ref bufferOffset))
                {
                    return(Error);
                }
            }

            return(Success);
        }