Ejemplo n.º 1
0
        public string GetPreviewString(RSTriggerInfo inTriggerContext, RSLibrary inLibrary)
        {
            switch (Mode)
            {
            case ResolvableValueMode.Value:
                return(Value.GetPreviewString(inTriggerContext, inLibrary));

            case ResolvableValueMode.Argument:
                return(string.Format("Arg({0})", inTriggerContext?.ParameterType?.Name ?? "TriggerArg"));

            case ResolvableValueMode.Query:
            {
                using (PooledStringBuilder psb = PooledStringBuilder.Alloc())
                {
                    var sb = psb.Builder;

                    sb.Append(Query.GetPreviewStringAsQuery(inTriggerContext, inLibrary));

                    if (QueryArguments != null && QueryArguments.Length > 0)
                    {
                        sb.Append("(");

                        RSQueryInfo queryInfo = inLibrary.GetQuery(Query.Id);
                        for (int i = 0; i < QueryArguments.Length; ++i)
                        {
                            if (i > 0)
                            {
                                sb.Append("; ");
                            }

                            if (queryInfo != null && i < queryInfo.Parameters.Length)
                            {
                                sb.Append(queryInfo.Parameters[i].Name);
                            }
                            else
                            {
                                sb.Append(i);
                            }

                            sb.Append(": ");

                            sb.Append(QueryArguments[i].GetPreviewString(inTriggerContext, inLibrary));
                        }

                        sb.Append(")");
                    }

                    return(sb.ToString());
                }
            }

            case ResolvableValueMode.Register:
                return(string.Format("Register({0})", Register));

            default:
                return("[No Value]");
            }
        }
Ejemplo n.º 2
0
        public string GetPreviewString(RSTriggerInfo inTriggerContext, RSLibrary inLibrary)
        {
            switch (m_Mode)
            {
            case ResolvableValueMode.Value:
                return(m_Value.GetPreviewString(inTriggerContext, inLibrary));

            case ResolvableValueMode.Argument:
                return(string.Format("Arg({0})", inTriggerContext?.ParameterType?.Name ?? "TriggerArg"));

            case ResolvableValueMode.Query:
                return(m_Query.GetPreviewStringAsQuery(inTriggerContext, inLibrary));

            case ResolvableValueMode.Register:
                return(string.Format("Register({0})", m_Register));

            default:
                return("[No Value]");
            }
        }