コード例 #1
0
ファイル: OscReader.cs プロジェクト: tilde-love/osc-core
 private void CheckForPacketEnd(OscError error, int count)
 {
     if (Position + count > maxPosition)
     {
         throw new OscException(error, "Unexpected end of message");
     }
 }
コード例 #2
0
ファイル: OscReader.cs プロジェクト: tilde-love/osc-core
        private string ReadStringInner(ref OscTypeTag typeTag, OscError error)
        {
            int  stringStart = Position;
            bool failed      = true;

            // scan forward and look for the end of the string
            while (Position < maxPosition)
            {
                if (buffer.Array[buffer.Offset + Position++] != 0)
                {
                    continue;
                }

                failed = false;


                break;
            }

            if (failed)
            {
                throw new OscException(error, $@"Terminator could not be found while parsing argument '{typeTag.Index}'");
            }

            string result = Encoding.UTF8.GetString(buffer.Array, buffer.Offset + stringStart, Position - stringStart - 1);

            // Advance pass the padding
            if (SkipPadding() == false)
            {
                throw new OscException(error, $"Unexpected end of message while parsing argument '{typeTag.Index}'");
            }

            currentToken = typeTag.NextToken();

            return(result);
        }
コード例 #3
0
ファイル: OscException.cs プロジェクト: tilde-love/osc-core
 public OscException(OscError oscError, string message, Exception innerException) : base(message, innerException)
 {
     OscError = oscError;
 }
コード例 #4
0
ファイル: OscException.cs プロジェクト: tilde-love/osc-core
 public OscException(OscError oscError, string message) : base(message)
 {
     OscError = oscError;
 }