Exemplo n.º 1
0
        public Int32 GetBytes(Char[] chars, Int32 charIndex, Int32 charCount, Byte[] bytes, Int32 byteIndex)
        {
            Int32 result = 0;

            while (charCount > 0)
            {
                FF8TextTag tag = FF8TextTag.TryRead(chars, ref charIndex, ref charCount);
                if (tag != null)
                {
                    result += tag.Write(bytes, ref byteIndex);
                }
                else if (FF8TextComment.TryRead(chars, ref charIndex, ref charCount) == null)
                {
                    bytes[byteIndex++] = _codepage[chars[charIndex++]];
                    charCount--;
                    result++;
                }
            }

            return(result);
        }
Exemplo n.º 2
0
        public int GetChars(byte[] bytes, int byteIndex, int byteCount, char[] chars, int charIndex)
        {
            int result = 0;

            while (byteCount > 0)
            {
                FF8TextTag tag = FF8TextTag.TryRead(bytes, ref byteIndex, ref byteCount);
                if (tag != null)
                {
                    result += tag.Write(chars, ref charIndex);
                }
                else
                {
                    chars[charIndex++] = _codepage[bytes[byteIndex++]];
                    byteCount--;
                    result++;
                }
            }

            return(result);
        }
Exemplo n.º 3
0
        public Int32 GetByteCount(Char[] chars, Int32 index, Int32 count)
        {
            Int32 result = 0;

            Byte[] buff = new Byte[2];
            while (count > 0)
            {
                FF8TextTag tag = FF8TextTag.TryRead(chars, ref index, ref count);
                if (tag != null)
                {
                    Int32 offset = 0;
                    result += tag.Write(buff, ref offset);
                }
                else if (FF8TextComment.TryRead(chars, ref index, ref count) == null)
                {
                    count--;
                    result++;
                    index++;
                }
            }

            return(result);
        }
Exemplo n.º 4
0
        public int GetCharCount(byte[] bytes, int index, int count)
        {
            int result = 0;

            char[] buff = new char[FF8TextTag.MaxTagLength];
            while (count > 0)
            {
                FF8TextTag tag = FF8TextTag.TryRead(bytes, ref index, ref count);
                if (tag != null)
                {
                    int offset = 0;
                    result += tag.Write(buff, ref offset);
                }
                else
                {
                    count--;
                    result++;
                    index++;
                }
            }

            return(result);
        }
Exemplo n.º 5
0
        public Int32 GetCharCount(Byte[] bytes, Int32 index, Int32 count)
        {
            Int32 result = 0;

            Char[] buff = new Char[FF8TextTag.MaxTagLength];
            while (count > 0)
            {
                FF8TextTag tag = FF8TextTag.TryRead(bytes, ref index, ref count);
                if (tag != null)
                {
                    Int32 offset = 0;
                    result += tag.Write(buff, ref offset);
                }
                else
                {
                    count--;
                    result++;
                    index++;
                }
            }

            return(result);
        }
Exemplo n.º 6
0
        public int GetByteCount(char[] chars, int index, int count)
        {
            int result = 0;

            byte[] buff = new byte[2];
            while (count > 0)
            {
                FF8TextTag tag = FF8TextTag.TryRead(chars, ref index, ref count);
                if (tag != null)
                {
                    int offset = 0;
                    result += tag.Write(buff, ref offset);
                }
                else if (FF8TextComment.TryRead(chars, ref index, ref count) == null)
                {
                    count--;
                    result++;
                    index++;
                }
            }

            return(result);
        }