Exemplo n.º 1
0
    private string DecodeProjectParameterValue(string value)
    {
        if (string.IsNullOrEmpty(value))
        {
            return(null);
        }

        Regex r       = new Regex(@"[a-z_0-9]+", RegexOptions.IgnoreCase);
        var   matches = r.Matches(value);

        if (matches.Count == 0)
        {
            return(null);
        }

        string projectParameterId = matches[0].Value;

        IO.Swagger.Model.ProjectParameter pp = ProjectManager.Instance.ProjectParameters.Find(p => p.Id == projectParameterId);
        return(pp?.Name);
    }
Exemplo n.º 2
0
    public static object GetValue(IO.Swagger.Model.ProjectParameter parameter)
    {
        switch (parameter.Type)
        {
        case "integer":
            return(JsonConvert.DeserializeObject <int>(parameter.Value));

        case "string":
            return(JsonConvert.DeserializeObject <string>(parameter.Value));

        case "double":
            return(JsonConvert.DeserializeObject <double>(parameter.Value));

        case "boolean":
            return(JsonConvert.DeserializeObject <bool>(parameter.Value));

        default:
            throw new Base.RequestFailedException($"Unsupported parameter type {parameter.Type}");
        }
    }