private void MainForm_Load(object sender, System.EventArgs e) { if (!x64f2717168e0a936.x2402b6eabad5b567(true)) { MessageBox.Show("EEP is not registered.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } if (SysEEPLogService.Enable) { SysEEPLog eeplog = new SysEEPLog(null, SysEEPLog.LogStyleType.System , SysEEPLog.LogTypeType.Normal, DateTime.Now, "Server Start", string.Empty); eeplog.Log(); } // 在Users.xml加载到内存中去。 tmUser.Enabled = true; tmUser_Tick(tmUser, null); tmMaxTimeOut.Enabled = true; tmMaxTimeOut_Tick(tmMaxTimeOut, null); this.StatusBar.Panels[1].Text = string.Format("Licensed To {0}: [{1}]", x64f2717168e0a936.Company, x64f2717168e0a936.Text); this.Text = string.Format("EEP.NET Server(Version:{0})", GetFileVersion(typeof(CliUtils).Assembly)); //加载EEPClient Update Server try { //Assembly assembly = Assembly.LoadFrom(EEPRegistry.Server + "\\EEPSetUpLibrary.dll"); //frmupdateserver = (Form)assembly.CreateInstance("EEPSetUpLibrary.Server.frmMain"); //frmupdateserver.Show(this); //frmupdateserver.Hide(); formupdateserver = ShowForm("EEPSetUpLibrary", "EEPSetUpLibrary.Server.frmMain"); } catch { menuItemClientUpdate.Enabled = false; } try { formwcfserver = ShowForm("WCFServer", "WCFServer.FormMain"); } catch { } try { ShowForm("EEPCloudSetupLibrary", "EEPCloudSetupLibrary.FormServer"); } catch { } if (!Directory.Exists(Application.ExecutablePath.Substring(0, Application.ExecutablePath.IndexOf("\\EEPNetServer")) + "\\EFWCFModule")) menuItem4.Enabled = false; ConnectRemoteServers(); }
private void frmServerMain_FormClosing(object sender, FormClosingEventArgs e) { if (e.CloseReason == CloseReason.UserClosing && MessageBox.Show(this, "Do you want to close EEPNetServer?" , "Close Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2) == DialogResult.No) { e.Cancel = true; } else { if (SysEEPLogService.Enable) { SysEEPLog eeplog = new SysEEPLog(null, SysEEPLog.LogStyleType.System , SysEEPLog.LogTypeType.Normal, DateTime.Now, "Server Close", string.Empty); eeplog.Log(); } string s = SystemFile.PackageTransferListFile; if (File.Exists(s)) File.Delete(s); FileStream aFileStream = new FileStream(s, FileMode.Create); try { XmlTextWriter w = new XmlTextWriter(aFileStream, new System.Text.ASCIIEncoding()); w.Formatting = Formatting.Indented; w.WriteStartElement("PackageTransferList"); w.WriteAttributeString("AutoTransfer", ServerConfig.AutoTransferPackage.ToString()); DataRowCollection dataRowCollection = ServerConfig.PackageTransferList.Tables[0].Rows; for (int i = 0; i < dataRowCollection.Count; i++) { w.WriteStartElement("Package"); w.WriteAttributeString("IP", dataRowCollection[i]["IP"].ToString()); w.WriteAttributeString("FileName", dataRowCollection[i]["FileName"].ToString()); w.WriteAttributeString("SolutionName", dataRowCollection[i]["SolutionName"].ToString()); w.WriteAttributeString("PackageType", dataRowCollection[i]["PackageType"].ToString()); w.WriteAttributeString("DateTime", dataRowCollection[i]["DateTime"].ToString()); w.WriteAttributeString("TransferInfo", dataRowCollection[i]["TransferInfo"].ToString()); w.WriteEndElement(); } w.WriteEndElement(); w.Close(); } finally { aFileStream.Close(); } } }
/// <summary> /// 发送Email /// </summary> private static void SendMail(object data) { SmtpClient _client = (SmtpClient)((object[])data)[0]; MailMessage _message = (MailMessage)((object[])data)[1]; StringBuilder title = new StringBuilder("To:"); foreach (MailAddress address in _message.To) { title.Append(address.Address); title.Append(";"); } if(title.Length> 64) { title.Remove(64, title.Length - 64); } _message.Subject = _message.Subject.Replace("\r", "").Replace("\n", " "); string description = _message.Subject; if(description.Length > 128) { description = description.Remove(128, description.Length - 128); } try { _client.Send(_message); if (SysEEPLogService.Enable) { SysEEPLog log = new SysEEPLog(null, SysEEPLog.LogStyleType.Email, SysEEPLog.LogTypeType.Normal , DateTime.Now, title.ToString(), description ); log.Log(); } } catch { if (SysEEPLogService.Enable) { SysEEPLog log = new SysEEPLog(null, SysEEPLog.LogStyleType.Email, SysEEPLog.LogTypeType.Warning , DateTime.Now, title.ToString() , description); log.Log(); } } }
public object[] UserDefineLog(object[] param) { if (param.Length >= 2 && SysEEPLogService.Enable) { string title = (string)param[0]; string description = (string)param[1]; SysEEPLog eeplog = new SysEEPLog(base.GetClientInfo(), SysEEPLog.LogStyleType.UserDefine , SysEEPLog.LogTypeType.Normal, DateTime.Now, title, description); eeplog.Log(); } return new object[] { 0 }; }
private void Log(string sql) { if (SysEEPLogService.Enable && SysEEPLogService.LogSql) { SysEEPLog sysLog = new SysEEPLog(OwnerComp != null? OwnerComp.GetClientInfo(): ClientInfo, SysEEPLog.LogStyleType.Provider , SysEEPLog.LogTypeType.Normal, DateTime.Now, string.Empty, string.Empty); sysLog.OnlyLogSqlSentence = true; sysLog.SqlLogType = 1; //0:ExecuteSql,1:InfoCommand,2:UpdateComp sysLog.SqlSentence = sql; sysLog.Log(); } }