Advertisement
Guest User

Untitled

a guest
May 4th, 2015
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.01 KB | None | 0 0
  1. private string CharsAvailable()
  2. {
  3. int unicodeFlag = 0;
  4. int extraChars = 0;
  5. int msgCount = 0;
  6. string msgString = String.Empty;
  7.  
  8. if (chkSignature.Checked)
  9. msgString = msgString + Environment.NewLine + txtSignature.Text;
  10. else
  11. msgString = txtMessage.Text;
  12.  
  13. for (int i = 0; (unicodeFlag != 1 && (i < msgString.Length)); i++)
  14. {
  15. if ((msgString[i] >= '0') && (msgString[i] <= '9'))
  16. {
  17. }
  18. else if ((msgString[i] >= 'A') && (msgString[i] <= 'Z'))
  19. {
  20. }
  21. else if ((msgString[i] >= 'a') && (msgString[i] <= 'z'))
  22. {
  23. }
  24. else if (msgString[i] == '@')
  25. {
  26. }
  27. else if (msgString[i] == 0xA3)
  28. {
  29. }
  30. else if (msgString[i] == '$')
  31. {
  32. }
  33. else if (msgString[i] == 0xA5)
  34. {
  35. }
  36. else if (msgString[i] == 0xE8)
  37. {
  38. }
  39. else if (msgString[i] == 0xE9)
  40. {
  41. }
  42. else if (msgString[i] == 0xF9)
  43. {
  44. }
  45. else if (msgString[i] == 0xEC)
  46. {
  47. }
  48. else if (msgString[i] == 0xF2)
  49. {
  50. }
  51. else if (msgString[i] == 0xC7)
  52. {
  53. }
  54. else if (msgString[i] == 'r')
  55. {
  56. }
  57. else if (msgString[i] == 'n')
  58. {
  59. }
  60. else if (msgString[i] == 0xD8)
  61. {
  62. }
  63. else if (msgString[i] == 0xF8)
  64. {
  65. }
  66. else if (msgString[i] == 0xC5)
  67. {
  68. }
  69. else if (msgString[i] == 0xE5)
  70. {
  71. }
  72. else if (msgString[i] == 0x394)
  73. {
  74. }
  75. else if (msgString[i] == '_')
  76. {
  77. }
  78. else if (msgString[i] == 0x3A6)
  79. {
  80. }
  81. else if (msgString[i] == 0x393)
  82. {
  83. }
  84. else if (msgString[i] == 0x39B)
  85. {
  86. }
  87. else if (msgString[i] == 0x3A9)
  88. {
  89. }
  90. else if (msgString[i] == 0x3A0)
  91. {
  92. }
  93. else if (msgString[i] == 0x3A8)
  94. {
  95. }
  96. else if (msgString[i] == 0x3A3)
  97. {
  98. }
  99. else if (msgString[i] == 0x398)
  100. {
  101. }
  102. else if (msgString[i] == 0x39E)
  103. {
  104. }
  105. else if (msgString[i] == 0xC6)
  106. {
  107. }
  108. else if (msgString[i] == 0xE6)
  109. {
  110. }
  111. else if (msgString[i] == 0xDF)
  112. {
  113. }
  114. else if (msgString[i] == 0xC9)
  115. {
  116. }
  117. else if (msgString[i] == ' ')
  118. {
  119. }
  120. else if (msgString[i] == '!')
  121. {
  122. }
  123. else if (msgString[i] == '"')
  124. {
  125. }
  126. else if (msgString[i] == '#')
  127. {
  128. }
  129. else if (msgString[i] == 0xA4)
  130. {
  131. }
  132. else if (msgString[i] == '%')
  133. {
  134. }
  135. else if (msgString[i] == '&')
  136. {
  137. }
  138. else if (msgString[i] == ''')
  139. {
  140. }
  141. else if (msgString[i] == '(')
  142. {
  143. }
  144. else if (msgString[i] == ')')
  145. {
  146. }
  147. else if (msgString[i] == '*')
  148. {
  149. }
  150. else if (msgString[i] == '+')
  151. {
  152. }
  153. else if (msgString[i] == ',')
  154. {
  155. }
  156. else if (msgString[i] == '-')
  157. {
  158. }
  159. else if (msgString[i] == '.')
  160. {
  161. }
  162. else if (msgString[i] == '/')
  163. {
  164. }
  165. else if (msgString[i] == ':')
  166. {
  167. }
  168. else if (msgString[i] == ';')
  169. {
  170. }
  171. else if (msgString[i] == '<')
  172. {
  173. }
  174. else if (msgString[i] == '=')
  175. {
  176. }
  177. else if (msgString[i] == '>')
  178. {
  179. }
  180. else if (msgString[i] == '?')
  181. {
  182. }
  183. else if (msgString[i] == 0xA1)
  184. {
  185. }
  186. else if (msgString[i] == 0xC4)
  187. {
  188. }
  189. else if (msgString[i] == 0xD6)
  190. {
  191. }
  192. else if (msgString[i] == 0xD1)
  193. {
  194. }
  195. else if (msgString[i] == 0xDC)
  196. {
  197. }
  198. else if (msgString[i] == 0xA7)
  199. {
  200. }
  201. else if (msgString[i] == 0xBF)
  202. {
  203. }
  204. else if (msgString[i] == 0xE4)
  205. {
  206. }
  207. else if (msgString[i] == 0xF6)
  208. {
  209. }
  210. else if (msgString[i] == 0xF1)
  211. {
  212. }
  213. else if (msgString[i] == 0xFC)
  214. {
  215. }
  216. else if (msgString[i] == 0xE0)
  217. {
  218. }
  219. else if (msgString[i] == 0x391)
  220. {
  221. }
  222. else if (msgString[i] == 0x392)
  223. {
  224. }
  225. else if (msgString[i] == 0x395)
  226. {
  227. }
  228. else if (msgString[i] == 0x396)
  229. {
  230. }
  231. else if (msgString[i] == 0x397)
  232. {
  233. }
  234. else if (msgString[i] == 0x399)
  235. {
  236. }
  237. else if (msgString[i] == 0x39A)
  238. {
  239. }
  240. else if (msgString[i] == 0x39C)
  241. {
  242. }
  243. else if (msgString[i] == 0x39D)
  244. {
  245. }
  246. else if (msgString[i] == 0x39F)
  247. {
  248. }
  249. else if (msgString[i] == 0x3A1)
  250. {
  251. }
  252. else if (msgString[i] == 0x3A4)
  253. {
  254. }
  255. else if (msgString[i] == 0x3A5)
  256. {
  257. }
  258. else if (msgString[i] == 0x3A7)
  259. {
  260. }
  261. else if (msgString[i] == '^')
  262. {
  263. extraChars++;
  264. }
  265. else if (msgString[i] == '{')
  266. {
  267. extraChars++;
  268. }
  269. else if (msgString[i] == '}')
  270. {
  271. extraChars++;
  272. }
  273. else if (msgString[i] == '\')
  274. {
  275. extraChars++;
  276. }
  277. else if (msgString[i] == '[')
  278. {
  279. extraChars++;
  280. }
  281. else if (msgString[i] == '~')
  282. {
  283. extraChars++;
  284. }
  285. else if (msgString[i] == ']')
  286. {
  287. extraChars++;
  288. }
  289. else if (msgString[i] == '|')
  290. {
  291. extraChars++;
  292. }
  293. else if (msgString[i] == 0x20AC)
  294. {
  295. extraChars++;
  296. }
  297. else
  298. {
  299. unicodeFlag = 1;
  300. }
  301. }
  302.  
  303. if (unicodeFlag == 1)
  304. {
  305. msgCount = msgString.Length;
  306. if (msgCount <= 70)
  307. {
  308. msgCount = 1;
  309. }
  310. else
  311. {
  312. msgCount += (63 - 1);
  313. msgCount -= (msgCount % 63);
  314. msgCount /= 63;
  315. }
  316. return msgString.Length.ToString() + " unicode characters, " + msgCount + " SMS message(s)";
  317. }
  318. else
  319. {
  320. msgCount = msgString.Length + extraChars;
  321. if (msgCount <= 160)
  322. {
  323. msgCount = 1;
  324. }
  325. else
  326. {
  327. msgCount += (153 - 1);
  328. msgCount -= (msgCount % 153);
  329. msgCount /= 153;
  330. }
  331. return (msgString.Length + extraChars).ToString() + " characters, " + msgCount + " SMS message(s)";
  332. }
  333.  
  334. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement