internal void AddKeyHash (System.Text.StringBuilder sb)
		{
			sb.Append ("XAEA ");
			KeyHelper.AddField (sb, 1, ns);
			KeyHelper.AddField (sb, 2, elementName);
			sb.Append ('|');
		}
Beispiel #2
0
		protected internal override int decodeMiddle(BitArray row, int[] startRange, System.Text.StringBuilder result)
		{
			int[] counters = decodeMiddleCounters;
			counters[0] = 0;
			counters[1] = 0;
			counters[2] = 0;
			counters[3] = 0;
			int end = row.Size;
			int rowOffset = startRange[1];
			
			for (int x = 0; x < 4 && rowOffset < end; x++)
			{
				int bestMatch = decodeDigit(row, counters, rowOffset, L_PATTERNS);
				result.Append((char) ('0' + bestMatch));
				for (int i = 0; i < counters.Length; i++)
				{
					rowOffset += counters[i];
				}
			}
			
			int[] middleRange = findGuardPattern(row, rowOffset, true, MIDDLE_PATTERN);
			rowOffset = middleRange[1];
			
			for (int x = 0; x < 4 && rowOffset < end; x++)
			{
				int bestMatch = decodeDigit(row, counters, rowOffset, L_PATTERNS);
				result.Append((char) ('0' + bestMatch));
				for (int i = 0; i < counters.Length; i++)
				{
					rowOffset += counters[i];
				}
			}
			
			return rowOffset;
		}
		// basis for all formats 
		public static System.Text.StringBuilder format(System.Text.StringBuilder sb, String chars, int length, int alignment, char preFieldCharacter, char postFieldCharacter)
		{
			// find the length of our string 
			int charsCount = chars.Length;
			
			// position within the field
			int startAt = 0;
			if (alignment == ALIGN_RIGHT)
				startAt = length - charsCount;
			else if (alignment == ALIGN_CENTER)
				startAt = (length - charsCount) / 2;
			
			// force to right it off edge
			if (startAt < 0)
				startAt = 0;
			
			// truncate it
			if ((startAt + charsCount) > length)
				charsCount = length - startAt;
			
			// now add the pre-field if any
			for (int i = 0; i < startAt; i++)
				sb.Append(preFieldCharacter);
			
			// the content
			sb.Append(chars.Substring(0, (charsCount) - (0)));
			
			// post field if any
			for (int i = startAt + charsCount; i < length; i++)
				sb.Append(postFieldCharacter);
			
			return sb;
		}
		internal void AddKeyHash (System.Text.StringBuilder sb)
		{
			sb.Append ("XTXA ");
			KeyHelper.AddField (sb, 1, type);
			KeyHelper.AddField (sb, 2, dataType);
			sb.Append ('|');
		}			
		internal override void AppendOperatingSystem (System.Text.StringBuilder sb)
		{
			sb.Append ("\tWindows ");
			sb.Append (Environment.OSVersion.Version.ToString ());
			if (IntPtr.Size == 8 || Environment.GetEnvironmentVariable ("PROCESSOR_ARCHITEW6432") != null)
				sb.Append (" (64-bit)");
			sb.AppendLine ();
		}
		internal void AddKeyHash (System.Text.StringBuilder sb)
		{
			sb.Append ("STA ");
			KeyHelper.AddField (sb, 1, ns);
			KeyHelper.AddField (sb, 2, typeName);
			KeyHelper.AddField (sb, 3, includeInSchema);
			sb.Append ('|');
		}
 static void showExpecting(System.Text.StringBuilder buf, string[] msgs)
 {
     if (msgs == null || msgs.Length == 0)
         return;
     string[] umsgs = Dedup(msgs);
     buf.Append("expecting ");
     showList(buf, umsgs);
     buf.Append(".\n");
 }
Beispiel #8
0
 public override void ToScenarioScript( ref System.Text.StringBuilder sb )
 {
     sb.Append( "[instantiate storage=" + anyResourcePath + " " );
     if( parent != null ){
         sb.Append( "parent=" + parent.name );
     }
     sb.Append( "]");
     sb.Append( System.Environment.NewLine );
 }
