private void buttonImportExcel_Click(object sender, EventArgs e) { var ofd = new OpenFileDialog(); ofd.Filter = "Excel Workbook|*.xlsx"; if (ofd.ShowDialog() != DialogResult.OK) { return; } var fileName = new FileInfo(ofd.FileName); using (var excelDoc = new ExcelPackage(fileName)) { var dialogs = ImportWorkSheet(excelDoc, "Dialogs").ToArray(); //Clear all actions from the asset LoadedAsset.RemoveDialogueActions(LoadedAsset.GetAllDialogueActions()); foreach (var d in dialogs) { LoadedAsset.AddDialogAction(d); } } RefreshDialogs(); }
private void buttonImportTxt_Click(object sender, EventArgs e) { var ofd = new OpenFileDialog(); ofd.Filter = "Text File|*.txt"; if (ofd.ShowDialog() != DialogResult.OK) { return; } var fileName = new FileInfo(ofd.FileName); File.SetAttributes(fileName.DirectoryName, FileAttributes.Normal); LoadedAsset.RemoveDialogueActions(LoadedAsset.GetAllDialogueActions()); int stateCounter = 0; var lines = File.ReadAllLines(fileName.FullName); var totalSize = lines.Length; foreach (var line in lines) { var add = GenerateDialogueActionFromLine(line, totalSize, ref stateCounter); LoadedAsset.AddDialogAction(add); } RefreshDialogs(); }
private void buttonDuplicateDialogueAction_Click(object sender, EventArgs e) { if (dataGridViewDialogueActions.SelectedRows.Count == 1) { var item = ((ObjectView <DialogueStateActionDTO>)dataGridViewDialogueActions.SelectedRows[0] .DataBoundItem).Object; var newDialogueAction = new DialogueStateActionDTO { CurrentState = item.CurrentState, NextState = item.NextState, Meaning = item.Meaning, Style = item.Style, Utterance = item.Utterance }; LoadedAsset.AddDialogAction(newDialogueAction); RefreshDialogs(); } }