//// Display selected M3U(s) content
        private void loadM3U()
        {
            M3USingleItems.Clear();
            M3UItems.Clear();
            List <FileInfo> selectedM3Uinfo = M3U.GetSelectedM3UInfo(selectedItems());

            // Class M3UItem to create objects to be bind to ListBox
            foreach (FileInfo file in selectedM3Uinfo)
            {
                M3UItem m3UItem = new M3UItem(file, LoadOptions);
                M3UItems.Add(m3UItem);

                foreach (KeyValuePair <string, string> entry in m3UItem.FormatedContent)
                {
                    M3USingleItems.Add(new M3USingleItem(entry.Key, entry.Value, m3UItem.Name));
                }

                //foreach (string line in m3UItem._FormatedContent)
                //{
                //    M3USingleItems.Add(new M3USingleItem(line, m3UItem.Name));
                //}
            }

            btnLoadFile.IsEnabled = true;
        }
Ejemplo n.º 2
0
        public void Save(M3UItem M3U, ObservableCollection <M3USingleItem> singleItems)
        {
            StreamWriter Stream = new StreamWriter(M3U.M3UInfo.FullName);

            for (int i = 0; i < singleItems.Count; i++)
            {
                if (i == singleItems.Count - 1)
                {
                    Stream.Write(singleItems[i].fullPath);
                }
                else
                {
                    Stream.Write(singleItems[i].fullPath + "\n");
                }
            }

            Stream.Close();
        }