Exemple #1
0
        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();
        }
Exemple #2
0
        // Сохранение результатов
        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);
                    }
                }
            }
        }
Exemple #3
0
        // Сохранение цветовых схем
        private void ColorSchemesWrite()
        {
            string colorFileName = Path.Combine(Application.StartupPath, "Colors");

            ProjFileStream writer = new ProjFileStream(colorFileName, FileMode.Create, FileAccess.Write);

            int cnt = schemes.Count;

            writer.WriteInt(cnt);
            for (int i = 0; i < cnt; i++)
            {
                SheetColorScheme.WriteToStream(writer, schemes[i]);
            }

            writer.Close();
        }