Exemple #1
0
        internal virtual void CopyLine(StringBuilder sb, string[] text, int[] offsets, int
			 fileIdx)
        {
            string s = text[fileIdx];
            int start = offsets[fileIdx];
            int end = s.IndexOf('\n', start);
            if (end < 0)
            {
                end = s.Length;
            }
            else
            {
                end++;
            }
            sb.AppendRange(s, start, end);
            offsets[fileIdx] = end;
        }
Exemple #2
0
			public override string Quote(string @in)
			{
				StringBuilder r = new StringBuilder();
				r.Append('\'');
				int start = 0;
				int i = 0;
				for (; i < @in.Length; i++)
				{
					switch (@in[i])
					{
						case '\'':
						case '!':
						{
							r.AppendRange(@in, start, i);
							r.Append('\'');
							r.Append('\\');
							r.Append(@in[i]);
							r.Append('\'');
							start = i + 1;
							break;
						}
					}
				}
				r.AppendRange(@in, start, i);
				r.Append('\'');
				return r.ToString();
			}