private void LoadData() { String path = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location); String filename = Path.Combine(path, "configuration.txt"); buttons = new List <List <ButtonModel> >(); try { String[] inp; using (StreamReader infile = new StreamReader(filename)) { inp = infile.ReadLine().Split(' '); int tabCount = int.Parse(inp[inp.Length - 1]); for (int i = 0; i < tabCount; i++) { buttons.Add(new List <ButtonModel>()); inp = infile.ReadLine().Split(' '); int buttonCount = int.Parse(inp[inp.Length - 1]); Color tabColor = Color.FromArgb(int.Parse(inp[3])); CreateTab(tabColor); for (int j = 0; j < buttonCount; j++) { inp = infile.ReadLine().Split(' '); String name = ""; for (int k = 1; k <= inp.Length - 3; k++) { if (k > 1) { name = name + " "; } name = name + inp[k]; } Color color = Color.FromArgb(int.Parse(inp[inp.Length - 1])); int clicked = 0;// int.Parse(inp[inp.Length - 1]); var button = new ButtonModel(name, color, clicked); buttons[buttons.Count - 1].Add(button); button.image = infile.ReadLine(); parseMatrix(infile.ReadLine(), button); } } } } catch (Exception ex) { //не смог сохранить статистику } filename = Path.Combine(path, "stats.txt"); try { using (StreamReader infile = new StreamReader(filename)) { for (int i = 0; i < tabControl1.TabPages.Count; i++) { if (i > 0) { infile.ReadLine(); } infile.ReadLine(); for (int j = 0; j < buttons[i].Count; j++) { String[] inp = infile.ReadLine().Split(' '); buttons[i][j].clicked = int.Parse(inp[inp.Length - 1]); } } } } catch (Exception ex) { //не смог сохранить статистику } Settings.maxtrix = new MatrixCell[Settings.matrixSize, Settings.matrixSize]; Settings.MatrixSelectionColor = Settings.DefaultMatrixSelectionColor; }