Beispiel #1
0
        /// <summary>
        /// 提取cookie需要部分
        /// </summary>
        /// <param name="cookie"></param>
        /// <param name="keys"></param>
        /// <returns></returns>
        private string GetPart(string cookie, params string[] keys)
        {
            string result = "";

            foreach (string i in keys)
            {
                if (!cookie.Contains(i + "="))
                {
                    continue;
                }
                if (!cookie.Substring(cookie.IndexOf(i + "=")).Contains(";"))
                {
                    result += cookie.Substring(cookie.IndexOf(i + "=")) + ";";
                }
                else
                {
                    result += i + "=" + Tieba.Mid(cookie, i + "=", ";") + ";";
                }
            }
            return(result);
        }