Advertisement
Guest User

Untitled

a guest
Oct 27th, 2016
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.46 KB | None | 0 0
  1. if (File.Exists(@"C:\auto\wycinanie\dane2.xml"))
  2.             {
  3.                 string[] lines = File.ReadAllLines(@"C:\auto\wycinanie\dane2.xml");
  4.                 Console.WriteLine("Plik wczytano\nNaciśnij dowolny klawisz aby kontynuować");
  5.                 Console.ReadKey();
  6.                 foreach (string line in lines)
  7.                 {
  8.                     foreach (Match match in Regex.Matches(line, "CmdSyntax=\"(.+?)\""))
  9.                         using (StreamWriter temp_file = File.AppendText(@"C:\auto\wycinanie\temp.txt"))
  10.                             temp_file.WriteLine(match);
  11.                 }
  12.                 string[] lines2 = File.ReadAllLines(@"C:\auto\wycinanie\temp.txt");
  13.                 foreach (string line in lines)
  14.                 {
  15.                     foreach (Match match in Regex.Matches(line, "\"([^\"]*)\""))
  16.                         // CmdSyntax =\"(.*?)" stare to: "\"([^\"]*)\""
  17.                         using (StreamWriter temp_file = File.AppendText(@"C:\auto\wycinanie\test_wycinanki.txt"))
  18.                             temp_file.WriteLine(match);
  19.                 }
  20.                 if (File.Exists(@"C:\auto\wycinanie\temp.txt"))
  21.                 {
  22.                     File.Delete(@"C:\auto\wycinanie\temp.txt");
  23.                     Console.WriteLine("Plik tymczasowy usunięto");
  24.                 }
  25.             }
  26.             else
  27.             {
  28.                 Console.WriteLine("Błąd pliku");
  29.             }
  30.             Console.ReadKey();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement