protected override void ProcessNewLines(IEnumerable <string> lines)
        {
            ForwardingInfo = new ForwardingInfo();

            foreach (var line in lines)
            {
                var match = line.Match(INFO, REOPTIONS);
                if (match.Success)
                {
                    this.ForwardingInfo.Serial = match.Groups[1].Value;

                    this.ForwardingInfo.LocalProtocol = match.Groups[2].Value;

                    try
                    {
                        this.ForwardingInfo.LocalPort = int.Parse(match.Groups[3].Value);
                    }
                    catch (FormatException)
                    {
                        Log.Warn(TAG, $"Failed to parse {match.Groups[3].Value} as an integer");
                    }

                    this.ForwardingInfo.RemoteProtocol = match.Groups[4].Value;

                    try
                    {
                        this.ForwardingInfo.RemotePort = int.Parse(match.Groups[5].Value);
                    }
                    catch (FormatException)
                    {
                        Log.Warn(TAG, $"Failed to parse {match.Groups[5].Value} as an integer");
                    }
                }
            }
        }
Esempio n. 2
0
 public void Init()
 {
     instance = new ForwardingInfo();
 }