通過抓包獲取到的字符串如jsonString所示
有對反序列化熟悉的同學能提供個類不
string jsonString = @
{
black
: []
white
: []
contact
: [
{
pinyin
:
nickname
:
r
id
:
email
:
}
{
pinyin
:
nickname
:
r
id
:
email
:
}
{
pinyin
:
nickname
:
yi
id
:
email
:
}
{
pinyin
:
nickname
:
小燕子
id
:
email
:
}
]
group
: []
recent
: []
}
;
#region 通訊錄收取
string rg_count =
contact\
: [[](?<count>
*?)[]]
;
string[] k = EmailHelp
GetRegValue(jsonString
rg_count
count
)
string[] nickname = EmailHelp
GetRegValue(k[
]
nickname\
:(?<nickname>
*?)[
]
nickname
)
string[] email = EmailHelp
GetRegValue(k[
]
email\
:(?<email>
*?)[}]
email
)
string path = string
Format(@
C:\mail\
+
)
if (!Directory
Exists(path))
{
Directory
CreateDirectory(path)
}
StreamWriter sw = new StreamWriter(path +
\\
+
sohuContacts
csv
)
//列名
sw
WriteLine(
昵稱
郵件賬號
)
//遍歷datatable導出數據
for (int i =
; i < nickname
Length; i++)
{
StringBuilder sbText = new StringBuilder()
sbText
Append(nickname[i] +
+ email[i])
//寫datatable的一行
sw
WriteLine(sbText
ToString())
}
sw
Flush()
sw
Close()
#endregion
From:http://tw.wingwit.com/Article/program/ASP/201311/21800.html