private String GetCandidates(IntPtr result) { StringBuilder candidates = new StringBuilder(); bool exit = false; int lineSize = Hwr.GetLineSize(result); if (lineSize == 0) { candidates.Append("result empty"); return(candidates.ToString()); } for (int i = 0; i < MAX_CANDIDATES; i++) { for (int j = 0; j < lineSize; j++) { IntPtr line = Hwr.GetLine(result, j); int blockSize = Hwr.GetBlockSize(line); for (int k = 0; k < blockSize; k++) { IntPtr block = Hwr.GetBlock(line, k); if (Hwr.GetCandidateSize(block) <= i) { exit = true; break; } int length = 0; candidates.Append(String.Format("[{0}] ", i + 1)); candidates.Append(Hwr.GetCandidate(block, i, ref length)); if (k + 1 < blockSize) { candidates.Append(" "); } } if (exit) { break; } if (j + 1 < lineSize) { candidates.Append("\n"); } } if (exit) { break; } candidates.Append("\n"); } return(candidates.ToString()); }