private void Parse()
        {
            string path;

            switch (_tabGroup.SelectedPage.Text)
            {
            case FromFileTabName:
                path = _fileSelectTextBox.Text;
                break;

            case FromDeviceTabName:
                path = GetCurrentlySelectedDrive() + Common.MyClippingsRelativePath;
                break;

            default:
                throw new Exception("Error: could not determine what tab you are on.");
            }

            if (File.Exists(path))
            {
                try
                {
                    var clippings = MyClippingsParser.Parse(path).ToList();

                    var authorDict = ClippingOrganizer.GroupClippingsByAuthorAndBook(clippings);

                    _pathLabel.Text = path;

                    PopulateTree(authorDict.Values);

                    MessageBox.Show(clippings.Count + " clippings parsed.", "Parsing Complete");
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Parsing Error", MessageBoxType.Error);
                }
            }
            else
            {
                MessageBox.Show("Could not find the file specified.", "Parsing Error", MessageBoxType.Error);
            }
        }
Example #2
0
        public IEnumerable <Clipping> AllKindleClippings(string filename)
        {
            var clippings = MyClippingsParser.Parse(filename);

            return(clippings);
        }