public override global::System.Data.DataSet Clone() { databaseDataSet cln = ((databaseDataSet)(base.Clone())); cln.InitVars(); cln.SchemaSerializationMode = this.SchemaSerializationMode; return(cln); }
public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs) { databaseDataSet ds = new databaseDataSet(); global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType(); global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence(); global::System.Xml.Schema.XmlSchemaAny any = new global::System.Xml.Schema.XmlSchemaAny(); any.Namespace = ds.Namespace; sequence.Items.Add(any); type.Particle = sequence; global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable(); if (xs.Contains(dsSchema.TargetNamespace)) { global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream(); global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream(); try { global::System.Xml.Schema.XmlSchema schema = null; dsSchema.Write(s1); for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext();) { schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current)); s2.SetLength(0); schema.Write(s2); if ((s1.Length == s2.Length)) { s1.Position = 0; s2.Position = 0; for (; ((s1.Position != s1.Length) && (s1.ReadByte() == s2.ReadByte()));) { ; } if ((s1.Position == s1.Length)) { return(type); } } } } finally { if ((s1 != null)) { s1.Close(); } if ((s2 != null)) { s2.Close(); } } } xs.Add(dsSchema); return(type); }
public UpravaPostavyDialog2(String jmeno, String rasa, String pohlavi, String povolani, int[] vlastnosti, int vyj, int[] konstituce, String druzina) { InitializeComponent(); this.database = Program.getDB(); this.druzina = druzina; this.jmeno = jmeno; this.rasa = rasa; this.pohlavi = pohlavi; this.povolani = povolani; this.vlastnosti = vlastnosti; this.vyjimecnost = vyj; this.konstituce = konstituce; maxBodu = vyjimecnost * 5; boduLeft = maxBodu; body[0] = 0; body[1] = 0; body[2] = 0; max[0] = (maxBodu + 3 > 8 ? 8 : maxBodu); max[1] = (maxBodu + 3 > 8 ? 8 : maxBodu + 3); max[2] = (maxBodu + 3 > 8 ? 8 : maxBodu + 3); pmax[0] = (maxBodu + 3 > 8 ? 8 : maxBodu); pmax[1] = (maxBodu + 3 > 8 ? 8 : maxBodu + 3); pmax[2] = (maxBodu + 3 > 8 ? 8 : maxBodu + 3); puvody[0] = "Nalezenec"; puvody[1] = "Sirotek"; puvody[2] = "Z neúplné rodiny"; puvody[3] = "Z pochybné rodiny"; puvody[4] = "Ze slušné rodiny"; puvody[5] = "Z dobré rodiny"; puvody[6] = "Z velmi dobré a vlivné rodiny"; puvody[7] = "Šlechtic"; puvody[8] = "Šlechtic z dobrého rodu"; majetky[0] = 1; majetky[1] = 3; majetky[2] = 10; majetky[3] = 30; majetky[4] = 100; majetky[5] = 300; majetky[6] = 1000; majetky[7] = 3000; majetky[8] = 10000; DataRow row = database.povolani.Rows.Find(this.povolani); for (int i = 0; i < 9; i++) { dovednosti[i] = new short[3]; dovednosti[i][0] = short.Parse(row.ItemArray[i * 3 + 5].ToString()); dovednosti[i][1] = short.Parse(row.ItemArray[i * 3 + 6].ToString()); dovednosti[i][2] = short.Parse(row.ItemArray[i * 3 + 7].ToString()); } setZbyva(); setLabels(); }
public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs) { databaseDataSet ds = new databaseDataSet(); global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType(); global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence(); global::System.Xml.Schema.XmlSchemaAny any = new global::System.Xml.Schema.XmlSchemaAny(); any.Namespace = ds.Namespace; sequence.Items.Add(any); type.Particle = sequence; global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable(); if (xs.Contains(dsSchema.TargetNamespace)) { global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream(); global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream(); try { global::System.Xml.Schema.XmlSchema schema = null; dsSchema.Write(s1); for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext(); ) { schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current)); s2.SetLength(0); schema.Write(s2); if ((s1.Length == s2.Length)) { s1.Position = 0; s2.Position = 0; for (; ((s1.Position != s1.Length) && (s1.ReadByte() == s2.ReadByte())); ) { ; } if ((s1.Position == s1.Length)) { return type; } } } } finally { if ((s1 != null)) { s1.Close(); } if ((s2 != null)) { s2.Close(); } } } xs.Add(dsSchema); return type; }
public UpravaPostavyDialog(Main nparent, String njmeno, String nrasa, String npohlavi, String npovolani, String druzina) { InitializeComponent(); parent = nparent; this.database = Program.getDB(); this.druzina = druzina; //pridani controls do array captionL[0] = (Label)this.Controls.Find("SilL", true)[0]; captionL[1] = (Label)this.Controls.Find("ObrL", true)[0]; captionL[2] = (Label)this.Controls.Find("ZrcL", true)[0]; captionL[3] = (Label)this.Controls.Find("VolL", true)[0]; captionL[4] = (Label)this.Controls.Find("IntL", true)[0]; captionL[5] = (Label)this.Controls.Find("ChrL", true)[0]; vlastnostL[0] = (Label)this.Controls.Find("Sil", true)[0]; vlastnostL[1] = (Label)this.Controls.Find("Obr", true)[0]; vlastnostL[2] = (Label)this.Controls.Find("Zrc", true)[0]; vlastnostL[3] = (Label)this.Controls.Find("Vol", true)[0]; vlastnostL[4] = (Label)this.Controls.Find("Int", true)[0]; vlastnostL[5] = (Label)this.Controls.Find("Chr", true)[0]; zbyvaL[0] = (Label)this.Controls.Find("zSilL", true)[0]; zbyvaL[1] = (Label)this.Controls.Find("zObrL", true)[0]; zbyvaL[2] = (Label)this.Controls.Find("zZrcL", true)[0]; zbyvaL[3] = (Label)this.Controls.Find("zVolL", true)[0]; zbyvaL[4] = (Label)this.Controls.Find("zIntL", true)[0]; zbyvaL[5] = (Label)this.Controls.Find("zChrL", true)[0]; //kontrola "mužství", jinak opravy za pohlavi if (npohlavi == "Muž") { opravyPohlaviCh.Checked = false; opravyPohlaviCh.Enabled = false; } else { opravyPohlaviCh.Checked = true; opravyPohlaviCh.Enabled = true; } //inicializace jmenoPos.Text = njmeno; rasaPos.Text = nrasa; pohlaviPos.Text = npohlavi; povolaniPos.Text = npovolani; //konstituce postavy konstituce[0] = (int)Program.getRasyCell(nrasa, "vel"); konstituce[1] = (int)Program.getRasyCell(nrasa, "hmt"); konstituce[2] = (int)Program.getRasyCell(nrasa, "vyska"); pKonstituce[0] = konstituce[0]; pKonstituce[1] = konstituce[1]; pKonstituce[2] = konstituce[2]; vyskaN.Maximum = pKonstituce[2] + 15; vyskaN.Minimum = pKonstituce[2] - 15; vyskaN.Value = pKonstituce[2]; //určení názvů (zkratek) vlastnosti nazvy[0] = "Sil"; nazvy[1] = "Obr"; nazvy[2] = "Zrč"; nazvy[3] = "Vol"; nazvy[4] = "Int"; nazvy[5] = "Chr"; // 3 body ke kazde vlastnosti for (int i = 0; i < 6; i++) { zbyva[i] = 3; } //zakladni vlastnosti podle rasy for (int i = 0, j = 2; i < 6; i++, j++) { vlastnosti[i] = int.Parse(Program.getRasyCell(nrasa, j).ToString()); } //oprava podle pohlavi if (npohlavi == "Žena") { for (int i = 0, j = 22; i < 6; i++, j++) { vlastnosti[i] += opravyPohlavi[i] = int.Parse(Program.getRasyCell(nrasa, j).ToString()); } } //hlavni vlastnosti podle povolani vlast1 = Program.getPovolaniCell(npovolani, "vlast1").ToString(); vlast2 = Program.getPovolaniCell(npovolani, "vlast2").ToString(); for (int i = 0; i < 6; i++) { if (vlast1 == nazvy[i]) { vlastnosti[i]++; zbyva[i]--; captionL[i].Font = new Font(captionL[i].Font, FontStyle.Bold); } if (vlast2 == nazvy[i]) { vlastnosti[i]++; zbyva[i]--; captionL[i].Font = new Font(captionL[i].Font, FontStyle.Bold); } // minima/maxima min[i] = vlastnosti[i]; max[i] = zbyva[i] + vlastnosti[i]; pmin[i] = vlastnosti[i]; pmax[i] = zbyva[i] + vlastnosti[i]; } hracR.Checked = true; nahodneB.Visible = false; kombinaceR.Checked = true; nahazeno = false; setVlastnosti(); }
static void Main(string[] args) { Console.WriteLine("Prosim pockejte nez program vytvori novou verzi databaze."); Console.WriteLine(); Console.WriteLine("Hledam starou verzi databaze: 'database.sdf'."); if (File.Exists("database.sdf")) { Console.WriteLine("Soubor 'database.sdf' existuje."); Console.WriteLine("Exportuji databázi do dočasneho souboru."); try { databaseDataSet database = new databaseDataSet(); databaseDataSetTableAdapters.povolaniTableAdapter povolaniTableAdapter = new databaseDataSetTableAdapters.povolaniTableAdapter(); povolaniTableAdapter.ClearBeforeFill = true; databaseDataSetTableAdapters.tabZZTableAdapter tabZZTableAdapter = new databaseDataSetTableAdapters.tabZZTableAdapter(); povolaniTableAdapter.ClearBeforeFill = true; databaseDataSetTableAdapters.rasyTableAdapter rasyTableAdapter = new databaseDataSetTableAdapters.rasyTableAdapter(); rasyTableAdapter.ClearBeforeFill = true; databaseDataSetTableAdapters.tabZraneniUnavyTableAdapter tabZraneniUnavyTableAdapter = new databaseDataSetTableAdapters.tabZraneniUnavyTableAdapter(); tabZraneniUnavyTableAdapter.ClearBeforeFill = true; databaseDataSetTableAdapters.zbraneTableAdapter zbraneTableAdapter = new databaseDataSetTableAdapters.zbraneTableAdapter(); zbraneTableAdapter.ClearBeforeFill = true; databaseDataSetTableAdapters.zbrojeTableAdapter zbrojeTableAdapter = new databaseDataSetTableAdapters.zbrojeTableAdapter(); zbrojeTableAdapter.ClearBeforeFill = true; databaseDataSetTableAdapters.prilbyTableAdapter prilbyTableAdapter = new databaseDataSetTableAdapters.prilbyTableAdapter(); prilbyTableAdapter.ClearBeforeFill = true; databaseDataSetTableAdapters.stityTableAdapter stityTableAdapter = new databaseDataSetTableAdapters.stityTableAdapter(); stityTableAdapter.ClearBeforeFill = true; databaseDataSetTableAdapters.tabVzdalenostiTableAdapter tabVzdalenostiTableAdapter = new databaseDataSetTableAdapters.tabVzdalenostiTableAdapter(); tabVzdalenostiTableAdapter.ClearBeforeFill = true; databaseDataSetTableAdapters.predmetyTableAdapter predmetyTableAdapter = new databaseDataSetTableAdapters.predmetyTableAdapter(); predmetyTableAdapter.ClearBeforeFill = true; databaseDataSetTableAdapters.strelneTableAdapter strelneTableAdapter = new databaseDataSetTableAdapters.strelneTableAdapter(); predmetyTableAdapter.ClearBeforeFill = true; databaseDataSetTableAdapters.dovednostiTableAdapter dovednostiTableAdapter = new databaseDataSetTableAdapters.dovednostiTableAdapter(); dovednostiTableAdapter.ClearBeforeFill = true; tabZraneniUnavyTableAdapter.Fill(database.tabZraneniUnavy); tabZZTableAdapter.Fill(database.tabZZ); povolaniTableAdapter.Fill(database.povolani); rasyTableAdapter.Fill(database.rasy); zbraneTableAdapter.Fill(database.zbrane); zbrojeTableAdapter.Fill(database.zbroje); prilbyTableAdapter.Fill(database.prilby); stityTableAdapter.Fill(database.stity); tabVzdalenostiTableAdapter.Fill(database.tabVzdalenosti); predmetyTableAdapter.Fill(database.predmety); strelneTableAdapter.Fill(database.strelne); dovednostiTableAdapter.Fill(database.dovednosti); database.WriteXml("tempDB.xml"); Console.WriteLine("\nDatabaze byla uspesne vyexportovana. CGen+ ji slouci s novou verzi databaze."); return; } catch { Console.WriteLine("!!! NASTALA CHYBA PRI NAPLONOVANI DB DATAMA !!!"); } } else { Console.WriteLine("Databáze nenalezena."); } Console.ReadKey(); }