Esempio n. 1
0
        public string EncodeToString(Cori contextCori, CoralUsing usingDictionary)
        {
            StringBuilder builder = new StringBuilder();

            BuildString(builder, "", contextCori, usingDictionary);

            return(builder.ToString());
        }
Esempio n. 2
0
        public void BuildString(StringBuilder builder, string pad, Cori contextCori, CoralUsing usingDictionary)
        {
            Cori baseCori = contextCori;

            foreach (CoralItem item in _items)
            {
                if (item is CoralBaseDirective)
                {
                    baseCori = ((CoralBaseDirective)item).BaseValue;
                    item.BuildString(builder, pad, contextCori, usingDictionary);
                }
                else
                {
                    item.BuildString(builder, pad, baseCori, usingDictionary);
                }
            }
        }
Esempio n. 3
0
 public abstract void BuildString(StringBuilder builder, string pad, Cori contextCori, CoralUsing usingDictionary);
 /// <inheritdoc />
 public override void BuildString(StringBuilder builder, string pad, Cori contextCori, CoralUsing usingDictionary)
 {
     builder.Append(pad);
     if (contextCori != null)
     {
         builder.AppendFormat($"#base <{BaseValue.MakeRelative(contextCori)}>\n");
     }
     else
     {
         builder.AppendFormat($"#base <{BaseValue}>\n");
     }
 }
Esempio n. 5
0
        public override void BuildString(StringBuilder builder, string pad, Cori contextCori, CoralUsing usingDictionary)
        {
            builder.Append(pad);
            if (usingDictionary != null)
            {
                string t = usingDictionary.Abbreviate(RelationType.ToString());
                builder.Append(t);
            }
            else
            {
                builder.AppendFormat($"<{RelationType}>");
            }

            if (Target != null)
            {
                if (contextCori == null)
                {
                    builder.Append($" <{Target}>");
                }
                else
                {
                    builder.Append($" <{Target.MakeRelative(contextCori)}>");
                }
            }
            else if (Value != null)
            {
                builder.Append($" {Value}");
            }
            else if (TargetInt != null)
            {
                builder.Append($" ## {TargetInt} ##");
            }

            if (Body != null)
            {
                builder.Append(" [\n");
                Body.BuildString(builder, pad + "  ", contextCori, usingDictionary);
                builder.Append(pad);
                builder.Append("]");
            }

            builder.Append("\n");
        }
Esempio n. 6
0
 /// <inheritdoc />
 public override void BuildString(StringBuilder builder, string pad, Cori contextCori, CoralUsing usingDictionary)
 {
     builder.Append(pad);
     builder.Append(Uri);
     builder.Append("\n");
 }
Esempio n. 7
0
 /// <inheritdoc />
 public override void BuildString(StringBuilder builder, string pad, Cori contextCori, CoralUsing usingDictionary)
 {
     throw new System.NotImplementedException();
 }