本文整理汇总了C#中ErrorLog.WriteFiles方法的典型用法代码示例。如果您正苦于以下问题:C# ErrorLog.WriteFiles方法的具体用法?C# ErrorLog.WriteFiles怎么用?C# ErrorLog.WriteFiles使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ErrorLog
的用法示例。
在下文中一共展示了ErrorLog.WriteFiles方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: timer_Tick
void timer_Tick(object sender, EventArgs e)
{
ErrorLog Log = new ErrorLog();
Log.WriteFiles(DateTime.Now.ToString() + "—" + "GetSVDBDataBuffer" + "—timer_Tick_B");
if (!Worker.IsBusy)
{
Worker.RunWorkerAsync();
Log.WriteFiles(DateTime.Now.ToString() + "—" + "GetSVDBDataBuffer" + "—timer_Tick_A");
}
}
示例2: StartProcess
public void StartProcess()
{
timer.Enabled = true;
timer.Start();
Worker.RunWorkerAsync();
ErrorLog Log = new ErrorLog();
Log.WriteFiles(DateTime.Now.ToString() + "—" + "GetSVDBDataBuffer" + "—StartProcess");
}
示例3: DealScanMessage
/// <summary>
/// 处理扫描消息
/// </summary>
/// <param name="msg"></param>
private void DealScanMessage(string msg)
{
try
{
string acceptIp = msg.Split('/')[2];
if (msg.Split('/')[3].Equals("server"))
{
switch (msg.Split('/')[4])
{
//启动扫描
case "start":
try
{
ScanUser = msg.Split('/')[5];
Process scanProcess = new Process();
ProcessStartInfo startInfo = new ProcessStartInfo(GetScanAppPatn(), msg.Split('/')[2] + " " + msg.Split('/')[1]);
scanProcess.StartInfo = startInfo;
scanProcess.Start();
}
catch (Exception ex)
{
acceptIp = msg.Split('/')[1];
}
break;
//取消扫描
case "cancel":
try
{
ScanUser = string.Empty;
Process[] process = Process.GetProcessesByName("ECCNetScanC");
for (int i = 0; i < process.Length; i++)
{
process[i].Kill();
}
}
catch (Exception ex)
{
ErrorLog Log = new ErrorLog();
Log.WriteFiles(DateTime.Now.ToString() + "—" + "关闭扫描进程失败: " + ex.ToString());
}
break;
//清理扫描
case "clear":
try
{
Process[] pcs = Process.GetProcessesByName("ECCNetScanC");
for (int i = 0; i < pcs.Length; i++)
{
pcs[i].Kill();
}
}
catch (Exception ex) { }
break;
}
}
//获取要接收消息的客户端
for (int i = 0; i < XmppServer.ClientConnectionList.Count; i++)
{
if (XmppServer.ClientConnectionList[i].ClientIPAddress.Equals(acceptIp))
{
if (XmppServer.ClientConnectionList[i].m_Sock.Connected)
XmppServer.ClientConnectionList[i].Send(msg);
}
//break;
}
}
catch (Exception ex) { }
}
示例4: m_StreamParser_OnStreamRead
/// <summary>
/// gong tao
/// </summary>
/// <param name="buf"></param>
void m_StreamParser_OnStreamRead(byte[] buf)
{
try
{
if (XmppServer.ClientConnectionList != null && XmppServer.ClientConnectionList.Count > 0)
{
//去除智能缓存
string msg = Encoding.UTF8.GetString(buf);
//if (msg.StartsWith("OnShow"))
//{
// //XmppServer.GlobeEntityId = msg.Split(':')[1].Split('/')[0].Trim();
// if (XmppServer.GlobeEntityIdList.ContainsKey(this))
// {
// XmppServer.GlobeEntityIdList[this] = msg.Split(':')[1].Split('/')[0].Trim();
// }
// else
// {
// XmppServer.GlobeEntityIdList.Add(this, msg.Split(':')[1].Split('/')[0].Trim());
// }
// return;
//}
string type = msg.Split('/')[0];
//XmppSeverConnection xmppClient = null;
//拓扑扫描消息,对指定的客户端发送消息
if (type.Equals("single"))
{
DealScanMessage(msg);
}
//用户登陆消息
else if(type.Equals("login"))
{
DealLoginMessage(msg);
}
//智能缓存消息
else
{
for (int i = 0; i < XmppServer.ClientConnectionList.Count; i++)
{
try
{
if (XmppServer.ClientConnectionList[i] != null && XmppServer.ClientConnectionList[i].m_Sock != null)
{
//if (i == 0)
//{
// XmppServer.ClientConnectionList[i].m_Sock.Close();
//}
XmppServer.ClientConnectionList[i].Send(Encoding.UTF8.GetString(buf));
}
}
catch (Exception ex)
{
ErrorLog Log = new ErrorLog();
Log.WriteFiles(DateTime.Now.ToString() + "—" + "XmppSeverConnection" + "—m_StreamParser_OnStreamRead--loop" + "—" + ex.Message);
}
}
}
}
}
catch (Exception ex)
{
ErrorLog Log = new ErrorLog();
Log.WriteFiles(DateTime.Now.ToString() + "—" + "XmppSeverConnection" + "—m_StreamParser_OnStreamRead" + "—" + ex.Message);
}
}
示例5: GetScanAppPatn
/// <summary>
/// 获取NetScan路径
/// </summary>
/// <returns></returns>
private string GetScanAppPatn()
{
string scanPath = string.Empty;
try
{
RegistryKey root = Registry.LocalMachine;
RegistryKey child = root.OpenSubKey("Software\\Siteview\\SiteviewECC");
if (child != null)
{
scanPath = child.GetValue("NetScan").ToString();
}
else
{
scanPath = ConfigManager.ScanPath;
}
}
catch (Exception ex)
{
ErrorLog Log = new ErrorLog();
Log.WriteFiles(DateTime.Now.ToString() + "—" + "XmppSeverConnection" + "—获取NetScan路径" + "—" + ex.ToString());
}
return scanPath;
}
示例6: EndClientConnection
private void EndClientConnection()
{
try
{
if (XmppServer.ClientConnectionList != null && XmppServer.ClientConnectionList.Count > 0)
{
if(XmppServer.ClientConnectionList.Contains(this))
{
XmppServer.ClientConnectionList.Remove(this);
}
if(XmppServer.GlobeEntityIdList.ContainsKey(this))
{
XmppServer.GlobeEntityIdList.Remove(this);
}
ErrorLog Log = new ErrorLog();
Log.WriteFiles(DateTime.Now.ToString() + "—Delete—ClientConnectionList" + "—" + XmppServer.ClientConnectionList.Count.ToString());
}
if (XmppServer.ClientLoginNameList.Count > 0)
{
string UserName = "";
foreach (string key in XmppServer.ClientLoginNameList.Keys)
{
if (XmppServer.ClientLoginNameList[key].m_Sock.RemoteEndPoint.ToString().Split(new char[1] { ':' })[0] == this.m_Sock.RemoteEndPoint.ToString().Split(new char[1] { ':' })[0])
{
UserName = key;
break;
}
}
if (XmppServer.ClientLoginNameList.ContainsKey(UserName))
{
XmppServer.ClientLoginNameList.Remove(UserName);
}
}
if (this.m_ClientAccount != null)
{
if (this.m_Server.ClientConnections[this.m_ClientAccount].ContainsKey(this.strBindResource))
{
this.m_Server.ClientConnections[this.m_ClientAccount].Remove(this.strBindResource);
}
Presence newPresence = new Presence();
newPresence.Type = PresenceType.unavailable;
newPresence.From = this.m_ClientAccount.JID;
foreach (Friend friend in this.m_ClientAccount.Friends)
{
Send(friend.JID, newPresence);
}
}
if (this.OnClientEnd != null)
{
this.OnClientEnd(this);
}
//m_Sock.Shutdown(SocketShutdown.Both);
if (m_Sock.Connected)
{
m_Sock.Shutdown(SocketShutdown.Both);
m_Sock.Close();
}
}
catch (Exception ex)
{
ErrorLog Log = new ErrorLog();
Log.WriteFiles(DateTime.Now.ToString() + "—" + "XmppSeverConnection" + "—EndClientConnection" + "—" + ex.Message);
//System.Windows.Forms.MessageBox.Show("EndClientConnection" + "----" + ex.ToString());
}
//Console.WriteLine("Close");
}
示例7: Send
public void Send(string data)
{
// Convert the string data to byte data using ASCII encoding.
try
{
if (this.m_Sock == null)
{
if (XmppServer.ClientConnectionList.Count > 0 && XmppServer.ClientConnectionList.Contains(this))
{
XmppServer.ClientConnectionList.Remove(this);
ErrorLog Log = new ErrorLog();
Log.WriteFiles(DateTime.Now.ToString() + "—" + "XmppSeverConnection" + "—Send1");
return;
}
}
byte[] byteData = Encoding.UTF8.GetBytes(data);
ErrorLog Log1 = new ErrorLog();
string tmp = data.Replace("g", "组");
tmp = tmp.Replace("a", "添加");
tmp = tmp.Replace("e", "设备");
tmp = tmp.Replace("m", "监测器");
tmp = tmp.Replace("d", "删除");
if (!data.Contains("test"))
{
Log1.WriteFiles(DateTime.Now.ToString() + "—" + "XmppSeverConnection" + "—BSend—" + m_Sock.RemoteEndPoint.ToString() + "—" + tmp.Trim(new char[1] { '\0' }));
}
m_Sock.BeginSend(byteData, 0, byteData.Length, 0, new AsyncCallback(SendCallback), null);
if (!data.Contains("test"))
{
Log1.WriteFiles(DateTime.Now.ToString() + "—" + "XmppSeverConnection" + "—ASend—" + m_Sock.RemoteEndPoint.ToString() + "—" + tmp.Trim(new char[1] { '\0' }));
}
}
catch (Exception ex)
{
if (XmppServer.ClientConnectionList.Count > 0 && XmppServer.ClientConnectionList.Contains(this))
{
XmppServer.ClientConnectionList.Remove(this);
}
ErrorLog Log = new ErrorLog();
Log.WriteFiles(DateTime.Now.ToString() + "—" + "XmppSeverConnection" + "—Send" + "—" + ex.Message);
}
//Console.WriteLine("");
//Console.WriteLine("=========================sending==========================");
//Console.WriteLine(data);
//if (this.OnOutput != null)
//{
// this.OnOutput(this, "Sending", data);
//}
}
示例8: ReadCallback
public void ReadCallback(IAsyncResult ar)
{
try
{
// Retrieve the state object and the handler socket
// from the asynchronous state object
// Read data from the client socket.
if (this.m_Sock == null)
{
if (XmppServer.ClientConnectionList.Count > 0 && XmppServer.ClientConnectionList.Contains(this))
{
XmppServer.ClientConnectionList.Remove(this);
ErrorLog Log = new ErrorLog();
Log.WriteFiles(DateTime.Now.ToString() + "—" + "XmppSeverConnection" + "—ReadCallback");
return;
}
}
int bytesRead = 0;
if (m_Sock.Connected)
{
bytesRead = m_Sock.EndReceive(ar);
}
if (bytesRead > 0)
{
//string strTemp = Encoding.Default.GetString(buffer, 0, bytesRead);
//if (strTemp == "<Scan><Query>CompanyID</Query></Scan>")
//{
// byte[] byteData = Encoding.UTF8.GetBytes(ConfigManager.Company.ID);
// // Begin sending the data to the remote device.
// m_Sock.Send(byteData);
// m_Sock.Close();
// return;
//}
m_StreamParser.Push(buffer, 0, bytesRead);
if (m_Sock.Connected)
{
// Not all data received. Get more.
m_Sock.BeginReceive(buffer, 0, BUFFERSIZE, 0, new AsyncCallback(ReadCallback), null);
}
}
else
{
//m_Sock.Shutdown(SocketShutdown.Both);
m_Sock.Close();
}
}
catch (SocketException se)
{
//Console.WriteLine(se.Message);
EndClientConnection();
}
}
示例9: GetAllSVDBData
public void GetAllSVDBData()
{
try
{
ErrorLog Log = new ErrorLog();
Log.WriteFiles(DateTime.Now.ToString() + "—" + "GetSVDBDataBuffer" + "—GetAllSVDBData_A");
string XFireUrl = Log.ReadFile();
XFireUrl = XFireUrl.Split(new char[1] { '=' })[1].Trim();
UserPermissionContext.Instance.Url = "http://"+ConfigManager.XfireUrl +"//webservice//InterfaceEccService";
ITreeDao treeDao = MicroKernelUtil.GetDefaultKernel()[typeof(ITreeDao)] as ITreeDao;
IList<NameValueCollection> tree = treeDao.GetAll2();
Dictionary<XmppSeverConnection, string> ReturnStr = new Dictionary<XmppSeverConnection, string>();
if (m_DataBuffer.Count < 1)
{
m_DataBuffer.Add(tree);
}
else
{
ReturnStr = CompareDataState(tree);
m_DataBuffer.RemoveAt(0);
m_DataBuffer.Add(tree);
if (ReturnStr.Count == 0)
{
return;
}
foreach (XmppSeverConnection key in ReturnStr.Keys)
{
if (ReturnStr[key] != "Norefresh")
{
List<string> SentStrList = new List<string>();
//if (ReturnStr.Length > 8192)
//{
// SentStrList = GetbatchdisableSendList(ReturnStr, "refresh<");
//}
//else
{
string sendStr = ReturnStr[key];
sendStr = sendStr + ">stop";
key.Send(sendStr);
//XmppServer.ClientConnectionList[i].Send(SentStrList[j]);
System.Threading.Thread.Sleep(1000);
}
//if (XmppServer.IsSendData)
//{
//if (SentStrList == null || SentStrList.Count == 0)
//{
// for (int i = 0; i < XmppServer.ClientConnectionList.Count; i++)
// {
// XmppServer.ClientConnectionList[i].Send(ReturnStr);
// System.Threading.Thread.Sleep(1000);
// }
//}
//else
//{
// for (int j = 0; j < SentStrList.Count; j++)
// {
// for (int i = 0; i < XmppServer.ClientConnectionList.Count; i++)
// {
// XmppServer.ClientConnectionList[i].Send(SentStrList[j]);
// System.Threading.Thread.Sleep(1000);
// }
// }
//}
// System.Threading.Thread.Sleep(5000);
// List<string> ClientResponseKeyList = new List<string>();
// if (XmppServer.ClientResponseList.Count > 0)
// {
// foreach (string key in XmppServer.ClientResponseList.Keys)
// {
// ClientResponseKeyList.Add(key);
// if (!XmppServer.ClientResponseList[key])
// {
// for (int i = 0; i < XmppServer.ClientConnectionList.Count; i++)
// {
// if (XmppServer.ClientConnectionList[i].ClientIPAddress == key)
// {
// if (SentStrList == null || SentStrList.Count == 0)
// {
// //for (int i = 0; i < XmppServer.ClientConnectionList.Count; i++)
// {
// XmppServer.ClientConnectionList[i].Send(ReturnStr);
// //System.Threading.Thread.Sleep(1000);
// }
// }
// else
// {
// for (int j = 0; j < SentStrList.Count; j++)
// {
// //for (int i = 0; i < XmppServer.ClientConnectionList.Count; i++)
// {
//.........这里部分代码省略.........