void podzial(int nr) { Kolejka.Clear(); if (nr == 0) { tresc = tresc.Replace("\r\n", " "); string[] s = tresc.Split(); int n = Int32.Parse(s[5]); int a, b, c; int j = 12; for (int i = 1; i <= n; i++) { a = int.Parse(s[j]); b = int.Parse(s[j + 2]); c = int.Parse(s[j + 3]); zadania tmp = new zadania(); tmp.nr = a; tmp.start = b; tmp.end = c; Kolejka.Add(tmp); j += 4; } } if (nr == 1 || nr == 3) { string[] s = tresc.Split(); int n = Int32.Parse(s[5]); CMAX = Int32.Parse(s[12]); int a, b, c, d; int j = 17; for (int i = 1; i <= n; i++) { a = int.Parse(s[j]); b = int.Parse(s[j + 2]); c = int.Parse(s[j + 3]); d = int.Parse(s[j + 4]); zadania tmp = new zadania(); tmp.nr = a; tmp.r = b; tmp.p = c; tmp.q = d; Kolejka.Add(tmp); j += 6; } } }
void ReadFile() { string cmdOutput; // Schrage & Schrage z podziałem (tablice dynamiczne) Process proc = new Process(); proc.StartInfo.FileName = "SPD.exe"; proc.StartInfo.Arguments = "inJ.txt"; proc.StartInfo.UseShellExecute = false; proc.StartInfo.RedirectStandardOutput = true; proc.Start(); cmdOutput = proc.StandardOutput.ReadToEnd(); proc.WaitForExit(); proc.Close(); cmdOutput = cmdOutput.Replace("\r\n", " "); string[] s = cmdOutput.Split(); int n = Int32.Parse(s[0]); int a, b, c; int j = 1; for (int i = 1; i <= n; i++) { a = int.Parse(s[j]); b = int.Parse(s[j + 1]); c = int.Parse(s[j + 2]); zadania tmp = new zadania(); tmp.nr = a; tmp.start = b; tmp.end = c; Kolejka.Add(tmp); j += 3; } }