private void bOpen_Click(object sender, EventArgs e) { DialogResult sd = OfDialog.ShowDialog(); if (sd == DialogResult.OK) { try { string path = OfDialog.FileName; string[] s__ = new string[19]; lNameFile.Text = OfDialog.SafeFileName; string tunes_str = File.ReadAllText(path); int[] IX = new int[20]; for (int i = 0; i < 19; i++) { IX[i] = tunes_str.IndexOf((i + 341 + "\t").ToString()); } for (int i = 0; i < s__.Length; i++) { if (i == 18) { string temp1 = tunes_str.Substring(IX[i], 37); string[] temp2 = temp1.Split('\n'); string[] temp3 = temp2[0].Split('\t'); s__[i] = temp3[4].Trim(); } else { string temp1 = tunes_str.Substring(IX[i], IX[i + 1] - IX[i]); string[] temp2 = temp1.Split('\t'); s__[i] = temp2[4].Trim(); } } tB341.Text = s__[0]; tB342.Text = s__[1]; tB343.Text = s__[2]; tB344.Text = s__[3]; tB345.Text = s__[4]; tB346.Text = s__[5]; tB347.Text = s__[6]; tB348.Text = s__[7]; tB349.Text = s__[8]; tB350.Text = s__[9]; tB351.Text = s__[10]; tB352.Text = s__[11]; tB353.Text = s__[12]; tB354.Text = s__[13]; tB355.Text = s__[14]; tB356.Text = s__[15]; tB357.Text = s__[16]; tB358.Text = s__[17]; tB359.Text = s__[18]; } catch (Exception ex) { MessageBox.Show("Не вернЫй формат файла!"); } } }
private void bOpen_Click(object sender, EventArgs e) { DialogResult sd = OfDialog.ShowDialog(); if (sd == DialogResult.OK) { try { string[] s__ = new string[10]; string path = OfDialog.FileName; lNameFile.Text = OfDialog.SafeFileName; string tunes_str = File.ReadAllText(path); int[] IX = new int[10]; for (int i = 0; i < 8; i++) { IX[i] = tunes_str.IndexOf((i + 301).ToString()); } IX[8] = tunes_str.IndexOf("310"); IX[9] = tunes_str.IndexOf("312"); for (int i = 0; i < s__.Length; i++) { if (i == 9) { string temp1 = tunes_str.Substring(IX[i], 35); string[] temp3 = temp1.Split('\n'); string[] temp2 = temp3[0].Split('\t'); s__[i] = temp2[4].Trim(); } else { string temp1 = tunes_str.Substring(IX[i], IX[i + 1] - IX[i]); string[] temp2 = temp1.Split('\t'); s__[i] = temp2[4].Trim(); } } tB321.Text = s__[0]; tB322.Text = s__[1]; tB323.Text = s__[2]; tB324.Text = s__[3]; tB325.Text = s__[4]; tB326.Text = s__[5]; tB327.Text = s__[6]; tB328.Text = s__[7]; tB330.Text = s__[8]; tB332.Text = s__[9]; } catch (Exception ex) { MessageBox.Show("Не верный формат файла."); } } }