public static SheetColorScheme ReadFromStream(ProjFileStream reader) { SheetColorScheme resultScheme = new SheetColorScheme(); resultScheme.Name = reader.ReadString(); resultScheme.HeaderBackColor = reader.ReadColor(); resultScheme.ValueBackColor = reader.ReadColor(); resultScheme.TextColor = reader.ReadColor(); resultScheme.SelectedBackColor = reader.ReadColor(); resultScheme.LightingBackColor = reader.ReadColor(); resultScheme.LightingSelectedBackColor = reader.ReadColor(); return(resultScheme); }
// Загрузка результатов 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 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(); } }