public bool Equals(DialogId p) { // If parameter is null return false: if ((object)p == null) { return(false); } // Return true if the fields match: return((chapter == p.chapter) && (scene == p.scene) && (dlcNumber == p.dlcNumber)); }
public void DeleteLineByDlc(DialogId dId) { if (connection != null && connection.State == System.Data.ConnectionState.Open) { SQLiteCommand command = new SQLiteCommand(connection); command.CommandText = "DELETE FROM dialogDb WHERE chapter = " + dId.Chapter + " AND scene = " + dId.Scene + " AND dlcNumber = " + dId.DlcNumber; SQLiteDataReader reader = command.ExecuteReader(); reader.Close(); reader.Dispose(); command.Dispose(); } else { throw new Exception("Invalid data base connection."); } }
public override bool Equals(System.Object obj) { // If parameter is null return false. if (obj == null) { return(false); } // If parameter cannot be cast to Point return false. DialogId p = obj as DialogId; if ((System.Object)p == null) { return(false); } // Return true if the fields match: return((chapter == p.chapter) && (scene == p.scene) && (dlcNumber == p.dlcNumber)); }
public DialogLine(DialogLineContainer _dlcId) { id = -1; dlcId = _dlcId.dialogId; character = "Nobody"; contentGer = "Nix"; contentEng = "Nothing"; isEntry = false; isJump = false; previous = -1; next = new List <int>(new int[] { 0, 0, 0, 0 }); activeNexts = 0; requirements = "None"; eventTrigger = 0; audioFileGer = "Nix"; audioFileEng = "None"; pause = 0.0f; }
public DialogLine GetLineById(int id) { if (connection != null && connection.State == System.Data.ConnectionState.Open) { SQLiteCommand command = new SQLiteCommand(connection); command.CommandText = "SELECT * FROM dialogDb WHERE id = " + id; SQLiteDataReader reader = command.ExecuteReader(); DialogLine dl = null; while (reader.Read()) { DialogId dId = new DialogId(Convert.ToInt32(reader[13].ToString()), Convert.ToInt32(reader[14].ToString()), Convert.ToInt32(reader[15].ToString())); dl = new DialogLine(dId); dl.Id = Convert.ToInt32(reader[0].ToString()); dl.Character = reader[1].ToString(); dl.ContentGer = reader[2].ToString(); dl.ContentEng = reader[3].ToString(); dl.previous = Convert.ToInt32(reader[4].ToString()); dl.next[0] = Convert.ToInt32(reader[5].ToString()); dl.next[1] = Convert.ToInt32(reader[6].ToString()); dl.next[2] = Convert.ToInt32(reader[7].ToString()); dl.next[3] = Convert.ToInt32(reader[8].ToString()); dl.activeNexts = Convert.ToInt32(reader[9].ToString()); dl.IsEntry = Convert.ToBoolean(reader[10]); dl.IsJump = Convert.ToBoolean(reader[11]); dl.Requirements = reader[12].ToString(); dl.EventTrigger = Convert.ToInt32(reader[16].ToString()); dl.AudioFileGer = reader[17].ToString(); dl.AudioFileEng = reader[18].ToString(); dl.Pause = (float)Convert.ToDouble(reader[19].ToString()); Console.WriteLine(dl); } reader.Close(); reader.Dispose(); command.Dispose(); return(dl); } else { throw new Exception("Invalid data base connection."); } }
// Checks if selected Node is a Dlc. If true then set it as activeDlc private void TrvTreeView_AfterSelect(object sender, TreeViewEventArgs e) { TreeNode CurrentNode = e.Node; string fullpath = CurrentNode.FullPath; int firstIndex = fullpath.IndexOf("\\"); bool result = firstIndex != fullpath.LastIndexOf("\\") && firstIndex != -1; if (result) { string[] splittedString = fullpath.Split('\\'); DialogId id = new DialogId(Int32.Parse(splittedString[0]), Int32.Parse(splittedString[1]), Int32.Parse(splittedString[2])); DialogLineContainer dlc = dlcList.Find(item => item.dialogId == id); activeDlc = dlc; LblActiveDlc.Text = "Active Dlc: " + activeDlc; UpdateDataGridByActiveDlc(); // VERAENDERN, DAMIT ES ALLES AUF RECHTER SEITE AKTUALISIERT } else { return; } }
// Deletes activeDlc itself and from List private void CmdDeleteFromDlcList_Click(object sender, EventArgs e) { if (activeDlc == null) { MessageBox.Show("No Dlc selected."); return; } DialogResult dr = MessageBox.Show("Do you really want to delete the DialogLineContainer with all its DialogLines from the DataBase? It cannot be restored.", "Delete DialogLineContainer", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr != DialogResult.Yes) { return; } DialogId id = activeDlc.dialogId; DialogLineContainer dlc = dlcList.Find(item => item.dialogId == id); dlcList.Remove(dlc); db.DeleteLineByDlc(id); activeDlc = null; UpdateTreeView(); }
public DialogLineContainer(int _chapter, int _scene, int _dlcNumber) { dialogId = new DialogId(_chapter, _scene, _dlcNumber); }