Beispiel #9
0
		internal void AddKeyHash (System.Text.StringBuilder sb)
		{
			if (Count == 0) return;
			
			sb.Append ("XEAS ");
			for (int n=0; n<Count; n++)
				this[n].AddKeyHash (sb);
			sb.Append ('|');
		}
        /// <summary>
        /// Writes text data of the plot object to the supplied string builder. It is 
        /// possible to specify that only data in the specified range be written.
        /// </summary>
        /// <param name="sb">the StringBuilder object to write to.</param>
        /// <param name="region">a region used if onlyInRegion is true.</param>
        /// <param name="onlyInRegion">If true, only data enclosed in the provided region will be written.</param>
        public void WriteData( System.Text.StringBuilder sb, RectangleD region, bool onlyInRegion )
        {
            SequenceAdapter data_ =
                new SequenceAdapter( this.DataSource, this.DataMember, this.OrdinateData, this.AbscissaData );

            sb.Append( "Label: " );
            sb.Append( this.Label );
            sb.Append( "\r\n" );
            data_.WriteData( sb, region, onlyInRegion );
        }
Beispiel #11
0
        public static System.Text.StringBuilder AppendLine(System.Text.StringBuilder builder)
        {
#if CF2
            return builder.Append("\r\n");
#elif FX11
            return builder.Append(Environment.NewLine);
#else
            return builder.AppendLine();
#endif
        }
 static void showMessages(System.Text.StringBuilder buf, string[] msgs)
 {
     if (msgs == null || msgs.Length == 0)
         return;
     buf.Append(msgs[0]);
     for (int i = 1; i < msgs.Length; i++)
     {
         buf.Append(" or \n").Append(msgs[i]);
     }
     buf.Append("\n");
 }
Beispiel #13
0
        public void TestAppend()
        {
            var arr = new[] {0, 1, 2};

              Assert.AreEqual(new[] {0, 1, 2, 3}, arr.Append(3));
              Assert.AreEqual(new[] {0, 1, 2, 3, 4, 5}, arr.Append(3, 4, 5));

              arr = new int[] {};

              Assert.AreEqual(new[] {9}, arr.Append(9));
        }
 /*
 static string[] unique (string[] msgs) {
   SupportClass.TreeSetSupport set_Renamed = new SupportClass.TreeSetSupport ((msgs));
   string[] umsgs = new string[set_Renamed.Count];
   SupportClass.ICollectionSupport.ToArray (set_Renamed, umsgs);
   return umsgs;
 }*/
 static void showList(System.Text.StringBuilder buf, string[] msgs)
 {
     if (msgs.Length == 0)
         return;
     for (int i = 0; i < msgs.Length - 1; i++)
     {
         buf.Append(msgs[i]).Append(' ');
     }
     if (msgs.Length > 1)
         buf.Append("or ");
     buf.Append(msgs[msgs.Length - 1]);
 }
 public static void PrintDcgNode (System.Text.StringBuilder stringBuilder, ISolutionTreeNode node)
 {
     Goal goal = node.HeadGoal;
     string predicate = goal.Definition.Predicate.Name;
     if (predicate != "concat")
     {
         stringBuilder.Append (predicate);
         stringBuilder.Append ("(");
         stringBuilder.Append (string.Join(", ", goal.Arguments.Where(a => !(a.ConcreteValue is List)).Select (new ArgumentPrinter().Print)));
         stringBuilder.Append (")");
     }
 }
		public static void  maybeAppend(System.String value_Renamed, System.Text.StringBuilder result)
		{
			if (value_Renamed != null && value_Renamed.Length > 0)
			{
				// Don't add a newline before the first value
				if (result.Length > 0)
				{
					result.Append('\n');
				}
				result.Append(value_Renamed);
			}
		}
