// Загрузка результатов public void LoadSheet(ProjFileStream pfs) { int rc = pfs.ReadInt(); int cc = pfs.ReadInt(); Clear(); for (int j = 1; j < cc - 1; j++) { AddNewRound(pfs.ReadString()); } for (int i = 0; i < rc; i++) { string name = pfs.ReadString(); AddNewTeam(name); for (int j = 1; j < cc - 1; j++) { dataGridView1.Rows[i].Cells[j].Value = pfs.ReadInt(); } } UpdateResults(); }
// Загрузка цветовых схем private void ColorSchemesRead() { schemes.Clear(); string colorFileName = Path.Combine(Application.StartupPath, "Colors"); if (File.Exists(colorFileName)) { ProjFileStream reader = new ProjFileStream(colorFileName, FileMode.Open, FileAccess.Read); int cnt = reader.ReadInt(); for (int i = 0; i < cnt; i++) { schemes.Add(SheetColorScheme.ReadFromStream(reader)); } reader.Close(); } else { schemes.Add(new SheetColorScheme()); } }
private void LoadUNO() { OpenFileDialog ofd = new OpenFileDialog(); ofd.Filter = "*.uno | *.uno"; if (ofd.ShowDialog() == DialogResult.OK) { currentFile = ofd.FileName; ProjFileStream pfs = new ProjFileStream(currentFile, System.IO.FileMode.Open, System.IO.FileAccess.Read); if (tabControl1.TabPages.Count > 0) { tabControl1.TabPages.Clear(); } tabControl1.Visible = true; gameToolStripMenuItem.Enabled = true; showResultsToolStripMenuItem.Checked = pfs.ReadBool(); playerCount = pfs.ReadInt(); tabControl1.Height = UNOOneGame.ColumnHeaderHeight + playerCount * UNOOneGame.RowHeight + UNOOneGame.BottomHeight + tabControl1.ItemSize.Height; for (int i = 0; i < playerCount; i++) { playerNames[i] = pfs.ReadString(); } int stages = pfs.ReadInt(); for (int i = 0; i < stages; i++) { string name = pfs.ReadString(); string date = pfs.ReadString(); tabControl1.TabPages.Add(name); UNOOneGame unoOneGame = new UNOOneGame(); unoOneGame.UNOStageName = name; unoOneGame.UNOStageDate = date; unoOneGame.CreateUNOGame(playerCount, playerNames); unoOneGame.ShowHideResults(!showResultsToolStripMenuItem.Checked); unoOneGame.Dock = DockStyle.Top; unoOneGame.ScrollVisiblityChangeEvent += new EventHandler <ScrollVisiblityEventArgs>(unoOneGame_ScrollVisiblityChangeEvent); unoOneGame.NameChangedEvent += new EventHandler <NameChangedEventArgs>(unoOneGame_NameChangedEvent); tabControl1.TabPages[tabControl1.TabPages.Count - 1].Tag = unoOneGame; tabControl1.TabPages[tabControl1.TabPages.Count - 1].Controls.Add(unoOneGame); if (!roundToolStripMenuItem.Enabled) { roundToolStripMenuItem.Enabled = true; } int roundCount = pfs.ReadInt(); for (int j = 0; j < roundCount; j++) { (tabControl1.TabPages[i].Tag as UNOOneGame).AddRound(playerCount); for (int k = 0; k < playerCount; k++) { (tabControl1.TabPages[i].Tag as UNOOneGame).SetValue(j, k, pfs.ReadInt()); (tabControl1.TabPages[i].Tag as UNOOneGame).SetWinState(j, k, pfs.ReadBool()); } } unoOneGame.RefreshResults(); } pfs.Close(); } }