当前位置: 首页>>代码示例>>C#>>正文


C# IOutputWriter.Append方法代码示例

本文整理汇总了C#中IOutputWriter.Append方法的典型用法代码示例。如果您正苦于以下问题:C# IOutputWriter.Append方法的具体用法?C# IOutputWriter.Append怎么用?C# IOutputWriter.Append使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IOutputWriter的用法示例。


在下文中一共展示了IOutputWriter.Append方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Append

        public void Append(ref Dictionary<string, object> variables, IOutputWriter writer)
		{
            if (_variableName.StartsWith("!"))
            {
                bool ret = !Utility.IsComponentTrue(Utility.GenerateStringFromObject(Utility.LocateObjectInVariables(_variableName.Substring(1), variables), _seperator));
                writer.Append(ret.ToString());   
            }
            else
                writer.Append(Utility.GenerateStringFromObject(Utility.LocateObjectInVariables(_variableName, variables), _seperator));
		}
开发者ID:marquismark,项目名称:stringtemplate,代码行数:10,代码来源:ParameterComponent.cs

示例2: Append

        public void Append(ref Dictionary<string, object> variables, IOutputWriter writer)
		{
			switch(_val){
				case Values.NEW_LINE:
					writer.Append("\n");
					break;
				case Values.TAB:
					writer.Append("\t");
					break;
				case Values.SPACE:
					writer.Append(" ");
					break;
			}
		}
开发者ID:marquismark,项目名称:stringtemplate,代码行数:14,代码来源:SpecialCharacterComponent.cs

示例3: Append

 public override void Append(ref Dictionary<string, object> variables, IOutputWriter writer){
     StringOutputWriter swo = new StringOutputWriter();
     Decimal? d = null;
     try
     {
         _val.Append(ref variables, swo);
         d = Decimal.Parse(swo.ToString());
     }
     catch (Exception e)
     {
         if (_val is GenericComponent)
         {
             swo.Clear();
             _val.Append(ref variables, swo);
             string str = Utility.GenerateStringFromObject(Utility.LocateObjectInVariables(swo.ToString(), variables));
             if (str != null)
             {
                 try
                 {
                     d = Decimal.Parse(str);
                 }
                 catch (Exception ex)
                 {
                     d = null;
                 }
             }
         }
     }
     if (d.HasValue)
     {
         if (d.Value % 2 == 0)
             writer.Append(false.ToString());
         else
             writer.Append(true.ToString());
     }else
         writer.Append(false.ToString());
 }
开发者ID:marquismark,项目名称:stringtemplate,代码行数:37,代码来源:Odd.cs

示例4: Append

 public override void Append(ref Dictionary<string, object> variables, IOutputWriter writer)
 {
     StringOutputWriter swo = new StringOutputWriter();
     object obj = null;
     bool found = false;
     if (_val is ParameterComponent)
         obj = ((ParameterComponent)_val).GetObjectValue(variables);
     else
     {
         found = true;
         swo.Clear();
         _val.Append(ref variables, swo);
         if (_val is GenericComponent)
         {
             obj = Utility.LocateObjectInVariables(swo.ToString(), variables);
             if (obj == null)
                 writer.Append(swo.ToString().Length.ToString());
         }
         else
             writer.Append(swo.ToString().Length.ToString());
     }
     if (obj != null)
     {
         if (obj is ArrayList)
             writer.Append(((ArrayList)obj).Count.ToString());
         else if (obj is IDictionary)
             writer.Append(((IDictionary)obj).Count.ToString());
         else if (obj is string)
             writer.Append(((string)obj).Length.ToString());
         else
         {
             int cnt = 0;
             foreach (object o in (IEnumerable)obj)
                 cnt++;
             writer.Append(cnt.ToString());
         }
     }else if (!found)
         writer.Append("-1");
 }
开发者ID:marquismark,项目名称:stringtemplate,代码行数:39,代码来源:Len.cs

示例5: Append

 public void Append(ref Dictionary<string, object> variables, IOutputWriter writer)
 {
     writer.Append(_val);
 }
开发者ID:marquismark,项目名称:stringtemplate,代码行数:4,代码来源:QuotedStringComponent.cs

示例6: Append

 public void Append(ref Dictionary<string, object> variables, IOutputWriter writer)
 {
     string ret = "false";
     StringOutputWriter swo = new StringOutputWriter();
     _left.Append(ref variables, swo);
     string l = swo.ToString();
     swo.Clear();
     _right.Append(ref variables, swo);
     string r = swo.ToString();
     swo.Clear();
     switch (_type)
     {
         case CompareType.EQUAL:
             ret = Utility.StringsEqual(l, r).ToString();
             break;
         case CompareType.GREATER_THAN:
             if (_regNumber.IsMatch(l) && _regNumber.IsMatch(r))
                 ret = (decimal.Parse(l) > decimal.Parse(r)).ToString();
             else
                 ret = ((l != null) && ((r == null) || (l.CompareTo(r) > 0))).ToString();
             break;
         case CompareType.GREATER_THAN_OR_EQUAL_TO:
             if (_regNumber.IsMatch(l) && _regNumber.IsMatch(r))
                 ret = (decimal.Parse(l) >= decimal.Parse(r)).ToString();
             else
                 ret = (((l == null) && (r == null)) || ((l != null) && ((r == null) || (l.CompareTo(r) >= 0)))).ToString();
             break;
         case CompareType.LESS_THAN:
             if (_regNumber.IsMatch(l) && _regNumber.IsMatch(r))
                 ret = (decimal.Parse(l) < decimal.Parse(r)).ToString();
             else
                 ret = ((r != null) && ((l == null) || l.CompareTo(r) < 0)).ToString();
             break;
         case CompareType.LESS_THAN_OR_EQUAL_TO:
             if (_regNumber.IsMatch(l) && _regNumber.IsMatch(r))
                 ret = (decimal.Parse(l) <= decimal.Parse(r)).ToString();
             else
                 ret = (((l == null) && (r == null)) || ((r != null) && ((l == null) || l.CompareTo(r) <= 0))).ToString();
             break;
         case CompareType.NOT_EQUAL:
             if (_regNumber.IsMatch(l) && _regNumber.IsMatch(r))
                 ret = (decimal.Parse(l) != decimal.Parse(r)).ToString();
             else
                 ret = (!Utility.StringsEqual(l, r)).ToString();
             break;
         case CompareType.SIMILAR_TO:
             ret = Utility.StringContainsString(l, r).ToString();
             break;
         case CompareType.NOT_SIMILAR_TO:
             ret = (!Utility.StringContainsString(l, r)).ToString();
             break;
     }
     writer.Append(ret);
 }
开发者ID:marquismark,项目名称:stringtemplate,代码行数:54,代码来源:CompareComponent.cs


注:本文中的IOutputWriter.Append方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。