Initial project commit
This commit is contained in:
29
TorControlLibrary/Responses/EventResponse.cs
Normal file
29
TorControlLibrary/Responses/EventResponse.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace TorControlLibrary.Responses
|
||||
{
|
||||
public class EventResponse
|
||||
{
|
||||
public static EventResponse Parse(String line)
|
||||
{
|
||||
EventResponse resp = new EventResponse();
|
||||
string[] parts = line.Split(' ');
|
||||
Int32 id;
|
||||
resp.EventType = parts[1];
|
||||
if (Int32.TryParse(parts[2], out id))
|
||||
resp.ID = id;
|
||||
resp.Action = parts[3];
|
||||
for (int i = 2; i < parts.Length; i++)
|
||||
resp.EventInformation += parts[i] + ' ';
|
||||
resp.EventInformation = resp.EventInformation.Trim();
|
||||
return resp;
|
||||
}
|
||||
public String EventType { get; set; }
|
||||
public String Action { get; set; }
|
||||
public Int32 ID { get; set; }
|
||||
public String EventInformation { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user