发送 poll包

金沙注册送58 1

  1金沙注册送58 2using System.Data;
  2金沙注册送58 3using System.Data.SqlClient;
  3金沙注册送58 4using System.Configuration;
  4金沙注册送58 5using System.Web;
  5金沙注册送58 6using System.Web.Security;
  6金沙注册送58 7using System.Web.UI;
群聊音信收发,登录成功后获得。  7金沙注册送58 8using System.Web.UI.WebControls;
  8金沙注册送58 9using System.Web.UI.WebControls.WebParts;
  9金沙注册送58 10using System.Web.UI.HtmlControls;
 10金沙注册送58 11using System.Drawing;
 11金沙注册送58 12using System.IO;
 12金沙注册送58 13using System.Web.Mail;
 13金沙注册送58 14using System.Text.RegularExpressions;
 14金沙注册送58 15using System.Text;
 15金沙注册送58 16
 16金沙注册送58 17金沙注册送58 18/**//// <summary>
 17金沙注册送58 19/// CommonUI 公共措施
 18金沙注册送58 20/// </summary>
 19金沙注册送58 21public class CommonUI : System.Web.UI.Page
 20金沙注册送58 22金沙注册送58 23金沙注册送58 24{
 21金沙注册送58 25
 22金沙注册送58 26金沙注册送58 27    只弹出音信#region 只弹出音讯
 23金沙注册送58 28金沙注册送58 29    /**//// <summary>
 24金沙注册送58 30    /// 只弹出音讯
 25金沙注册送58 31    /// </summary>
 26金沙注册送58 32    /// <param name=”msg”>弹出的音讯</param>
 27金沙注册送58 33    public static void Alert(string msg)
 28金沙注册送58 34金沙注册送58 35    金沙注册送58 36{
 29金沙注册送58 37        string s = “<script language=’javascript’ >alert(\”” + msg + “\”);</script>”;
 30金沙注册送58 38        HttpContext.Current.Response.Write(s);
 31金沙注册送58 39    }
 32金沙注册送58 40    #endregion
 33金沙注册送58 41
 34金沙注册送58 42金沙注册送58 43    弹出并回到#region 弹出并回到
 35金沙注册送58 44金沙注册送58 45    /**//// <summary>
 36金沙注册送58 46    /// 弹出并回到
 37金沙注册送58 47    /// </summary>
 38金沙注册送58 48    /// <param name=”msg”>弹出的音讯</param>
 39金沙注册送58 49    /// <param name=”msg”>再次回到哪超级的数字:如-1赶回上1页</param>
 40金沙注册送58 50    public static void AlertAndGo(string msg, int intGo)
 41金沙注册送58 51金沙注册送58 52    金沙注册送58 53{
 42金沙注册送58 54        string s = “<script language=’javascript’ >alert(\”” + msg + “\”);history.go(” + intGo + “)</script>”;
 43金沙注册送58 55        HttpContext.Current.Response.Write(s);
 44金沙注册送58 56    }
 45金沙注册送58 57    #endregion
 46金沙注册送58 58
 47金沙注册送58 59金沙注册送58 60    只进行页面跳转#region 只进行页面跳转
 48金沙注册送58 61金沙注册送58 62    /**//// <summary>
 49金沙注册送58 63    /// 只进行页面跳转
 50金沙注册送58 64    /// </summary>
 51金沙注册送58 65    /// <param name=”url”>跳转的靶子U哈弗L</param>
 52金沙注册送58 66    public static void AlertRedirect(string url)
 53金沙注册送58 67金沙注册送58 68    金沙注册送58 69{
 54金沙注册送58 70        string s = “<script language=’javascript’ >window.location='” + url + “‘;</script>”;
 55金沙注册送58 71        HttpContext.Current.Response.Write(s);
 56金沙注册送58 72    }
 57金沙注册送58 73    #endregion
 58金沙注册送58 74
 59金沙注册送58 75金沙注册送58 76    呈现新闻提示对话框,并拓展页面跳转#region 展现音信提醒对话框,并拓展页面跳转
 60金沙注册送58 77金沙注册送58 78    /**//// <summary>
 61金沙注册送58 79    /// 展现新闻提醒对话框,并展开页面跳转 
 62金沙注册送58 80    /// </summary>
 63金沙注册送58 81    /// <param name=”msg”>提醒新闻</param>
 64金沙注册送58 82    /// <param name=”url”>跳转的靶子UMuranoL</param>
 65金沙注册送58 83    public static void AlertAndRedirect(string msg, string url)
 66金沙注册送58 84金沙注册送58 85    金沙注册送58 86{
 67金沙注册送58 87        string s = “<script language=’javascript’ >alert(\”” + msg + “\”);window.location='” + url + “‘;</script>”;
 68金沙注册送58 88        HttpContext.Current.Response.Write(s);
 69金沙注册送58 89    }
 70金沙注册送58 90    #endregion
 71金沙注册送58 91
 72金沙注册送58 92金沙注册送58 93    判断是或不是日期#region 判断是还是不是日期
 73金沙注册送58 94金沙注册送58 95    /**//// <summary>
 74金沙注册送58 96    /// 判断是或不是日期
 75金沙注册送58 97    /// </summary>
 76金沙注册送58 98    /// <param name=”strValue”>判断是还是不是日期</param>
 77金沙注册送58 99    /// <returns>bool</returns>
 78金沙注册送58 100    public static bool IsDateTime(string strValue)
 79金沙注册送58 101金沙注册送58 102    金沙注册送58 103{
 80金沙注册送58 104        bool bolReturn;
 81金沙注册送58 105        DateTime dteReturn;
 82金沙注册送58 106        if (strValue == null)
 83金沙注册送58 107金沙注册送58 108        金沙注册送58 109{
 84金沙注册送58 110            bolReturn = false;
 85金沙注册送58 111        }
 86金沙注册送58 112        try
 87金沙注册送58 113金沙注册送58 114        金沙注册送58 115{
 88金沙注册送58 116            dteReturn = Convert.ToDateTime(strValue);
 89金沙注册送58 117            bolReturn = true;
 90金沙注册送58 118        }
 91金沙注册送58 119        catch
 92金沙注册送58 120金沙注册送58 121        金沙注册送58 122{
 93金沙注册送58 123            bolReturn = false;
 94金沙注册送58 124        }
 95金沙注册送58 125        return bolReturn;
 96金沙注册送58 126    }
 97金沙注册送58 127    #endregion
 98金沙注册送58 128
 99金沙注册送58 129金沙注册送58 130    将字符串转换来日期#region 将字符串转换来日期
100金沙注册送58 131金沙注册送58 132    /**//// <summary>
101金沙注册送58 133    /// 将字符串转换来日期
102金沙注册送58 134    /// </summary>
103金沙注册送58 135    /// <param name=”strValue”>将字符串转换到日期</param>
104金沙注册送58 136    /// <returns>int</returns>
105金沙注册送58 137    public static DateTime GetDateTime(string strValue)
106金沙注册送58 138金沙注册送58 139金沙注册送58 ,    金沙注册送58 140{
107金沙注册送58 141        return Convert.ToDateTime(strValue);
108金沙注册送58 142    }
109金沙注册送58 143    #endregion
110金沙注册送58 144
111金沙注册送58 145金沙注册送58 146    汉字字符串转拼音缩写#region 汉字字符串转拼音缩写
112金沙注册送58 147金沙注册送58 148    /**//// <summary>
113金沙注册送58 149    /// 汉字字符串转拼音缩写
114金沙注册送58 150    /// </summary>
115金沙注册送58 151    /// <param name=”str”>要更换的方块字字符串</param>
116金沙注册送58 152    /// <param name=”IsSmallChar”>是或不是用小写字母</param>
117金沙注册送58 153    /// <returns>拼音缩写</returns>
118金沙注册送58 154    public static string GetPYString(string str,bool IsSmallChar)
119金沙注册送58 155金沙注册送58 156    金沙注册送58 157{
120金沙注册送58 158        string tempStr = “”;
121金沙注册送58 159        foreach (char c in str)
122金沙注册送58 160金沙注册送58 161        金沙注册送58 162{
123金沙注册送58 163            if ((int)c >= 33 && (int)c <= 126)
124金沙注册送58 164金沙注册送58 165            金沙注册送58 166{//字母和符号原样保留
125金沙注册送58 167                tempStr += c.ToString();
126金沙注册送58 168            }
127金沙注册送58 169            else
128金沙注册送58 170金沙注册送58 171            金沙注册送58 172{//累加拼音声母
129金沙注册送58 173                tempStr += GetPYChar(c.ToString(), IsSmallChar);
130金沙注册送58 174            }
131金沙注册送58 175        }
132金沙注册送58 176        return tempStr;
133金沙注册送58 177    }
134金沙注册送58 178    #endregion
135金沙注册送58 179
136金沙注册送58 180金沙注册送58 181    将单个汉字转拼音缩写#region 将单个汉字转拼音缩写
137金沙注册送58 182金沙注册送58 183    /**//// <summary>
138金沙注册送58 184    /// 将单个汉字转拼音缩写
139金沙注册送58 185    /// </summary>
140金沙注册送58 186    /// <param name=”c”>要转换的单个汉字</param>
141金沙注册送58 187    /// <param name=”IsSmallChar”>是否用小写字母</param>
142金沙注册送58 188    /// <returns>拼音声母</returns>
143金沙注册送58 189    public static string GetPYChar(string c, bool IsSmallChar)
144金沙注册送58 190金沙注册送58 191    金沙注册送58 192{
145金沙注册送58 193        byte[] array = new byte[2];
146金沙注册送58 194        string strReturn = “*”;
147金沙注册送58 195        array = System.Text.Encoding.Default.GetBytes(c);
148金沙注册送58 196        int i = (short)(array[0] – ‘\0’) * 256 + ((short)(array[1] – ‘\0’));
149金沙注册送58 197
150金沙注册送58 198        if (i < 0xB0A1) strReturn = “*”;
151金沙注册送58 199        if (i < 0xB0C5) strReturn = “A”;
152金沙注册送58 200        if (i < 0xB2C1) strReturn = “B”;
153金沙注册送58 201        if (i < 0xB4EE) strReturn = “C”;
154金沙注册送58 202        if (i < 0xB6EA) strReturn = “D”;
155金沙注册送58 203        if (i < 0xB7A2) strReturn = “E”;
156金沙注册送58 204        if (i < 0xB8C1) strReturn = “F”;
157金沙注册送58 205        if (i < 0xB9FE) strReturn = “G”;
158金沙注册送58 206        if (i < 0xBBF7) strReturn = “H”;
159金沙注册送58 207        if (i < 0xBFA6) strReturn = “J”;
160金沙注册送58 208        if (i < 0xC0AC) strReturn = “K”;
161金沙注册送58 209        if (i < 0xC2E8) strReturn = “L”;
162金沙注册送58 210        if (i < 0xC4C3) strReturn = “M”;
163金沙注册送58 211        if (i < 0xC5B6) strReturn = “N”;
164金沙注册送58 212        if (i < 0xC5BE) strReturn = “O”;
165金沙注册送58 213        if (i < 0xC6DA) strReturn = “P”;
166金沙注册送58 214        if (i < 0xC8BB) strReturn = “Q”;
167金沙注册送58 215        if (i < 0xC8F6) strReturn = “R”;
168金沙注册送58 216        if (i < 0xCBFA) strReturn = “S”;
169金沙注册送58 217        if (i < 0xCDDA) strReturn = “T”;
170金沙注册送58 218        if (i < 0xCEF4) strReturn = “W”;
171金沙注册送58 219        if (i < 0xD1B9) strReturn = “X”;
172金沙注册送58 220        if (i < 0xD4D1) strReturn = “Y”;
173金沙注册送58 221        if (i < 0xD7FA) strReturn = “Z”;
174金沙注册送58 222
175金沙注册送58 223        if (IsSmallChar) strReturn =strReturn.ToLower();//是或不是用小写
176金沙注册送58 224
177金沙注册送58 225        return strReturn;
178金沙注册送58 226    }
179金沙注册送58 227    #endregion
180金沙注册送58 228
181金沙注册送58 229金沙注册送58 230    向地方中出席?或&#region 向地点中进入?或&
182金沙注册送58 231金沙注册送58 232    /**//// <summary>
183金沙注册送58 233    /// 向地点中参预?或&
184金沙注册送58 234    /// </summary>
185金沙注册送58 235    /// <param name=”strValue”>要处理的字符串</param>
186金沙注册送58 236    /// <returns>加了?或&的网址</returns>
187金沙注册送58 237    public static string JoinChar(string strValue)
188金沙注册送58 238金沙注册送58 239    金沙注册送58 240{
189金沙注册送58 241        int intValue1, intValue2, intLen;
190金沙注册送58 242
191金沙注册送58 243        intLen = strValue.Length;
192金沙注册送58 244        intValue1 = strValue.IndexOf(“?”);
193金沙注册送58 245        intValue2 = strValue.LastIndexOf(“&”);
194金沙注册送58 246        if (intValue1 > 0 && intValue1 < intLen – 1)
195金沙注册送58 247金沙注册送58 248        金沙注册送58 249{
196金沙注册送58 250            if ((intValue2 > 0 && intValue2 < intLen – 1) || intValue2 == -1)
197金沙注册送58 251金沙注册送58 252            金沙注册送58 253{
198金沙注册送58 254                return strValue + “&”;
199金沙注册送58 255            }
200金沙注册送58 256            else
201金沙注册送58 257金沙注册送58 258            金沙注册送58 259{
202金沙注册送58 260                return strValue;
203金沙注册送58 261            }
204金沙注册送58 262        }
205金沙注册送58 263        else if (intValue1 == intLen – 1)
206金沙注册送58 264金沙注册送58 265        金沙注册送58 266{
207金沙注册送58 267            return strValue;
208金沙注册送58 268        }
209金沙注册送58 269        else
210金沙注册送58 270金沙注册送58 271        金沙注册送58 272{
211金沙注册送58 273            return strValue + “?”;
212金沙注册送58 274        }
213金沙注册送58 275
214金沙注册送58 276    }
215金沙注册送58 277    #endregion
216金沙注册送58 278
217金沙注册送58 279金沙注册送58 280    去掉地址中”page=”及其背后字符#region 去掉地址中”page=”及其背后字符
218金沙注册送58 281金沙注册送58 282    /**//// <summary>
219金沙注册送58 283    /// 去掉地址中&page=”及其背后字符
220金沙注册送58 284    /// </summary>
221金沙注册送58 285    /// <param name=”strValue”>要拍卖的字符串</param>
222金沙注册送58 286    /// <returns>去掉地址中”page=”及其背后字符</returns>
223金沙注册送58 287    public static string GetPageURL(string strValue)
224金沙注册送58 288金沙注册送58 289    金沙注册送58 290{
225金沙注册送58 291        int intValue, intLen;
226金沙注册送58 292
227金沙注册送58 293        intLen = strValue.Length;
228金沙注册送58 294        intValue = strValue.IndexOf(“page=”);
229金沙注册送58 295        if (intValue > 0 && intValue < intLen – 5)
230金沙注册送58 296金沙注册送58 297        金沙注册送58 298{
231金沙注册送58 299            return strValue.Substring(0, intValue);
232金沙注册送58 300        }
233金沙注册送58 301        else
234金沙注册送58 302金沙注册送58 303        金沙注册送58 304{
235金沙注册送58 305            return strValue;
236金沙注册送58 306        }
237金沙注册送58 307
238金沙注册送58 308    }
239金沙注册送58 309    #endregion
240金沙注册送58 310
241金沙注册送58 311金沙注册送58 312    过滤/还原 带有 HTML-JS 的字符串#region 过滤/还原 带有 HTML-JS 的字符串
242金沙注册送58 313    public static string htmlInputText(string inputString)//HTML过滤输入字符串
243金沙注册送58 314金沙注册送58 315    金沙注册送58 316{
244金沙注册送58 317        if ((inputString != null) && (inputString != String.Empty))
245金沙注册送58 318金沙注册送58 319        金沙注册送58 320{
246金沙注册送58 321            inputString = inputString.Trim();
247金沙注册送58 322            inputString = inputString.Replace(“‘”, “"”);
248金沙注册送58 323            inputString = inputString.Replace(“<“, “<“);
249金沙注册送58 324            inputString = inputString.Replace(“>”, “>”);
250金沙注册送58 325            inputString = inputString.Replace(” “, ” “);
251金沙注册送58 326            inputString = inputString.Replace(“\n”, “<br>”);
252金沙注册送58 327            return inputString.ToString();
253金沙注册送58 328        }
254金沙注册送58 329        return “”;
255金沙注册送58 330    }
256金沙注册送58 331
257金沙注册送58 332    public static string htmlOutputText(string inputString)//HTML还原字符串
258金沙注册送58 333金沙注册送58 334    金沙注册送58 335{
259金沙注册送58 336        if ((inputString != null) && (inputString != String.Empty))
260金沙注册送58 337金沙注册送58 338        金沙注册送58 339{
261金沙注册送58 340            inputString = inputString.Trim();
262金沙注册送58 341            inputString = inputString.Replace(“"”, “‘”);
263金沙注册送58 342            inputString = inputString.Replace(“<“, “<“);
264金沙注册送58 343            inputString = inputString.Replace(“>”, “>”);
265金沙注册送58 344            inputString = inputString.Replace(” “, ” “);
266金沙注册送58 345            inputString = inputString.Replace(“<br>”, “\n”);
267金沙注册送58 346            return inputString.ToString();
268金沙注册送58 347        }
269金沙注册送58 348        return “”;
270金沙注册送58 349    }
271金沙注册送58 350
272金沙注册送58 351    public static string htmlInputTextfck(string inputString)//HTML还原字符串
273金沙注册送58 352金沙注册送58 353    金沙注册送58 354{
274金沙注册送58 355        if ((inputString != null) && (inputString != String.Empty))
275金沙注册送58 356金沙注册送58 357        金沙注册送58 358{
276金沙注册送58 359            inputString = inputString.Trim();
277金沙注册送58 360            inputString = inputString.Replace(“‘”, ” “);
278金沙注册送58 361            inputString = inputString.Replace(” “, ”    “);
279金沙注册送58 362            return inputString.ToString();
280金沙注册送58 363        }
281金沙注册送58 364        return “”;
282金沙注册送58 365    }
283金沙注册送58 366
284金沙注册送58 367    public static string htmlInputface(string inputString)//HTML过滤输入字符串
285金沙注册送58 368金沙注册送58 369    金沙注册送58 370{
286金沙注册送58 371        if ((inputString != null) && (inputString != String.Empty))
287金沙注册送58 372金沙注册送58 373        金沙注册送58 374{
288金沙注册送58 375            inputString = inputString.Trim();
289金沙注册送58 376            inputString = inputString.Replace(“‘”, “"”);
290金沙注册送58 377            inputString = inputString.Replace(“<“, “<“);
291金沙注册送58 378            inputString = inputString.Replace(“>”, “>”);
292金沙注册送58 379            inputString = inputString.Replace(” “, ” “);
293金沙注册送58 380            inputString = inputString.Replace(“\n”, “<br>”);
294金沙注册送58 381            inputString = inputString.Replace(“{image01}”, “<IMG src=face/01.gif>”);
295金沙注册送58 382            inputString = inputString.Replace(“{image02}”, “<IMG src=face/02.gif>”);
296金沙注册送58 383            inputString = inputString.Replace(“{image03}”, “<IMG src=face/03.gif>”);
297金沙注册送58 384            inputString = inputString.Replace(“{image04}”, “<IMG src=face/04.gif>”);
298金沙注册送58 385            inputString = inputString.Replace(“{image05}”, “<IMG src=face/05.gif>”);
299金沙注册送58 386            inputString = inputString.Replace(“{image06}”, “<IMG src=face/06.gif>”);
300金沙注册送58 387            inputString = inputString.Replace(“{image07}”, “<IMG src=face/07.gif>”);
301金沙注册送58 388            inputString = inputString.Replace(“{image08}”, “<IMG src=face/08.gif>”);
302金沙注册送58 389            inputString = inputString.Replace(“{image09}”, “<IMG src=face/09.gif>”);
303金沙注册送58 390            inputString = inputString.Replace(“{image10}”, “<IMG src=face/10.gif>”);
304金沙注册送58 391            inputString = inputString.Replace(“{image11}”, “<IMG src=face/11.gif>”);
305金沙注册送58 392            return inputString.ToString();
306金沙注册送58 393        }
307金沙注册送58 394        return “”;
308金沙注册送58 395    }
309金沙注册送58 396
310金沙注册送58 397    #endregion
311金沙注册送58 398
312金沙注册送58 399金沙注册送58 400    去除HTML标记#region 去除HTML标记 
313金沙注册送58 401金沙注册送58 402    /**//// <summary>
314金沙注册送58 403    /// 去除HTML标记 
315金沙注册送58 404    /// 恐怕用简单的,直接除去<>里面包车型地铁始末 
316金沙注册送58 405    /// = System.Text.RegularExpressions.Regex.Replace(strHtml, “<[^>]+>”, “”); 
317金沙注册送58 406    /// </summary>
318金沙注册送58 407    /// <param name=”NoHTML”>包括HTML的源码 </param>
319金沙注册送58 408    /// <returns>已经删除后的文字</returns>
320金沙注册送58 409    public static string NoHTML(string Htmlstring)
321金沙注册送58 410金沙注册送58 411    金沙注册送58 412{
322金沙注册送58 413        //删除脚本
323金沙注册送58 414        Htmlstring = Regex.Replace(Htmlstring, @”<script[^>]*?>.*?</script>”, “”, RegexOptions.IgnoreCase);
324金沙注册送58 415
325金沙注册送58 416        //删除HTML
326金沙注册送58 417        Htmlstring = Regex.Replace(Htmlstring, @”<(.[^>]*)>”, “”, RegexOptions.IgnoreCase);
327金沙注册送58 418        Htmlstring = Regex.Replace(Htmlstring, @”([\r\n])[\s]+”, “”, RegexOptions.IgnoreCase);
328金沙注册送58 419        Htmlstring = Regex.Replace(Htmlstring, @”–>”, “”, RegexOptions.IgnoreCase);
329金沙注册送58 420        Htmlstring = Regex.Replace(Htmlstring, @”<!–.*”, “”, RegexOptions.IgnoreCase);
330金沙注册送58 421
331金沙注册送58 422        Htmlstring = Regex.Replace(Htmlstring, @”&(quot|#34);”, “\””, RegexOptions.IgnoreCase);
332金沙注册送58 423        Htmlstring = Regex.Replace(Htmlstring, @”&(amp|#38);”, “&”, RegexOptions.IgnoreCase);
333金沙注册送58 424        Htmlstring = Regex.Replace(Htmlstring, @”&(lt|#60);”, “<“, RegexOptions.IgnoreCase);
334金沙注册送58 425        Htmlstring = Regex.Replace(Htmlstring, @”&(gt|#62);”, “>”, RegexOptions.IgnoreCase);
335金沙注册送58 426        Htmlstring = Regex.Replace(Htmlstring, @”&(nbsp|#160);”, ” “, RegexOptions.IgnoreCase);
336金沙注册送58 427        Htmlstring = Regex.Replace(Htmlstring, @”&(iexcl|#161);”, “\xa1”, RegexOptions.IgnoreCase);
337金沙注册送58 428        Htmlstring = Regex.Replace(Htmlstring, @”&(cent|#162);”, “\xa2”, RegexOptions.IgnoreCase);
338金沙注册送58 429        Htmlstring = Regex.Replace(Htmlstring, @”&(pound|#163);”, “\xa3”, RegexOptions.IgnoreCase);
339金沙注册送58 430        Htmlstring = Regex.Replace(Htmlstring, @”&(copy|#169);”, “\xa9”, RegexOptions.IgnoreCase);
340金沙注册送58 431        Htmlstring = Regex.Replace(Htmlstring, @”(\d+);”, “”, RegexOptions.IgnoreCase);
341金沙注册送58 432        Htmlstring.Replace(“<“, “”);
342金沙注册送58 433        Htmlstring.Replace(“>”, “”);
343金沙注册送58 434        Htmlstring.Replace(“\r\n”, “”);
344金沙注册送58 435        Htmlstring = HttpContext.Current.Server.HtmlEncode(Htmlstring).Trim();
345金沙注册送58 436
346金沙注册送58 437        return Htmlstring;
347金沙注册送58 438
348金沙注册送58 439    }
349金沙注册送58 440    #endregion
350金沙注册送58 441
351金沙注册送58 442金沙注册送58 443    从右边取钦赐长度的字符串 中文算 二 个#region 从左边取内定长度的字符串 中文算 2 个
352金沙注册送58 444金沙注册送58 445    /**//// <summary>
353金沙注册送58 446    /// 从左侧取钦赐长度的字符串 粤语算 二 个
354金沙注册送58 447    /// </summary>
355金沙注册送58 448    /// <param name=”inputString”>要截取的字符串</param>
356金沙注册送58 449    /// <param name=”len”>要截取的长短</param>
357金沙注册送58 450    /// <param name=”bolPoint”>是或不是出示金沙注册送58 451</param>
358金沙注册送58 452    /// <returns>截取后的字符串</returns>
359金沙注册送58 453    public static string CutString(string inputString, int len, bool bolPoint)
360金沙注册送58 454金沙注册送58 455    金沙注册送58 456{
361金沙注册送58 457
362金沙注册送58 458        ASCIIEncoding ascii = new ASCIIEncoding();
363金沙注册送58 459        int tempLen = 0;
364金沙注册送58 460        string tempString = “”;
365金沙注册送58 461        byte[] s = ascii.GetBytes(inputString);
366金沙注册送58 462        for (int i = 0; i < s.Length; i++)
367金沙注册送58 463金沙注册送58 464        金沙注册送58 465{
368金沙注册送58 466            //中文算 2 个
369金沙注册送58 467            if ((int)s[i] == 63)
370金沙注册送58 468金沙注册送58 469            金沙注册送58 470{
371金沙注册送58 471                tempLen += 2;
372金沙注册送58 472            }
373金沙注册送58 473            else
374金沙注册送58 474金沙注册送58 475            金沙注册送58 476{
375金沙注册送58 477                tempLen += 1;
376金沙注册送58 478            }
377金沙注册送58 479
378金沙注册送58 480            try
379金沙注册送58 481金沙注册送58 482            金沙注册送58 483{
380金沙注册送58 484                tempString += inputString.Substring(i, 1);
381金沙注册送58 485            }
382金沙注册送58 486            catch
383金沙注册送58 487金沙注册送58 488            金沙注册送58 489{
384金沙注册送58 490                break;
385金沙注册送58 491            }
386金沙注册送58 492
387金沙注册送58 493            if (tempLen > len)
388金沙注册送58 494                break;
389金沙注册送58 495        }
390金沙注册送58 496
391金沙注册送58 497        //加上半个省略号
392金沙注册送58 498        byte[] mybyte = System.Text.Encoding.Default.GetBytes(inputString);
393金沙注册送58 499        if (bolPoint && mybyte.Length > len)
394金沙注册送58 500金沙注册送58 501        金沙注册送58 502{
395金沙注册送58 503            tempString += “…”;
396金沙注册送58 504        }
397金沙注册送58 505
398金沙注册送58 506        return tempString;
399金沙注册送58 507    }
400金沙注册送58 508    #endregion
401金沙注册送58 509
402金沙注册送58 510}

public static class MessageBox
{
/// <summary>
/// 呈现消息提醒对话框
/// </summary>
/// <param name=”page”>当前页面指针,一般为this</param>
/// <param name=”msg”>提醒音讯</param>
public static void Show(System.Web.UI.Page page, string msg)
{
page.ClientScript.RegisterStartupScript(typeof(System.Web.UI.Page),
“message”, “<script type=\”text/javascript\”
language=\”javascript\” defer>alert(‘” + StrSafe +
“‘);</script>”);
}

public static void Login_PostPoll()
{
try
{
string url = “”;
string dat =
“{\”ptwebqq\”:\”#{ptwebqq}\”,\”clientid\”:53999199,\”psessionid\”:\”#{psessionid}\”,\”key\”:\”\”}”;
dat = dat.Replace(“#{ptwebqq}”,
Login_ptwebqq).Replace(“#{psessionid}”, Login_Psessionid);
dat = “r=” + HttpUtility.UrlEncode(dat);
HTTP.Post_Async_Action action = Message_Get;
HTTP.Post_Async(url, dat, action);
}
catch (Exception) { Login_PostPoll(); }
}
#endregion
#region 接收到音讯的回调函数
/// <summary>
/// 接收到消息的回调函数
/// </summary>
/// <param name=”data”>接收到的数据(json)</param>
private static bool Running = true;
public static void Message_Get(string data)
{
Task.Run(() => Login_PostPoll());
if (Running)
Task.Run(() =>
Message_Process(data));//那一个是处理收到音讯的其它3个方法具体处理
在源码
}

 

/// <summary>
/// 显示消息提醒对话框
/// </summary>
/// <param name=”page”>当前页面指针,一般为this</param>
/// <param name=”msg”>提醒消息</param>
public static void Show(System.Web.UI.Page page, string key, string
msg)
{
page.ClientScript.RegisterStartupScript(typeof(System.Web.UI.Page), key,
“<script type=\”text/javascript\” language=\”javascript\”
defer>alert(‘” + StrSafe + “‘);</script>”);
}

上述正是poll包的处理以及 收到的新闻处理

public static void Login_GetPHV()
{
string urldata =
“{\”ptwebqq\”:\”#{ptwebqq}\”,\”clientid\”:53999199,\”psessionid\”:\”\”,\”status\”:\”online\”}”.Replace(“#{ptwebqq}”,
Login_ptwebqq);
urldata = “r=” + HttpUtility.UrlEncode(urldata);
string dat = HTTP.Post(“”, urldata,
“”);

/// <summary>
/// 提醒音讯关闭页面,音讯可为空不出示。
/// </summary>
/// <param name=”page”>当前页面指针,1般为this</param>
/// <param name=”msg”>提醒音信,为空则不提醒</param>
public static void Close(System.Web.UI.Page page, string msg)
{
string js = “<script type=\”text/javascript\”
language=\”javascript\” defer>”;
if (msg != “”)
js += “alert(‘” + msg.ToString;”;
js += “window.close();</script>”;
page.ClientScript.RegisterStartupScript(typeof(System.Web.UI.Page),
“message”, js);
}
/// <summary>
/// 提醒音信关闭页面,新闻可为空不显得。
/// </summary>
/// <param name=”page”>当前页面指针,一般为this</param>
/// <param name=”msg”>提醒新闻,为空则不提醒</param>
public static void Close(System.Web.UI.Page page, string key, string
msg)
{
string js = “<script type=\”text/javascript\”
language=\”javascript\” defer>”;
if (msg != “”)
js += “alert(‘” + msg.ToString;”;
js += “window.close();</script>”;
page.ClientScript.RegisterStartupScript(typeof(System.Web.UI.Page), key,
js);
}

接下去是 发送的 

Login_Psessionid = dat.Replace(“:”, “,”).Replace(“{“, “”).Replace(“}”,
“”).Replace(“\””, “”).Split(‘,’)[10];
Login_QQ = dat.Replace(“:”, “,”).Replace(“{“, “”).Replace(“}”,
“”).Replace(“\””, “”).Split(‘,’)[14];//登录QQ
//Login_Vfwebqq = dat.Replace(“:”, “,”).Replace(“{“, “”).Replace(“}”,
“”).Replace(“\””, “”).Split(‘,’)[18];
Login_Hash = Hash2(Login_QQ, Login_ptwebqq);//
在那么些js 获得不行hash的值
JS里面包车型地铁主意名是Hash2 里面是1陆进制
必要转移成C#的品类。第三个参数是真实QQ第一个ptwebqq
//1开头拿地方的cookie
里面包车型地铁Vfwebqq,是13分的,再请求3回,获得收获好友消息的vfwebqq
string urlvfwebqq =
“”,
Login_ptwebqq).Replace(“#{t}”, TimeStamp());
string datVfwebqq = HTTP.Get(urlvfwebqq,
“”);
Login_Vfwebqq = datVfwebqq.Split(‘\”‘)[7];
SendOnlog(Login_QQ +”/r/n”+ Login_Vfwebqq + “/r/n” + Login_Psessionid

/// <summary>
/// 屏蔽提醒关闭窗口
/// </summary>
/// <param name=”page”></param>
/// <param name=”msg”></param>
public static void DClose(System.Web.UI.Page page, string msg)
{
StringBuilder js = new StringBuilder(“<script
type=\”text/javascript\” language=\”javascript\” defer>”);
if (msg != “”)
js.AppendLine(“alert(‘” + msg.ToString;”);
js.AppendLine(“var ua = navigator.userAgent; var ie =
navigator.appName==\”Microsoft Internet Explorer\”?true:false;”);
js.AppendLine{“);
js.AppendLine(“var IEversion =
parseFloat(ua.substring(ua.indexOf(\”MSIE
\”)+5,ua.indexOf(\”;\”,ua.indexOf(\”MSIE \”))));”);
js.AppendLine(“if( IEversion< 5.5){“);
js.AppendLine(“var str = ”;”);
js.AppendLine(“document.body.insertAdjacentHTML(\”beforeEnd\”,
str);”);
js.AppendLine(“document.all.noTipClose.Click;
js.AppendLine(“} else {“);
js.AppendLine(“window.opener =null; window.close;
js.AppendLine;
js.AppendLine;
js.AppendLine(“window.close;
js.AppendLine(“</script>”);
page.ClientScript.RegisterStartupScript(typeof(System.Web.UI.Page),
“message”, js.ToString;
}

金沙注册送58 511

  • “/r/n” + Login_Hash);
    }

/// <summary>
/// 屏蔽提醒关闭窗口
/// </summary>
/// <param name=”page”></param>
/// <param name=”msg”></param>
public static void DClose(System.Web.UI.Page page, string key, string
msg)
{
StringBuilder js = new StringBuilder(“<script
type=\”text/javascript\” language=\”javascript\” defer>”);
if (msg != “”)
js.AppendLine(“alert(‘” + msg.ToString;”);
js.AppendLine(“var ua = navigator.userAgent; var ie =
navigator.appName==\”Microsoft Internet Explorer\”?true:false;”);
js.AppendLine{“);
js.AppendLine(“var IEversion =
parseFloat(ua.substring(ua.indexOf(\”MSIE
\”)+5,ua.indexOf(\”;\”,ua.indexOf(\”MSIE \”))));”);
js.AppendLine(“if( IEversion< 5.5){“);
js.AppendLine(“var str = ”;”);
js.AppendLine(“document.body.insertAdjacentHTML(\”beforeEnd\”,
str);”);
js.AppendLine(“document.all.noTipClose.Click;
js.AppendLine(“} else {“);
js.AppendLine(“window.opener =null; window.close;
js.AppendLine;
js.AppendLine;
js.AppendLine(“window.close;
js.AppendLine(“</script>”);
page.ClientScript.RegisterStartupScript(typeof(System.Web.UI.Page), key,
js.ToString;
}

 

地点就足以得到 Login_ptwebqq  Login_Psessionid ,Login_Hash 这个hash 
需要

/// <summary>
/// 控件点击音讯确认提醒框
/// </summary>
/// <param name=”page”>当前页面指针,1般为this</param>
/// <param name=”msg”>提醒新闻</param>
public static void ShowConfirm(System.Web.UI.WebControls.WebControl
Control, string msg)
{
//Control.Attributes.Add(“onClick”,”if
(!window.confirm(‘”+msg+”‘)){return false;}”);
Control.Attributes.Add(“onclick”, “return confirm(‘” + msg + “‘);”);
}

 上边是出殡和埋葬的连日以及 发送后赶回的 poll包新闻。代码如下 

在这几个js 获得极度hash的值
JS里面包车型大巴办法名是Hash二 里面是1六进制 需求更换到C# 也能够平昔 
调用那个JS。第贰个参数是Login_QQ 第二个Login_ptwebqq  

/// <summary>
/// 呈现新闻提醒对话框,并展开页面跳转
/// </summary>
/// <param name=”page”>当前页面指针,一般为this</param>
/// <param name=”msg”>提醒新闻</param>
/// <param name=”url”>跳转的指标U奇骏L</param>
public static void ShowAndRedirect(System.Web.UI.Page page, string msg,
string url)
{
StringBuilder Builder = new StringBuilder();
Builder.Append(“<script type=\”text/javascript\”
language=\”javascript\” defer>”);
if (msg != “”)
Builder.AppendFormat(“alert;”, msg);
Builder.AppendFormat(“window.location.href='{0}’;”, url);
Builder.Append(“</script>”);
page.ClientScript.RegisterStartupScript(typeof(System.Web.UI.Page),
“message”, Builder.ToString;
}

/// <summary>
///
/// </summary>
/// <param name=”type”>私聊0 群聊1 讨论组2</param>
/// <param name=”uin”>uin</param>
/// <param name=”messageToSend”>消息</param>
/// <param name=”auto”></param>
/// <returns></returns>
public static bool Login_Postsend_buddy_msg(int type, string uin,
string messageToSend)
{
if (messageToSend.Equals(“”) || uin.Equals(“”))
return false;
string[] tmp = messageToSend.Split(“{}”.ToCharArray());
messageToSend = “”;
for (int i = 0; i < tmp.Length; i++)
if (!tmp[i].Trim().StartsWith(“..[face”) ||
!tmp[i].Trim().EndsWith(“]..”))
messageToSend += “\\\”” + tmp[i] + “\\\”,”;
else
messageToSend += tmp[i].Replace(“..[face”,
“[\\\”face\\\”,”).Replace(“]..”, “],”);
messageToSend = messageToSend.Remove(messageToSend.LastIndexOf(‘,’));
messageToSend = messageToSend.Replace(“\r\n”, “\n”).Replace(“\n\r”,
“\n”).Replace(“\r”, “\n”).Replace(“\n”, Environment.NewLine);
try
{
string to_groupuin_did, url;
switch (type)
{
case 0:
to_groupuin_did = “to”;
url = “”;
break;
case 1:
to_groupuin_did = “group_uin”;
url = “”;
break;
case 2:
to_groupuin_did = “did”;
url = “”;
break;
default:
return false;
}
string postData =
“{\”#{type}\”:#{id},\”content\”:\”[#{msg},[\\\”font\\\”,{\\\”name\\\”:\\\”繁体\\\”,\\\”size\\\”:10,\\\”style\\\”:[0,0,0],\\\”color\\\”:\\\”000000\\\”}]]\”,\”face\”:#{face},\”clientid\”:53999199,\”msg_id\”:#{msg_id},\”psessionid\”:\”#{psessionid}\”}”;
postData = “r=” + HttpUtility.UrlEncode(postData.Replace(“#{type}”,
to_groupuin_did).Replace(“#{id}”, uin).Replace(“#{msg}”,
messageToSend).Replace(“#{face}”,
SelfInfo.face.ToString()).Replace(“#{msg_id}”, rand.Next(10000000,
99999999).ToString()).Replace(“#{psessionid}”, Login_Psessionid));

public static string Hash2(string uin, string ptvfwebqq)
{
int[] ptbIndex = new int[4];
long QQ_Long = long.Parse(uin);
for (int i = 0; i < ptvfwebqq.Length; i++)
{
ptbIndex[i % 4] ^= ptvfwebqq.ToCharArray()[i];
}
string[] salt = { “EC”, “OK” };
long[] uinByte = new long[4];
uinByte[0] = QQ_Long >> 24 & 255 ^
salt[0].ToCharArray()[0];
uinByte[1] = QQ_Long >> 16 & 255 ^
salt[0].ToCharArray()[1];
uinByte[2] = QQ_Long >> 8 & 255 ^
salt[1].ToCharArray()[0];
uinByte[3] = QQ_Long & 255 ^ salt[1].ToCharArray()[1];

/// <summary>
/// 输出自定义脚本消息
/// </summary>
/// <param name=”page”>当前页面指针,一般为this</param>
/// <param name=”script”>输出脚本</param>
public static void ResponseScript(System.Web.UI.Page page, string
script)
{
page.ClientScript.RegisterStartupScript(typeof(System.Web.UI.Page),
“message”, “<script type=\”text/javascript\”
language=\”javascript\” defer>” + script + “</script>”);
}
/// <summary>
/// 输出自定义脚本信息
/// </summary>
/// <param name=”page”>当前页面指针,1般为this</param>
/// <param name=”script”>输出脚本</param>
public static void ResponseScript(System.Web.UI.Page page, string key,
string script)
{
page.ClientScript.RegisterStartupScript(typeof(System.Web.UI.Page), key,
“<script type=\”text/javascript\” language=\”javascript\”
defer>” + script + “</script>”);
}

string dat = HTTP.Post(url, postData,
“”);
return dat.Equals(“{\”errCode\”:0,\”msg\”:\”send ok\”}”);
}
catch (Exception)
{
return false;
}
}

long[] result = new long[8];

/// <summary>
/// 页面后退
/// </summary>
/// <param name=”page”>当前页面指针,一般为this</param>
/// <param name=”count”>后倒退数</param>
public static void HistoryBack(System.Web.UI.Page page, int count)
{
StringBuilder Builder = new StringBuilder();
Builder.Append(“<script type=\”text/javascript\”
language=\”javascript\” defer>”);
Builder.AppendFormat(“window.history.go”, count);
Builder.Append(“</script>”);
page.ClientScript.RegisterStartupScript(typeof(System.Web.UI.Page),
“historygo”, Builder.ToString;
}

 

for (int i = 0; i < 8; i++)
{
result[i] = i % 2 == 0 ? ptbIndex[i >> 1] : uinByte[i
>> 1];
}

/// <summary>
/// 重返上一页
/// </summary>
/// <returns></returns>
public static void HistoryBack(System.Web.UI.Page page)
{
page.ClientScript.RegisterStartupScript(typeof(System.Web.UI.Page),
“historygo”, “<script type=\”text/javascript\”
language=\”javascript\” defer>\n window.history.go; \n
</script>”);
}

那一讲费了广大光阴,中间又去查了素材。特别是处理回来的 包的json
,不晓得怎么格式化,只好替换出来,得到想要的数码。

string[] hex = { “0”, “1”, “2”, “3”, “4”, “5”, “6”, “7”, “8”, “9”,
“A”, “B”, “C”, “D”, “E”, “F” };
string buf = “”;

/// <summary>
/// js安全转移
/// </summary>
/// <param name=”str”>源字符</param>
/// <returns>重临代码</returns>
public static string StrSafe(string str)
{
StringBuilder rd = new StringBuilder;
rd.Replace(“\b”, “\\b”);
rd.Replace(“\f”, “\\f”);
rd.Replace(“\n”, “\\n”);
rd.Replace(“\r”, “\\r”);
rd.Replace(“\t”, “\\t”);
rd.Replace(“\'”, “\\'”);
rd.Replace(“\””, “\\\””);
return rd.ToString();
}

 

for (int i= 0; i < result.Length; i++)
{
buf += hex[(int)((result[i] >> 4) & 15)];
buf += hex[(int)(result[i] & 15)];
}
return buf;
}

#region Ajax
/// <summary>
/// 呈现新闻提醒对话框
/// </summary>
/// <param name=”page”>当前页面指针,壹般为this</param>
/// <param name=”msg”>提示音信</param>
public static void AjaxShow(System.Web.UI.Page page, string msg)
{
System.Web.UI.ScriptManager.RegisterStartupScript(page, page.GetType(),
“message”, “alert(‘” + StrSafe + “‘);”, true);
}
/// <summary>
/// 突显音信提示对话框
/// </summary>
/// <param name=”page”>当前页面指针,①般为this</param>
/// <param name=”msg”>提醒音信</param>
public static void AjaxShow(System.Web.UI.Page page, string key, string
msg)
{
System.Web.UI.ScriptManager.RegisterStartupScript(page, page.GetType(),
key, “alert(‘” + StrSafe + “‘);”, true);
}
/// <summary>
/// 显示信息提醒对话框,并实行页面跳转
/// </summary>
/// <param name=”page”>当前页面指针,一般为this</param>
/// <param name=”msg”>提醒消息</param>
/// <param name=”url”>跳转的指标UEvoqueL</param>
public static void AjaxShowAndRedirect(System.Web.UI.Page page, string
msg, string url)
{
StringBuilder Builder = new StringBuilder();
if (msg != “”)
Builder.AppendFormat(“alert;”, msg);
Builder.AppendFormat(“window.location.href='{0}’;”, url);
System.Web.UI.ScriptManager.RegisterStartupScript(page, page.GetType(),
“message”, Builder.ToString;
}
/// <summary>
/// 显示音信提示对话框,并进行页面跳转
/// </summary>
/// <param name=”page”>当前页面指针,壹般为this</param>
/// <param name=”msg”>提醒新闻</param>
/// <param name=”url”>跳转的目的U安德拉L</param>
public static void AjaxShowAndRedirect(System.Web.UI.Page page, string
key, string msg, string url)
{
StringBuilder Builder = new StringBuilder();
if (msg != “”)
Builder.AppendFormat(“alert;”, msg);
Builder.AppendFormat(“window.location.href='{0}’;”, url);
System.Web.UI.ScriptManager.RegisterStartupScript(page, page.GetType(),
key, Builder.ToString;
}
/// <summary>
/// 提醒音讯关闭页面,消息可为空不显得。
/// </summary>
/// <param name=”page”>当前页面指针,一般为this</param>
/// <param name=”msg”>提醒消息,为空则不提醒</param>
public static void AjaxClose(System.Web.UI.Page page, string msg)
{
string js = “”;
if (msg != “”)
js += “alert(‘” + msg.ToString;”;
js += “window.close();”;
System.Web.UI.ScriptManager.RegisterStartupScript(page, page.GetType(),
“message”, js, true);
}
/// <summary>
/// 提示消息关闭页面,音信可为空不显得。
/// </summary>
/// <param name=”page”>当前页面指针,一般为this</param>
/// <param name=”msg”>提示新闻,为空则不提示</param>
public static void AjaxClose(System.Web.UI.Page page, string key, string
msg)
{
string js = “”;
if (msg != “”)
js += “alert(‘” + msg.ToString;”;
js += “window.close();”;
System.Web.UI.ScriptManager.RegisterStartupScript(page, page.GetType(),
key, js, true);
}
/// <summary>
/// 输出自定义脚本音讯
/// </summary>
/// <param name=”page”>当前页面指针,1般为this</param>
/// <param name=”script”>输出脚本</param>
public static void AjaxResponseScript(System.Web.UI.Page page, string
script)
{
System.Web.UI.ScriptManager.RegisterStartupScript(page, page.GetType(),
“message”, script, true);
}
/// <summary>
/// 输出自定义脚本音讯
/// </summary>
/// <param name=”page”>当前页面指针,一般为this</param>
/// <param name=”script”>输出脚本</param>
public static void AjaxResponseScript(System.Web.UI.Page page, string
key, string script)
{
System.Web.UI.ScriptManager.RegisterStartupScript(page, page.GetType(),
key, script, true);
}
/// <summary>
/// 页面后退
/// </summary>
/// <param name=”page”>当前页面指针,1般为this</param>
/// <param name=”count”>后倒退数</param>
public static void AjaxHistoryBack(System.Web.UI.Page page, int count)
{
StringBuilder Builder = new StringBuilder();
Builder.AppendFormat(“window.history.go;”, count);
System.Web.UI.ScriptManager.RegisterStartupScript(page, page.GetType(),
“historygo”, Builder.ToString;
}
/// <summary>
/// 再次回到上1页
/// </summary>
/// <returns></returns>
public static void AjaxHistoryBack(System.Web.UI.Page page)
{
System.Web.UI.ScriptManager.RegisterStartupScript(page, page.GetType(),
“historygo”, “window.history.go\”;”, true);
}
#endregion
}

到现行反革命甘休,整个新手smart qq http 协议的教程
已经能够说成功了,因为这么些体协会议的效益分外单纯,并且很多都曾经被TX去掉的,就像是获取好友的
真实QQ也一度是报错的。接下来就可以做图形界面,还有部分业务了(qq机器人自动回复等)

 

 

上述便是C# 获取smart qq  的vfwebqq ,psessionid,hash 

相关文章

网站地图xml地图