Beispiel #17
0
 public override void ToScenarioScript( ref System.Text.StringBuilder sb )
 {
     if( units != null && units.Length > 0 ){
         for( int i=0;i<units.Length;i++){
             ViNode target = units[ i ].targetNode;
             string targetStr = target.GetNodeTag( target.name );
             sb.Append( "[link target=*"+ targetStr + "]" + units[ i ].text + "[endlink][r]" );	// This is KiriKiri Script.
             sb.Append( System.Environment.NewLine );
         }
         sb.Append( "[s]" );
         sb.Append( System.Environment.NewLine );
     }
 }
Beispiel #18
0
        public void AppendItems(System.Text.StringBuilder oBuilder, ForumInfo forum)
        {
            foreach (TopicInfo row in Forums.GetForumTopics(forum.Id,0,10).OrderByDescending(t => t.LastPostDate))
            {
                int topicId = row.Id;
                TopicInfo topic = Topics.GetTopic(topicId);
                string sTitle = topic.Subject;
                string sGuid = string.Format("{0}Content/Forums/Topic/{1}", Config.ForumUrl, topicId);
                string sLink = string.Format("{0}Content/Forums/topic.aspx?TOPIC={1}&amp;whichpage=-1", Config.ForumUrl, topicId);
                if (topic.LastReplyId > 0)
                    sLink += "#" + topic.LastReplyId;

                string sDescription = topic.Message; //topic.Message.Length > 512 ? topic.Message.Substring(0, 512) + " ... " : topic.Message;
                string sPubDate = topic.LastPostDate.Value.ToISO8601Date(false,null);
                string author = topic.AuthorName;
                if (topic.LastReplyId > 0)
                {
                    if (topic.LastReplyId != null)
                    {
                        ReplyInfo rep = Replies.GetReply((int) topic.LastReplyId);
                        author = rep.AuthorName;
                        sDescription = rep.Message;  //rep.Message.Length > 256 ? rep.Message.Substring(0, 256) + " ... " : rep.Message;
                    }
                }

                oBuilder.Append("<item>");
                oBuilder.Append("<category>");
                oBuilder.Append(forum.Subject.WrapCData());
                oBuilder.Append("</category>");
                oBuilder.Append("<title>");
                oBuilder.Append(sTitle.WrapCData());
                oBuilder.Append("</title>");
                oBuilder.Append("<author>");
                oBuilder.Append(author);
                oBuilder.Append("</author>");
                oBuilder.Append("<link>");
                oBuilder.Append(sLink);
                oBuilder.Append("</link>");
                oBuilder.Append("<guid isPermaLink=\"true\">");
                oBuilder.Append(sGuid);
                oBuilder.Append("</guid>");
                oBuilder.Append("<description>");
                oBuilder.Append(sDescription.ParseTags().WrapCData());
                oBuilder.Append("</description>");
                oBuilder.Append("<pubDate>");
                oBuilder.Append(sPubDate);
                oBuilder.Append("</pubDate>");
                oBuilder.Append("</item>");

            }
        }
 protected internal virtual System.Text.StringBuilder assign_to(System.Text.StringBuilder s)
 {
     //// s.Replace(s.ToString(0, s.Length - 0), current.ToString(0, limit), 0, s.Length - 0);
     s.Remove(0, s.Length);
     s.Append(current.ToString(0, limit));
     return s;
 }
