コード例 #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));
 }
コード例 #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)));
                }
            }
        }
コード例 #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();
            }
        }
コード例 #4
0
ファイル: DataSqlBuilder.cs プロジェクト: nerdymishka/dotnet
        /// <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);
        }
コード例 #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;
        }
コード例 #6
0
        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);
        }
コード例 #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));
     }
 }
コード例 #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)));
        }
コード例 #9
0
        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);
        }
コード例 #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));
        }
コード例 #11
0
 public MarkdownHandler(IFileSystem fileSystem, ITextTransform textTransform)
 {
     this.fileSystem = fileSystem;
     this.textTransform = textTransform;
 }
コード例 #12
0
 public JsonContractResolver(ITextTransform transform, JsonProcessingDirection direction)
 {
     _transform = transform;
     _direction = direction;
 }
コード例 #13
0
 public ConsoleWriter(ITextTransform textTransform)
 {
     _textTransform = textTransform;
 }
コード例 #14
0
ファイル: JsonLayout.cs プロジェクト: reckcn/log4net.NoSql
 public JsonLayout(ITextTransform transform)
 {
     _transform = transform;
 }
コード例 #15
0
ファイル: JsonLayout.cs プロジェクト: reckcn/log4net.NoSql
 public JsonLayout() : base()
 {
     _transform = TextTransform.Instance;
 }
コード例 #16
0
 public RequestClient(ITextTransform transform, string gamerTag)
 {
     _gamerTag = gamerTag;
 }
コード例 #17
0
 public CodeTransformHelper(CodeGenerationTools code, ITextTransform transform)
 {
     this.code      = code;
     this.transform = transform;
 }
コード例 #18
0
 public JsonLayout(ITextTransform transform)
 {
     _transform = transform;
 }
コード例 #19
0
 public JsonLayout() : base()
 {
     _transform = TextTransform.Instance;
 }
コード例 #20
0
 public MarkdownHandler(IFileSystem fileSystem, ITextTransform textTransform)
 {
     this.fileSystem    = fileSystem;
     this.textTransform = textTransform;
 }
コード例 #21
0
ファイル: DataSqlBuilder.cs プロジェクト: nerdymishka/dotnet
 /// <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);
 }