Example #1
0
        public void SaveList(FirePlayList list)
        {
            if (save_textBox.Text == string.Empty)
            {
                MessageBox.Show("No save file selected! ", "Select Save File", MessageBoxButtons.OK);
                return;
            }
            if (File.Exists(save_textBox.Text))
            {
                File.Delete(save_textBox.Text);
            }
            if (!save_textBox.Text.EndsWith(".fps.xml") && !save_textBox.Text.EndsWith(".xml"))
            {
                save_textBox.Text = save_textBox.Text + ".fps.xml";
            }

            if (EPClass.ExportList == null || EPClass.ExportListDefaulted == null)
            {
                MessageBox.Show("Missing Playlists", "You have no sellected playlists", MessageBoxButtons.OK);
                return;
            }
            if (!System.IO.Directory.Exists(Path.GetDirectoryName(EPClass.Location)))
            {
                MessageBox.Show("Location Dyrectory is wrong!", "Wrong dyrectory", MessageBoxButtons.OK);
            }
            ExportWindow.SavePlaylistToFileAsPlainTextXML(list, EPClass.Location);
            Task.Run(() => MessageBox.Show("Done ", "Done", MessageBoxButtons.OK));
        }
Example #2
0
        public ExportClass(FirePlayList fp_list, string path)
        {
            this.Location = path;
            Setup(fp_list);

            ExportWindow win = new ExportWindow(this);
        }
Example #3
0
        private async void names_button_Click_1(object sender, EventArgs e)
        {
            listBox1.Items.Clear();

            foreach (string x in listBox2.Items)
            {
                FirePlayList n = imported_list;
                listBox1.Items.Add("List: " + n.ListName);
                try
                {
                    foreach (FirePlaySong ppp in n.Songs)
                    {
                        listBox1.Items.Add("\t" + "Song: " + ppp.Autor + " - " + ppp.Naziv);
                        if (listBox3.SelectedItems.Count > 0)
                        {
                            listBox1.Items.Add("\t\t" + listBox3.SelectedItem.ToString() + ": " + ppp.SongElementByIndex(listBox3.SelectedIndex));
                        }
                    }
                }
                catch
                {
                    await Task.Run(() => MessageBox.Show("Something wen wrong\n ErrorCode: 1", "Error", MessageBoxButtons.OK));
                }
            }
        }
Example #4
0
 private void UpdateImportedList(Sweeper_Form sweeper_Form, EventArgs e)
 {
     if (imported_list.Songs.Count == 0)
     {
         imported_list = FirePlayList.CrearteFromMany(_files);
     }
 }
Example #5
0
 private async void import_button_Click(object sender, EventArgs e)
 {
     _files = _main_window.files;
     if (_files != null)
     {
         if (imported_list.Songs.Count == 0)
         {
             imported_list = await FirePlayList.CrearteFromManyAsync(_files);
         }
         else
         {
             DialogResult answer = MessageBox.Show("A list is already present. Do you want to owerwrite it?", "Warnong: List Present", MessageBoxButtons.YesNoCancel);
             if (answer == DialogResult.Yes)
             {
                 imported_list = FirePlayList.CrearteFromMany(_files);
             }
             else if (answer == DialogResult.No)
             {
                 imported_list.AddList(FirePlayList.CrearteFromMany(_files));
             }
         }
         SongView.CurrentListImplemented = imported_list;
         Panel_Options.SetFirePlayListAsync(imported_list);
         imported_list.ListChanged += UpdateSongViewAfterChange;
         OnFilesChanged();
     }
 }
Example #6
0
        public static void SavePlaylistToFileAsPlainTextXML(string path, FirePlayList List)
        {
            XmlDocument  doc  = new XmlDocument();
            XmlNode      root = doc.CreateElement("PlayList");
            FirePlayList l    = List.Clone();

            this_window.lists_in_form = l;
            if (this_window.StartButtonControlDown)
            {
                l.DefaultTheList();
            }
            foreach (FirePlaySong s in l.Songs)
            {
                try
                {
                    XmlNode item = doc.CreateElement("PlayItem");
                    for (int i = 0; i < FirePlaySong.Elements.Length; i++)
                    {
                        XmlNode c = doc.CreateElement(FirePlaySong.Elements[i]);
                        c.InnerText = s.SongElementByIndex(i);
                        item.AppendChild(c);
                    }
                    root.AppendChild(item);
                }
                catch (Exception e)
                {
                    MessageBox.Show(e.Message, "Error", MessageBoxButtons.OK);
                }
            }

            doc.AppendChild(root);
            using (System.IO.StreamWriter tw = new StreamWriter(File.Open(path, FileMode.OpenOrCreate), Encoding.Default))
                tw.Write(ReturnXMLAsString(doc));
        }
Example #7
0
        static void SavePlaylistToFile(StartingWindowForm t, List <FirePlayList> List)
        {
            XmlDocument  doc  = new XmlDocument();
            XmlNode      root = doc.CreateElement("PlayList");
            FirePlayList l    = new FirePlayList("Temp"); l.AddMultipleLists(List);

            if (t.StartButtonControlDown)
            {
                l.DefaultTheList();
            }
            foreach (FirePlaySong s in l.Songs)
            {
                try
                {
                    XmlNode item = doc.CreateElement("PlayItem");
                    for (int i = 0; i < FirePlaySong.Elements.Length; i++)
                    {
                        XmlNode c = doc.CreateElement(FirePlaySong.Elements[i]);
                        c.InnerText = s.SongElementByIndex(i);
                        item.AppendChild(c);
                    }
                    root.AppendChild(item);
                }
                catch (Exception e)
                {
                    MessageBox.Show(e.Message, "Error", MessageBoxButtons.OK);
                    t.Close();
                }
            }

            doc.AppendChild(root);
            using (System.IO.StreamWriter tw = new StreamWriter(File.Open(t.save_textBox.Text, FileMode.OpenOrCreate), Encoding.Default))
                doc.Save(tw);
        }
