Initial project commit
This commit is contained in:
37
TorControlLibrary/Responses/CircuitStatusResponse.cs
Normal file
37
TorControlLibrary/Responses/CircuitStatusResponse.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace TorControlLibrary.Responses
|
||||
{
|
||||
public class CircuitStatusResponse : CommandResponse
|
||||
{
|
||||
public CircuitStatusResponse()
|
||||
{
|
||||
Nodes = new SortedList<int, string>();
|
||||
}
|
||||
public static CircuitStatusResponse Parse(String line)
|
||||
{
|
||||
CircuitStatusResponse resp = new CircuitStatusResponse();
|
||||
resp.PopulateData(line, resp);
|
||||
return resp;
|
||||
}
|
||||
protected SortedList<Int32, String> ParseNodes(String data)
|
||||
{
|
||||
SortedList<Int32, String> nodes = new SortedList<int, string>();
|
||||
String[] nodeList = data.Split(',');
|
||||
for (int i = 0; i < nodeList.Length; i++)
|
||||
nodes.Add(i, nodeList[i]);
|
||||
return nodes;
|
||||
}
|
||||
[ParseAttribute(1)]
|
||||
public Int32 CircuitID { get; set; }
|
||||
[ParseAttribute(2)]
|
||||
public String Status { get; set; }
|
||||
[ParseAttribute(3, CustomParser="ParseNodes")]
|
||||
public SortedList<Int32,String> Nodes { get; set; }
|
||||
[ParseAttribute(4)]
|
||||
public String Purpose { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user