Beispiel #1
0
        public string GetLastError()
        {
            if (IsLinux)
            {
                var len = GrammarApi.sol_GetErrorLen8(_engine);
                if (len == 0)
                {
                    return("");
                }

                var errUtf8 = new byte[len];
                GrammarApi.sol_GetError8(_engine, errUtf8, len);

                GrammarApi.sol_ClearError(_engine);
                return(Encoding.UTF8.GetString(errUtf8));
            }
            else
            {
                var len = GrammarApi.sol_GetErrorLen(_engine);
                if (len == 0)
                {
                    return("");
                }

                var b = new StringBuilder(len + 1);
                GrammarApi.sol_GetError(_engine, b, len);
                GrammarApi.sol_ClearError(_engine);
                return(b.ToString());
            }
        }