/// <summary> /// 解析数据 /// </summary> /// <param name="datasource"></param> public void BuildData(CallDataSource datasource) { if (!FileHelper.IsValid(MainDbPath)) { return; } SqliteContext mainContext = null; try { //主数据库对象 var mainDbPath = SqliteRecoveryHelper.DataRecovery(MainDbPath, @"chalib\IOS_Call\call_history.db.charactor", "call", true); mainContext = new SqliteContext(mainDbPath); mainContext.UsingSafeConnection("SELECT * FROM call", r => { Call call; dynamic callObj; while (r.Read()) { callObj = r.ToDynamic(); call = new Call(); call.DataState = DynamicConvert.ToEnumByValue(callObj.XLY_DataType, EnumDataState.Normal); call.Number = DataParseHelper.NumberToStu(DynamicConvert.ToSafeString(callObj.address)); // 号码过滤,验证号码长度 if (!DataParseHelper.ValidateNumber(call.Number)) { continue; } call.DurationSecond = DynamicConvert.ToSafeInt(callObj.duration); call.StartDate = DynamicConvert.ToSafeDateTime(callObj.date); call.Type = GetCallStatus(DynamicConvert.ToSafeInt(callObj.flags), call.DurationSecond); datasource.Items.Add(call); } }); } finally { mainContext?.Dispose(); mainContext = null; } }
/// <summary> /// 解析数据 /// </summary> /// <param name="datasource"></param> public void BuildData(CallDataSource datasource) { if (!FileHelper.IsValid(MainDbPath)) { return; } SqliteContext context = null; SqliteContext contactcontext = null; try { context = new SqliteContext(MainDbPath); if (FileHelper.IsValid(ContactDbPath)) { contactcontext = new SqliteContext(ContactDbPath); } var calllogList = context.Find(new SQLiteString("SELECT number,date,duration,type,ring_times FROM calls_tb")); foreach (var calllogdata in calllogList) { Call callTmp = new Call(); callTmp.Number = DynamicConvert.ToSafeString(calllogdata.number); callTmp.Name = FindName(contactcontext, callTmp.Number); callTmp.Type = ConvertToEnumCallType(DynamicConvert.ToSafeString(calllogdata.type), DynamicConvert.ToSafeString(calllogdata.duration)); callTmp.DataState = EnumDataState.Normal; callTmp.StartDate = new DateTime(1970, 1, 1).AddSeconds(DynamicConvert.ToSafeLong(calllogdata.date) / 1000).AddHours(8); callTmp.DurationSecond = DynamicConvert.ToSafeInt(calllogdata.duration); datasource.Items.Add(callTmp); } } catch { } finally { context?.Dispose(); contactcontext?.Dispose(); context = null; contactcontext = null; } }
/// <summary> /// 解析数据 /// </summary> /// <param name="datasource"></param> public void BuildData(ContactDataSource datasource) { if (!FileHelper.IsValid(MainDbPath)) { return; } SqliteContext mainContext = null; try { var rMainDbFile = SqliteRecoveryHelper.DataRecovery(MainDbPath, @"chalib\com.android.providers.contacts\contacts2.db.charactor", "raw_contacts,contacts,phone_lookup,data,mimetypes,groups", true); mainContext = new SqliteContext(rMainDbFile); // raw_contacts表数据集合 var contactList = mainContext.Find(_SelectRawContactsSql); // phone_lookup表数据集合 var phoneLookupList = mainContext.Find("SELECT * FROM phone_lookup"); // dataView视图数据集合 var dataViewList = mainContext.Find(_SelectDataViewSql); // 群组列表 var groupList = mainContext.Find("SELECT * FROM groups"); // 联系人解析 var items = new List <Contact>(); if (contactList.IsValid()) { items = TryParseItems(contactList); TryParsePhoneLookup(items, phoneLookupList); TryParseDataView(items, dataViewList, groupList); } foreach (var item in items.Where(c => c.Number.IsValid())) { datasource.Items.Add(item); } } finally { mainContext?.Dispose(); mainContext = null; } }
private IEnumerable <dynamic> GetContactList() { if (!FileHelper.IsValid(ContactDbPath)) { return(new List <dynamic>()); } var nfile = SqliteRecoveryHelper.DataRecovery(ContactDbPath, @"chalib\com.android.providers.contacts\contacts2.db.charactor", "data,mimetypes", true); var context = new SqliteContext(nfile); string sqlStr = "select A.mimetype_id,A.raw_contact_id,A.data1,A.data4,substr(B.[mimetype],25,length(B.[mimetype])-24) as mimetype from data as A left outer join mimetypes as B on A.[mimetype_id] = B.[_id]"; var res = context.Find(new SQLiteString(sqlStr)); if (null != context) { context.Dispose(); } return(res); }
private List <Call> GetFromLog() { SqliteContext context = null; try { var items = new List <Call>(); if (!FileHelper.IsValid(MainDbPath)) { return(items); } var newFile = SqliteRecoveryHelper.DataRecovery(MainDbPath, @"chalib\com.android.providers.telephony\logs.db.charactor", "logs", true); // 处理新文件 context = new SqliteContext(newFile); var calls = context.Find(new SQLiteString("select * from logs where logtype=100 or logtype=256")); if (calls.IsInvalid()) { return(items); } TryParseCall(items, calls); return(items); } catch { return(new List <Call>()); } finally { if (null != context) { context.Dispose(); } } }
private List <Call> GetFromDefault() { SqliteContext context = null; try { var items = new List <Call>(); var file = ContactDbPath; if (!FileHelper.IsValid(file)) { return(new List <Call>()); } var newFile = SqliteRecoveryHelper.DataRecovery(file, @"chalib\com.android.providers.contacts\contacts2.db.charactor", "calls", true); // 处理新文件 context = new SqliteContext(newFile); var calls = context.FindByName("calls"); if (calls.IsInvalid()) { return(items); } TryParseCallDeafult(items, calls); return(items); } catch { return(new List <Call>()); } finally { if (null != context) { context.Dispose(); } } }
/// <summary> /// 解析数据 /// </summary> /// <param name="dataSource"></param> public void BuildData(SmsDataSource dataSource) { if (!FileHelper.IsValid(MainDbPath)) { return; } SqliteContext mainContext = null; string attendDirPath = MediaDomainPath; try { var rMainDbFile = SqliteRecoveryHelper.DataRecovery(MainDbPath, @"chalib\IOS_Sms\sms.db.charactor", "message,handle,attachment,chat,chat_message_join,chat_handle_join,message_attachment_join", true); mainContext = new SqliteContext(rMainDbFile); var handleDynamicList = mainContext.FindByName("handle"); var chathandlejoinDynamicList = mainContext.Find(new SQLiteString("SELECT chat_id,handle_id FROM chat_handle_join WHERE chat_id NOTNULL")).ToList(); var chatmessagejoinDynamicList = mainContext.Find(new SQLiteString("SELECT chat_id,message_id FROM chat_message_join WHERE chat_id NOTNULL")); var messageAttachmentJoinDynamicList = mainContext.Find(new SQLiteString("SELECT message_id,attachment_id FROM message_attachment_join WHERE message_id NOTNULL")).ToList(); var attachmentDynamicList = mainContext.FindByName("attachment"); var dateStr = ""; mainContext.UsingSafeConnection(new SQLiteString("select * from message order by date desc"), r => { dynamic smsObj; while (r.Read()) { smsObj = r.ToDynamic(); var sms = new SMS(); //短信内容 sms.Content = DynamicConvert.ToSafeString(smsObj.text); sms.Content = FragmentHelper.RemoveNullityDataNew(sms.Content); // 验证内容是否为空 if (FragmentHelper.IsEmptyString(sms.Content)) { continue; } sms.DataState = DynamicConvert.ToEnumByValue(smsObj.XLY_DataType, EnumDataState.Normal); //发送时间和读取时间。 dateStr = DynamicConvert.ToSafeString(smsObj.date); if (dateStr.Length > 9) { dateStr = dateStr.Substring(0, 9); } sms.StartDate = DynamicConvert.ToSafeDateTime(dateStr, 2001); //sms.ReadTime = DynamicConvert.ToSafeDateTime(smsObj.date_read, 2001); int smsId = DynamicConvert.ToSafeInt(smsObj.ROWID); sms.Remark = string.Empty; int hanldeId = DynamicConvert.ToSafeInt(smsObj.handle_id); if (hanldeId == 0) { //群发消息 var someChatMsgObj = chatmessagejoinDynamicList.FirstOrDefault(cmj => DynamicConvert.ToSafeInt(cmj.message_id) == smsId && DynamicConvert.ToSafeInt(cmj.chat_id) != 0); if (someChatMsgObj != null) { var handleIdList = chathandlejoinDynamicList.FindAll(chj => DynamicConvert.ToSafeInt(chj.chat_id) == someChatMsgObj.chat_id); var numbersBuilder = new StringBuilder(); foreach (var oneHandle in handleIdList) { numbersBuilder.Append(GetPhoteNumber(DynamicConvert.ToSafeInt(oneHandle.handle_id), handleDynamicList)); numbersBuilder.Append(";"); } sms.Remark = LanguageHelper.GetString(Languagekeys.PluginSMS_QunSend) + "; "; sms.Number = numbersBuilder.ToString().TrimEnd(";"); } } else { sms.Number = GetPhoteNumber(hanldeId, handleDynamicList); } if (sms.Number.IsValid() && sms.DataState == EnumDataState.Fragment) { if (!FragmentHelper.IsValidFragment(sms.Number)) { continue; } } //发送或者接收 sms.SmsState = DynamicConvert.ToSafeInt(smsObj.is_from_me) == 1 ? EnumSMSState.SendSMS : EnumSMSState.ReceiveSMS; int isDelivered = DynamicConvert.ToSafeInt(smsObj.is_delivered); int isSent = DynamicConvert.ToSafeInt(smsObj.is_sent); if (sms.SmsState == EnumSMSState.ReceiveSMS) { sms.Remark += DynamicConvert.ToSafeInt(smsObj.is_read) == 1 ? string.Format("{0};", LanguageHelper.GetString(Languagekeys.PluginSMS_IsRead)) : string.Format("{0};", LanguageHelper.GetString(Languagekeys.PluginSMS_NotRead)); } else { if (isDelivered == 0 && isSent == 0) { sms.Remark += LanguageHelper.GetString(Languagekeys.PluginSMS_SendFail) + "; "; } } #region 附件解析 int cache_has_attachments = DynamicConvert.ToSafeInt(smsObj.cache_has_attachments); if (cache_has_attachments == 1) { var attachmentIdList = messageAttachmentJoinDynamicList.FindAll(maj => DynamicConvert.ToSafeInt(maj.message_id) != 0 && DynamicConvert.ToSafeInt(maj.message_id) == smsId); sms.Remark += LanguageHelper.GetString(Languagekeys.PluginSMS_Attachment) + "; "; foreach (var oneAttachIdObj in attachmentIdList) { int attId = DynamicConvert.ToSafeInt(oneAttachIdObj.attachment_id); var attachObj = attachmentDynamicList.FirstOrDefault(att => DynamicConvert.ToSafeInt(att.ROWID) == attId); if (attachObj != null) { string attPath = DynamicConvert.ToSafeString(attachObj.filename); attPath = attPath.Replace('/', '\\').TrimStart('~'); sms.Remark += FileHelper.ConnectPath(attendDirPath, attPath) + ";"; } } } #endregion sms.Remark = sms.Remark.TrimEnd(";"); if (sms.Remark.Contains(LanguageHelper.GetString(Languagekeys.PluginSMS_NotRead))) { sms.ReadState = EnumReadState.Unread; } else { sms.ReadState = EnumReadState.Read; } if (sms.Number.IsInvalid() && sms.Content.IsInvalid()) { continue; } if (sms.Number.IsInvalid()) { var address = DataParseHelper.NumberToStu(DynamicConvert.ToSafeString(smsObj.address)); sms.Number = DynamicConvert.ToSafeString(address); } dataSource.Items.Add(sms); } }); } finally { mainContext?.Dispose(); mainContext = null; } }
protected override void Dispose(bool disposing) { _sqliteContext.Dispose(); base.Dispose(disposing); }
/// <summary> /// 解析数据 /// </summary> /// <param name="datasource"></param> public void BuildData(ContactDataSource datasource) { if (!FileHelper.IsValid(MainDbPath)) { return; } SqliteContext mainContext = null; try { var dataList = mainContext.Find(new SQLiteString("SELECT raw_contact_id,data1,mimetype FROM data_tb WHERE data1 NOTNULL ORDER BY raw_contact_id,mimetype")); var rawidList = dataList.Select(d => DynamicConvert.ToSafeString(d.raw_contact_id)).Distinct(); foreach (string rawid in rawidList) { var nameData = dataList.FirstOrDefault(d => DynamicConvert.ToSafeString(d.raw_contact_id) == rawid && DynamicConvert.ToSafeString(d.mimetype) == "vnd.android.cursor.item/name"); var noteData = dataList.FirstOrDefault(d => DynamicConvert.ToSafeString(d.raw_contact_id) == rawid && DynamicConvert.ToSafeString(d.mimetype) == "vnd.android.cursor.item/note"); var emailData = dataList.FirstOrDefault(d => DynamicConvert.ToSafeString(d.raw_contact_id) == rawid && DynamicConvert.ToSafeString(d.mimetype) == "vnd.android.cursor.item/email_v2"); //var websiteData = dataList.FirstOrDefault(d => DynamicConvert.ToSafeString(d.raw_contact_id) == rawid && DynamicConvert.ToSafeString(d.mimetype) == "vnd.android.cursor.item/website"); var addressData = dataList.FirstOrDefault(d => DynamicConvert.ToSafeString(d.raw_contact_id) == rawid && DynamicConvert.ToSafeString(d.mimetype) == "vnd.android.cursor.item/postal-address_v2"); //string name = "", note = "", email = "", website = "", address = ""; string name = "", note = "", email = "", address = ""; if (null != nameData) { name = DynamicConvert.ToSafeString(nameData.data1); } if (null != noteData) { note = DynamicConvert.ToSafeString(noteData.data1); } if (null != emailData) { email = DynamicConvert.ToSafeString(emailData.data1); } //if (null != websiteData) //{ // website = DynamicConvert.ToSafeString(websiteData.data1); //} if (null != addressData) { address = DynamicConvert.ToSafeString(addressData.data1); } var phones = dataList.Where(d => DynamicConvert.ToSafeString(d.raw_contact_id) == rawid && DynamicConvert.ToSafeString(d.mimetype) == "vnd.android.cursor.item/phone_v2") .Select(d => DynamicConvert.ToSafeString(d.data1)); //var groups = dataList.Where(d => DynamicConvert.ToSafeString(d.raw_contact_id) == rawid && DynamicConvert.ToSafeString(d.mimetype) == "vnd.android.cursor.item/group_membership") // .Select(d => DynamicConvert.ToSafeString(d.data1)).Distinct(); //string groupinfo = GetGroupsInfo(context, groups); DateTime?lastContactDate = GetLastContactDate(mainContext, rawid); if (phones.IsInvalid()) { if (name.IsInvalid()) { continue; } Contact contactTemp = new Contact(); contactTemp.DataState = EnumDataState.Normal; contactTemp.Name = name; contactTemp.Remark = note; contactTemp.Email = email; //contactTemp.Website = website; contactTemp.PostalAddress = address; //contactTemp.GroupName = groupinfo; contactTemp.LastContactDate = lastContactDate; datasource.Items.Add(contactTemp); } else { foreach (var phonenumber in phones) { Contact contactTemp = new Contact(); contactTemp.DataState = EnumDataState.Normal; contactTemp.Number = DynamicConvert.ToSafeString(phonenumber); contactTemp.Name = name; contactTemp.Remark = note; contactTemp.Email = email; //contactTemp.Website = website; contactTemp.PostalAddress = address; //contactTemp.GroupName = groupinfo; contactTemp.LastContactDate = lastContactDate; datasource.Items.Add(contactTemp); } } } } finally { mainContext?.Dispose(); mainContext = null; } }
public void Dispose() { _context.Dispose(); GC.SuppressFinalize(this); }
/// <summary> /// 解析数据 /// </summary> /// <param name="dataSource"></param> public void BuildData(MMSDataSource dataSource) { if (!FileHelper.IsValid(MainDbPath)) { return; } SqliteContext mainContext = null; string attendDirPath = MediaDomainPath; try { var rMainDbFile = SqliteRecoveryHelper.DataRecovery(MainDbPath, @"chalib\IOS_Sms\sms.db.charactor", "message,handle,attachment,chat,chat_message_join,chat_handle_join,message_attachment_join", true); mainContext = new SqliteContext(rMainDbFile); var messageSource = mainContext.Find(new SQLiteString("SELECT * FROM MESSAGE WHERE CACHE_HAS_ATTACHMENTS = 1 and ROWID not null")); var allContact = mainContext.FindByName("HANDLE"); foreach (var message in messageSource) { var sb = new StringBuilder( "select distinct atta.[filename],atta.[mime_type],atta.[created_date] from MESSAGE_ATTACHMENT_JOIN mes "); sb.Append("left join attachment atta on mes.attachment_id = atta.[ROWID] "); sb.AppendFormat("where mes.[message_id] = {0} and atta.filename not null", DynamicConvert.ToSafeString(message.ROWID)); var contact = allContact.First(cct => DynamicConvert.ToSafeInt(cct.ROWID) == DynamicConvert.ToSafeInt(message.handle_id)); var mms = new MMS(); mms.SenderName = DynamicConvert.ToSafeString(contact.uncanonicalized_id); mms.SendState = DynamicConvert.ToSafeInt(message.is_from_me) == 1 ? EnumSendState.Send : EnumSendState.Receive; mms.Date = DynamicConvert.ToSafeDateTime(message.date); mms.ReadDate = DynamicConvert.ToSafeDateTime(message.date_read); mms.Content = DynamicConvert.ToSafeString(message.text).TrimStart('?') + Environment.NewLine; // 获取当前消息的所有附件; var attaSource = mainContext.Find(new SQLiteString(sb.ToString())); foreach (var atta in attaSource) { if (FragmentHelper.IsValidFragment(atta)) { continue; } string attPath = DynamicConvert.ToSafeString(atta.filename).TrimStart('~').TrimStart('/').Replace("/", @"\"); mms.Content += string.Format("{0}{1}", Path.Combine(attendDirPath, attPath), Environment.NewLine); } mms.Content = FragmentHelper.RemoveNullityDataNew(mms.Content.Trim()); // 验证内容是否为空 if (FragmentHelper.IsEmptyString(mms.Content)) { continue; } dataSource.Items.Add(mms); } } finally { mainContext?.Dispose(); mainContext = null; } }
public virtual void Dispose() { _context.Dispose(); }
/// <summary> /// 解析数据 /// </summary> /// <param name="datasource"></param> public void BuildData(ContactDataSource datasource) { if (!FileHelper.IsValid(MainDbPath)) { return; } SqliteContext mainContext = null; try { var rMainDbFile = SqliteRecoveryHelper.DataRecovery(MainDbPath, @"chalib\IOS_Contact\AddressBook.sqlitedb_V7.charactor", "ABPerson,ABMultiValue,ABGroupMembers,ABGroup", true); mainContext = new SqliteContext(rMainDbFile); string groupString = "select member_id,Name from ABGroupMembers m left join ABGroup g on m.group_id == g.ROWID"; var groups = mainContext.Find(groupString); mainContext.UsingSafeConnection("select p.*,v.record_id,v.property,v.label,v.[value] from ABPerson p,ABMultiValue v WHERE p.ROWID = v.record_id", r => { Contact contact; dynamic contactObj; while (r.Read()) { contactObj = r.ToDynamic(); contact = new Contact(); contact.DataState = DynamicConvert.ToEnumByValue(contactObj.XLY_DataType, EnumDataState.Normal); //正常的联系人,目前只处理电话号码的信息,如亲属关系,社交等暂不处理。 if (contact.DataState == EnumDataState.Normal) { int propertyId = DynamicConvert.ToSafeInt(contactObj.property); if (propertyId != 3) { continue; } } contact.Name = DynamicConvert.ToSafeString(contactObj.Last) + DynamicConvert.ToSafeString(contactObj.First); contact.Name = FragmentHelper.RemoveNullityDataNew(contact.Name); contact.Number = DataParseHelper.NumberToStu(DynamicConvert.ToSafeString(contactObj.value)); // 号码过滤,验证号码长度 if (!DataParseHelper.ValidateNumber(contact.Number)) { continue; } //创建时间(最后修改时间) contact.CreateDate = DynamicConvert.ToSafeDateTime(contactObj.ModificationDate, 2001); //联系人分组 int contactId = DynamicConvert.ToSafeInt(contactObj.ROWID); var groupObj = groups.FirstOrDefault(g => DynamicConvert.ToSafeInt(g.member_id) == contactId); if (groupObj != null) { contact.GroupName = DynamicConvert.ToSafeString(groupObj.Name); } //基础备注 contact.Remark = BuildRemark(contactObj).ToString().TrimStart(';'); datasource.Items.Add(contact); } }); } finally { mainContext?.Dispose(); mainContext = null; } }
/// <summary> /// 解析数据 /// </summary> /// <param name="datasource"></param> public void BuildData(SmsDataSource datasource) { if (!FileHelper.IsValid(MainDbPath)) { return; } SqliteContext mainContext = null; try { string charatorPath = MatchCharatorPath(); var rMainDbFile = SqliteRecoveryHelper.DataRecovery(MainDbPath, charatorPath, "sms", true); mainContext = new SqliteContext(rMainDbFile); string createSmsSql = string.Empty; var smssList = GetSmssList(mainContext, ref createSmsSql); if (smssList.IsInvalid()) { return; } var contactList = GetContactList(); SMS item; foreach (var sms in smssList) { try { item = new SMS(); item.Content = DynamicConvert.ToSafeString(sms.content); item.Content = FragmentHelper.RemoveNullityDataNew(item.Content); // 验证内容是否为空 if (FragmentHelper.IsEmptyString(item.Content)) { continue; } item.SmsState = DynamicConvert.ToEnumByValue <EnumSMSState>(sms.type, EnumSMSState.None); item.Number = DynamicConvert.ToSafeString(sms.number); item.Number = DataParseHelper.NumberToStu(item.Number); item.ContactName = DynamicConvert.ToSafeString(sms.name); if (item.ContactName.IsInvalid()) { // 关联获取联系人名称 item.ContactName = GetContactName(item.Number, contactList); } item.DataState = DynamicConvert.ToEnumByValue <EnumDataState>(sms.XLY_DataType, EnumDataState.Normal); if (DynamicConvert.ToSafeString(sms.deleted) == "1") { item.DataState = EnumDataState.Deleted; } item.StartDate = DynamicConvert.ToSafeDateTime(sms.date); item.ReadState = DynamicConvert.ToSafeInt(sms.read) == 0 ? EnumReadState.Unread : EnumReadState.Read; datasource.Items.Add(item); } catch { } } } finally { mainContext?.Dispose(); mainContext = null; } }
/// <summary> /// 解析数据 /// </summary> /// <param name="datasource"></param> public void BuildData(CallDataSource datasource) { if (!FileHelper.IsValid(MainDbPath)) { return; } SqliteContext mainContext = null; try { //主数据库对象 var mainDbPath = SqliteRecoveryHelper.DataRecovery(MainDbPath, "", "ZCALLRECORD", true); mainContext = new SqliteContext(mainDbPath); IEnumerable <dynamic> addressDynamicList = null; if (FileHelper.IsValid(AddrDbPath)) { var addressDbPath = SqliteRecoveryHelper.DataRecovery(AddrDbPath, @"chalib\IOS_Contact\AddressBook.sqlitedb.charactor", "ABMultiValue,ABPerson", true); SqliteContext addrContext = new SqliteContext(addressDbPath); addressDynamicList = addrContext.Find("select p.[value],p.[record_id],v.[Last],v.[ROWID] from ABMultiValue p left join ABPerson v on p.[record_id]=v.[ROWID] where p.[property]=3"); addrContext.Dispose(); addrContext = null; } mainContext.UsingSafeConnection("select XLY_DataType,ZDURATION,Z_OPT,ZDURATION,ZORIGINATED,cast(ZADDRESS as varchar) as number, cast(ZDATE as DATETIME) as phonetime from ZCALLRECORD", r => { Call call; dynamic callObj; while (r.Read()) { callObj = r.ToDynamic(); call = new Call(); call.Number = DataParseHelper.NumberToStu(DynamicConvert.ToSafeString(callObj.number)); // 号码过滤,验证号码长度 if (!DataParseHelper.ValidateNumber(call.Number)) { continue; } if (addressDynamicList.IsValid()) { var addressname = addressDynamicList.FirstOrDefault(o => DynamicConvert.ToSafeString(o.value).Replace("-", "").Equals(callObj.number)); if (addressname != null) { call.Name = FragmentHelper.RemoveNullityDataNew(DynamicConvert.ToSafeString(addressname.Last)); } } call.DataState = DynamicConvert.ToEnumByValue(callObj.XLY_DataType, EnumDataState.Normal); call.DurationSecond = DynamicConvert.ToSafeInt(callObj.ZDURATION); string time = DynamicConvert.ToSafeString(callObj.phonetime).Insert(0, "1"); double opertime = time.ToDouble() - 21692848; call.StartDate = DynamicConvert.ToSafeDateTime(opertime); call.Type = GetCallV10Status(DynamicConvert.ToSafeInt(callObj.ZORIGINATED), call.DurationSecond); datasource.Items.Add(call); } }); } finally { mainContext?.Dispose(); mainContext = null; } }