Exemplo n.º 1
0
        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());
        }
Exemplo n.º 2
0
 internal WorkItemUtil(WorkItemData workItemData, List<string> unknownList)
 {
     _workItemData = workItemData;
     _unknownList = unknownList;
 }