Beispiel #20
0
		/// <summary>
		/// 在指定 StringBuilder 后添加连续字符串
		/// </summary>
		/// <param name="sb">StringBuilder</param>
		/// <param name="ary">需要添加的对象(调用其 ToString() 方法)</param>
		public static void Append(System.Text.StringBuilder sb, params object[] ary)
		{
			foreach (object obj in ary)
			{
				sb.Append(obj.ToString());
			}
		}
 public override void RenderJS(ref System.Text.StringBuilder Javascript)
 {
     Javascript.Append(
        @"function openExamplePage(id) {
          UmbClientMgr.contentFrame('../App_Plugins/UmbracoMVCBackofficePages/Index?id='+id);
         }");
 }
		protected override void AppendOperatingSystem (System.Text.StringBuilder sb)
		{
			var psi = new System.Diagnostics.ProcessStartInfo ("uname", "-a") {
				RedirectStandardOutput = true,
				UseShellExecute = false,
			};
			
			var process = System.Diagnostics.Process.Start (psi);
			process.WaitForExit (500);
			if (process.HasExited && process.ExitCode == 0) {
				sb.Append ("\t");
				string val = process.StandardOutput.ReadLine ();

				//wrap the mac value across multiple lines
				if (Platform.IsMac && val != null) {
					var split = val.Split (new string[] { ";", ": " }, StringSplitOptions.RemoveEmptyEntries);
					for (int i = 0; i < split.Length; i++) {
						split[i] = split[i].Trim ();
					}
					val = String.Join ("\n\t    ", split);
				}

				sb.AppendLine (val);
			}
		}
		protected internal override int decodeMiddle(BitArray row, int[] startRange, System.Text.StringBuilder result)
		{
			int[] counters = decodeMiddleCounters;
			counters[0] = 0;
			counters[1] = 0;
			counters[2] = 0;
			counters[3] = 0;
			int end = row.Size;
			int rowOffset = startRange[1];
			
			int lgPatternFound = 0;
			
			for (int x = 0; x < 6 && rowOffset < end; x++)
			{
				int bestMatch = decodeDigit(row, counters, rowOffset, L_AND_G_PATTERNS);
				result.Append((char) ('0' + bestMatch % 10));
				for (int i = 0; i < counters.Length; i++)
				{
					rowOffset += counters[i];
				}
				if (bestMatch >= 10)
				{
					lgPatternFound |= 1 << (5 - x);
				}
			}
			
			determineNumSysAndCheckDigit(result, lgPatternFound);
			
			return rowOffset;
		}
Beispiel #24
0
        public async Task Append4()
        {
            var xs = new[] {1, 2, 3}.ToAsyncEnumerable();

            var res = xs.Append(4);
            Assert.Equal(4, await res.Count());
        }
 public override void RenderJS(ref System.Text.StringBuilder Javascript)
 {
     Javascript.Append(
        @"function openExportToWordPage() {
          UmbClientMgr.contentFrame('/umbraco/plugins/AsposeMemberExportToWord/ExportToWord.aspx');
         }");
 }
 static void showUnexpected(System.Text.StringBuilder buf, string[] msgs)
 {
     if (msgs == null || msgs.Length == 0)
         return;
     showList(buf, Dedup(msgs));
     buf.Append(" unexpected.\n");
 }
		internal void AddKeyHash (System.Text.StringBuilder sb)
		{
			sb.Append ("SEA ");
			KeyHelper.AddField (sb, 1, elementName);
			KeyHelper.AddField (sb, 2, dataType);
			KeyHelper.AddField (sb, 3, isNullable);
			sb.Append ('|');
		}
		internal void AddKeyHash (System.Text.StringBuilder sb)
		{
			sb.Append ("SAA ");
			KeyHelper.AddField (sb, 1, attrName);
			KeyHelper.AddField (sb, 2, dataType);
			KeyHelper.AddField (sb, 3, ns);
			sb.Append ("|");
		}
Beispiel #29
0
        public override void Encode(System.Text.StringBuilder result)
        {
            if (this.Name[0] == '$')
                throw new BerylError("Symbol already mangled: " + this.Name);

            // output function or operator name
            result.Append('$');
            result.Append(Mangler.EncodeNamePart(this.Name));

            // output parameter types
            result.Append('$');
            foreach (ParameterDeclaration parameter in _parameters)
                parameter.Encode(result);

            // output terminating dollar sign ($)
            result.Append('$');
        }
		public static void  maybeAppend(System.String[] value_Renamed, System.Text.StringBuilder result)
		{
			if (value_Renamed != null)
			{
				for (int i = 0; i < value_Renamed.Length; i++)
				{
					if (value_Renamed[i] != null && value_Renamed[i].Length > 0)
					{
						if (result.Length > 0)
						{
							result.Append('\n');
						}
						result.Append(value_Renamed[i]);
					}
				}
			}
		}