public void OneTimeSetup() { // Initialize and read the settings CustomDataCollection <ElementLocation> locations = (new CustomDataCollection <ElementLocation>()).LoadDataFromXls( Path.GetFullPath(Path.Combine(Environment.CurrentDirectory, "../../../Data/Location.xlsx")), "Location"); CustomDataCollection <PageUrl> urls = (new CustomDataCollection <PageUrl>()).LoadDataFromXls( Path.GetFullPath(Path.Combine(Environment.CurrentDirectory, "../../../Data/Location.xlsx")), "Url"); CustomDataCollection <ExpectedSetting> expecteds = (new CustomDataCollection <ExpectedSetting>()).LoadDataFromXls( Path.GetFullPath(Path.Combine(Environment.CurrentDirectory, "../../../Data/Location.xlsx")), "Expected"); Settings.GetInstance().SetLocations(locations).SetUrls(urls).SetExpecteds(expecteds); }
static void RealtimeWarning(object source, System.Timers.ElapsedEventArgs e) { System.Timers.Timer pp = (System.Timers.Timer)source; pp.Enabled = false; MSSQLOperate pRealtimeCheck = new MSSQLOperate(strAccess);//(strAccess); pRealtimeCheck.Connect(false); pRealtimeCheck.ExecuteQuery("EXEC SP_GET_REALTIMECONTENT");// ("EXEC SP_GET_REALTIMECONTENT"); pRealtimeCheck.GetResult(RecordStyle.DATASET); DataSet pDataSet = (DataSet)pRealtimeCheck.RecordData; if (null != pDataSet && pDataSet.Tables[0].Rows.Count > 0) { CustomDataCollection mReturnBody = new CustomDataCollection(StructType.CUSTOMDATA); foreach (DataTable pDataTable in pDataSet.Tables) { for (int i = 0; i < pDataTable.Rows.Count; i++) { uint usFirstTag = 0x08000001; for (int j = 0; j < pDataTable.Columns.Count; j++) { mReturnBody.Add((DataField)usFirstTag, DefineUtilities.ToDataFormat(pDataTable.Columns[j].DataType.Name), pDataTable.Rows[i][j]); usFirstTag++; } mReturnBody.AddRows(); } } SocketPacket mSocketPacket = new SocketPacket(TaskService.INSTANT_MONITOR_SEND, mReturnBody); byte[] pSendBuffer = mSocketPacket.CoalitionInfo(); if (null != pServer.SocketConnected) { pServer.SocketConnected.ServerConnection().SendTo(pSendBuffer, true); pServer.SocketConnected.OnRecive(); //pRealtimeCheck.ExecuteQuery("EXEC SP_SET_VIEW"); //pRealtimeCheck.GetResult(RecordStyle.NONE); } } pp.Enabled = true; }
static void CheckMail(object source, System.Timers.ElapsedEventArgs e) { NotesUtils pNotesUtils = null; Console.WriteLine("Notes Check:"); System.Timers.Timer pp = (System.Timers.Timer)source; pp.Enabled = false; try { //pNotesUtils = new NotesUtils(pNotesSession, "mail9you/runstar", "mail\\费亚平.nsf"); pNotesUtils = new NotesUtils(pNotesSession, "mail9you/runstar", "mail\\netadmin.nsf"); if (pNotesUtils.OpenDataBase("netadmin", "12341234")) { if (pNotesUtils.GetMailInfo()) { MSSQLOperate pSaveMail = new MSSQLOperate(strAnalyse); CustomDataCollection pMailStruct = (CustomDataCollection)pNotesUtils.Records; CustomData[,] pMailInfo = pMailStruct[-1]; for (int i = 0; i < pMailStruct.RowCount; i++) { pSaveMail.Connect(false); string strProcParams = "SP_PUT_NOTESCONTENT"; DbParameter[] paramCache = DataUtilities.GetParameters(strProcParams); #region if (paramCache == null) { paramCache = new SqlParameter[] { new SqlParameter("@iFailure", SqlDbType.Int, 4), new SqlParameter("@iCategory", SqlDbType.Int, 4), new SqlParameter("@strUID", SqlDbType.VarChar, 100), new SqlParameter("@strPUID", SqlDbType.VarChar, 100), new SqlParameter("@strSubject", SqlDbType.VarChar, 100), new SqlParameter("@dtPost", SqlDbType.DateTime), new SqlParameter("@strSender", SqlDbType.VarChar, 50), new SqlParameter("@strRecive", SqlDbType.Text), new SqlParameter("@strContent", SqlDbType.Text), new SqlParameter("@strCount", SqlDbType.VarChar, 100), new SqlParameter("@iView", SqlDbType.Int, 4), new SqlParameter("@iGroup", SqlDbType.Int, 4) }; DataUtilities.SetParameters(strProcParams, paramCache); } paramCache[0].Value = 0; paramCache[1].Value = 0; paramCache[2].Value = pMailInfo[i, 0].Content; paramCache[3].Value = pMailInfo[i, 1].Content; paramCache[4].Value = pMailInfo[i, 2].Content; paramCache[5].Value = pMailInfo[i, 4].Content; paramCache[6].Value = pMailInfo[i, 3].Content; paramCache[7].Value = pMailInfo[i, 5].Content; paramCache[8].Value = pMailInfo[i, 6].Content; paramCache[9].Value = pMailInfo[i, 7].Content; paramCache[10].Value = 0; paramCache[11].Value = 2; #endregion pSaveMail.ExecuteQuery(false, strProcParams, paramCache); pSaveMail.GetResult(RecordStyle.NONE); } #region Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("Notes Recive Count : " + pMailStruct.RowCount); Console.ForegroundColor = ConsoleColor.Gray; Console.WriteLine(""); #endregion } else { #region Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("Notes Recive Exception : " + pNotesUtils.Message); Console.ForegroundColor = ConsoleColor.Gray; Console.WriteLine(""); #endregion } } else { #region Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("Notes Connect Exception : " + pNotesUtils.Message); Console.ForegroundColor = ConsoleColor.Gray; Console.WriteLine(""); #endregion } } catch (Exception ex) { #region Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("Notes Save Exception : " + ex.Message); Console.ForegroundColor = ConsoleColor.Gray; Console.WriteLine(""); #endregion } finally { if (pNotesUtils != null) { pNotesUtils.Dispose(); } } pp.Enabled = true; }
private void RealTimeProcessing(object state) { if (!this.Disposed) { ISocketConnection pSendChannels = null; SqlCommand pCallBackCmd = null; SqlDataReader pCallBackReader = null; TaskService pCallService = this.eService;//TaskService.MESSAGE; IAsyncResult AsyncResult = (IAsyncResult)state; try { byte[] pSendBuffer; SocketPacket pSendPacket = null; CustomDataCollection pRealTimeData = null; RecordDataCallback pRealTimeCallback = (RecordDataCallback)AsyncResult.AsyncState; pCallService = pRealTimeCallback.Service; pSendChannels = pRealTimeCallback.Channels; pCallBackCmd = (SqlCommand)pRealTimeCallback.Command; if (null != this.SocketConnection) { pCallBackReader = pCallBackCmd.EndExecuteReader(AsyncResult); if (pCallBackReader.HasRows) { while (pCallBackReader.Read()) { pRealTimeData = new CustomDataCollection(StructType.CUSTOMDATA); for (int i = 0; i < pCallBackReader.FieldCount; i++) { pRealTimeData.Add(DefineUtilities.ToDataField(pCallBackReader.GetName(i)), DefineUtilities.ToDataFormat(pCallBackReader.GetFieldType(i).Name), pCallBackReader[i]); } pRealTimeData.AddRows(); pSendPacket = new SocketPacket(pCallService, pRealTimeData); pSendBuffer = pSendPacket.CoalitionInfo(); this.SocketConnection.OnSend(pSendBuffer); pRealTimeData.Clear(); pSendPacket.Dispose(); pRealTimeData = null; pSendBuffer = null; } } else { pRealTimeData = new CustomDataCollection(StructType.CUSTOMDATA); pRealTimeData.Add("暂无数据"); pSendPacket = new SocketPacket(pCallService, pRealTimeData); pSendBuffer = pSendPacket.CoalitionInfo(); this.SocketConnection.OnSend(pSendBuffer); pRealTimeData.Clear(); pSendPacket.Dispose(); pRealTimeData = null; pSendBuffer = null; } } } catch (SqlException ex) { this.strErrorMsg = ex.Message; } catch (Exception ex) { this.strErrorMsg = ex.Message; } finally { try { pCallBackReader.Close(); pCallBackReader.Dispose(); pCallBackCmd.Dispose(); pCallBackReader = null; pCallBackCmd = null; } catch (Exception ex) { this.strErrorMsg = ex.Message; CustomDataCollection pRealTimeData = new CustomDataCollection(StructType.CUSTOMDATA); pRealTimeData.Add(strErrorMsg); SocketPacket pSendPacket = new SocketPacket(pCallService, pRealTimeData); byte[] pSendBuffer = pSendPacket.CoalitionInfo(); this.SocketConnection.OnSend(pSendBuffer); } } } }
public static void Init() { if (Cache.CollectionExists("Skills")) { Cache.DropCollection("Skills"); } if (File.Exists(Settings.ConfigsPath)) { ArchiveManager am = new ArchiveManager(Settings.ConfigsPath, new ArchiveKey()); am.ReadFileTable(); var entry = am.Files.Where(x => x.Path.EndsWith("skillstr.txt")).ToList(); if (entry.Count > 0) { byte[] skillstr = am.GetFile(entry.First()); StreamReader sr = new StreamReader(new MemoryStream(skillstr)); string text = sr.ReadToEnd(); Regex r = new Regex(@"^[0-9]+\s{0,10}" + "(\"[^\"]*\")", RegexOptions.Multiline); var collection = r.Matches(text); var enumerator = collection.GetEnumerator(); var col = Cache.GetCollection <CustomDataCollection>("Skills"); while (enumerator.MoveNext()) { var split = enumerator.Current.ToString().Split(new string[] { "\"" }, StringSplitOptions.RemoveEmptyEntries); string id = split[0].Remove(split[0].IndexOf(" ") - 1); string name = split[1].Replace("\"", ""); enumerator.MoveNext(); col.Insert(new CustomDataCollection() { ID = id.ToInt32(), Name = name, Desc = enumerator.Current.ToString().Substring(enumerator.Current.ToString().IndexOf("\"")) }); } sr.Close(); Utils.MemoryCleaner(); } } if (File.Exists(Settings.ElementsPath)) { if (Cache.CollectionExists("Npcs")) { Cache.DropCollection("Npcs"); } if (Cache.CollectionExists("Mobs")) { Cache.DropCollection("Mobs"); } if (Cache.CollectionExists("Mines")) { Cache.DropCollection("Mines"); } var col1 = Cache.GetCollection <CustomDataCollection>("Npcs"); var col2 = Cache.GetCollection <CustomDataCollection>("Mobs"); var col3 = Cache.GetCollection <CustomDataCollection>("Mines"); KuklusDataEditor.Core.ElementsData elements = new KuklusDataEditor.Core.ElementsData(); try { elements.Load(Settings.ElementsPath); } catch { } byte list_count = 0; foreach (var list in elements.Lists) { if (list_count == 3) { break; } if (list.Name.Contains("NPC_ESSENCE") || list.Name.Contains("MONSTER_ESSENCE") || list.Name.Contains("MINE_ESSENCE")) { foreach (var item in list.Items) { int id = item.Values[list.IDIndex].ToString().ToInt32(); string name = item.Values[list.NameIndex].ToString(); var data = new CustomDataCollection() { ID = id, Name = name, Desc = "" }; if (list.Name.Contains("NPC_ESSENCE")) { col1.Insert(data); } else if (list.Name.Contains("MONSTER_ESSENCE")) { col2.Insert(data); } else if (list.Name.Contains("MINE_ESSENCE")) { col3.Insert(data); } } ++list_count; } } elements.Lists.Clear(); Utils.MemoryCleaner(); } }
/// <summary> /// 获取联系人 /// </summary> /// <param name="strCategory">联系人分组</param> /// <returns></returns> public bool GetLinkerInfo(string strCategory) { bool bResult = false; NotesView pLinkerView = null; NotesDocument pLinkerDocument = null; try { if (this._strDataBase != "names.nsf") { this.pNotesDatabase = this._pNotesSession.GetDatabase(this._strDomain, "names.nsf", false); } pLinkerView = this.pNotesDatabase.GetView(strCategory); pLinkerDocument = pLinkerView.GetFirstDocument(); CustomDataCollection pLinkerStruct = new CustomDataCollection(StructType.CUSTOMDATA); while (pLinkerDocument != null) { pLinkerStruct.Add(DataField.LINKER_NAME, DataFormat.STRING, pLinkerDocument.GetFirstItem("ListName").Text); pLinkerStruct.Add(DataField.LINKER_CONTENT, DataFormat.STRING, (pLinkerDocument.GetFirstItem("Members") == null) ? "N/A" : pLinkerDocument.GetFirstItem("Members").Text); pLinkerStruct.AddRows(); //pLinkerStruct[0].oFieldsName = "Linker_Name"; //pLinkerStruct[0].oFiledsTypes = "String"; //pLinkerStruct[0].oFieldValues = pLinkerDocument.GetFirstItem("ListName").Text; //pLinkerStruct[1].oFieldsName = "Linker_Content"; //pLinkerStruct[1].oFiledsTypes = "String"; //pLinkerStruct[1].oFieldValues = (pLinkerDocument.GetFirstItem("Members") == null) ? "N/A" : pLinkerDocument.GetFirstItem("Members").Text; //this.pInfoList.Add(pLinkerStruct); pLinkerDocument = pLinkerView.GetNextDocument(pLinkerDocument); } this.pRecords = pLinkerStruct; bResult = true; } catch (Exception ex) { this.strMessage = ex.Message; bResult = false; //this.pInfoList.Clear(); } finally { if (pLinkerDocument != null) { Marshal.ReleaseComObject(pLinkerDocument); } if (pLinkerView != null) { Marshal.ReleaseComObject(pLinkerView); } pLinkerDocument = null; pLinkerView = null; } return(bResult); }
/// <summary> /// 获取信件中的附件内容 /// </summary> /// <param name="strNotesUID"></param> /// <returns></returns> public bool GetMailAttachment(string strNotesUID) { bool bResult = false; NotesView pMailView = null; NotesDocument pMailDocument = null; int iCount = 0; try { if (this._strDataBase == "names.nsf") { this.pNotesDatabase = this._pNotesSession.GetDatabase(this._strDomain, this._strDataBase, false); } if (this.pNotesDatabase == null) { throw new Exception("不能打开数据库:" + this._strDataBase); } pMailView = this.pNotesDatabase.GetView("($inbox)"); pMailDocument = pMailView.GetFirstDocument(); CustomDataCollection pAttachmentStruct = new CustomDataCollection(StructType.CUSTOMDATA); while (pMailDocument != null) { if (pMailDocument.UniversalID == strNotesUID) { object[] arrItemObject = (object[])((NotesRichTextItem)pMailDocument.GetFirstItem("Body")).EmbeddedObjects; for (int i = 0; i < arrItemObject.Length; i++) { NotesEmbeddedObject pEmbeddedObject = (NotesEmbeddedObject)arrItemObject[i]; pEmbeddedObject.ExtractFile(System.AppDomain.CurrentDomain.BaseDirectory + "\\Attachment\\" + pEmbeddedObject.Source); FileStream pAttachmentStream = new FileStream(System.AppDomain.CurrentDomain.BaseDirectory + "\\Attachment\\" + pEmbeddedObject.Source, FileMode.Open, FileAccess.Read); byte[] pAttachmentContent = new byte[pAttachmentStream.Length]; pAttachmentStream.Read(pAttachmentContent, 0, pAttachmentContent.Length); pAttachmentStream.Close(); pAttachmentStream.Dispose(); File.Delete(System.AppDomain.CurrentDomain.BaseDirectory + "\\Attachment\\" + pEmbeddedObject.Source); pAttachmentStruct.Add(DataField.NOTES_ATTACHMENTNAME, DataFormat.STRING, pEmbeddedObject.Source); pAttachmentStruct.Add(DataField.NOTES_ATTACHMENTCOUNT, DataFormat.NONE, pAttachmentContent); pAttachmentStruct.AddRows(); //GlobalStruct[] pAttachmentStruct = new GlobalStruct[2]; //pAttachmentStruct[0].oFieldsName = "Notes_AttachmentName"; //pAttachmentStruct[0].oFiledsTypes = "String"; //pAttachmentStruct[0].oFieldValues = pEmbeddedObject.Source; //pAttachmentStruct[1].oFieldsName = "Notes_AttachmentCount"; //pAttachmentStruct[1].oFiledsTypes = "Byte[]"; //pAttachmentStruct[1].oFieldValues = pAttachmentContent; pAttachmentContent = null; this.pInfoList.Add(pAttachmentStruct); } } pMailDocument = pMailView.GetNextDocument(pMailDocument); iCount++; } this.pRecords = pAttachmentStruct; bResult = true; } catch (Exception ex) { this.strMessage = ex.Message; bResult = false; //this.pInfoList.Clear(); } finally { if (pMailDocument != null) { Marshal.ReleaseComObject(pMailDocument); } if (pMailView != null) { Marshal.ReleaseComObject(pMailView); } pMailDocument = null; pMailView = null; } if (iCount == 0) { return(false); } return(bResult); }
/// <summary> /// 获取新信件 /// </summary> /// <returns></returns> public bool GetMailInfo() { bool bResult = false; NotesView pMailView = null; NotesDocument pMailDocument = null; int iCount = 0; try { if (this._strDataBase == "names.nsf") { this.pNotesDatabase = this._pNotesSession.GetDatabase(this._strDomain, this._strDataBase, false); } if (this.pNotesDatabase == null) { throw new Exception("不能打开数据库:" + this._strDataBase); } pMailView = this.pNotesDatabase.GetView("($inbox)"); pMailDocument = pMailView.GetFirstDocument(); Console.WriteLine("共计:" + pMailView.EntryCount.ToString()); CustomDataCollection pMailStruct = new CustomDataCollection(StructType.CUSTOMDATA); while (pMailDocument != null) { if (((object[])pMailDocument.GetItemValue("Reader"))[0].ToString() != "YES") { string strPUID = string.Empty; string strSubject = (((object[])pMailDocument.ColumnValues)[5] == null) ? "N/A" : ((object[])pMailDocument.ColumnValues)[5].ToString(); string strSupervisors = (((object[])pMailDocument.GetItemValue("CopyTo")).Length == 0) ? "N/A" : ((object[])pMailDocument.GetItemValue("CopyTo"))[0].ToString(); string strSendTo = (((object[])pMailDocument.GetItemValue("SendTo")).Length == 0) ? "N/A" : ((object[])pMailDocument.GetItemValue("SendTo"))[0].ToString(); if (strSendTo != "N/A") { for (int i = 0; i < ((object[])pMailDocument.GetItemValue("SendTo")).Length; i++) { strSupervisors = strSupervisors + ";" + ((object[])pMailDocument.GetItemValue("SendTo"))[i].ToString(); } } if (strSupervisors != "N/A") { for (int i = 1; i < ((object[])pMailDocument.GetItemValue("CopyTo")).Length; i++) { strSupervisors = strSupervisors + ";" + ((object[])pMailDocument.GetItemValue("CopyTo"))[i].ToString(); } } string strBody = ((object[])pMailDocument.GetItemValue("Body"))[0].ToString(); if (((object[])pMailDocument.GetItemValue("SSM_Agent"))[0].ToString().Length != 0) { strPUID = ((object[])pMailDocument.GetItemValue("SSM_Agent"))[0].ToString(); } else if (((object[])pMailDocument.GetItemValue("SSM_Agent"))[0].ToString().Length == 0 && pMailDocument.ParentDocumentUNID == null) { strPUID = "N/A"; } else { strPUID = pMailDocument.ParentDocumentUNID; } /* * if (pMailDocument.HasItem("SMS Agent")) * { * strPUID = ((object[])pMailDocument.GetItemValue("SMS Agent"))[0].ToString(); * } * else if (!pMailDocument.HasItem("SMS Agent") && pMailDocument.ParentDocumentUNID == null) * { * strPUID = "N/A"; * } * else * { * strPUID = pMailDocument.ParentDocumentUNID; * } */ //剔除--服务器正常和服务器一切正常 if (strSubject.IndexOf("服务器正常", StringComparison.CurrentCulture) > 0 || strSubject.IndexOf("服务器一切正常", StringComparison.CurrentCulture) > 0) { if (pMailDocument.HasItem("Reader")) { pMailDocument.ReplaceItemValue("Reader", "YES"); } else { pMailDocument.AppendItemValue("Reader", "YES"); } pMailDocument.Save(true, true, true); } else { pMailStruct.Add(DataField.NOTES_UID, DataFormat.STRING, pMailDocument.UniversalID); pMailStruct.Add(DataField.NOTES_UID, DataFormat.STRING, strPUID); pMailStruct.Add(DataField.NOTES_SUBJECT, DataFormat.STRING, strSubject); pMailStruct.Add(DataField.NOTES_FROM, DataFormat.STRING, ((object[])pMailDocument.GetItemValue("Principal"))[0].ToString()); pMailStruct.Add(DataField.NOTES_DATE, DataFormat.STRING, ((object[])pMailDocument.ColumnValues)[2].ToString()); pMailStruct.Add(DataField.NOTES_SUPERVISORS, DataFormat.STRING, (strSupervisors == "") ? "N/A" : strSupervisors); pMailStruct.Add(DataField.NOTES_CONTENT, DataFormat.STRING, (strBody == "") ? "N/A" : strBody); try { pMailStruct.Add(DataField.NOTES_ATTACHMENTCOUNT, DataFormat.STRING, (((NotesRichTextItem)pMailDocument.GetFirstItem("Body")).EmbeddedObjects == null) ? "0" : ((object[])((NotesRichTextItem)pMailDocument.GetFirstItem("Body")).EmbeddedObjects).Length.ToString()); } catch { pMailStruct.Add(DataField.NOTES_ATTACHMENTCOUNT, DataFormat.STRING, "信件内包含多个信件主体,请查阅自己的信箱!"); } pMailStruct.AddRows(); //GlobalStruct[] pMailStruct = new GlobalStruct[8]; //pMailStruct[0].oFieldsName = "Notes_UID"; //pMailStruct[0].oFiledsTypes = "String"; //pMailStruct[0].oFieldValues = pMailDocument.UniversalID; //pMailStruct[1].oFieldsName = "Notes_PUID"; //pMailStruct[1].oFiledsTypes = "String"; //pMailStruct[1].oFieldValues = strPUID; // (pMailDocument.ParentDocumentUNID == null) ? "N/A" : pMailDocument.ParentDocumentUNID; //pMailStruct[2].oFieldsName = "Notes_Subject"; //pMailStruct[2].oFiledsTypes = "String"; //pMailStruct[2].oFieldValues = strSubject; //pMailStruct[3].oFieldsName = "Notes_From"; //pMailStruct[3].oFiledsTypes = "String"; //pMailStruct[3].oFieldValues = ((object[])pMailDocument.GetItemValue("Principal"))[0].ToString(); //((object[])pMailDocument.ColumnValues)[1].ToString(); //pMailStruct[4].oFieldsName = "Notes_Date"; //pMailStruct[4].oFiledsTypes = "String"; //pMailStruct[4].oFieldValues = ((object[])pMailDocument.ColumnValues)[2].ToString(); //pMailStruct[5].oFieldsName = "Notes_Supervisors"; //pMailStruct[5].oFiledsTypes = "String"; //pMailStruct[5].oFieldValues = (strSupervisors == "") ? "N/A" : strSupervisors; //pMailStruct[6].oFieldsName = "Notes_Content"; //pMailStruct[6].oFiledsTypes = "String"; //pMailStruct[6].oFieldValues = (strBody == "") ? "N/A" : strBody; //pMailStruct[7].oFieldsName = "Notes_AttachmentCount"; //pMailStruct[7].oFiledsTypes = "String"; //try //{ // pMailStruct[7].oFieldValues = (((NotesRichTextItem)pMailDocument.GetFirstItem("Body")).EmbeddedObjects == null) ? "0" : ((object[])((NotesRichTextItem)pMailDocument.GetFirstItem("Body")).EmbeddedObjects).Length.ToString(); //} //catch //{ // pMailStruct[7].oFieldValues = "信件内包含多个信件主体,请查阅自己的信箱!"; //} this.pInfoList.Add(pMailStruct); if (pMailDocument.HasItem("Reader")) { pMailDocument.ReplaceItemValue("Reader", "YES"); } else { pMailDocument.AppendItemValue("Reader", "YES"); } //pMailStruct = null; pMailDocument.Save(true, true, true); iCount++; } } //pMailDocument.PutInFolder("历史纪录", false); pMailDocument = pMailView.GetNextDocument(pMailDocument); //if (pMailDocument != null) //{ // pMailView.GetPrevDocument(pMailDocument).Remove(false); //} } this.pRecords = pMailStruct; bResult = true; } catch (Exception ex) { this.strMessage = ex.Message; Console.WriteLine("丢失Notes个数" + iCount.ToString()); bResult = false; //this.pInfoList.Clear(); } finally { if (pMailDocument != null) { Marshal.ReleaseComObject(pMailDocument); } if (pMailView != null) { Marshal.ReleaseComObject(pMailView); } pMailDocument = null; pMailView = null; } return(bResult); }