private bool BatchProcessFiles(string[] paths, BackgroundWorker worker)
        {
            var model = new ConversationModel();

            int progress = 0;

            foreach (string p in paths)
            {
                //Open file
                if (!model.LoadFromFile(p))
                {
                    continue;
                }

                //In case no name found
                if (model.FileCont.Name == null)
                {
                    model.FileCont.Name = Path.GetFileNameWithoutExtension(p);
                }

                //Name new file and export
                string newFileName = Path.Combine(Path.GetDirectoryName(p), model.FileCont.Name + "_Processed.txt");
                model.ExportStrippedFile(newFileName);

                //Report progress
                progress++;
                worker.ReportProgress(progress / paths.Length * 100);
            }

            return(true);
        }
        public bool OpenFile(ModelType type)
        {
            var ofd = new OpenFileDialog
            {
                Filter      = Properties.Resources.OpenFileDialogFilter,
                FilterIndex = 1,
                FileName    = string.Empty
            };

            if (ofd.ShowDialog() != DialogResult.OK)
            {
                return(false);
            }

            try
            {
                switch (type)
                {
                case ModelType.Source:
                    if (sourceModel.LoadFromFile(ofd.FileName))
                    {
                        if (sourceModel.FileCont.Name == null)
                        {
                            sourceModel.FileCont.Name = Path.GetFileNameWithoutExtension(ofd.FileName);
                        }

                        mainView.FormName = sourceModel.FileCont.Name;
                        mainView.SetMessageList(MessageListToTable(sourceModel.FileCont.Messages), false);
                    }
                    return(true);

                case ModelType.Target:
                    if (targetModel.LoadFromFile(ofd.FileName))
                    {
                        if (targetModel.FileCont.Name == null)
                        {
                            targetModel.FileCont.Name = Path.GetFileNameWithoutExtension(ofd.FileName);
                        }

                        mainView.FormName = targetModel.FileCont.Name;
                        mainView.SetMessageList(MessageListToTable(targetModel.FileCont.Messages), true);
                    }
                    return(true);

                default:
                    throw new ArgumentOutOfRangeException(nameof(type), type, null);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, Properties.Resources.OpenErrorTitle, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }
        }