// Сохранение результатов public void SaveSheet(ProjFileStream pfs, bool templ) { int rc = dataGridView1.Rows.Count; int cc = dataGridView1.Columns.Count; pfs.WriteInt(rc); pfs.WriteInt(cc); for (int i = 1; i < cc - 1; i++) { pfs.WriteString(dataGridView1.Columns[i].HeaderText); } for (int i = 0; i < rc; i++) { pfs.WriteString((string)dataGridView1.Rows[i].Cells[0].Value); for (int j = 1; j < cc - 1; j++) { if (templ) { pfs.WriteInt((int)0); } else { pfs.WriteInt((int)dataGridView1.Rows[i].Cells[j].Value); } } } }
private void SaveUNO(string name) { ProjFileStream pfs = new ProjFileStream(name, System.IO.FileMode.Create, System.IO.FileAccess.Write); pfs.WriteBool(showResultsToolStripMenuItem.Checked); pfs.WriteInt(playerCount); for (int i = 0; i < playerCount; i++) { pfs.WriteString(playerNames[i]); } pfs.WriteInt(tabControl1.TabPages.Count); for (int i = 0; i < tabControl1.TabPages.Count; i++) { pfs.WriteString((tabControl1.TabPages[i].Tag as UNOOneGame).UNOStageName); pfs.WriteString((tabControl1.TabPages[i].Tag as UNOOneGame).UNOStageDate); pfs.WriteInt((tabControl1.TabPages[i].Tag as UNOOneGame).RoundsCount); for (int j = 0; j < (tabControl1.TabPages[i].Tag as UNOOneGame).RoundsCount; j++) { for (int k = 0; k < playerCount; k++) { pfs.WriteInt((tabControl1.TabPages[i].Tag as UNOOneGame).GetValue(j, k)); pfs.WriteBool((tabControl1.TabPages[i].Tag as UNOOneGame).GetWinState(j, k)); } } } saved = true; pfs.Close(); }
public static void WriteToStream(ProjFileStream writer, SheetColorScheme scheme) { writer.WriteString(scheme.Name); writer.WriteColor(scheme.HeaderBackColor); writer.WriteColor(scheme.ValueBackColor); writer.WriteColor(scheme.TextColor); writer.WriteColor(scheme.SelectedBackColor); writer.WriteColor(scheme.LightingBackColor); writer.WriteColor(scheme.LightingSelectedBackColor); }