void KinematicArrive(Transform target) { //Distance to target / arrive radius * max speed transform.LookAt(new Vector3(target.position.x, transform.position.y, target.position.z)); float distanceToTarget = CustomTools.GetDistanceToTarget(transform, target); float distanceComponent = Mathf.Max(distanceToTarget / arriveSlowRadius, 1); print(distanceComponent); //print("boom: info"); //print(distanceToTarget); //print(distanceComponent); //newVelocity *= (distanceToTarget / arriveRadius); if (distanceToTarget > arriveRadius) { if (distanceToTarget < arriveSlowRadius) { //rb.velocity = newVelocity; //print("haven't arrived"); MoveForwardAtSpeed(distanceComponent * maxSpeed); } else { MoveForwardAtSpeed(maxSpeed); } } else { //print("ARRIVED"); MoveForwardAtSpeed(0); arrived = true; } }
private void CoderParse(String line, ref CustomTools.CustomBase.Rec rec) { try { _log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> is STARTED "); //if (!IsSkipKeyWord(line)) //{ String[] subLine0 = line.Split(new Char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < subLine0.Length; i++) { if (subLine0[i].Contains("fac")) { rec.CustomStr10 = StringParse(subLine0[i]); } if (subLine0[i].Contains("area")) { rec.SourceName = StringParse(subLine0[i]); } if (subLine0[i].Contains("type")) { rec.EventType = StringParse(subLine0[i]); } if (subLine0[i].Contains("hostname")) { rec.ComputerName = StringParse(subLine0[i]); } if (subLine0[i].Contains("app_risk")) { rec.CustomStr5= StringParse(subLine0[i]); } if (subLine0[i].Contains("app_categories")) { rec.EventCategory = StringParse(subLine0[i]); } if (subLine0[i].Contains("srcip")) { rec.CustomStr3 = StringParse(subLine0[i]); } if (subLine0[i].Contains("srcport")) { rec.CustomInt3 = Convert.ToInt32(StringParse(subLine0[i])); } if (subLine0[i].Contains("dstip")) { rec.CustomStr4 = StringParse(subLine0[i]); } if (subLine0[i].Contains("dstport")) { rec.CustomInt4 = Convert.ToInt32(StringParse(subLine0[i])); } if (subLine0[i].Contains("protocol")) { rec.CustomInt1 = Convert.ToInt32(StringParse(subLine0[i])); } if (subLine0[i].Contains("dest_geo")) { rec.CustomStr3 = StringParse(subLine0[i]); } if (subLine0[i].Contains("src_geo")) { rec.CustomStr2 = StringParse(subLine0[i]); } if (subLine0[i].Contains("bytes_written_to_cliend")) { rec.CustomInt9 = Convert.ToInt32(StringParse(subLine0[i])); } if (subLine0[i].Contains("bytes_written_to_server")) { rec.CustomInt10 = Convert.ToInt32(StringParse(subLine0[i])); } if (subLine0[i].Contains("rule_name")) { rec.UserName = StringParse(subLine0[i]); } if (subLine0[i].Contains("application")) { rec.CustomStr6 = StringParse(subLine0[i]); } if (subLine0[i].Contains("information")) { rec.CustomStr7 = StringParse(subLine0[i]); } if (subLine0[i].Contains("event")) { rec.CustomStr8 = StringParse(subLine0[i]); } if (subLine0[i].Contains("alert_type")) { rec.CustomStr9 = StringParse(subLine0[i]); } if (subLine0[i].Contains("reason")) { rec.CustomStr1 = StringParse(subLine0[i]); } if (line.Length>900) { rec.Description = line.Substring(0, 899); } else { rec.Description = line; } //} } _log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> is successfully FINISHED."); } catch (Exception ex) { _log.Log(LogType.FILE, LogLevel.ERROR, " CoderParse() -->> An error occurred. " + ex.ToString()); } }
//fdsfsdf /// <summary> /// Parse the line /// </summary> /// <param name="line">Will parsing line</param> /// <param name="rec">Will recording record</param> private void CoderParse(String line, ref CustomTools.CustomBase.Rec rec) { try { Log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> is STARTED "); Int32 Year = 1; Int32 Month = 1; Int32 Day = 1; Int32 Hour = 0; Int32 Minute = 0; Int32 Second = 0; if (!line.StartsWith("#")) { String[] subLine0 = line.Split(new Char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); Log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> line : " + line); for (int i = 0; i < subLine0.Length; i++) { Log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> subline0[" + i + "] : " + subLine0[i]); } rec.CustomStr3 = Convert.ToString(subLine0[0]); Log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> CustomStr3 : " + rec.CustomStr3); rec.UserName = Convert.ToString(subLine0[1]); Log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> UserName : "******" " + Convert.ToString(subLine0[4]); Log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> Datetime : " + rec.Datetime); rec.ComputerName = Convert.ToString(subLine0[5]); Log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> ComputerName : " + rec.ComputerName); rec.Description = Convert.ToString(subLine0[6]); if (rec.Description.Length > 899) { rec.Description = rec.Description.Substring(0, 899); } else { rec.Description = rec.Description; } Log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> Description : " + rec.Description); if (subLine0[6].Contains("/")) { string[] strArray = subLine0[6].Split('/'); rec.CustomStr5 = strArray[0] + "//" + strArray[2]; Log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> CustomStr5 : " + rec.CustomStr5); } rec.CustomStr4 = Convert.ToString(subLine0[8]); Log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> CustomStr4 : " + rec.CustomStr4); rec.CustomInt4 = Convert.ToInt32(subLine0[9]); Log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> CustomInt4 : " + rec.CustomInt4); rec.CustomInt5 = Convert.ToInt32(subLine0[11]); Log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> CustomInt5 : " + rec.CustomInt5); rec.CustomInt6 = Convert.ToInt32(subLine0[12]); Log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> CustomInt6 : " + rec.CustomInt6); rec.EventType = Convert.ToString(subLine0[13]); Log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> EventType : " + rec.EventType); rec.EventCategory = subLine0[14]; Log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> EventCategory : " + rec.EventCategory); rec.CustomStr1 = Convert.ToString(subLine0[15]); if (rec.CustomStr1.Length > 899) { rec.CustomStr1 = rec.CustomStr1.Substring(0, 899); } else { rec.CustomStr1 = rec.CustomStr1; } Log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> CustomStr1 : " + rec.CustomStr1); rec.CustomStr2 = Convert.ToString(subLine0[16]); Log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> CustomStr2 : " + rec.CustomStr2); try { rec.CustomInt7 = Convert.ToInt32(subLine0[17]); Log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> CustomInt7 : " + rec.CustomInt7); } catch (Exception ex) { Log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> CustomInt7 is not integer : " + subLine0[17]); } rec.CustomStr6 = Convert.ToString(subLine0[19]); Log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> CustomStr6 : " + rec.CustomStr6); rec.CustomStr7 = Convert.ToString(subLine0[20]); Log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> CustomStr7 : " + rec.CustomStr7); rec.CustomStr9 = Convert.ToString(subLine0[21]); Log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> CustomStr9 : " + rec.CustomStr9); rec.CustomStr10 = Convert.ToString(subLine0[22]); Log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> CustomStr10 : " + rec.CustomStr10); try { rec.CustomInt10 = Convert.ToInt32(subLine0[24]); Log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> CustomInt10 : " + rec.CustomInt10); } catch (Exception) { Log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> CustomInt10 is not integer : " + subLine0[24]); } try { rec.CustomInt9 = Convert.ToInt32(subLine0[30]); Log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> CustomInt9 : " + rec.CustomInt9); } catch (Exception) { Log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> CustomInt9 is not integer : " + subLine0[30]); } try { rec.CustomInt8 = Convert.ToInt32(subLine0[40]); Log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> CustomInt8 : " + rec.CustomInt8); } catch (Exception) { Log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> CustomInt8 is not integer : " + subLine0[40]); } rec.EventCategory = Convert.ToString(subLine0[39]); Log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> EventCategory : " + rec.EventCategory); //DateTime dateTime = new DateTime(Year, Month, Day, Hour, Minute, Second); //rec.Datetime = String.Format("{0:yyyy/MM/dd HH:mm:ss}", dateTime); //Log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> Datetime : " + rec.Datetime); Log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> is successfully FINISHED."); } } catch (Exception ex) { Log.Log(LogType.FILE, LogLevel.ERROR, " CoderParse() -->> An error occurred. " + ex.ToString()); } }
private int CoderParse(String line, ref CustomTools.CustomBase.Rec rec) { try { Log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> is STARTED "); Log.Log(LogType.FILE, LogLevel.DEBUG, "Line is : " + line + ""); Log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> Arraylist fill started."); try { string[] arr = SpaceSplit(line, true); string day; string month; string year; string time; day = arr[2]; month = arr[1]; year = arr[4]; time = arr[3]; DateTime dt = Convert.ToDateTime(day + "/" + month + "/" + year + " " + time); if (line.Contains("Connection")) { rec.Datetime = dt.ToString("yyyy-MM-dd HH:mm:ss"); rec.EventType = arr[5].Replace(':', ' ').Trim(); rec.EventCategory = arr[6]; if (arr[8].Contains(":")) { rec.CustomStr1 = arr[8].Split(':')[0]; rec.CustomStr2 = arr[8].Split(':')[1]; } else { rec.CustomStr1 = arr[8]; rec.CustomStr2 = "-"; } if (arr[10].Contains(":")) { rec.CustomStr3 = arr[10].Split(':')[0]; rec.CustomStr4 = arr[8].Split(':')[1]; } else { rec.CustomStr3 = arr[10]; rec.CustomStr4 = "-"; } rec.CustomStr5 = arr[11]; } } catch (Exception ex) { Log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> line is unrecognized, unable to parse!" + ex.StackTrace); } Log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> is successfully FINISHED."); return 1; } catch (Exception ex) { Log.Log(LogType.FILE, LogLevel.ERROR, " CoderParse() -->> An error occurred. " + ex.ToString()); Log.Log(LogType.FILE, LogLevel.ERROR, " CoderParse() -->> " + ex.StackTrace); return 0; } }
private int CoderParse(String line, ref CustomTools.CustomBase.Rec rec) { try { Log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> is STARTED "); Log.Log(LogType.FILE, LogLevel.DEBUG, "Line is : " + line + ""); Log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> Arraylist fill started."); try { if (!string.IsNullOrEmpty(line)) { if (!line.StartsWith("#")) { string[] lineArr = SpaceSplit(line, true); rec.EventId = Convert.ToInt64(lineArr[0].Replace('[',' ').Replace(']',' ')); Log.Log(LogType.FILE, LogLevel.DEBUG, "EventId: " + rec.EventId); rec.CustomInt1 = Convert.ToInt32(lineArr[5].Replace('(', ' ').Replace(')', ' ')); Log.Log(LogType.FILE, LogLevel.DEBUG, "CustomInt1: " + rec.CustomInt1); try { string day = lineArr[2].Substring(0, 2); string month = lineArr[2].Substring(2, 3); string year = lineArr[2].Substring(lineArr[2].Length - 2); string time = lineArr[3]; DateTime dt; string myDateTimeString = month + ", " + day + "," + year + " ," + time; dt = Convert.ToDateTime(myDateTimeString); string date = dt.ToString(dateFormat); rec.Datetime = date; Log.Log(LogType.FILE, LogLevel.DEBUG, " Datetime : " + rec.Datetime); } catch (Exception exception) { Log.Log(LogType.FILE, LogLevel.ERROR, "CoderParse DateError: " + exception.Message); } if (line.Contains("Local address")) { rec.ComputerName = Between(line, "address", ")"); Log.Log(LogType.FILE, LogLevel.DEBUG, " ComputerName : " + rec.ComputerName); } if (line.Contains("Connected to")) { rec.CustomStr3 = Between(line, "to", " ("); Log.Log(LogType.FILE, LogLevel.DEBUG, " CustomStr3 : " + rec.CustomStr3); } for (int i = 0; i < lineArr.Length; i++) { if(lineArr[i].ToString()=="User") { rec.UserName = Between(line, "User", "logged "); Log.Log(LogType.FILE, LogLevel.DEBUG, " UserName : "******" " + lineArr[lineArr.Length - 1]; Log.Log(LogType.FILE, LogLevel.DEBUG, " EventType : " + rec.EventType); } } if (lineArr[6].ToString().Trim() == "Sending") { rec.EventCategory = lineArr[6] + " " + lineArr[7]; Log.Log(LogType.FILE, LogLevel.DEBUG, "EventCategory : " + rec.EventCategory); rec.CustomStr1 = lineArr[lineArr.Length - 1]; Log.Log(LogType.FILE, LogLevel.DEBUG, " CustomStr1 : " + rec.CustomStr1); if (!string.IsNullOrEmpty(rec.CustomStr1)) { string[] str2Arr = rec.CustomStr1.Split('\\'); rec.CustomStr2 = str2Arr[str2Arr.Length - 1]; Log.Log(LogType.FILE, LogLevel.DEBUG, " CustomStr2 : " + rec.CustomStr2); } } if (lineArr[6].ToString().Trim() == "Sent") { rec.EventCategory = lineArr[6] + " " + lineArr[7]; Log.Log(LogType.FILE, LogLevel.DEBUG, "EventCategory : " + rec.EventCategory); rec.EventType = lineArr[9]; Log.Log(LogType.FILE, LogLevel.DEBUG, "EventCategory : " + rec.EventCategory); rec.CustomStr1 = lineArr[8]; Log.Log(LogType.FILE, LogLevel.DEBUG, " CustomStr1 : " + rec.CustomStr1); if (!string.IsNullOrEmpty(rec.CustomStr1)) { string[] str2Arr = rec.CustomStr1.Split('\\'); rec.CustomStr2 = str2Arr[str2Arr.Length - 1]; Log.Log(LogType.FILE, LogLevel.DEBUG, " CustomStr2 : " + rec.CustomStr2); } rec.CustomStr8 = lineArr[10].Replace('(', ' ').Trim(); Log.Log(LogType.FILE, LogLevel.DEBUG, "CustomStr8 : " + rec.CustomStr8); rec.CustomStr9 = lineArr[13].Replace('[', ' ').Trim(); Log.Log(LogType.FILE, LogLevel.DEBUG, "CustomStr9 : " + rec.CustomStr9); } if (lineArr[6].ToString().Trim() == "Error") { rec.EventCategory = lineArr[6] + " " + lineArr[7] + " " + lineArr[8]; Log.Log(LogType.FILE, LogLevel.DEBUG, "EventCategory : " + rec.EventCategory); rec.EventType = lineArr[10]; Log.Log(LogType.FILE, LogLevel.DEBUG, "EventCategory : " + rec.EventCategory); rec.CustomStr1 = lineArr[9]; Log.Log(LogType.FILE, LogLevel.DEBUG, " CustomStr1 : " + rec.CustomStr1); if (!string.IsNullOrEmpty(rec.CustomStr1)) { string[] str2Arr = rec.CustomStr1.Split('\\'); rec.CustomStr2 = str2Arr[str2Arr.Length - 1]; Log.Log(LogType.FILE, LogLevel.DEBUG, " CustomStr2 : " + rec.CustomStr2); } rec.CustomStr8 = lineArr[11].Replace('(', ' ').Trim(); Log.Log(LogType.FILE, LogLevel.DEBUG, "CustomStr8 : " + rec.CustomStr8); rec.CustomStr9 = lineArr[14].Replace('[', ' ').Trim(); Log.Log(LogType.FILE, LogLevel.DEBUG, "CustomStr9 : " + rec.CustomStr9); string str3 = After(line, "aborting"); rec.CustomStr3 = Between(str3, ",", ")"); Log.Log(LogType.FILE, LogLevel.DEBUG, "CustomStr3 : " + rec.CustomStr3); } if (lineArr[6].ToString().Trim() == "Closing") { rec.EventCategory = lineArr[6] + " " + lineArr[7]; Log.Log(LogType.FILE, LogLevel.DEBUG, "EventCategory : " + rec.EventCategory); rec.EventType = lineArr[lineArr.Length-1].Replace(')',' ').Trim(); Log.Log(LogType.FILE, LogLevel.DEBUG, "EventCategory : " + rec.EventCategory); rec.UserName = Between(line, "user", "("); Log.Log(LogType.FILE, LogLevel.DEBUG, "UserName : "******"CustomStr8 : " + rec.CustomStr8); } Log.Log(LogType.FILE, LogLevel.DEBUG, " Description : " + rec.Description); } else { Log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> line is unrecognized, unable to parse!"); } } } catch (Exception ex) { Log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> line is unrecognized, unable to parse!" + ex.StackTrace); } Log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> is successfully FINISHED."); return 1; } catch (Exception ex) { Log.Log(LogType.FILE, LogLevel.ERROR, " CoderParse() -->> An error occurred. " + ex.ToString()); Log.Log(LogType.FILE, LogLevel.ERROR, " CoderParse() -->> " + ex.StackTrace); return 0; } }
private int CoderParse(String line, ref CustomTools.CustomBase.Rec rec) { try { Log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> is STARTED "); Log.Log(LogType.FILE, LogLevel.DEBUG, "Line is : " + line + ""); Log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> Arraylist fill started."); try { if (!string.IsNullOrEmpty(line)) { if (!line.StartsWith("#")) { string[] parseArray1 = line.Split(' '); rec.Datetime = parseArray1[0] + " " + parseArray1[1]; rec.CustomStr3 = parseArray1[2]; rec.UserName = parseArray1[3]; rec.ComputerName= parseArray1[6]; rec.CustomStr2 = parseArray1[7]; rec.EventType = parseArray1[8].Split(']')[1]; rec.Description = parseArray1[9]; rec.CustomStr4 = parseArray1[6]; rec.CustomInt1 = Convert.ToInt32(parseArray1[11]); Log.Log(LogType.FILE, LogLevel.DEBUG, " Datetime : " + rec.Datetime); Log.Log(LogType.FILE, LogLevel.DEBUG, " CustomStr3 : " + rec.CustomStr3); Log.Log(LogType.FILE, LogLevel.DEBUG, " UserName : "******" ComputerName : " + rec.ComputerName); Log.Log(LogType.FILE, LogLevel.DEBUG, " CustomStr2 : " + rec.CustomStr2); Log.Log(LogType.FILE, LogLevel.DEBUG, " EventType : " + rec.EventType); Log.Log(LogType.FILE, LogLevel.DEBUG, " Description : " + rec.Description); Log.Log(LogType.FILE, LogLevel.DEBUG, " CustomStr4 : " + rec.CustomStr4); Log.Log(LogType.FILE, LogLevel.DEBUG, " CustomInt1 : " + rec.CustomInt1); } else { Log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> line is unrecognized, unable to parse!"); } } } catch (Exception ex) { Log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> line is unrecognized, unable to parse!" + ex.StackTrace); } Log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> is successfully FINISHED."); return 1; } catch (Exception ex) { Log.Log(LogType.FILE, LogLevel.ERROR, " CoderParse() -->> An error occurred. " + ex.ToString()); Log.Log(LogType.FILE, LogLevel.ERROR, " CoderParse() -->> " + ex.StackTrace); return 0; } }
public static float GetDistanceToTarget(Transform origin, Transform target) { return(CustomTools.MagnitudeVec3(target.position - origin.position)); }
private int CoderParse(String line, ref CustomTools.CustomBase.Rec rec) { try { Log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> is STARTED "); Log.Log(LogType.FILE, LogLevel.DEBUG, "Line is : " + line + ""); Log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> Arraylist fill started."); try { if (!string.IsNullOrEmpty(line)) { if (!line.StartsWith("#")) { if (line.Contains("reservedip")) { string[] parseArray1 = line.Split('"'); string newLine1 = parseArray1[0]; rec.UserName = parseArray1[1]; rec.CustomStr7 = parseArray1[5]; //fdsljfdsf string[] parseArray2 = newLine1.Split('\\'); rec.CustomStr8 = parseArray2[0]; string newLine2 = parseArray2[2]; string[] parseArray3 = newLine2.Split(' '); rec.ComputerName = parseArray3[0]; rec.CustomStr9 = parseArray3[1]; rec.CustomStr1 = parseArray3[2]; rec.EventType = parseArray3[3]; rec.EventCategory = parseArray3[4]; rec.CustomStr3 = parseArray3[5]; rec.CustomStr4 = parseArray3[6]; Log.Log(LogType.FILE, LogLevel.DEBUG, " ComputerName : " + rec.ComputerName); Log.Log(LogType.FILE, LogLevel.DEBUG, " CustomStr9 : " + rec.CustomStr9); Log.Log(LogType.FILE, LogLevel.DEBUG, " CustomStr8 : " + rec.CustomStr8); Log.Log(LogType.FILE, LogLevel.DEBUG, " CustomStr1 : " + rec.CustomStr1); Log.Log(LogType.FILE, LogLevel.DEBUG, " EventType : " + rec.EventType); Log.Log(LogType.FILE, LogLevel.DEBUG, " EventCategory : " + rec.EventCategory); Log.Log(LogType.FILE, LogLevel.DEBUG, " CustomStr3 : " + rec.CustomStr3); Log.Log(LogType.FILE, LogLevel.DEBUG, " CustomStr4 : " + rec.CustomStr4); } } else { Log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> line is unrecognized, unable to parse!"); } } } catch (Exception ex) { Log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> line is unrecognized, unable to parse!" + ex.StackTrace); } Log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> is successfully FINISHED."); return 1; } catch (Exception ex) { Log.Log(LogType.FILE, LogLevel.ERROR, " CoderParse() -->> An error occurred. " + ex.ToString()); Log.Log(LogType.FILE, LogLevel.ERROR, " CoderParse() -->> " + ex.StackTrace); return 0; } }
private void CoderParse(String line, ref CustomTools.CustomBase.Rec rec) { try { _log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> is STARTED "); //if (!IsSkipKeyWord(line)) { String[] subLine0 = line.Split(new Char[] { '|' }, StringSplitOptions.RemoveEmptyEntries); String[] subLine0_1 = subLine0[1].Split(new Char[] { ':' }, StringSplitOptions.RemoveEmptyEntries); String[] subLine0_3 = subLine0[3].Split(new Char[] { ':' }, StringSplitOptions.RemoveEmptyEntries); String[] subLine0_4 = subLine0[4].Split(new Char[] { ':' }, StringSplitOptions.RemoveEmptyEntries); rec.CustomStr1 = Convert.ToString(subLine0[5]); rec.CustomStr2 = Convert.ToString(subLine0[6]); rec.CustomStr5 = Convert.ToString(subLine0[7]); rec.CustomStr6 = Convert.ToString(subLine0[8]); rec.CustomStr7 = Convert.ToString(subLine0[9]); rec.CustomStr8 = Convert.ToString(subLine0[10]); rec.CustomInt1 = Convert.ToInt32(subLine0[11]); rec.EventCategory = Convert.ToString(subLine0_1[0]); rec.EventType = Convert.ToString(subLine0_1[1]); rec.CustomStr3 = Convert.ToString(subLine0_3[0]); rec.CustomStr4 = Convert.ToString(subLine0_4[0]); try { rec.CustomInt3 = Convert.ToInt32(subLine0_3[1]); } catch (Exception ex) { rec.CustomInt3 = 0; } try { rec.CustomInt4 = Convert.ToInt32(subLine0_4[1]); } catch (Exception ex) { rec.CustomInt4 = 0; } } _log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> is successfully FINISHED."); } catch (Exception ex) { _log.Log(LogType.FILE, LogLevel.ERROR, " CoderParse() -->> An error occurred. " + ex.ToString()); } }
private void CoderParse(String line, ref CustomTools.CustomBase.Rec rec) { try { _log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> is STARTED "); _log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> line is : " + line); String[] subLine0 = line.Split(new String[] { "-#-#-" }, StringSplitOptions.RemoveEmptyEntries); rec.Datetime = Convert.ToString(subLine0[0]); rec.UserName = Convert.ToString(subLine0[1]); rec.CustomStr1 = Convert.ToString(subLine0[2]); rec.CustomStr2 = Convert.ToString(subLine0[3]); rec.Description = Convert.ToString(subLine0[4]); rec.CustomStr3 = Convert.ToString(subLine0[5]); rec.CustomStr4 = Convert.ToString(subLine0[6]); rec.CustomStr5 = Convert.ToString(subLine0[7]); if (rec.Datetime != null) { DateTime dateTime = Convert.ToDateTime(rec.Datetime); rec.Datetime = String.Format("{0:yyyy/MM/dd HH:mm:ss}", dateTime); } _log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> is successfully FINISHED."); } catch (Exception ex) { _log.Log(LogType.FILE, LogLevel.ERROR, " CoderParse() -->> An error occurred. " + ex.ToString()); } }
/// <summary> /// Parse the line /// </summary> /// <param name="line">Will parsing line</param> /// <param name="rec">Will recording record</param> //private int CoderParse(String line, ref CustomTools.CustomBase.Rec rec) //{ // try // { // Log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> is STARTED "); // String[] subLine0 = line.Split(new Char[] { ',' }, StringSplitOptions.None); // if (!(subLine0.Length > 18)) // { // Log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> line is unrecognized, unable to parse!"); // return 0; // } // rec.Datetime = subLine0[0]; // rec.EventCategory = subLine0[8]; // rec.EventType = subLine0[7]; // rec.ComputerName = subLine0[4]; // rec.CustomStr1 = subLine0[17]; // rec.CustomStr2 = subLine0[6].Split('\\')[1]; // rec.CustomStr3 = subLine0[18]; // rec.CustomStr4 = subLine0[11]; // rec.CustomStr7 = subLine0[10]; // rec.CustomStr8 = subLine0[1]; // rec.CustomStr9 = subLine0[3]; // rec.CustomStr10 = subLine0[2]; // Log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> is successfully FINISHED."); // return 1; // } // catch (Exception ex) // { // Log.Log(LogType.FILE, LogLevel.ERROR, " CoderParse() -->> An error occurred. " + ex.ToString()); // Log.Log(LogType.FILE, LogLevel.ERROR, " CoderParse() -->> " + ex.StackTrace); // return 0; // } //} // CoderParse private int CoderParse(String line, ref CustomTools.CustomBase.Rec rec) { //List<string> li; //List<String> fileNameList = GetFileNamesOnRemote(); //li = SortFileNames(fileNameList); //for (int i = 0; i < li.Count; i++) //{ // Log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> Filenamelist : " + li[i].ToString()); //} try { Log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> is STARTED "); Log.Log(LogType.FILE, LogLevel.DEBUG, "Line is : " + line + ""); Log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> Arraylist fill started."); try { ArrayList arr = new ArrayList(); if (line.Contains("\"")) { char c1 = ','; string[] par = line.Split('"'); for (int i = 0; i < par.Length; i++) { if (par[i].ToString().StartsWith(c1.ToString()) || par[i].ToString().EndsWith(c1.ToString())) { string lineNew = ""; if (par[i].ToString().StartsWith(",")) { lineNew = par[i].ToString().Substring(1, par[i].Length - 2); } else { lineNew = par[i].ToString().Substring(0, par[i].Length - 1); ; } string[] g = lineNew.Split(c1); for (int j = 0; j < g.Length; j++) { if (par[i].ToString().StartsWith(c1.ToString())) { arr.Add(g[j].ToString()); } else { arr.Add(g[j].ToString()); } } } else { arr.Add(par[i].ToString()); } } // for } else { string[] par = line.Split(','); for (int i = 0; i < par.Length; i++) { arr.Add(par[i].ToString()); } } Log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> Arraylist filled."); newFields nf = new newFields(); DateTime dt = Convert.ToDateTime(arr[0].ToString()); nf.datetime = dt.ToString(); Log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> DateTime : " + dt.ToString()); nf.datetime = arr[0].ToString(); Log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> Datetime_1. " + nf.datetime.ToString()); nf.clientIp = arr[1].ToString(); // ok nf.clientHostname = arr[2].ToString(); // ok nf.serverIp = arr[3].ToString(); // ok nf.source = arr[7].ToString(); // ok nf.eventId = arr[8].ToString(); // ok nf.recipientStatus = arr[11].ToString(); // 12'den 11 olarak değişti nf.messageSubject = arr[17].ToString(); // ok nf.returnPath = arr[19].ToString(); // ok Log.Log(LogType.FILE, LogLevel.DEBUG, " Datetime : " + nf.datetime); Log.Log(LogType.FILE, LogLevel.DEBUG, " ClientIp : " + nf.clientIp); Log.Log(LogType.FILE, LogLevel.DEBUG, " ClientHostname : " + nf.clientHostname); Log.Log(LogType.FILE, LogLevel.DEBUG, " ServerIp : " + nf.serverIp); Log.Log(LogType.FILE, LogLevel.DEBUG, " Source : " + nf.source); Log.Log(LogType.FILE, LogLevel.DEBUG, " EventId : " + nf.eventId); Log.Log(LogType.FILE, LogLevel.DEBUG, " RecipientStatus : " + nf.recipientStatus); Log.Log(LogType.FILE, LogLevel.DEBUG, " MessageSubject : " + nf.messageSubject); Log.Log(LogType.FILE, LogLevel.DEBUG, " ReturnPath : " + nf.returnPath); Log.Log(LogType.FILE, LogLevel.DEBUG, " EventCategory : " + nf.eventId); rec.Datetime = nf.datetime.ToString(); rec.EventCategory = nf.eventId; rec.EventType = nf.source; rec.ComputerName = nf.clientHostname; rec.CustomStr1 = nf.messageSubject; if (!string.IsNullOrEmpty(nf.source)) { if (nf.source.Contains("\\")) { rec.CustomStr2 = nf.source.Split('\\')[1].ToString(); } else { rec.CustomStr2 = nf.source; } } else { rec.CustomStr2 = rec.EventCategory; } rec.CustomStr3 = nf.returnPath; rec.CustomStr4 = nf.recipientStatus; rec.CustomStr7 = nf.recipientAddress; rec.CustomStr8 = nf.clientIp; rec.CustomStr9 = nf.serverIp; rec.CustomStr10 = nf.clientHostname; } catch (Exception ex) { Log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> line is unrecognized, unable to parse!" + ex.StackTrace); } Log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> is successfully FINISHED."); return 1; } catch (Exception ex) { Log.Log(LogType.FILE, LogLevel.ERROR, " CoderParse() -->> An error occurred. " + ex.ToString()); Log.Log(LogType.FILE, LogLevel.ERROR, " CoderParse() -->> " + ex.StackTrace); return 0; } }
private void CoderParse(String line, ref CustomTools.CustomBase.Rec rec) { try { _log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> is STARTED "); if (!IsSkipKeyWord(line)) { String[] subLine0 = line.Split(new Char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); if (subLine0.Length == 14) { String[] subLine0_0 = subLine0[0].Split(new Char[] { ':' }, StringSplitOptions.RemoveEmptyEntries); String[] subLine0_3 = subLine0[3].Split(new Char[] { '/' }, StringSplitOptions.RemoveEmptyEntries); var description = subLine0.Length > 3 ? Convert.ToString(subLine0[3]) : string.Empty; if (description.Length > 899) { rec.Description = description.Substring(0, 899); rec.CustomStr8 = description.Substring(900, description.Length); } else { rec.Description = description; } _log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() Lenght 14 Description : " + rec.Description); String[] subLine0_4 = subLine0[4].Split(new Char[] { '*' }, StringSplitOptions.RemoveEmptyEntries); rec.UserName = Convert.ToString(subLine0[1]); _log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() Lenght 14 UserName : "******" CoderParse() Lenght 14 CustomStr3 : " + rec.CustomStr3); rec.EventType = Convert.ToString(subLine0[5]); _log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() Lenght 14 EventType : " + rec.EventType); try { rec.CustomInt1 = Convert.ToInt32(subLine0[6]); _log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() Lenght 14 CustomInt1 : " + rec.CustomInt1); } catch (Exception exception) { _log.Log(LogType.FILE, LogLevel.ERROR, " CoderParse() Lenght 14 CustomInt1 Error : " + exception.Message); } try { rec.CustomInt2 = Convert.ToInt32(subLine0[7]); _log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() Lenght 14 CustomInt2 : " + rec.CustomInt2); } catch (Exception exception) { _log.Log(LogType.FILE, LogLevel.ERROR, " CoderParse() Lenght 14 CustomInt2 Error : " + exception.Message); } try { rec.CustomInt3 = Convert.ToInt32(subLine0[8]); _log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() Lenght 14 CustomInt3 : " + rec.CustomInt3); } catch (Exception exception) { _log.Log(LogType.FILE, LogLevel.ERROR, " CoderParse() Lenght 14 CustomInt3 Error : " + exception.Message); } try { rec.CustomInt4 = Convert.ToInt32(subLine0[9]); _log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() Lenght 14 CustomInt4 : " + rec.CustomInt4); } catch (Exception exception) { _log.Log(LogType.FILE, LogLevel.ERROR, " CoderParse() Lenght 14 CustomInt4 Error : " + exception.Message); } try { rec.CustomInt5 = Convert.ToInt32(subLine0[13]); _log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() Lenght 14 CustomInt5 : " + rec.CustomInt5); } catch (Exception exception) { _log.Log(LogType.FILE, LogLevel.ERROR, " CoderParse() Lenght 14 CustomInt5 Error : " + exception.Message); } rec.CustomStr4 = Convert.ToString(subLine0_3[1]); _log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() Lenght 14 CustomStr4 : " + rec.CustomStr4); rec.CustomStr5 = Convert.ToString(subLine0[10]); _log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() Lenght 14 CustomStr5 : " + rec.CustomStr5); rec.CustomStr6 = Convert.ToString(subLine0[11]); _log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() Lenght 14 CustomStr6 : " + rec.CustomStr6); rec.CustomStr7 = Convert.ToString(subLine0[12]); _log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() Lenght 14 CustomStr7 : " + rec.CustomStr7); rec.ComputerName = Convert.ToString(subLine0_0[0]); _log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() Lenght 14 ComputerName : " + rec.ComputerName); rec.EventCategory = Convert.ToString(subLine0_4[0]); _log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() Lenght 14 EventCategory : " + rec.EventCategory); //rec.CustomStr1 = Convert.ToString(subLine0_4[1]); } if (subLine0.Length == 13) { String[] subLine0_0 = subLine0[0].Split(new Char[] { ':' }, StringSplitOptions.RemoveEmptyEntries); String[] subLine0_3 = subLine0[3].Split(new Char[] { '/' }, StringSplitOptions.RemoveEmptyEntries); var description = subLine0.Length > 3 ? Convert.ToString(subLine0[3]) : string.Empty; if (description.Length > 899) { rec.Description = description.Substring(0, 899); rec.CustomStr8 = description.Substring(900, description.Length); } else { rec.Description = description; } _log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() Lenght 13 Description : " + rec.Description); String[] subLine0_4 = subLine0[4].Split(new Char[] { '*' }, StringSplitOptions.RemoveEmptyEntries); rec.UserName = Convert.ToString(subLine0[1]); _log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() Lenght 13 UserName : "******" CoderParse() Lenght 13 EventCategory : " + rec.EventCategory); rec.ComputerName = Convert.ToString(subLine0_0[0]); _log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() Lenght 13 ComputerName : " + rec.ComputerName); rec.EventType = Convert.ToString(subLine0[5]); _log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() Lenght 13 EventType : " + rec.EventType); rec.CustomStr1 = Convert.ToString(subLine0_4[1]); _log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() Lenght 13 CustomStr1 : " + rec.CustomStr1); rec.CustomStr3 = Convert.ToString(subLine0[2]); _log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() Lenght 13 CustomStr3 : " + rec.CustomStr3); rec.CustomStr4 = Convert.ToString(subLine0_3[1]); _log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() Lenght 13 CustomStr4 : " + rec.CustomStr4); rec.CustomStr5 = Convert.ToString(subLine0[10]); _log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() Lenght 13 CustomStr5 : " + rec.CustomStr5); rec.CustomStr6 = Convert.ToString(subLine0[11]); _log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() Lenght 13 CustomStr6 : " + rec.CustomStr6); rec.CustomStr7 = Convert.ToString(subLine0[12]); _log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() Lenght 13 CustomStr7 : " + rec.CustomStr7); try { rec.CustomInt1 = Convert.ToInt32(subLine0[6]); _log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() Lenght 13 CustomInt1 : " + rec.CustomInt1); } catch (Exception exception) { _log.Log(LogType.FILE, LogLevel.ERROR, " CoderParse() Lenght 13 CustomInt1 Error : " + exception.Message); } try { rec.CustomInt2 = Convert.ToInt32(subLine0[7]); _log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() Lenght 13 CustomInt2 : " + rec.CustomInt2); } catch (Exception exception) { _log.Log(LogType.FILE, LogLevel.ERROR, " CoderParse() Lenght 13 CustomInt2 Error : " + exception.Message); } try { rec.CustomInt3 = Convert.ToInt32(subLine0[8]); _log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() Lenght 13 CustomInt3 : " + rec.CustomInt3); } catch (Exception exception) { _log.Log(LogType.FILE, LogLevel.ERROR, " CoderParse() Lenght 13 CustomInt3 Error : " + exception.Message); } try { rec.CustomInt4 = Convert.ToInt32(subLine0[9]); _log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() Lenght 13 CustomInt4 : " + rec.CustomInt4); } catch (Exception exception) { _log.Log(LogType.FILE, LogLevel.ERROR, " CoderParse() Lenght 13 CustomInt4 Error : " + exception.Message); } //rec.CustomInt5 = Convert.ToInt32(subLine0[13]); //_log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() Lenght 14 CustomInt5 : " + rec.CustomInt5); } if (subLine0.Length == 15) { String[] subLine0_0 = subLine0[0].Split(new Char[] { ':' }, StringSplitOptions.RemoveEmptyEntries); String[] subLine0_3 = subLine0[3].Split(new Char[] { '/' }, StringSplitOptions.RemoveEmptyEntries); var description = subLine0.Length > 3 ? Convert.ToString(subLine0[3]) : string.Empty; if (description.Length > 899) { rec.Description = description.Substring(0, 899); rec.CustomStr8 = description.Substring(900, description.Length); } else { rec.Description = description; } _log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() Lenght 15 Description : " + rec.Description); String[] subLine0_4 = subLine0[4].Split(new Char[] { '*' }, StringSplitOptions.RemoveEmptyEntries); rec.UserName = Convert.ToString(subLine0[1]); _log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() Lenght 15 UserName : "******" CoderParse() Lenght 15 EventType : " + rec.EventType); rec.ComputerName = Convert.ToString(subLine0_0[0]); _log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() Lenght 15 ComputerName : " + rec.ComputerName); rec.EventCategory = Convert.ToString(subLine0_4[0]); _log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() Lenght 15 EventCategory : " + rec.EventCategory); rec.CustomStr1 = Convert.ToString(subLine0_4[1]); _log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() Lenght 15 CustomStr1 : " + rec.CustomStr1); rec.CustomStr3 = Convert.ToString(subLine0[2]); _log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() Lenght 15 CustomStr3 : " + rec.CustomStr3); rec.CustomStr4 = Convert.ToString(subLine0_3[1]); _log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() Lenght 15 CustomStr4 : " + rec.CustomStr4); rec.CustomStr5 = Convert.ToString(subLine0[10]); _log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() Lenght 15 CustomStr5 : " + rec.CustomStr5); rec.CustomStr6 = Convert.ToString(subLine0[11]); _log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() Lenght 15 CustomStr6 : " + rec.CustomStr6); rec.CustomStr7 = Convert.ToString(subLine0[12]); _log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() Lenght 15 CustomStr7 : " + rec.CustomStr7); try { rec.CustomInt1 = Convert.ToInt32(subLine0[6]); _log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() Lenght 15 CustomInt1 : " + rec.CustomInt1); } catch (Exception exception) { _log.Log(LogType.FILE, LogLevel.ERROR, " CoderParse() Lenght 15 CustomInt1 Error : " + exception.Message); } try { rec.CustomInt2 = Convert.ToInt32(subLine0[7]); _log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() Lenght 15 CustomInt2 : " + rec.CustomInt2); } catch (Exception exception) { _log.Log(LogType.FILE, LogLevel.ERROR, " CoderParse() Lenght 15 CustomInt2 Error : " + exception.Message); } try { rec.CustomInt4 = Convert.ToInt32(subLine0[9]); _log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() Lenght 15 CustomInt4 : " + rec.CustomInt4); } catch (Exception exception) { _log.Log(LogType.FILE, LogLevel.ERROR, " CoderParse() Lenght 15 CustomInt4 Error : " + exception.Message); } //rec.CustomInt3 = Convert.ToInt32(subLine0[8]); //_log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() Lenght 13 CustomInt3 : " + rec.CustomInt3); //rec.CustomInt5 = Convert.ToInt32(subLine0[13]); //_log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() Lenght 14 CustomInt5 : " + rec.CustomInt5); } if (subLine0.Length == 5) { String[] subLine0_4 = subLine0[4].Split(new Char[] { '*' }, StringSplitOptions.RemoveEmptyEntries); String[] subLine0_3 = subLine0[4].Split(new Char[] { '>' }, StringSplitOptions.RemoveEmptyEntries); String[] ss = subLine0_3[3].Split('<'); var description = ss.Length > 0 ? Convert.ToString(ss[0]) : string.Empty; if (description.Length > 899) { rec.Description = description.Substring(0, 899); rec.CustomStr8 = description.Substring(900, description.Length); } else { rec.Description = description; } _log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() Lenght 5 Description : " + rec.Description); rec.ComputerName = Convert.ToString(subLine0[3]); _log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() Lenght 5 Computername : " + rec.ComputerName); String[] dd = subLine0_3[1].Split('<'); rec.UserName = Convert.ToString(dd[0]); _log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() Lenght 5 Username : "******" CoderParse() Lenght 5 CustomStr3 : " + rec.CustomStr3); rec.EventCategory = Convert.ToString(subLine0_4[1]); _log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() Lenght 5 EventCategory : " + rec.EventCategory); String[] dss = subLine0_4[2].Split('<'); rec.CustomStr1 = Convert.ToString(dss[0]); _log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() Lenght 5 CustomStr1 : " + rec.CustomStr1); String[] dss1 = dss[1].Split('>'); rec.EventType = Convert.ToString(dss1[1]); _log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() Lenght 5 EventType : " + rec.EventType); try { String[] ss1 = dss[2].Split('>'); rec.CustomInt1 = Convert.ToInt32(ss1[1]); _log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() Lenght 5 CustomInt1 : " + rec.CustomInt1); } catch (Exception exception) { _log.Log(LogType.FILE, LogLevel.ERROR, " CoderParse() Lenght 5 CustomInt1 Error : " + exception.Message); } try { String[] ss2 = dss[3].Split('>'); rec.CustomInt2 = Convert.ToInt32(ss2[1]); _log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() Lenght 5 CustomInt2 : " + rec.CustomInt2); } catch (Exception exception) { _log.Log(LogType.FILE, LogLevel.ERROR, " CoderParse() Lenght 5 CustomInt2 Error : " + exception.Message); } try { String[] ss3 = dss[5].Split('>'); rec.CustomInt3 = Convert.ToInt32(ss3[1]); _log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() Lenght 5 CustomInt3 : " + rec.CustomInt3); } catch (Exception exception) { _log.Log(LogType.FILE, LogLevel.ERROR, " CoderParse() Lenght 5 CustomInt3 Error : " + exception.Message); } try { String[] ss4 = dss[6].Split('>'); rec.CustomInt4 = Convert.ToInt32(ss4[1]); _log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() Lenght 5 CustomInt4 : " + rec.CustomInt4); } catch (Exception exception) { _log.Log(LogType.FILE, LogLevel.ERROR, " CoderParse() Lenght 5 CustomInt4 Error : " + exception.Message); } String[] ss5 = dss[7].Split('>'); rec.CustomStr5 = Convert.ToString(ss5[1]); _log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() Lenght 5 CustomStr5 : " + rec.CustomStr5); String[] ss6 = dss[9].Split('>'); rec.CustomStr6 = Convert.ToString(ss6[1]); _log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() Lenght 5 CustomStr6 : " + rec.CustomStr6); String[] ss7 = dss[10].Split('>'); rec.CustomStr7 = Convert.ToString(ss7[1]); _log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() Lenght 5 CustomStr7 : " + rec.CustomStr7); try { String[] ss8 = dss[11].Split('>'); rec.CustomInt5 = Convert.ToInt32(ss8[1]); _log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() Lenght 5 CustomInt5 : " + rec.CustomInt5); } catch (Exception exception) { _log.Log(LogType.FILE, LogLevel.ERROR, " CoderParse() Lenght 5 CustomInt5 Error : " + exception.Message); } String[] ss9 = ss[0].Split('/'); rec.CustomStr4 = ss9[2]; _log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() Lenght 5 CustomStr4 : " + rec.CustomStr4); } else { if (line.Length > 899) { rec.Description = line.Substring(0, 899); rec.CustomStr8 = line.Substring(900, line.Length); } else { rec.Description = line; } } } _log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> is successfully FINISHED."); } catch (Exception ex) { _log.Log(LogType.FILE, LogLevel.ERROR, " CoderParse() -->> An error occurred. " + ex.ToString()); } }
private void CoderParse(String line, ref CustomTools.CustomBase.Rec rec) { try { _log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> is STARTED "); if (!IsSkipKeyWord(line)) { String[] subLine0 = line.Split(new Char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); String[] subLine0_0 = subLine0[0].Split(new Char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); String[] subLine0_1 = subLine0[1].Split(new Char[] { ':' }, StringSplitOptions.RemoveEmptyEntries); string[] ss = subLine0_0[0].Split('\t'); string[] tarih = ss[0].Split('-'); string date = tarih[0] + "/" + tarih[1] + "/" + tarih[2] + " " + ss[1]; rec.Datetime = Convert.ToDateTime(date, CultureInfo.InvariantCulture).ToString("yyyy/MM/dd HH:mm:ss"); _log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> Datetime : " + rec.Datetime); rec.SourceName = ss[2]; _log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> SourceName : " + rec.SourceName); rec.ComputerName = ss[3]; _log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> ComputerName : " + rec.ComputerName); string[] sd = subLine0[8].Split('<'); rec.CustomStr6 = sd[0]; _log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> CustomStr6 : " + rec.CustomStr6); rec.Description = subLine0[1]; _log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> Description : " + rec.Description); rec.CustomInt4 = Convert.ToInt32(subLine0[7]); _log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> CustomInt4 : " + rec.CustomInt4); rec.CustomInt3 = Convert.ToInt32(subLine0[5]); _log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> CustomInt3 : " + rec.CustomInt3); rec.EventCategory = subLine0[3]; _log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> EventCategory : " + rec.EventCategory); rec.CustomStr3 = subLine0[4]; _log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> CustomStr3 : " + rec.CustomStr3); rec.CustomStr1 = subLine0[6]; _log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> CustomStr1 : " + rec.CustomStr1); } _log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> is successfully FINISHED."); } catch (Exception ex) { _log.Log(LogType.FILE, LogLevel.ERROR, " CoderParse() -->> An error occurred. " + ex.ToString()); } }
private int CoderParse(String line, ref CustomTools.CustomBase.Rec rec) { try { Log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> is STARTED "); Log.Log(LogType.FILE, LogLevel.DEBUG, "Line is : " + line + ""); Log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> Arraylist fill started."); try { string[] arr; if (!line.StartsWith("#")) { //if (line.Length > 899) { arr = line.Split('-'); for (int i = 0; i < arr.Length; i++) { if (arr[i].StartsWith("{")) { rec.EventCategory = arr[i].Replace("{", " ").Replace("}", " "); } if (arr[i].StartsWith("<")) { rec.CustomStr2 = arr[i].Replace("<", " ").Replace(">", " "); } if (arr[i].Contains("Sicil:")) { try { rec.CustomInt6 = Convert.ToInt32(arr[i].Split(':')[1]); } catch (Exception) { rec.CustomInt6 = 0; } } } //DateTime dt = Convert.ToDateTime(arr[4]); rec.Datetime = lastFile.Split(' ')[2].Split('.')[0]; ;//DateTime.Now.ToString();//dt.ToString("yyyy-MM-dd HH:mm:ss"); Log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> datetime" + rec.Datetime); rec.CustomStr1 = arr[6]; rec.CustomStr7 = arr[4]; rec.EventType = Between(line, "->", "Sicil"); rec.Description = line; //Log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> Datetime" + dt.ToString("yyyy-MM-dd HH:mm:ss")); Log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> Datetime" + rec.Datetime); Log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> CustomStr1" + rec.CustomStr1); //Date time 14.05.2012 10.05.255 şeklinde geldiği ve bu bizim formatımıza convert edilirken hata verdiğinden // orj date time customstr7'ye basılıp dosya adındaki date datetime'e basıldı. } } } catch (Exception ex) { Log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> line is unrecognized, unable to parse!" + ex.StackTrace); } Log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> is successfully FINISHED."); return 1; } catch (Exception ex) { Log.Log(LogType.FILE, LogLevel.ERROR, " CoderParse() -->> An error occurred. " + ex.ToString()); Log.Log(LogType.FILE, LogLevel.ERROR, " CoderParse() -->> " + ex.StackTrace); return 0; } }
private int CoderParse(String line, ref CustomTools.CustomBase.Rec rec) { try { Log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> is STARTED "); Log.Log(LogType.FILE, LogLevel.DEBUG, "Line is : " + line + ""); Log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> Arraylist fill started."); try { string[] arr; if (!line.StartsWith("#")) { //if (line.Length > 899) { arr = line.Split('-'); for (int i = 0; i < arr.Length; i++) { if (arr[i].StartsWith("{")) { rec.EventCategory = arr[i].Replace("{", " ").Replace("}", " "); } if (arr[i].StartsWith("<")) { rec.CustomStr2 = arr[i].Replace("<", " ").Replace(">", " "); } if (arr[i].Contains("Sicil:")) { try { rec.CustomInt6 = Convert.ToInt32(arr[i].Split(':')[1]); } catch (Exception) { rec.CustomInt6 = 0; } } } DateTime dt = Convert.ToDateTime(arr[4]); rec.Datetime = dt.ToString("yyyy-MM-dd HH:mm:ss"); Log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> datetime" + rec.Datetime); rec.CustomStr1 = arr[6]; rec.EventType = Between(line, "->", "Sicil"); rec.Description = line; Log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> Datetime" + dt.ToString("yyyy-MM-dd HH:mm:ss")); Log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> Datetime" + rec.Datetime); Log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> CustomStr1" + rec.CustomStr1); } } } catch (Exception ex) { Log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> line is unrecognized, unable to parse!" + ex.StackTrace); } Log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> is successfully FINISHED."); return 1; } catch (Exception ex) { Log.Log(LogType.FILE, LogLevel.ERROR, " CoderParse() -->> An error occurred. " + ex.ToString()); Log.Log(LogType.FILE, LogLevel.ERROR, " CoderParse() -->> " + ex.StackTrace); return 0; } }
private void CoderParse(String line, ref CustomTools.CustomBase.Rec rec) { try { _log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> is STARTED "); _log.Log(LogType.FILE, LogLevel.DEBUG, " Line start -->> " + line); if (!IsSkipKeyWord(line)) { _log.Log(LogType.FILE, LogLevel.DEBUG, " IsSkipKeyWord Line -->> " + line); String[] subLine0 = line.Split(new Char[] { ':' }, StringSplitOptions.RemoveEmptyEntries); //rec.CustomStr10 = Convert.ToString(subLine0[6]); string line1 = Convert.ToString(subLine0[6]); _log.Log(LogType.FILE, LogLevel.DEBUG, " Line1 -->> " + line1); rec.ComputerName = Convert.ToString(subLine0[0]); _log.Log(LogType.FILE, LogLevel.DEBUG, " Computername -->> " + subLine0[0]); if (line1.Contains("New SMTP ICID") && line1.Contains("reverse dns host") && !line1.Contains("interface Outgoing")) { _log.Log(LogType.FILE, LogLevel.DEBUG, " New SMTP ICID -->> is STARTED : " + line1); string[] smtp = line1.Split(' '); rec.SourceName = Convert.ToString(smtp[13]); _log.Log(LogType.FILE, LogLevel.DEBUG, " New SMTP ICID -->> SourceName : " + rec.SourceName); rec.EventCategory = Convert.ToString(smtp[1]) + " " + Convert.ToString(smtp[2]); _log.Log(LogType.FILE, LogLevel.DEBUG, " New SMTP ICID -->> EventCategory : " + rec.EventCategory); rec.EventType = Convert.ToString(smtp[5]) + " " + Convert.ToString(smtp[6]); _log.Log(LogType.FILE, LogLevel.DEBUG, " New SMTP ICID -->> EventType : " + rec.EventType); rec.CustomStr4 = Convert.ToString(smtp[7].TrimStart('(').TrimEnd(')')); _log.Log(LogType.FILE, LogLevel.DEBUG, " New SMTP ICID -->> CustomStr4 : " + rec.CustomStr4); rec.CustomStr3 = Convert.ToString(smtp[9]); _log.Log(LogType.FILE, LogLevel.DEBUG, " New SMTP ICID -->> CustomStr3 : " + rec.CustomStr3); rec.CustomStr9 = Convert.ToString(smtp[3]); _log.Log(LogType.FILE, LogLevel.DEBUG, " New SMTP ICID -->> CustomStr9 : " + rec.CustomStr9); rec.CustomInt9 = Convert.ToInt32(smtp[4]); _log.Log(LogType.FILE, LogLevel.DEBUG, " New SMTP ICID -->> CustomInt9 : " + rec.CustomInt9); rec.Description = Convert.ToString(line1); } else if (line1.Contains("New SMTP DCID")) { _log.Log(LogType.FILE, LogLevel.DEBUG, " New SMTP DCID -->> is STARTED : " + line1); string[] dcdi = line1.Split(' '); rec.EventCategory = Convert.ToString(dcdi[1]) + " " + Convert.ToString(dcdi[2]); _log.Log(LogType.FILE, LogLevel.DEBUG, " New SMTP DCID -->> EventCategory : " + rec.EventCategory); rec.EventType = Convert.ToString(dcdi[5]); _log.Log(LogType.FILE, LogLevel.DEBUG, " New SMTP DCID -->> EventType : " + rec.EventType); rec.CustomStr3 = Convert.ToString(dcdi[8]); _log.Log(LogType.FILE, LogLevel.DEBUG, " New SMTP DCID -->> CustomStr3 : " + rec.CustomStr3); rec.CustomStr4 = Convert.ToString(dcdi[6]); _log.Log(LogType.FILE, LogLevel.DEBUG, " New SMTP DCID -->> CustomStr4 : " + rec.CustomStr4); rec.CustomInt4 = Convert.ToInt32(dcdi[10]); _log.Log(LogType.FILE, LogLevel.DEBUG, " New SMTP DCID -->> CustomInt4 : " + rec.CustomInt4); rec.CustomInt9 = Convert.ToInt32(dcdi[4]); _log.Log(LogType.FILE, LogLevel.DEBUG, " New SMTP DCID -->> CustomInt9 : " + rec.CustomInt9); rec.Description = Convert.ToString(line1); } else if (line1.Contains("Start") && line1.Contains("MID")) { _log.Log(LogType.FILE, LogLevel.DEBUG, " Start MID -->> is STARTED : " + line1); string[] sec = subLine0[2].Split(' '); rec.SourceName = Convert.ToString(sec[1]); _log.Log(LogType.FILE, LogLevel.DEBUG, " Start MID -->> Sourcename : " + rec.SourceName); string[] mid = line1.Split(' '); rec.EventType = Convert.ToString(mid[1]); _log.Log(LogType.FILE, LogLevel.DEBUG, " Start MID -->> EventType : " + rec.EventType); rec.CustomInt9 = Convert.ToInt32(mid[5]); _log.Log(LogType.FILE, LogLevel.DEBUG, " Start MID -->> CustomInt9 : " + rec.CustomInt9); rec.CustomInt10 = Convert.ToInt32(mid[3]); _log.Log(LogType.FILE, LogLevel.DEBUG, " Start MID -->> CustomInt10 : " + rec.CustomInt10); rec.Description = Convert.ToString(line1); } else if (line1.Contains("MID") && line1.Contains("From") && line1.Contains("ICID")) { _log.Log(LogType.FILE, LogLevel.DEBUG, " MID From ICID -->> is STARTED : " + line1); string[] sec1 = subLine0[2].Split(' '); rec.SourceName = Convert.ToString(sec1[1]); _log.Log(LogType.FILE, LogLevel.DEBUG, " MID From ICID -->> Sourcename : " + rec.SourceName); string[] frm = line1.Split(' '); rec.EventType = Convert.ToString(frm[5].Trim(':')); _log.Log(LogType.FILE, LogLevel.DEBUG, " MID From ICID -->> EventType : " + rec.EventType); rec.CustomStr3 = Convert.ToString(subLine0[7].Substring(1).TrimStart('<').TrimEnd('>')); _log.Log(LogType.FILE, LogLevel.DEBUG, " MID From ICID -->> CustomStr3 : " + rec.CustomStr3); rec.CustomInt9 = Convert.ToInt32(frm[4]); _log.Log(LogType.FILE, LogLevel.DEBUG, " MID From ICID -->> CustomInt9 : " + rec.CustomInt9); rec.CustomInt10 = Convert.ToInt32(frm[2]); _log.Log(LogType.FILE, LogLevel.DEBUG, " MID From ICID -->> CustomInt10 : " + rec.CustomInt10); rec.Description = Convert.ToString(line1) + ":" + Convert.ToString(subLine0[7]); } else if (line1.Contains("MID") && line1.Contains("ICID") && line1.Contains("To")) { _log.Log(LogType.FILE, LogLevel.DEBUG, " MID ICID To -->> is STARTED : " + line1); string[] sec2 = subLine0[2].Split(' '); rec.SourceName = Convert.ToString(sec2[1]); _log.Log(LogType.FILE, LogLevel.DEBUG, " MID ICID To -->> Sourcename : " + rec.SourceName); string[] rid = line1.Split(' '); rec.EventType = Convert.ToString(rid[7].Trim(':')); _log.Log(LogType.FILE, LogLevel.DEBUG, " MID ICID To -->> EventType : " + rec.EventType); rec.CustomStr4 = Convert.ToString(subLine0[7].Substring(1).TrimStart('<').TrimEnd('>')); _log.Log(LogType.FILE, LogLevel.DEBUG, " MID ICID To -->> CustomStr4 : " + rec.CustomStr4); rec.CustomInt1 = Convert.ToInt32(rid[6]); _log.Log(LogType.FILE, LogLevel.DEBUG, " MID ICID To -->> CustomInt1 : " + rec.CustomInt1); rec.CustomInt9 = Convert.ToInt32(rid[4]); _log.Log(LogType.FILE, LogLevel.DEBUG, " MID ICID To -->> CustomInt9 : " + rec.CustomInt9); rec.CustomInt10 = Convert.ToInt32(rid[2]); _log.Log(LogType.FILE, LogLevel.DEBUG, " MID ICID To -->> CustomInt10 : " + rec.CustomInt10); rec.Description = Convert.ToString(line1) + ":" + Convert.ToString(subLine0[7]); } else if (line1.Contains("MID") && line1.Contains("Message-ID")) { _log.Log(LogType.FILE, LogLevel.DEBUG, " MID Message-ID -->> is STARTED : " + line1); string[] msg = line1.Split(' '); rec.EventType = Convert.ToString(msg[3]); _log.Log(LogType.FILE, LogLevel.DEBUG, " MID Message-ID -->> EventType : " + rec.EventType); rec.CustomStr5 = Convert.ToString(msg[4].Substring(1).TrimStart('<').TrimEnd('>')); _log.Log(LogType.FILE, LogLevel.DEBUG, " MID Message-ID -->> CustomStr5 : " + rec.CustomStr5); rec.CustomInt10 = Convert.ToInt32(msg[2]); _log.Log(LogType.FILE, LogLevel.DEBUG, " MID Message-ID -->> CustomInt10 : " + rec.CustomInt10); rec.Description = Convert.ToString(line1); } else if (line1.Contains("MID") && line1.Contains("Subject")) { _log.Log(LogType.FILE, LogLevel.DEBUG, " MID Subject -->> is STARTED : " + line1); string[] subject = line1.Split(' '); rec.EventType = Convert.ToString(subject[3]); _log.Log(LogType.FILE, LogLevel.DEBUG, " MID Subject -->> EventType : " + rec.EventType); rec.CustomStr5 = Convert.ToString(line1.Substring(21)); _log.Log(LogType.FILE, LogLevel.DEBUG, " MID Subject -->> CustomStr5 : " + rec.CustomStr5); rec.CustomInt10 = Convert.ToInt32(subject[2]); _log.Log(LogType.FILE, LogLevel.DEBUG, " MID Subject -->> CustomInt10 : " + rec.CustomInt10); rec.Description = Convert.ToString(line1); } else if (line1.Contains("MID") && line1.Contains("bytes from")) { _log.Log(LogType.FILE, LogLevel.DEBUG, " MID bytes from -->> is STARTED : " + line1); string[] bytfrm = line1.Split(' '); rec.EventType = Convert.ToString(bytfrm[5]) + " " + Convert.ToString(bytfrm[6]); _log.Log(LogType.FILE, LogLevel.DEBUG, " MID bytes from -->> EventType : " + rec.EventType); rec.CustomStr3 = Convert.ToString(bytfrm[7].TrimStart('<').TrimEnd('>')); _log.Log(LogType.FILE, LogLevel.DEBUG, " MID bytes from -->> CustomStr3 : " + rec.CustomStr3); rec.CustomInt8 = Convert.ToInt32(bytfrm[4]); _log.Log(LogType.FILE, LogLevel.DEBUG, " MID bytes from -->> CustomInt8 : " + rec.CustomInt8); rec.CustomInt10 = Convert.ToInt32(bytfrm[2]); _log.Log(LogType.FILE, LogLevel.DEBUG, " MID bytes from -->> CustomInt10 : " + rec.CustomInt10); rec.Description = Convert.ToString(line1); } else if (line1.Contains("MID") && line1.Contains("interim") && !(line1.Contains("AV") || line1.Contains("av"))) { _log.Log(LogType.FILE, LogLevel.DEBUG, " MID interim : -->> is STARTED : " + line1); string[] intrm = line1.Split(' '); rec.EventType = Convert.ToString(intrm[3]) + " " + Convert.ToString(intrm[4]) + " " + Convert.ToString(intrm[5]) + " " + Convert.ToString(intrm[6]); _log.Log(LogType.FILE, LogLevel.DEBUG, " MID interim : -->> EventType : " + rec.EventType); rec.CustomStr6 = Convert.ToString(subLine0[7]); _log.Log(LogType.FILE, LogLevel.DEBUG, " MID interim : -->> CustomStr6 : " + rec.CustomStr6); rec.CustomInt10 = Convert.ToInt32(intrm[2]); _log.Log(LogType.FILE, LogLevel.DEBUG, " MID interim : -->> CustomInt10 : " + rec.CustomInt10); rec.Description = Convert.ToString(line1); } else if (line1.Contains("MID") && line1.Contains("using engine") && !line1.Contains("interim")) { _log.Log(LogType.FILE, LogLevel.DEBUG, " MID using engine -->> is STARTED : " + line1); string[] engine = line1.Split(' '); rec.EventType = Convert.ToString(engine[3]) + " " + Convert.ToString(engine[4].Trim(':')); _log.Log(LogType.FILE, LogLevel.DEBUG, " MID using engine -->> EventType : " + rec.EventType); rec.CustomStr6 = Convert.ToString(subLine0[7]); _log.Log(LogType.FILE, LogLevel.DEBUG, " MID using engine -->> CustomStr6 : " + rec.CustomStr6); rec.CustomInt10 = Convert.ToInt32(engine[2]); _log.Log(LogType.FILE, LogLevel.DEBUG, " MID using engine -->> CustomInt10 : " + rec.CustomInt10); rec.Description = Convert.ToString(line1) + ":" + Convert.ToString(subLine0[7]); } else if (line1.Contains("MID") && line1.Contains("interim") && (line1.Contains("AV") || line1.Contains("av"))) { _log.Log(LogType.FILE, LogLevel.DEBUG, " MID interim -->> is STARTED : " + line1); string[] midd = line1.Split(' '); rec.EventType = Convert.ToString(midd[3]) + " " + Convert.ToString(midd[4]) + " " + Convert.ToString(midd[5]) + " " + Convert.ToString(midd[6]); _log.Log(LogType.FILE, LogLevel.DEBUG, " MID interim -->> EventType : " + rec.EventType); rec.CustomStr7 = Convert.ToString(midd[7]) + " " + Convert.ToString(midd[8]); _log.Log(LogType.FILE, LogLevel.DEBUG, " MID interim -->> CustomStr7 : " + rec.CustomStr7); rec.CustomInt10 = Convert.ToInt32(midd[2]); _log.Log(LogType.FILE, LogLevel.DEBUG, " MID interim -->> CustomInt10 : " + rec.CustomInt10); rec.Description = Convert.ToString(line1); } else if (line1.Contains("MID") && line1.Contains("antivirus")) { _log.Log(LogType.FILE, LogLevel.DEBUG, " MID antivirus -->> is STARTED : " + line1); string[] anti = line1.Split(' '); rec.EventType = Convert.ToString(anti[3]); _log.Log(LogType.FILE, LogLevel.DEBUG, " MID antivirus -->> EventType : " + rec.EventType); rec.CustomStr7 = Convert.ToString(anti[4]); _log.Log(LogType.FILE, LogLevel.DEBUG, " MID antivirus -->> CustomStr7 : " + rec.CustomStr7); rec.CustomInt10 = Convert.ToInt32(anti[2]); _log.Log(LogType.FILE, LogLevel.DEBUG, " MID antivirus -->> CustomInt10 : " + rec.CustomInt10); rec.Description = Convert.ToString(line1); } else if (line1.Contains("MID") && line1.Contains("Response") && line1.Contains("@")) { string k = "''"; char[] kk = k.ToCharArray(); _log.Log(LogType.FILE, LogLevel.DEBUG, " MID Response @ -->> is STARTED : " + line1); string[] resp = line1.Split(' '); rec.EventType = Convert.ToString(resp[5]); _log.Log(LogType.FILE, LogLevel.DEBUG, " MID Response @ -->> EventType : " + rec.EventType); rec.CustomStr5 = Convert.ToString(resp[7].TrimStart('<').TrimEnd('>')); _log.Log(LogType.FILE, LogLevel.DEBUG, " MID Response @ -->> CustomStr5 : " + rec.CustomStr5); rec.CustomInt10 = Convert.ToInt32(resp[2]); _log.Log(LogType.FILE, LogLevel.DEBUG, " MID Response @ -->> CustomInt10 : " + rec.CustomInt10); string[] s = line1.Split(kk); rec.CustomStr8 = Convert.ToString(s[1]); _log.Log(LogType.FILE, LogLevel.DEBUG, " MID Response @ -->> CustomStr8 : " + rec.CustomStr8); rec.Description = Convert.ToString(line1); } else if (line1.Contains("MID") && line1.Contains("Response") && !line1.Contains("@") && subLine0.Length == 7) { string k = "''"; char[] kk = k.ToCharArray(); _log.Log(LogType.FILE, LogLevel.DEBUG, " MID Response Length=7 -->> is STARTED : " + line1); string[] respp = line1.Split(' '); rec.EventType = Convert.ToString(respp[5]); _log.Log(LogType.FILE, LogLevel.DEBUG, " MID Response Length=7 -->> EventType : " + rec.EventType); rec.CustomInt10 = Convert.ToInt32(respp[2]); _log.Log(LogType.FILE, LogLevel.DEBUG, " MID Response Length=7 -->> CustomInt10 : " + rec.CustomInt10); string[] s = line1.Split(kk); rec.CustomStr8 = Convert.ToString(s[1]); _log.Log(LogType.FILE, LogLevel.DEBUG, " MID Response Length=7 -->> CustomStr8 : " + rec.CustomStr8); rec.Description = Convert.ToString(line1); } else if (line1.Contains("MID") && line1.Contains("Response") && !line1.Contains("@") && subLine0.Length != 7 && subLine0.Length != 8) { string k = "''"; char[] kk = k.ToCharArray(); _log.Log(LogType.FILE, LogLevel.DEBUG, " MID Response Length != 7 && 8 -->> is STARTED : " + line1); string[] respp = line1.Split(' '); rec.EventType = Convert.ToString(respp[5]); _log.Log(LogType.FILE, LogLevel.DEBUG, " MID Response Length != 7 && 8 -->> EventType : " + rec.EventType); rec.CustomInt10 = Convert.ToInt32(respp[2]); _log.Log(LogType.FILE, LogLevel.DEBUG, " MID Response Length != 7 && 8 -->> CustomInt10 : " + rec.CustomInt10); string[] s = line1.Split(kk); rec.CustomStr8 = Convert.ToString(s[1]) + " " + Convert.ToString(subLine0[7]) + " " + Convert.ToString(subLine0[8]); _log.Log(LogType.FILE, LogLevel.DEBUG, " MID Response Length != 7 && 8 -->> CustomStr8 : " + rec.CustomStr8); rec.Description = Convert.ToString(line1) + " " + Convert.ToString(subLine0[7]) + " " + Convert.ToString(subLine0[8]); } else if (line1.Contains("MID") && line1.Contains("Response") && !line1.Contains("@") && subLine0.Length == 8) { string k = "''"; char[] kk = k.ToCharArray(); _log.Log(LogType.FILE, LogLevel.DEBUG, " MID Response Length = 8 -->> is STARTED : " + line1); string[] respp = line1.Split(' '); rec.EventType = Convert.ToString(respp[5]); _log.Log(LogType.FILE, LogLevel.DEBUG, " MID Response Length = 8 -->> EventType : " + rec.EventType); rec.CustomInt10 = Convert.ToInt32(respp[2]); _log.Log(LogType.FILE, LogLevel.DEBUG, " MID Response Length = 8 -->> CustomInt10 : " + rec.CustomInt10); string[] s = line1.Split(kk); rec.CustomStr8 = Convert.ToString(s[1]) + " " + Convert.ToString(subLine0[7]); _log.Log(LogType.FILE, LogLevel.DEBUG, " MID Response Length = 8 -->> CustomStr8 : " + rec.CustomStr8); rec.Description = Convert.ToString(line1) + " " + Convert.ToString(subLine0[7]); } else if (line1.Contains("New SMTP ICID") && line1.Contains("interface Outgoing") && line1.Contains("reverse dns host")) { _log.Log(LogType.FILE, LogLevel.DEBUG, " New SMTP ICID interface Outgoing reverse dns host -->> is STARTED : " + line1); string[] facee = line1.Split(' '); rec.EventCategory = Convert.ToString(facee[1]) + " " + Convert.ToString(facee[2]); _log.Log(LogType.FILE, LogLevel.DEBUG, " New SMTP ICID interface Outgoing reverse dns host -->> EventCategory : " + rec.EventCategory); rec.EventType = Convert.ToString(facee[5]) + " " + Convert.ToString(facee[6]); _log.Log(LogType.FILE, LogLevel.DEBUG, " New SMTP ICID interface Outgoing reverse dns host -->> EventType : " + rec.EventType); rec.SourceName = Convert.ToString(facee[13]); _log.Log(LogType.FILE, LogLevel.DEBUG, " New SMTP ICID interface Outgoing reverse dns host -->> SourceName : " + rec.SourceName); rec.CustomStr3 = Convert.ToString(facee[9]); _log.Log(LogType.FILE, LogLevel.DEBUG, " New SMTP ICID interface Outgoing reverse dns host -->> CustomStr3 : " + rec.CustomStr3); rec.CustomStr4 = Convert.ToString(facee[7].TrimStart('(').TrimEnd(')')); _log.Log(LogType.FILE, LogLevel.DEBUG, " New SMTP ICID interface Outgoing reverse dns host -->> CustomStr4 : " + rec.CustomStr4); rec.CustomInt9 = Convert.ToInt32(facee[4]); _log.Log(LogType.FILE, LogLevel.DEBUG, " New SMTP ICID interface Outgoing reverse dns host -->> CustomInt9 : " + rec.CustomInt9); rec.Description = Convert.ToString(line1); } else if (line1.Contains("ICID") && (line1.Contains("SBRS") || line1.Contains("sbrs")) && subLine0.Length == 8) { string[] sec4 = subLine0[2].Split(' '); rec.SourceName = Convert.ToString(sec4[1]); _log.Log(LogType.FILE, LogLevel.DEBUG, " ICID [SBRS] -->> is STARTED : " + line1); string[] sbrs = line1.Split(' '); rec.EventType = Convert.ToString(sbrs[3]) + " " + Convert.ToString(sbrs[4]) + " " + Convert.ToString(sbrs[5]); _log.Log(LogType.FILE, LogLevel.DEBUG, " ICID [SBRS] -->> EventType : " + rec.EventType); rec.CustomStr1 = Convert.ToString(subLine0[7].Substring(6)); _log.Log(LogType.FILE, LogLevel.DEBUG, " ICID [SBRS] -->> Customstr1 : " + rec.CustomStr1); rec.CustomInt9 = Convert.ToInt32(sbrs[2]); _log.Log(LogType.FILE, LogLevel.DEBUG, " ICID [SBRS] -->> CustomInt9 : " + rec.CustomInt9); rec.Description = Convert.ToString(line1) + ":" + Convert.ToString(subLine0[7]); } else if (line1.Contains("ICID") && (line1.Contains("SBRS") || line1.Contains("sbrs")) && subLine0.Length == 7) { _log.Log(LogType.FILE, LogLevel.DEBUG, " ICID SBRS -->> is STARTED : " + line1); string[] sbrss = line1.Split(' '); rec.EventType = Convert.ToString(sbrss[3]) + " " + Convert.ToString(sbrss[4]) + " " + Convert.ToString(sbrss[5]); _log.Log(LogType.FILE, LogLevel.DEBUG, " ICID SBRS -->> EventType : " + rec.EventType); if (sbrss.Length == 10) { rec.CustomStr1 = Convert.ToString(sbrss[8]) + " " + Convert.ToString(sbrss[9]); } else { rec.CustomStr1 = Convert.ToString(sbrss[8]) + " " + Convert.ToString(sbrss[9]) + " " + Convert.ToString(sbrss[10]); } _log.Log(LogType.FILE, LogLevel.DEBUG, " ICID SBRS -->> CustomStr1 : " + rec.CustomStr1); rec.CustomInt9 = Convert.ToInt32(sbrss[2]); _log.Log(LogType.FILE, LogLevel.DEBUG, " ICID SBRS -->> CustomInt9 : " + rec.CustomInt9); rec.Description = Convert.ToString(line1); } else if (line1.Contains("MID") && line1.Contains("queued")) { _log.Log(LogType.FILE, LogLevel.DEBUG, " MID queued -->> is STARTED : " + line1); string[] que = line1.Split(' '); rec.EventType = Convert.ToString(que[3]) + " " + Convert.ToString(que[4]) + " " + Convert.ToString(que[5]); _log.Log(LogType.FILE, LogLevel.DEBUG, " MID queued -->> EventType : " + rec.EventType); rec.CustomInt10 = Convert.ToInt32(que[2]); _log.Log(LogType.FILE, LogLevel.DEBUG, " MID queued -->> CustomInt10 : " + rec.CustomInt10); rec.Description = Convert.ToString(line1); } else { _log.Log(LogType.FILE, LogLevel.DEBUG, " Different Line -->> is STARTED : " + line1); rec.Description = Convert.ToString(line1); } } _log.Log(LogType.FILE, LogLevel.DEBUG, " CoderParse() -->> is successfully FINISHED."); } catch (Exception ex) { _log.Log(LogType.FILE, LogLevel.ERROR, " CoderParse() -->> An error occurred. " + ex.ToString()); } }