예제 #1
0
        private async void HyperlinkButton_Click(object sender, RoutedEventArgs e)
        {
            var picker = new Windows.Storage.Pickers.FileOpenPicker
            {
                SuggestedStartLocation = Windows.Storage.Pickers.PickerLocationId.MusicLibrary
            };

            picker.FileTypeFilter.Add(".bcc");
            picker.FileTypeFilter.Add(".lrc");
            StorageFile file = await picker.PickSingleFileAsync();

            if (file != null)
            {
                string text = await FileIO.ReadTextAsync(file);

                switch (file.FileType)
                {
                case ".bcc":
                    LyricParser.BCCFormatLyric(text, lyricList);
                    break;

                case ".lrc":
                    LyricParser.LRCFormatLyric(text, lyricList);
                    break;
                }
                lyricMessagePanel.Visibility = Visibility.Collapsed;
            }
        }
예제 #2
0
        //private void FileInputNode_FileCompleted(AudioFileInputNode sender, object args)
        //{
        //	graphGlobal.fileInputNode.Reset();
        //}

        private async void LoadAndProcessLyricFile(string path, string[] formats)
        {
            foreach (var _ in formats)
            {
                if (File.Exists(path + _))
                {
                    var storageFile = await StorageFile.GetFileFromPathAsync(path + _);

                    string text = await FileIO.ReadTextAsync(storageFile);

                    switch (_)
                    {
                    case ".bcc":
                        LyricParser.BCCFormatLyric(text, lyricList);
                        break;

                    case ".lrc":
                        LyricParser.LRCFormatLyric(text, lyricList);
                        break;
                    }
                    return;
                }
            }
        }