PeerCastStation.FLV.RTMP.RTMPPlayConnection.StreamName.Parse C# (CSharp) Method

Parse() public static method

public static Parse ( string str ) : StreamName
str string
return StreamName
      public static StreamName Parse(string str)
      {
        var result = new StreamName();
        var match = namePattern.Match(str);
        if (!match.Success) {
          result.Name = str;
          return result;
        }
        result.Name = Uri.UnescapeDataString(match.Groups["name"].Value);
        if (match.Groups["format"].Success) {
          result.Format = Uri.UnescapeDataString(match.Groups["format"].Value);
        }
        if (match.Groups["params"].Success) {
          var params_str = match.Groups["params"].Value;
          foreach (var param_str in params_str.Split('&')) {
            var idx = param_str.IndexOf('=');
            if (idx<0) continue;
            var key = Uri.UnescapeDataString(param_str.Substring(0, idx));
            var val = Uri.UnescapeDataString(param_str.Substring(idx+1));
            result.Parameters[key] = val;
          }
        }
        return result;
      }
    }