本文整理汇总了C#中Rec类的典型用法代码示例。如果您正苦于以下问题:C# Rec类的具体用法?C# Rec怎么用?C# Rec使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Rec类属于命名空间,在下文中一共展示了Rec类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ParseSpecific
// string parçalama
public override bool ParseSpecific(String line, bool dontSend)
{
line = line.Trim();
line = line.Replace("\0", "");
if (line == "" || line == " ")
return true;
if (!dontSend)
{
try
{
Rec rRec = new Rec();
rRec.LogName = LogName;
rRec = str_Paracala(line, rRec);
SetRecordData(rRec);
}
catch (Exception e)
{
Log.Log(LogType.FILE, LogLevel.ERROR, " MicrosoftIASServerRecorder In ParseSpecific() -->> " + e.Message);
Log.Log(LogType.FILE, LogLevel.ERROR, " MicrosoftIASServerRecorder In ParseSpecific() -->> " + e.StackTrace);
Log.Log(LogType.FILE, LogLevel.ERROR, " MicrosoftIASServerRecorder In ParseSpecific() -->> " + " Line : " + line);
return true;
}
}
return true;
}
示例2: ParseSpecific
public override bool ParseSpecific(String line, bool dontSend)
{
Log.Log(LogType.FILE, LogLevel.DEBUG, "Parsing Specific line");
if (line == "")
return true;
if (!dontSend)
{
String[] arr = SpaceSplit(line, false, '"');
try
{
Rec r = new Rec();
string[] fields = line.Split('@');
for (int i = 0; i < fields.Length; i++)
{
fields[i] = fields[i].Trim('#');
}
try
{
//ALLOW#@#Gambling Related#@#Sat Nov 20 00:00:04 EET 2010#@#null#@#null#@#null#@#085.109.179.003#@#mssp_ww#@#www.mackolik.com#@#http://www.mackolik.com/LiveScores/SequenceNo.aspx#@#-
//#Sat Nov 20 00:00:04 EET 2010#
//AOW#@#Search Engines#@#Sat gn 01 02:12:3aclk?saaclk?sa=l% EEf=CErAPuW4eTfbEGpG4hQeO2eiAB--IqJkBqbjrkxDZpMzlARAEKAhQueCHiAJglladhoAhoAHdg_D-A8gBAaoEFk_Q8kKy0eJhL1ltT08nmVqCuykABJwullnum=4%llsig=AGiWqtyIkw--v0IyoK-GySWz_TXKibv4cg.04ad#http:ekJan01 otelgumuslukproxl#@#[email protected]#085.1Co109n0.236#e6RID79.093:36:3i4:06:1FQjCNGtPoh6iH6DqUwHB9nVXMOOkwzL7A%26204#52
//AOW#@#Search Engines#@#Sa Jan01 02:12:3aclk?sa2ht?sa=t/56sDweb%=0eb%llcd=2%5Bv/d=0CB8QFjAB.0ssp_ww#@#null#@#http:32582bt.com/index/mymail.ht.tm52
string[] datearr = fields[2].Split(' ');
string tempdate = datearr[2] + "/" + datearr[1] + "/" + datearr[5].TrimEnd('#') + " " + datearr[3];
DateTime date_time = Convert.ToDateTime(tempdate, CultureInfo.InvariantCulture);
r.Datetime = date_time.ToString("yyyy/MM/dd HH:mm:ss");
Log.Log(LogType.FILE, LogLevel.DEBUG, "Datetime = " + r.Datetime);
}
catch (Exception ex)
{
Log.Log(LogType.FILE, LogLevel.ERROR, "In Catch 1 " + ex.Message);
}
r.EventType = fields[0];
r.CustomStr5 = fields[1];
r.CustomStr3 = fields[6];
r.CustomStr9 = fields[8];
if (fields[9].Length > 898)
{
r.Description = fields[9].Substring(0, 898);
}
else
r.Description = fields[9];
r.LogName = LogName;
SetRecordData(r);
}
catch (Exception e)
{
Log.Log(LogType.FILE, LogLevel.ERROR, e.Message);
Log.Log(LogType.FILE, LogLevel.ERROR, e.StackTrace);
Log.Log(LogType.FILE, LogLevel.ERROR, "Line : " + line);
return true;
}
}
return true;
}
示例3: ParseSpecific
public override bool ParseSpecific(String line, bool dontSend)
{
Log.Log(LogType.FILE, LogLevel.DEBUG, "Parsing Specific line");
if (line == "")
return true;
if (!dontSend)
{
String[] arr = SpaceSplit(line, false);
try
{
Rec r = new Rec();
if (arr.Length < 6)
{
Log.Log(LogType.FILE, LogLevel.WARN, "Different message on parse, moving to description: " + line);
DateTime dt = DateTime.Now;
r.Datetime = dt.Year + "/" + dt.Month + "/" + dt.Day + " " + dt.Hour + ":" + dt.Minute + ":" + dt.Second;
r.Description = line;
}
else
{
String[] dateArr = arr[1].Split('/');
r.Datetime = DateTime.Now.Year + "/" + Convert.ToInt32(dateArr[0]) + "/" + Convert.ToInt32(dateArr[1]) + " " + arr[2] + ":00";
r.EventCategory = arr[0];
r.CustomStr1 = arr[3];
r.CustomStr2 = arr[4];
String[] lastArr = arr[5].Split('-');
if (lastArr.Length > 1)
{
r.CustomStr3 = lastArr[0];
r.CustomStr4 = lastArr[1];
}
else
r.CustomStr3 = arr[5];
}
r.LogName = LogName;
SetRecordData(r);
}
catch (Exception e)
{
Log.Log(LogType.FILE, LogLevel.ERROR, e.Message);
Log.Log(LogType.FILE, LogLevel.ERROR, e.StackTrace);
Log.Log(LogType.FILE, LogLevel.ERROR, "Line : " + line);
return true;
}
}
return true;
}
示例4: ParseSpecific
public override bool ParseSpecific(String line, bool dontSend)
{
Log.Log(LogType.FILE, LogLevel.DEBUG, "Parsing Specific line");
Log.Log(LogType.FILE, LogLevel.DEBUG, "Line Is : " + line);
if (line == "")
return true;
if (!dontSend)
{
String[] arr = SpaceSplit(line, false);
try
{
Rec r = new Rec();
for (int i = 0; i < arr.Length; i++)
{
if (arr[i].Contains("Info:"))
{
try
{
r.Datetime = arr[0] + " " + arr[1];
}
catch (Exception ex)
{
Log.Log(LogType.FILE, LogLevel.ERROR, "Onur Date Error" + ex.Message);
continue;
}
r.Description = line;
}
if (line.StartsWith("log - 1") && line.Contains("Info:"))
{
string[] logArr = line.Split('"');
for (int j = 0; j < logArr.Length; j++)
{
r.Datetime = logArr[1].Split(' ')[0] + " " + logArr[1].Split(' ')[1];
}
}
}
r.ComputerName = remoteHost;
r.LogName = LogName;
SetRecordData(r);
}
catch (Exception e)
{
Log.Log(LogType.FILE, LogLevel.ERROR, e.Message);
Log.Log(LogType.FILE, LogLevel.ERROR, e.StackTrace);
Log.Log(LogType.FILE, LogLevel.ERROR, "Line : " + line);
return true;
}
}
return true;
}
示例5: ParseSpecific
public override bool ParseSpecific(String line, bool dontSend)
{
Log.Log(LogType.FILE, LogLevel.DEBUG, "Parsing Specific line");
if (line == "")
return true;
if (!dontSend)
{
String[] arr = line.Split(new char[] { '-' });
Rec r = new Rec();
r.Description = line;
r.LogName = LogName;
r.Datetime = DateTime.Now.ToString();
try
{
if (arr.Length >= 6)
{
r.SourceName = arr[0];
r.ComputerName = arr[1];
r.UserName = arr[2];
//[29/Dec/2010:11:42:33 +0200]
string[] dateParts = arr[3].Split(new char[] { ' ', ':' }, StringSplitOptions.RemoveEmptyEntries);
string date = dateParts[0].TrimStart('[') + " " + dateParts[1] + ":" + dateParts[2] + ":" + dateParts[3];
r.Datetime = Convert.ToDateTime(date.TrimStart('[').TrimEnd(']').Trim(), CultureInfo.InvariantCulture).ToString("yyyy-MM-dd HH:mm:ss");
String[] parts = line.Split(new char[] { '"' }, StringSplitOptions.RemoveEmptyEntries);
r.CustomStr1 = parts[1];
r.CustomStr2 = parts[3];
r.CustomStr3 = parts[5];
r.CustomInt1 = Convert_To_Int32(arr[arr.Length - 1]);
}
else
{
Log.Log(LogType.FILE, LogLevel.INFORM, "Line format is not like we want! Line: " + line);
}
}
catch (Exception e)
{
Log.Log(LogType.FILE, LogLevel.ERROR, e.Message);
Log.Log(LogType.FILE, LogLevel.ERROR, e.StackTrace);
Log.Log(LogType.FILE, LogLevel.ERROR, "Line : " + line);
return true;
}
SetRecordData(r);
}
return true;
}
示例6: sendDataforRemoteRecorder
public void sendDataforRemoteRecorder(string Dal, string virtualhost, Rec rec)
{
try
{
CustomBase cb = new CustomBase();
CustomServiceBase s = base.GetInstanceService("Security Manager Remote Recorder");
s.SetData(Dal, virtualhost, rec);
}
catch(Exception e)
{
InitializeLogger.L.Log(LogType.FILE, LogLevel.DEBUG, e.Message);
InitializeLogger.L.Log(LogType.FILE, LogLevel.DEBUG, e.StackTrace);
}
InitializeLogger.L.Log(LogType.FILE, LogLevel.DEBUG, "sendDataforRemoteRecorder is finished");
}
示例7: TwoElement
public void TwoElement() {
Rec<string, string> rec1, rec2, rec3;
rec1 = new Rec<string, string>("abe", null);
rec2 = new Rec<string, string>("abe", null);
rec3 = new Rec<string, string>("abe", "kat");
Assert.IsTrue(rec1 == rec2);
Assert.IsFalse(rec1 != rec2);
Assert.IsFalse(rec1 == rec3);
Assert.IsTrue(rec1 != rec3);
Assert.IsTrue(rec1.Equals(rec2));
Assert.IsFalse(rec1.Equals(rec3));
//
Assert.IsFalse(rec1.Equals(null));
Assert.IsFalse(rec1.Equals("bamse"));
//
Assert.IsTrue(rec1.GetHashCode() == rec2.GetHashCode());
Assert.IsFalse(rec1.GetHashCode() == rec3.GetHashCode());
//
Assert.AreEqual("abe", rec1.X1);
Assert.IsNull(rec1.X2);
}
示例8: createRec
public Rec createRec()
{
Rec rec = new Rec();
rec.SourceName = sourceName;
rec.Datetime = dateTime;
rec.LogName = logName;
rec.EventType = eventType;
rec.CustomInt1 = sequenceNo;
rec.CustomInt2 = severity;
rec.CustomInt9 = Convert.ToInt64(sourceportNumber);
rec.CustomStr1 = facility;
rec.CustomStr2 = mnemonic;
rec.CustomStr3 = messageText;
rec.Description = unknownlogformat;
L.Log(LogType.FILE, LogLevel.DEBUG,unknownlogformat);
L.Log(LogType.FILE, LogLevel.DEBUG,messageText);
return rec;
}
示例9: ParseSpecific
public override bool ParseSpecific(String line, bool dontSend)
{
Log.Log(LogType.FILE, LogLevel.DEBUG, "Parsing Specific line");
Log.Log(LogType.FILE, LogLevel.DEBUG, "Line Is : " + line);
if (line == "")
return true;
if (!dontSend)
{
String[] arr = SpaceSplit(line, false);
try
{
Rec r = new Rec();
DateTime df = DateTime.Now;
DateTime dt;
string myDateTimeString = arr[0] + arr[1] + "," + df.Year + "," + arr[2];
dt = Convert.ToDateTime(myDateTimeString);
string lastDate = dt.ToString("yyyy-MM-dd HH:mm:ss");
r.Description = line;
r.Datetime = lastDate;
r.ComputerName = remoteHost;
r.LogName = LogName;
SetRecordData(r);
}
catch (Exception e)
{
Log.Log(LogType.FILE, LogLevel.ERROR, e.Message);
Log.Log(LogType.FILE, LogLevel.ERROR, e.StackTrace);
Log.Log(LogType.FILE, LogLevel.ERROR, "Line : " + line);
return true;
}
}
return true;
}
示例10: sendData
private void sendData(Rec rec)
{
if (usingRegistry)
{
CustomServiceBase s = base.GetInstanceService("Security Manager Sender");
s.SetData(rec);
}
else
{
CustomServiceBase s = base.GetInstanceService("Security Manager Remote Recorder");
s.SetData(Dal, virtualhost, rec);
}
}
示例11: ParseSpecific
public override bool ParseSpecific(String line, bool dontSend)
{
Log.Log(LogType.FILE, LogLevel.DEBUG, "Parsing Specific line");
if (line == "")
return true;
if (!dontSend)
{
// eski --->> 192.168.20.62 eucfcu\sgurbuz [28/Dec/2010:10:35:36 +0000] "GET http://www.playboy.com/ HTTP/1.1" "sx"
//192.168.20.100 - 192.168.20.100 - EUCFCU\gaktas - [29/Dec/2010:10:56:00 +0200] - "GET http://forum.memurlar.net/htc/banner.htc HTTP/1.1" - ""
//192.168.20.159 - leventaydos.eucfcu.local - EUCFCU\laydos - [30/Dec/2010:10:10:14 +0200] - "GET http://forum.memurlar.net/htc/banner.htc HTTP/1.1" - ""
//192.168.20.191 - mypc-d106bee486 - EUCFCU\btanrikulu - [30/Dec/2010:13:05:29 +0200] - "GET http://ecl.labs.popcap.com/v118/facebook/bj2/js/kt_common.js HTTP/1.1" - ""
//Yeni format
//192.168.20.186 209.85.149.189 "EUCFCU\mgcelik" [22/Feb/2011:10:13:05 +0200] "CONNECT chatenabled.mail.google.com:443 HTTP/1.0" 403 1091 1834 "" "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; InfoPath.3; .NET4.0C; .NET4.0E)" "im" 10 "-" "Genel" 0.024 "-" Neutral -
//192.168.20.180 69.63.189.16 "EUCFCU\lsutcu" [22/Feb/2011:10:13:27 +0200] "POST http://www.facebook.com/ajax/chat/buddy_list.php?__a=1 HTTP/1.1" 403 1947 1832 "http://www.facebook.com/?sk=messages#!/" "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; GTB0.0; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; InfoPath.3; .NET4.0C; .NET4.0E)" "ch" 10 "-" "Genel" 0.052 "-" Neutral -
if (line.StartsWith("#"))
return true;
String[] arr = line.Split(new char[] { ' ' });
Rec r = new Rec();
if (line.Length > 891)
{
r.Description = line.Substring(0, 890);
r.Description = r.Description.Replace("'", "|");
}
else
{
r.Description = line;
r.Description = r.Description.Replace("'", "|");
}
r.LogName = LogName;
r.Datetime = DateTime.Now.ToString();
try
{
if (arr.Length >= 6)
{
r.SourceName = arr[0];
r.ComputerName = arr[1];
r.UserName = arr[2].Trim('"');
string[] dateParts = arr[3].Split(new char[] { ' ', ':' }, StringSplitOptions.RemoveEmptyEntries);
string date = dateParts[0].TrimStart('[') + " " + dateParts[1] + ":" + dateParts[2] + ":" + dateParts[3];
r.Datetime = Convert.ToDateTime(date.Trim().Trim(':').Trim(), CultureInfo.InvariantCulture).ToString("yyyy-MM-dd HH:mm:ss");
string[] parts = line.Split(new char[] { '"' });
string[] url = parts[3].Split(' ');
r.EventType = url[0];
if (url[1].Length > 891)
r.CustomStr1 = url[1].Substring(0, 890);
else
r.CustomStr1 = url[1];
r.CustomStr3 = url[2];
string[] ints = parts[4].Trim().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
r.CustomInt1 = Convert_To_Int32(ints[0].Trim());
r.CustomInt2 = Convert_To_Int32(ints[1].Trim());
r.CustomInt3 = Convert_To_Int32(ints[2].Trim());
r.CustomStr2 = parts[7];
r.CustomStr10 = parts[5];
//if (parts.Length > 3)
//{
// r.CustomStr3 = parts[3];
//}
}
else
{
Log.Log(LogType.FILE, LogLevel.INFORM, "Line format is not like we want! Line: " + line);
}
}
catch (Exception e)
{
Log.Log(LogType.FILE, LogLevel.ERROR, e.Message);
Log.Log(LogType.FILE, LogLevel.ERROR, e.StackTrace);
Log.Log(LogType.FILE, LogLevel.ERROR, "Line : " + line);
}
SetRecordData(r);
}
return true;
}
示例12: SlogSyslogEvent
void SlogSyslogEvent(LogMgrEventArgs args)
{
var rec = new Rec();
try
{
L.Log(LogType.FILE, LogLevel.DEBUG, "Start preparing record");
L.Log(LogType.FILE, LogLevel.DEBUG, " Log : " + args.Message);
try
{
rec.LogName = "WatchGuardWebSyslogV_1_0_0Recorder";
rec.Datetime = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
rec.Description = args.Message.Length > 899 ? args.Message.Substring(0, 899) : args.Message;
rec.Description = args.Message.Replace("'", "|");
string line = args.Message;
string[] lineArr = line.Split();
string[] subLineArr = line.Split((char[])null, StringSplitOptions.RemoveEmptyEntries);
for (int i = 0; i < lineArr.Length; i++)
{
if (lineArr[i].StartsWith("op"))
{
rec.EventType = SplitFunction(lineArr[i]);
L.Log(LogType.FILE, LogLevel.DEBUG, "EventType: " + rec.EventType);
}
if (lineArr[i].StartsWith("proxy_act"))
{
rec.CustomStr2 = SplitFunction(lineArr[i]);
L.Log(LogType.FILE, LogLevel.DEBUG, "CustomStr2: " + rec.CustomStr2);
}
if (lineArr[i].StartsWith("dstname"))
{
rec.CustomStr6 = SplitFunction(lineArr[i]);
L.Log(LogType.FILE, LogLevel.DEBUG, "CustomStr6: " + rec.CustomStr6);
}
if (lineArr[i].StartsWith("arg"))
{
rec.CustomStr7 = SplitFunction(lineArr[i]);
L.Log(LogType.FILE, LogLevel.DEBUG, "CustomStr7: " + rec.CustomStr7);
}
try
{
if (lineArr[i].StartsWith("sent_bytes"))
{
rec.CustomInt5 = Convert.ToInt32(SplitFunction(lineArr[i]));
L.Log(LogType.FILE, LogLevel.DEBUG, "CustomInt5: " + rec.CustomInt5);
}
}
catch (Exception exception)
{
L.Log(LogType.FILE, LogLevel.ERROR, "CustomInt5 Type Casting Error: " + exception.Message);
}
try
{
if (lineArr[i].StartsWith("rcvd_bytes"))
{
rec.CustomInt6 = Convert.ToInt32(SplitFunction(lineArr[i]));
L.Log(LogType.FILE, LogLevel.DEBUG, "CustomInt6: " + rec.CustomInt6);
}
}
catch (Exception exception)
{
L.Log(LogType.FILE, LogLevel.ERROR, "CustomInt6 Type Casting Error: " + exception.Message);
}
try
{
if (lineArr[i].StartsWith("elapsed_time"))
{
rec.CustomStr8 = SplitFunction(lineArr[i]);
L.Log(LogType.FILE, LogLevel.DEBUG, "CustomStr8: " + rec.CustomStr8);
}
}
catch (Exception exception)
{
L.Log(LogType.FILE, LogLevel.ERROR, "CustomStr8 Type Casting Error: " + exception.Message);
}
if (lineArr[i].ToLower() == "tcp")
{
try
{
IPAddress sourceIp = IPAddress.Parse(lineArr[i + 1]);
rec.CustomStr3 = sourceIp.ToString(); L.Log(LogType.FILE, LogLevel.DEBUG, "CustomStr3: " + rec.CustomStr3);
}
catch (Exception exception)
{
L.Log(LogType.FILE, LogLevel.ERROR, "CustomStr3 Error: " + exception.Message);
}
try
{
//.........这里部分代码省略.........
示例13: SendData
private bool SendData(Rec rec)
{
try
{
L.Log(LogType.FILE, LogLevel.DEBUG, "Finish preparing record");
L.Log(LogType.FILE, LogLevel.DEBUG, "Start sending Data");
if (usingRegistry)
{
CustomServiceBase s = base.GetInstanceService("Security Manager Sender");
s.SetData(rec);
}
else
{
CustomServiceBase s = base.GetInstanceService("Security Manager Remote Recorder");
s.SetData(Dal, virtualhost, rec);
s.SetReg(Id, rec.Datetime, "", "", "", rec.Datetime);
}
L.Log(LogType.FILE, LogLevel.DEBUG, "Finish Sending Data");
return true;
}
catch (Exception exception)
{
return false;
}
}
示例14: ParseSpecific
public override bool ParseSpecific(String line, bool dontSend)
{
Log.Log(LogType.FILE, LogLevel.DEBUG, "Parsing Specific line");
Log.Log(LogType.FILE, LogLevel.DEBUG, "ParseSpecific | Line : " + line);
if (Position != 0)
{
RecordFields.lineNumber++;
Log.Log(LogType.FILE, LogLevel.DEBUG, "ParseSpecific | lineNumber : " + RecordFields.lineNumber);
}
else if (Position == 0)
{
RecordFields.lineNumber = 0;
}
if (line == "")
return true;
String[] lineArr = line.Split(' ');
try
{
Rec r = new Rec();
r.LogName = LogName;
//if (line.Length > 899)
//{
// r.Description = line.Substring(0, 899);
// Log.Log(LogType.FILE, LogLevel.DEBUG, "Description : " + r.Description);
//}
//else
//{
// r.Description = line;
// Log.Log(LogType.FILE, LogLevel.DEBUG, "Description : " + r.Description);
//}
try
{
DateTime dt;
string[] dateArr = lineArr[3].Replace('[', ' ').Trim().Split(':')[0].Split('/');
string[] timeArr = lineArr[3].Replace('[', ' ').Trim().Split(':');
string myDateTimeString = dateArr[1] + "-" + dateArr[0] + "-" + dateArr[2] + "," + timeArr[1] + ":" + timeArr[2] + ":" + timeArr[3];
dt = Convert.ToDateTime(myDateTimeString);
r.Datetime = dt.ToString(dateFormat);
}
catch (Exception exception)
{
Log.Log(LogType.FILE, LogLevel.DEBUG, "DateTime Parsing Error: " + exception.Message);
}
try
{
r.EventType = lineArr[5].Replace('"', ' ').Trim();
if (!string.IsNullOrEmpty(remoteHost))
{
r.ComputerName = remoteHost;
}
r.CustomStr1 = lineArr[7].Replace('"', ' ').Trim();
r.CustomStr3 = lineArr[0].Replace('"', ' ').Trim();
r.Description = lineArr[6];
try
{
r.CustomInt1 = Convert.ToInt32(lineArr[8]);
}
catch (Exception exception)
{
Log.Log(LogType.FILE, LogLevel.DEBUG, "CustomInt1 Cast Error: " + exception.Message);
r.CustomInt1 = 0;
}
try
{
r.CustomInt2 = Convert.ToInt32(lineArr[9]);
}
catch (Exception exception)
{
Log.Log(LogType.FILE, LogLevel.DEBUG, "CustomInt2 Cast Error: " + exception.Message);
r.CustomInt2 = 0;
}
}
catch (Exception exception)
{
Log.Log(LogType.FILE, LogLevel.DEBUG, "String Parsing Error: " + exception.Message);
}
#region Writelog
if (!string.IsNullOrEmpty(r.EventType))
{
Log.Log(LogType.FILE, LogLevel.DEBUG, "EventType" + r.EventType);
}
if (!string.IsNullOrEmpty(r.ComputerName))
{
Log.Log(LogType.FILE, LogLevel.DEBUG, "EventType" + r.ComputerName);
}
if (!string.IsNullOrEmpty(r.CustomStr1))
{
//.........这里部分代码省略.........
示例15: ParseSpecific
public override bool ParseSpecific(string line, bool dontSend)
{
Log.Log(LogType.FILE, LogLevel.DEBUG, "Parsing Specific line");
if (line == "")
return true;
String[] arr = SpaceSplit(line, false, '"');
if (arr.Length < 3)
return true;
try
{
if (!dontSend)
{
Rec r = new Rec();
r.Description = "";
String eventType = arr[2].TrimEnd(':');
arr[1] = arr[1].TrimStart('(');
arr[1] = arr[1].TrimEnd(')');
DateTime currentDate = DateTime.Now;
r.Datetime = currentDate.Year + "/" + currentDate.Month + "/" + currentDate.Day + " " + arr[0];
Int32 runItr = 2;
switch (eventType)
{
case "IN":
case "OUT":
{
r.EventType = eventType;
r.EventCategory = arr[3].TrimEnd('"').TrimStart('"');
r.UserName = arr[4];
runItr = 5;
} break;
case "UNSUPPORTED":
{
r.EventType = eventType;
r.EventCategory = arr[3].TrimEnd('"').TrimStart('"');
r.UserName = arr[5];
runItr = 6;
} break;
};
for (Int32 i = runItr; i < arr.Length; i++)
{
r.Description = arr[i] + " ";
}
r.Description = r.Description.Trim();
r.LogName = LogName;
SetRecordData(r);
}
}
catch (Exception e)
{
Log.Log(LogType.FILE, LogLevel.ERROR, e.Message);
Log.Log(LogType.FILE, LogLevel.ERROR, e.StackTrace);
Log.Log(LogType.FILE, LogLevel.ERROR, "Line : " + line);
return true;
}
return true;
}