Exemplo n.º 1
0
        /// <summary>
        /// 블럭 결과 값에서 인식된 후보문자를 반환한다
        /// </summary>
        /// <param name="block">[in] 블럭 결과 값</param>
        /// <param name="index">[in] 후보 인덱스</param>
        /// <param name="length">[out] 인식후보 문자열 크기</param>
        /// <returns>후보문자</returns>
        public static String GetCandidate(IntPtr block, int index, [In, Out] ref int length)
        {
            IntPtr        candidatePtr = Hwr.GetCandidatePtr(block, index, ref length);
            StringBuilder candidates   = new StringBuilder();

            if (length > 0)
            {
                String os = System.Environment.OSVersion.Platform.ToString();
                if (os.Contains("Win"))
                {
                    candidates.Append(Marshal.PtrToStringUni(candidatePtr, length));
                }
                else
                {
                    int[] buffers = new int[length];
                    Marshal.Copy(candidatePtr, buffers, 0, length);
                    foreach (uint buf in buffers)
                    {
                        candidates.Append(Convert.ToChar(buf));
                    }
                }
            }

            return(candidates.ToString());
        }
Exemplo n.º 2
0
 /// <summary>
 /// 엔진의 빌드넘버 스트링을 반환
 /// </summary>
 /// <returns>엔진의 빌드넘버 스트링</returns>
 public static String GetRevision()
 {
     IntPtr[] version = new IntPtr[1];
     Hwr.GetRevisionPtr(version);
     return(Marshal.PtrToStringAnsi(version[0]));
 }