Exemplo n.º 1
0
        public List <DialogLineContainer> GetUniqueDlcIds()
        {
            if (connection != null && connection.State == System.Data.ConnectionState.Open)
            {
                SQLiteCommand command = new SQLiteCommand(connection);
                command.CommandText = "SELECT DISTINCT chapter, scene, dlcNumber FROM dialogDb";
                SQLiteDataReader reader = command.ExecuteReader();

                List <DialogLineContainer> dlcList = new List <DialogLineContainer>();

                while (reader.Read())
                {
                    DialogLineContainer dlc = new DialogLineContainer(Convert.ToInt32(reader[0].ToString()), Convert.ToInt32(reader[1].ToString()), Convert.ToInt32(reader[2].ToString()));
                    dlcList.Add(dlc);
                }
                reader.Close();
                reader.Dispose();
                command.Dispose();
                return(dlcList);
            }
            else
            {
                throw new Exception("Invalid data base connection.");
            }
        }
Exemplo n.º 2
0
 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;
 }
Exemplo n.º 3
0
        public List <DialogLine> GetLinesByDialogId(DialogLineContainer dlc)
        {
            if (connection != null && connection.State == System.Data.ConnectionState.Open)
            {
                SQLiteCommand command = new SQLiteCommand(connection);
                command.CommandText = "SELECT * " +
                                      "FROM dialogDb WHERE chapter = " + dlc.dialogId.Chapter + " AND scene = " + dlc.dialogId.Scene + " AND dlcNumber = " + dlc.dialogId.DlcNumber + " ORDER BY id ASC";
                SQLiteDataReader reader = command.ExecuteReader();

                List <DialogLine> dialogLinesList = new List <DialogLine>();

                while (reader.Read())
                {
                    DialogLine dl = new DialogLine(dlc);
                    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);
                    dialogLinesList.Add(dl);
                }
                reader.Close();
                reader.Dispose();
                command.Dispose();
                return(dialogLinesList);
            }
            else
            {
                throw new Exception("Invalid data base connection.");
            }
        }
Exemplo n.º 4
0
        // 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;
            }
        }
Exemplo n.º 5
0
        private void CmdAddToDlcList_Click(object sender, EventArgs e)
        {
            if (db == null)
            {
                MessageBox.Show("No DataBase found.");
                return;
            }

            DialogLineContainer id = new DialogLineContainer((int)NumChapterSelect.Value, (int)NumSceneSelect.Value, (int)NumDlcSelect.Value);
            int index = dlcList.FindIndex(item => item.dialogId == id.dialogId);

            if (index < 0)
            {
                dlcList.Add(id);
                UpdateTreeView();
            }
            else
            {
                MessageBox.Show("Dialog with ID " + id.dialogId + " already exists. \nNo duplicates allowed!");
            }
        }
Exemplo n.º 6
0
        // 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();
        }