public static void UpdateFiles() { var tmp = new StringBuilder(); tmp.Append("<script src=\"" + new Uri(PathToJQueryScript) + "\"></script>"); tmp.Append("<script src=\"" + new Uri(PathToJSMarkScript) + "\"></script>"); string jsFunc = tmp.Append("<script src=\"" + new Uri(PathToBuiltInJScript) + "\"></script>").ToString(); string[] inputFiles = Directory.GetFiles(PathToInputFiles); Program.MainWindow.Files.LargeImageList = CreateListIcon(192); filePathes = new string[inputFiles.Length]; for (int i = 0; i < inputFiles.Length; i++) { if (inputFiles[i].Split('.').Last() == "html") { bool wrote = false; var curr = new FileDetailed(inputFiles[i]); string pathToInvolvedFile = PathToInvolvedFiles + curr.FileName; filePathes[i] = pathToInvolvedFile; if (!File.Exists(pathToInvolvedFile)) { using (StreamReader reader = new StreamReader(inputFiles[i])) using (StreamWriter writer = new StreamWriter(pathToInvolvedFile)) { string line; while ((line = reader.ReadLine()) != null) { if (!wrote && line.IndexOf("</head>") != -1) { string[] linePieces = line.Split(new string[] { "</head>" }, 2, StringSplitOptions.None); var nLine = new StringBuilder(); nLine.Append(linePieces[0]); nLine.Append(jsFunc + "</head>"); if (linePieces.Length == 2) { nLine.Append(linePieces[1]); } line = nLine.ToString(); wrote = true; } writer.WriteLine(line); } } } var item = new ListViewItem(); item.Text = item.ToolTipText = curr.Display; item.Name = pathToInvolvedFile; item.ImageKey = "icon"; Program.MainWindow.Files.Items.Add(item); } } }
public static void PrepareTests() { Program.Tests.ChooseTestListView.Items.Clear(); string[] testsFiles = Directory.GetFiles(PathToTestsFiles); foreach (var fileName in testsFiles) { var curr = new FileDetailed(fileName); var item = new ListViewItem(); item.Text = item.ToolTipText = curr.Display; item.Name = curr.Path; Program.Tests.ChooseTestListView.Items.Add(item); } }