コード例 #1
0
ファイル: Program.cs プロジェクト: jaredpar/random
        internal static void Main(string[] args)
        {
            var teamFoundationServer = new TfsTeamProjectCollection(new Uri("http://*****:*****@"c:\users\jaredpar\data.txt";
            var root = @"e:\dd\roslyn\src";
            var files =
                Directory.EnumerateFiles(root, "*.vb", SearchOption.AllDirectories)
                .Concat(Directory.EnumerateFiles(root, "*.cs", SearchOption.AllDirectories));

            foreach (var filePath in files)
            {
                Console.WriteLine($"{filePath}");
                SourceText text;
                using (var stream = File.OpenRead(filePath))
                {
                    text = SourceText.From(stream);
                }

                var rewriter = Path.GetExtension(filePath) == ".cs"
                    ? (IRewriter)new CSharpWorkItemRewriter(workItemUtil, filePath)
                    : (IRewriter)new BasicWorkItemRewriter(workItemUtil, filePath);

                var newText = rewriter.TryUpdate(text);
                if (newText != null)
                {
                    using (var writer = new StreamWriter(filePath, append: false, encoding: text.Encoding))
                    {
                        newText.Write(writer);
                    }
                }

                if (unknownList.Count > 20)
                {
                    File.AppendAllLines(dataFile, unknownList);
                    unknownList.Clear();
                }
            }

            File.AppendAllLines(dataFile, unknownList.ToArray());
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: jaredpar/random
 internal WorkItemUtil(WorkItemData workItemData, List<string> unknownList)
 {
     _workItemData = workItemData;
     _unknownList = unknownList;
 }