Example #8
0
        public static void SavePlaylistToFileAsPlainTextXML(FirePlayList list, string path)
        {
            XmlDocument doc  = new XmlDocument();
            XmlNode     root = doc.CreateElement("PlayList");

            list.Songs.ForEach((s) =>
            {
                try
                {
                    XmlNode item = doc.CreateElement("PlayItem");
                    for (int i = 0; i < FirePlaySong.Elements.Length; i++)
                    {
                        XmlNode c   = doc.CreateElement(FirePlaySong.Elements[i]);
                        c.InnerText = s.SongElementByIndex(i);
                        item.AppendChild(c);
                    }
                    root.AppendChild(item);
                }
                catch (Exception e)
                {
                    MessageBox.Show(e.Message, "Error", MessageBoxButtons.OK);
                }
            });

            doc.AppendChild(root);
            using (System.IO.StreamWriter tw = new System.IO.StreamWriter(System.IO.File.Open(path, System.IO.FileMode.OpenOrCreate), Encoding.Default))
                tw.Write(ReturnXMLAsString(doc));
        }
Example #9
0
        private void default_button_Click(object sender, EventArgs e)
        {
            FirePlayList l = EPClass.ExportList.Clone();

            l.DefaultTheList();
            StartingWindowForm.SavePlaylistToFileAsPlainTextXML(Location, l);
            l = null;
            //SaveList(EPClass.ExportListDefaulted);
            this.Close();
        }
Example #10
0
        public ExportClass(FirePlayList fp_list)
        {
            EXPORT_LIST = fp_list.Clone();
            EXPORT_LIST = fp_list.Clone();
            Setup(fp_list);

            ExportWindow win;

            Task.Run(() => win = new ExportWindow(this));
        }
Example #11
0
        public async void SetupParallelAsync(FirePlayList l)
        {
            List <Task <FirePlayList> > Tasks = new List <Task <FirePlayList> >();

            Tasks.Add(Task.Run(() => this.EXPORT_LIST           = l.Clone()));
            Tasks.Add(Task.Run(() => this.EXPORT_LIST_DEFAULTED = l.Clone()));

            await Task.WhenAll(Tasks);

            await Task.Run(() => EXPORT_LIST_DEFAULTED.DefaultTheList());
        }
Example #12
0
 public void DragDrop_(object sender, DragEventArgs e)
 {
     try
     {
         _files = null;
         _files = ((string[])e.Data.GetData(DataFormats.FileDrop));
         if (_files != null)
         {
             if (imported_list.Songs.Count == 0)
             {
                 imported_list = FirePlayList.CrearteFromMany(_files);
             }
             else
             {
                 bool truth = false;
                 int  ind   = -1;
                 foreach (SongView v in panel1.Controls)
                 {
                     if (v.ClientRectangle.Contains(v.PointToClient(Cursor.Position)))
                     {
                         truth = true; ind = v.Song.Index;
                     }
                 }
                 if (truth && ModifierKeys.HasFlag(Keys.Shift))
                 {
                     if (ind >= 0)
                     {
                         imported_list.Insert(ind, FirePlayList.CrearteFromMany(_files).Songs);
                     }
                 }
                 else
                 {
                     DialogResult answer = MessageBox.Show("A list is already present. Do you want to owerwrite it?", "Warnong: List Present", MessageBoxButtons.YesNoCancel);
                     if (answer == DialogResult.Yes)
                     {
                         imported_list = FirePlayList.CrearteFromMany(_files);
                     }
                     else if (answer == DialogResult.No)
                     {
                         imported_list.AddList(FirePlayList.CrearteFromMany(_files));
                     }
                 }
             }
             SongView.CurrentListImplemented = imported_list;
             Panel_Options.FirePlayList      = imported_list;
             imported_list.ListChanged      += UpdateSongViewAfterChange;
             OnFilesChanged();
         }
     }
     catch
     {
     }
 }
Example #13
0
 public async void Setup(FirePlayList l)
 {
     this.EXPORT_LIST           = l.Clone();
     this.EXPORT_LIST_DEFAULTED = l.Clone();
     EXPORT_LIST_DEFAULTED.DefaultTheList();
 }
Example #14
0
 public Clipboard(FirePlayList list)
 {
     list.Songs.ForEach((s) => Songs.Add(s.GetClone()));
 }
Example #15
0
 private void AddSongViewToPanel(FirePlayList _imported_list)
 {
     SongView.CreateSongViewFromList(_imported_list);
     UpdateSongViewAfterChange(this, new EventArgs());
 }
Example #16
0
 public async void SetFirePlayListAsync(FirePlayList list)
 {
     await Task.Run(() => FirePlayList = list);
 }
Example #17
0
 public void AddRange(FirePlayList list)
 {
     list.Songs.ForEach((s) => Songs.Add(s));
     _counter++;
 }