Example #1
0
 public static GPSData Read(this ITextTransform transform, string data)
 {
     transform.ThrowIfNull("transform");
     data.ThrowIfNull("data");
     using (var sr = new StringReader(data))
         return(transform.Read(sr));
 }
Example #2
0
        public static void CreateFromTemplate(this ITextTransform transform, LPath source, LPath destination)
        {
            // Console.WriteLine("{0} -> {1}", source, destination);

            if (source.IsFile)
            {
                destination.EnsureParentDirectoryExists();
                if (IsBinaryFile(source))
                {
                    source.CopyFile(destination);
                }
                else
                {
                    using (var w = destination.WriteText())
                        using (var r = source.ReadText())
                        {
                            transform.Transform(r, w);
                        }
                }
            }
            else
            {
                foreach (var i in source.Info.GetChildren())
                {
                    transform.CreateFromTemplate(i.FullName, destination.CatDir(transform.Transform(i.Name)));
                }
            }
        }
Example #3
0
        public void TransformText(ITextTransform transform)
        {
            Application.UndoRecord.StartCustomRecord(Properties.Resources.FontTransformationUndoRecord);
            Application.ScreenUpdating = false;
#if TRACE
            var stopwatch = new Stopwatch();
            stopwatch.Start();
#endif
            try
            {
                var range = Application.Selection.Range;
                if (range.Characters.Count == 0)
                {
                    return;
                }
                transform.Apply(range);
                range.Select();
            }
            finally
            {
#if TRACE
                Trace.WriteLine(stopwatch.Elapsed);
#endif
                Application.ScreenUpdating = true;
                Application.UndoRecord.EndCustomRecord();
            }
        }
Example #4
0
        /// <summary>
        /// Appends the specified value.
        /// </summary>
        /// <param name="value">The value.</param>
        /// <param name="transformer">The transformer.</param>
        /// <returns>The SQL builder.</returns>
        public ISqlBuilder Append(string value, ITextTransform transformer)
        {
            Check.NotNull(nameof(transformer), transformer);
            this.builder.Append(transformer.Transform(value));

            return(this);
        }
Example #5
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="T:System.Object" /> class.
        /// </summary>
        public CodeGenerationTools(ITextTransform transform, string defaultNamespace = null, string indent = "    ")
        {
            Contract.Requires(_transform != null);

            _transform        = transform;
            _indent           = indent;
            _defaultNamespace = defaultNamespace ?? UnknownNamespace;
        }
        public static void TestFixtureSetup(TestContext context)
        {
            var sorterFactory = new SorterFactory();

            _lineSorter      = sorterFactory.GetSorter(SortOptions.Line);
            _characterSorter = sorterFactory.GetSorter(SortOptions.Character);
            _wordSorter      = sorterFactory.GetSorter(SortOptions.Word);
        }
Example #7
0
 public static void Transform(this ITextTransform transform, TextReader input, TextWriter output)
 {
     for (; ;)
     {
         var line = input.ReadLine();
         if (line == null)
         {
             break;
         }
         output.WriteLine(transform.Transform(line));
     }
 }
Example #8
0
        public static StringBuilder AppendTransform(
            this StringBuilder builder,
            string identifier,
            ITextTransform transformer)
        {
            if (builder is null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

            if (transformer is null)
            {
                throw new ArgumentNullException(nameof(transformer));
            }

            return(builder.Append(
                       transformer.Transform(identifier)));
        }
        internal void AddTransform(int lineNum, int linePos, ITextTransform trans)
        {
            IDictionary <int, ITextTransform> strData = null;

            if (!lineText.TryGetValue(lineNum, out strData))
            {
                strData = new SortedDictionary <int, ITextTransform>();
                lineText.Add(lineNum, strData);
            }
            ITextTransform str = null;

            if (!strData.TryGetValue(linePos, out str))
            {
                strData.Add(linePos, trans);
            }
            //else
            //!!!((TextTransformAdd)str).Append(text);
        }
Example #10
0
        public static StringBuilder AppendQuote(
            this StringBuilder builder,
            string value,
            ITextTransform transformer,
            char leftQuote  = '"',
            char rightQuote = '"')
        {
            if (builder is null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

            if (transformer is null)
            {
                throw new ArgumentNullException(nameof(transformer));
            }

            return(builder.Append(leftQuote)
                   .Append(transformer.Transform(value))
                   .Append(rightQuote));
        }
Example #11
0
 public MarkdownHandler(IFileSystem fileSystem, ITextTransform textTransform)
 {
     this.fileSystem = fileSystem;
     this.textTransform = textTransform;
 }
 public JsonContractResolver(ITextTransform transform, JsonProcessingDirection direction)
 {
     _transform = transform;
     _direction = direction;
 }
Example #13
0
 public ConsoleWriter(ITextTransform textTransform)
 {
     _textTransform = textTransform;
 }
Example #14
0
 public JsonLayout(ITextTransform transform)
 {
     _transform = transform;
 }
Example #15
0
 public JsonLayout() : base()
 {
     _transform = TextTransform.Instance;
 }
 public RequestClient(ITextTransform transform, string gamerTag)
 {
     _gamerTag = gamerTag;
 }
 public CodeTransformHelper(CodeGenerationTools code, ITextTransform transform)
 {
     this.code      = code;
     this.transform = transform;
 }
Example #18
0
 public JsonLayout(ITextTransform transform)
 {
     _transform = transform;
 }
Example #19
0
 public JsonLayout() : base()
 {
     _transform = TextTransform.Instance;
 }
Example #20
0
 public MarkdownHandler(IFileSystem fileSystem, ITextTransform textTransform)
 {
     this.fileSystem    = fileSystem;
     this.textTransform = textTransform;
 }
Example #21
0
 /// <summary>
 /// Appends the line.
 /// </summary>
 /// <param name="value">The value.</param>
 /// <param name="transform">The transform.</param>
 /// <returns>
 /// The SQL Builder.
 /// </returns>
 public ISqlBuilder AppendLine(string value, ITextTransform transform)
 {
     Check.NotNull(nameof(transform), transform);
     this.builder.AppendLine(value);
     return(this);
 }