public void Split(string refactorPath, string generatedFilesPath, string[] filesToRefactor) { var failedFiles = new List <string>(); var avoidedOverWrites = new List <string>(); var filesCreated = 0; for (var i = 0; i < filesToRefactor.Length; i++) { var file = filesToRefactor[i]; var newPath = DirectoryMimicker.Mimick(refactorPath, generatedFilesPath, file); SeperatedJs seperatedJs; //Ux.WriteLine(string.Format("Processing item {0}", i.ToString(CultureInfo.InvariantCulture))); try { seperatedJs = AdvancedJsSeperationService.Evaluate(File.ReadAllLines(file), Properties.Settings.Default.SolutionPath, newPath, file, false); } catch (Exception e) { //Ux.WriteLine(string.Format("{0} ({1})", e.Message, file)); failedFiles.Add(file + e.Message); continue; } SplitJsFileCreator.Create(seperatedJs, newPath, avoidedOverWrites, ref filesCreated, file, false); } Ux.WriteLine(string.Format("Refactored {0} files", filesCreated)); JsRefactorResultsPresenter.Present(failedFiles, avoidedOverWrites); }
public void Test3() { var obj = new DirectoryMimicker(); const string refactorPath = @"C:\code\proj\views"; const string generatedFilesPath = @"C:\code\proj\script"; const string file = @"C:\code\proj\views\subDir1\subDir2\somefile.cshtml"; var result = obj.Mimick(refactorPath, generatedFilesPath, file); Assert.AreEqual(@"C:\code\proj\script\subDir1\subDir2", result); }