Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #region References
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- using System.IO;
- using System.Media;
- using WMPLib;
- using System.Runtime.InteropServices;
- using System.Diagnostics;
- using System.Windows.Input;
- using System.Threading;
- using Utilities;
- using YoutubeExtractor;
- using Newtonsoft;
- using Microsoft.VisualBasic;
- using MediaToolkit;
- using VideoLibrary;
- #endregion
- namespace RohuPlayer
- {
- public partial class Form1 : Form
- {
- #region Objects and Arrays
- //Key detection
- globalKeyboardHook gkh = new globalKeyboardHook();
- //MEDIA PLAYER
- AxWMPLib.AxWindowsMediaPlayer player;
- //LABEL ARRAY
- Button[] buttons;
- //Song array cointaining all the songs in the program
- public Song[] songs;
- //Shuffle object
- Shuffle shuffle;
- #endregion
- #region Variables
- //What song is selected
- int selectedIndex = 0;
- //Next pos for button
- int nextLabelY;
- int nextLabelX;
- //If previous was pressed twice;
- int doublePrevClicks = 0;
- //If song is paused
- bool paused = false;
- //If Shuffle is activated
- bool shuffleActivated = false;
- //Current Song that is playing
- public int playing;
- //index for songs
- public int index = 0;
- //Download
- int downloadClicked = 0;
- #endregion
- #region Constructor
- public Form1()
- {
- InitializeComponent();
- #region Keyboard Hook
- //Set up keybinds
- //play
- gkh.HookedKeys.Add(Keys.F5);
- //pause
- gkh.HookedKeys.Add(Keys.F6);
- //next
- gkh.HookedKeys.Add(Keys.F7);
- //previous
- gkh.HookedKeys.Add(Keys.F8);
- //Plus 10 sec
- gkh.HookedKeys.Add(Keys.F9);
- //Minus 10 sec
- gkh.HookedKeys.Add(Keys.F10);
- //Plus 60 sec
- gkh.HookedKeys.Add(Keys.F11);
- //Minus 60 sec
- gkh.HookedKeys.Add(Keys.F12);
- //minus volume
- gkh.HookedKeys.Add(Keys.F3);
- //plus volume
- gkh.HookedKeys.Add(Keys.F4);
- gkh.KeyDown += new KeyEventHandler(gkh_KeyDown);
- gkh.KeyUp += new KeyEventHandler(gkh_KeyUp);
- #endregion
- #region Variable Initializing
- nextLabelY = 13;
- nextLabelX = 13;
- //Create song array
- songs = new Song[128];
- //Initialize media player
- player = new AxWMPLib.AxWindowsMediaPlayer();
- //Create controls for media player
- player.CreateControl();
- //Set the current volume to the programs volume bar
- trackBar1.Value = player.settings.volume;
- //Init labels array
- buttons = new Button[128];
- #endregion
- #region File reading
- ReadFile();
- #endregion
- #region Buttons
- CreateSongListOS();
- //Buttons that are out of a certain area are made invisible
- ButtonVisibility();
- #endregion
- }
- #endregion
- #region Keyboard Hook Functions
- void gkh_KeyUp(object sender, KeyEventArgs e)
- {
- e.Handled = true;
- }
- void gkh_KeyDown(object sender, KeyEventArgs e)
- {
- switch (e.KeyCode)
- {
- case Keys.F3:
- if (player.currentMedia != null)
- {
- if (player.settings.volume - 2 >= 0)
- {
- player.settings.volume -= 2;
- trackBar1.Value = player.settings.volume;
- }
- }
- break;
- case Keys.F4:
- if (player.currentMedia != null)
- {
- if (player.settings.volume + 2 <= 100)
- {
- player.settings.volume += 2;
- trackBar1.Value = player.settings.volume;
- }
- }
- break;
- case Keys.F5:
- //Play
- button2.PerformClick();
- break;
- case Keys.F6:
- //Pause
- button4.PerformClick();
- break;
- case Keys.F7:
- //Previous song
- button9.PerformClick();
- break;
- case Keys.F8:
- //Next song
- button8.PerformClick();
- break;
- case Keys.F9:
- //plus 10
- button3.PerformClick();
- break;
- case Keys.F10:
- //minus 10
- button5.PerformClick();
- break;
- case Keys.F11:
- //plus 60
- button11.PerformClick();
- break;
- case Keys.F12:
- //minus 60
- button10.PerformClick();
- break;
- }
- e.Handled = true;
- }
- #endregion
- #region Run-Time Button
- private void songButton_Click(object sender, EventArgs e)
- {
- int index = 0;
- foreach (Button b in buttons)
- {
- if (sender == buttons[index])
- {
- selectedIndex = index;
- }
- index++;
- }
- }
- #endregion
- #region Control Buttons
- //Add Song
- private void button1_Click(object sender, EventArgs e)
- {
- //If the song is already in the list
- bool copy = false;
- //Make new song
- Song song = new Song();
- //For every song check if there is a duplicate
- copy = CheckDuplicate(song);
- if (song.success)
- {
- songs[index] = song;
- index++;
- Reload();
- }
- //If its a duplicate
- if (copy)
- {
- //Get the song to remove
- int songToRemove = -1;
- for (int i = 0; i < songs.Length; i++)
- {
- if (buttons[i] == null)
- {
- songToRemove = i - 1;
- break;
- }
- }
- //Remove Buttons
- RemoveButtons();
- //Remove The song
- RemoveSong(songToRemove);
- //Create a new list of songs on screen
- CreateSongListOS();
- //Highlight Selected Index
- HighLightText(selectedIndex);
- //Reload screen
- Reload();
- }
- }
- //Remove Song
- private void button6_Click(object sender, EventArgs e)
- {
- //Song index to remove
- int songToRemove = selectedIndex;
- //Double Check
- DialogResult dialogResult = MessageBox.Show("Do you want to remove the song: " + songs[songToRemove].name, "Remove Song?", MessageBoxButtons.YesNo);
- if (dialogResult == DialogResult.Yes)
- {
- //Remove song buttons
- RemoveButtons();
- //Remove The song
- ReWriteFile(songToRemove);
- //Reload Buttons
- CreateSongListOS();
- //Stop current song
- player.Ctlcontrols.stop();
- player.URL = songs[0].directory;
- //Reload
- Reload();
- }
- }
- //Play Button
- private void button2_Click(object sender, EventArgs e)
- {
- if (paused)
- {
- player.Ctlcontrols.play();
- paused = false;
- return;
- }
- if (selectedIndex <= songs.Length && selectedIndex >= 0 && songs[selectedIndex] != null)
- {
- HighLightText(selectedIndex);
- //Set new song up
- player.URL = songs[selectedIndex].directory;
- playing = selectedIndex;
- //Start the current second timer.
- timer2.Start();
- //Delay timer1 for 2 sec, because it does not work otherwise.
- timer3.Start();
- //Play
- player.Ctlcontrols.play();
- }
- else
- {
- player.Ctlcontrols.play();
- }
- }
- //Pause Button
- private void button4_Click(object sender, EventArgs e)
- {
- if(player.currentMedia != null)
- {
- paused = true;
- player.Ctlcontrols.pause();
- }
- }
- //+10 seconds
- private void button5_Click(object sender, EventArgs e)
- {
- if (player.currentMedia != null && player.Ctlcontrols.currentPosition + 10 < player.currentMedia.duration)
- {
- player.Ctlcontrols.currentPosition += 10;
- }
- }
- //-10 seconds
- private void button3_Click(object sender, EventArgs e)
- {
- if (player.currentMedia != null && player.Ctlcontrols.currentPosition - 10 > 0)
- {
- player.Ctlcontrols.currentPosition -= 10;
- }
- else if (player.currentMedia != null && (int)player.Ctlcontrols.currentPosition <= 10)
- {
- player.Ctlcontrols.currentPosition = 0;
- }
- }
- //Shuffle songs
- private void button7_Click(object sender, EventArgs e)
- {
- shuffleActivated = !shuffleActivated;
- shuffle = new Shuffle(ref songs);
- if (shuffleActivated)
- {
- //Stop Current Song
- player.Ctlcontrols.stop();
- //Set selected index to shuffle objects current song
- selectedIndex = shuffle.currentSong;
- //Update song URL
- player.URL = songs[shuffle.currentSong].directory;
- //Start Timers
- timer2.Start();
- //Delay timer1 for 2 sec, because it does not work otherwise.
- timer3.Start();
- timer4.Start();
- //Highlight Current Song
- HighLightText(selectedIndex);
- }
- }
- //Next Song
- private void button8_Click(object sender, EventArgs e)
- {
- playing++;
- if (shuffleActivated)
- {
- shuffle.Next(ref player);
- player.URL = songs[shuffle.currentSong].directory;
- player.Ctlcontrols.play();
- HighLightText(shuffle.currentSong);
- return;
- }
- if (songs[playing] == null)
- {
- playing--;
- }
- else
- {
- if(playing > 8)
- {
- button13.PerformClick();
- }
- player.URL = songs[playing].directory;
- player.Ctlcontrols.play();
- }
- HighLightText(playing);
- }
- //Previous Song
- private void button9_Click(object sender, EventArgs e)
- {
- doublePrevClicks++;
- if (doublePrevClicks >= 2)
- {
- playing--;
- if (playing < 0)
- {
- playing = 0;
- }
- else
- {
- button12.PerformClick();
- player.URL = songs[playing].directory;
- player.Ctlcontrols.play();
- doublePrevClicks = 0;
- }
- }
- else
- {
- player.Ctlcontrols.stop();
- player.Ctlcontrols.play();
- }
- HighLightText(playing);
- }
- //+60 seconds
- private void button10_Click(object sender, EventArgs e)
- {
- if (player.currentMedia != null && player.Ctlcontrols.currentPosition + 60 < player.currentMedia.duration)
- {
- player.Ctlcontrols.currentPosition += 60;
- }
- }
- //-60 seconds
- private void button11_Click(object sender, EventArgs e)
- {
- if (player.currentMedia != null && player.Ctlcontrols.currentPosition - 60 > 0)
- {
- player.Ctlcontrols.currentPosition -= 60;
- }
- else if (player.currentMedia != null && (int)player.Ctlcontrols.currentPosition <= 60)
- {
- player.Ctlcontrols.currentPosition = 0;
- }
- }
- //Scroll Up
- private void button12_Click(object sender, EventArgs e)
- {
- int songCount = GetSongCount();
- if(buttons[0].Location.Y == 13)
- {
- return;
- }
- if (songCount > 9)
- {
- foreach (Button b in buttons)
- {
- if (b != null)
- {
- b.Location = new Point(b.Location.X, b.Location.Y + 15);
- }
- }
- }
- ButtonVisibility();
- }
- //Scroll Down
- private void button13_Click(object sender, EventArgs e)
- {
- int lastSongIndex = -1;
- for (int i = 0; i < buttons.Length; i++)
- {
- if (buttons[i] == null)
- {
- lastSongIndex = i - 1;
- break;
- }
- }
- //13 + 15 * 8 = 133, if the last song reaches that then dont go any further.
- if(buttons[lastSongIndex].Location.Y == 133)
- {
- return;
- }
- int songCount = GetSongCount();
- if (songCount > 9)
- {
- foreach (Button b in buttons)
- {
- if (b != null)
- {
- b.Location = new Point(b.Location.X, b.Location.Y - 15);
- }
- }
- }
- ButtonVisibility();
- }
- //Download Button
- private async void button14_Click(object sender, EventArgs e)
- {
- downloadClicked++;
- if(downloadClicked == 3)
- {
- label3.Visible = false;
- txtUrl.Visible = false;
- downloadClicked = 0;
- return;
- }
- if(downloadClicked == 1)
- {
- label3.Visible = true;
- txtUrl.Visible = true;
- return;
- }
- using (FolderBrowserDialog fbd = new FolderBrowserDialog())
- {
- label3.Text = "STATUS: SELECTING FOLDER";
- fbd.ShowDialog();
- if (fbd.SelectedPath == null)
- {
- return;
- }
- try
- {
- label3.Text = "STATUS: DOWNLOADING";
- var youtube = YouTube.Default;
- var video = await youtube.GetVideoAsync(txtUrl.Text);
- string path = fbd.SelectedPath + @"\" + video.FullName;
- File.WriteAllBytes(path, await video.GetBytesAsync());
- Song s = new Song(fbd.SelectedPath + @"\" + video.FullName);
- //save the songs address to the list
- using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"Songs.txt", true))
- {
- file.WriteLine(s.directory);
- }
- Reload();
- label3.Text = "STATUS: SUCCESS";
- } catch(Exception ee)
- {
- label3.Text = "STATUS: ";
- MessageBox.Show(ee.Message);
- }
- }
- }
- #endregion
- #region Custom Functions
- //Duration to look better on screen
- string DurationToMin()
- {
- int minutes = 0;
- int seconds = 0;
- int duration = (int)player.currentMedia.duration;
- string toReturn;
- if(player.currentMedia != null)
- {
- if(duration <= 59 && duration >= 0)
- {
- if(duration <= 9)
- {
- toReturn = "00:0" + duration;
- return toReturn;
- } else
- {
- toReturn = "00:" + duration;
- return toReturn;
- }
- } else
- {
- do
- {
- duration -= 60;
- minutes++;
- } while (duration - 60 >= 60);
- duration = (int)player.currentMedia.duration;
- seconds = duration - (minutes * 60);
- if (seconds >= 60)
- {
- minutes++;
- seconds = duration - (minutes * 60);
- }
- if (minutes <= 9)
- {
- if (seconds <= 9)
- {
- toReturn = "0" + minutes + ":0" + seconds;
- return toReturn;
- }
- else
- {
- toReturn = "0" + minutes + ":" + seconds;
- return toReturn;
- }
- }
- else
- {
- if (seconds <= 9)
- {
- toReturn = minutes + ":0" + seconds;
- return toReturn;
- }
- else
- {
- toReturn = minutes + ":" + seconds;
- return toReturn;
- }
- }
- }
- }
- return "";
- }
- //Make seconds look better on screen
- string SecToMin()
- {
- int minutes = 0;
- int seconds = 0;
- string toReturn;
- if (player.currentMedia != null)
- {
- int pos = (int)player.Ctlcontrols.currentPosition;
- //Under a Minute
- if(pos <= 59 && pos >= 0)
- {
- if(pos <= 9)
- {
- toReturn = "00:0" + pos;
- return toReturn;
- }else
- {
- toReturn = "00:" + pos;
- return toReturn;
- }
- }
- else
- {
- do
- {
- pos -= 60;
- minutes++;
- } while (pos - 60 >= 60);
- pos = (int)player.Ctlcontrols.currentPosition;
- seconds = pos - (minutes * 60);
- if(seconds >= 60)
- {
- minutes++;
- seconds = pos - (minutes * 60);
- }
- Console.WriteLine(minutes + " " +seconds);
- if (minutes <= 9)
- {
- if (seconds <= 9)
- {
- toReturn = "0" + minutes+ ":0" + seconds;
- return toReturn;
- }
- else
- {
- toReturn = "0" + minutes + ":" + seconds;
- return toReturn;
- }
- } else
- {
- if (seconds <= 9)
- {
- toReturn = minutes + ":0" + seconds;
- return toReturn;
- }
- else
- {
- toReturn = minutes + ":" + seconds;
- return toReturn;
- }
- }
- }
- }
- return "";
- }
- //Remove all song buttons
- void RemoveButtons()
- {
- //Clear Controls
- foreach (Button b in buttons)
- {
- Controls.Remove(b);
- }
- }
- //Read a file in normally
- void ReadFile()
- {
- index = 0;
- //ReRead the text file and create new array
- //create text file if it doesnt exist, if it does load all the songs in.
- if (System.IO.File.Exists(@"Songs.txt"))
- {
- string[] lines = System.IO.File.ReadAllLines(@"Songs.txt");
- foreach (string line in lines)
- {
- Song song = new Song(line);
- songs[index] = song;
- index++;
- }
- }
- else
- {
- System.IO.File.Create(@"Songs.txt");
- }
- }
- //Write a new file without a specific song
- void ReWriteFile(int songToRemove)
- {
- //Create a new writer
- using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"Songs.txt", false))
- {
- //New song array to put in text file
- string[] dirs = new string[128];
- //Go through all songs
- for (int i = 0; i < songs.Length; i++)
- {
- //If the song exists and it is not the song to remove, if it is then skip it.
- if (songs[i] != null && i != songToRemove)
- {
- //Write it to the new file
- dirs[i] = songs[i].directory;
- file.WriteLine(dirs[i]);
- }
- }
- }
- }
- //Check Duplicate
- bool CheckDuplicate(Song song)
- {
- foreach (Song s in songs)
- {
- if (s != null)
- {
- if (s.name == song.name)
- {
- DialogResult dialogResult = MessageBox.Show("The song: " + song.name + " is already added. Do you still want to add it?", "Duplicate Found", MessageBoxButtons.YesNo);
- if (dialogResult == DialogResult.Yes)
- {
- return false;
- }
- if (dialogResult == DialogResult.No)
- {
- return true;
- }
- }
- }
- }
- return false;
- }
- //Create list of songs on screen
- void CreateSongListOS()
- {
- //Create list of songs on screen
- int songIndex = 0;
- foreach (Song a in songs)
- {
- if (a != null)
- {
- Button b = new Button();
- #region Button Config
- b.AutoSize = false;
- b.Font = new Font("Microsoft Sans Serif", 8);
- b.UseMnemonic = false;
- b.BackColor = Color.Transparent;
- b.ForeColor = Color.Transparent;
- b.Location = new Point(nextLabelX, nextLabelY);
- b.Size = new Size(385, 20);
- b.FlatStyle = FlatStyle.Flat;
- b.FlatAppearance.BorderSize = 0;
- b.TextAlign = ContentAlignment.MiddleLeft;
- b.Text = a.name;
- nextLabelY += 15;
- button1.Name = "Button";
- b.Click += new EventHandler(songButton_Click);
- #endregion
- Controls.Add(b);
- buttons[songIndex] = b;
- songIndex++;
- }
- }
- }
- //Remove Song
- void RemoveSong(int songToRemove)
- {
- //Create a new writer
- using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"Songs.txt", false))
- {
- //New song array to put in text file
- string[] dirs = new string[128];
- //Go through all songs
- for (int i = 0; i < songs.Length; i++)
- {
- //If the song exists and it is not the song to remove, if it is then skip it.
- if (songs[i] != null && i != songToRemove)
- {
- //Write it to the new file
- dirs[i] = songs[i].directory;
- file.WriteLine(dirs[i]);
- }
- }
- }
- }
- //If button is outside bounds make it invisible
- void ButtonVisibility()
- {
- //From that point the songs will be invisible
- int buttonRange = 140;
- foreach (Button b in buttons)
- {
- if (b != null)
- {
- int y = b.Location.Y;
- if (y > buttonRange)
- {
- b.Visible = false;
- }
- }
- }
- foreach (Button b in buttons)
- {
- if (b != null)
- {
- int y = b.Location.Y;
- if (y < buttonRange)
- {
- b.Visible = true;
- }
- }
- }
- }
- //Reload all songs from file
- void Reload()
- {
- selectedIndex = 0;
- nextLabelY = 13;
- //Reset songs array
- for (int i = 0; i < songs.Length; i++)
- {
- if (songs[i] != null)
- {
- songs[i] = null;
- }
- }
- ReadFile();
- RemoveButtons();
- CreateSongListOS();
- ButtonVisibility();
- player.Ctlcontrols.stop();
- }
- //Get the song Count in songs array
- int GetSongCount()
- {
- int songCount = 0;
- foreach (Song s in songs)
- {
- if (s != null)
- {
- songCount++;
- }
- }
- return songCount;
- }
- //Highlight a song
- void HighLightText(int songToHighlight)
- {
- int index = 0;
- foreach (Button b in buttons)
- {
- if (b != null)
- {
- if (index == songToHighlight)
- {
- b.ForeColor = Color.Red;
- }
- else
- {
- b.ForeColor = Color.White;
- }
- }
- index++;
- }
- }
- #endregion
- #region Timers
- //Update progress bar
- private void timer1_Tick(object sender, EventArgs e)
- {
- if (player.currentMedia != null)
- {
- //Set max size for progress bar
- progressBar1.Maximum = (int)player.currentMedia.duration;
- //Current pos on progress
- progressBar1.Value = (int)player.Ctlcontrols.currentPosition;
- //Update progressbar
- progressBar1.Update();
- //If the song is over stop the timer.
- if ((int)player.currentMedia.duration >= (int)player.Ctlcontrols.currentPosition)
- {
- timer1.Stop();
- }
- }
- }
- //This updates song stats, current time(s) and duration(s)
- private void timer2_Tick(object sender, EventArgs e)
- {
- if (player.currentMedia != null)
- {
- //make them int so it looks nice
- int currentSec = (int)player.Ctlcontrols.currentPosition;
- int duration = (int)player.currentMedia.duration;
- //Update text
- label1.Text = DurationToMin();
- label2.Text = SecToMin();
- }
- }
- //Delay progress bar launch
- private void timer3_Tick(object sender, EventArgs e)
- {
- timer1.Start();
- }
- //Shuffle Timer
- private void timer4_Tick(object sender, EventArgs e)
- {
- if (shuffleActivated)
- {
- if ((int)player.Ctlcontrols.currentPosition == (int)player.currentMedia.duration - 1)
- {
- shuffle.Next(ref player);
- player.URL = songs[shuffle.currentSong].directory;
- player.Ctlcontrols.play();
- HighLightText(shuffle.currentSong);
- }
- }
- }
- //AutoPlay Timer
- private void timer7_Tick(object sender, EventArgs e)
- {
- if (!shuffleActivated)
- {
- if(player.currentMedia != null)
- {
- if ((int)player.Ctlcontrols.currentPosition == (int)player.currentMedia.duration - 1)
- {
- if (songs[selectedIndex + 1] != null)
- {
- selectedIndex += 1;
- player.URL = songs[selectedIndex].directory;
- HighLightText(selectedIndex);
- player.Ctlcontrols.play();
- } else
- {
- player.Ctlcontrols.stop();
- }
- }
- }
- }
- }
- #endregion
- #region Volume
- //TRACKBAR - Volume slider.
- private void trackBar1_Scroll(object sender, EventArgs e)
- {
- player.settings.volume = trackBar1.Value;
- }
- #endregion
- #region Classes
- //Shuffle Class
- public class Shuffle
- {
- #region Variables
- public int currentSong;
- int[] songList;
- int songCount;
- Random random;
- public int index;
- #endregion
- #region Functions
- public void Next(ref AxWMPLib.AxWindowsMediaPlayer player)
- {
- if (index == songList.Length - 1)
- {
- player.Ctlcontrols.stop();
- return;
- }
- if (index < songList.Length)
- {
- currentSong = songList[++index];
- }
- }
- void reshuffle(int[] indexes)
- {
- // Knuth shuffle algorithm :: courtesy of Wikipedia :)
- for (int t = 0; t < indexes.Length; t++)
- {
- int tmp = indexes[t];
- int r = random.Next(t, indexes.Length - 1);
- indexes[t] = indexes[r];
- indexes[r] = tmp;
- }
- }
- #endregion
- #region Constructor
- public Shuffle(ref Song[] songs)
- {
- index = 0;
- random = new Random();
- //Get song count
- for (int i = 0; i < songs.Length; i++)
- {
- if (songs[i] != null)
- {
- songCount++;
- }
- }
- songList = new int[songCount];
- for (int i = 0; i < songCount; i++)
- {
- songList[i] = i;
- }
- //Rearrange songList Array
- reshuffle(songList);
- //Set current song
- currentSong = songList[index];
- Console.WriteLine("ORDER OF SHUFFLE: ");
- for (int i = 0; i < songList.Length; i++)
- {
- Console.WriteLine(songList[i]);
- }
- }
- #endregion
- }
- //Song Class
- public class Song
- {
- #region Variables
- public string name;
- public string directory;
- public bool success = false;
- public bool playing = false;
- #endregion
- #region Constructors
- public Song()
- {
- //For opening a file
- OpenFileDialog openFile = new OpenFileDialog();
- //Show windows explorer and open file
- if (openFile.ShowDialog() == DialogResult.OK)
- {
- //Init variables
- directory = openFile.FileName;
- name = openFile.SafeFileName;
- //save the songs address to the list
- using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"Songs.txt", true))
- {
- file.WriteLine(directory);
- }
- success = true;
- }
- else
- {
- success = false;
- }
- }
- //Alternative constructor for a song. This is for loading in a song from the text file.
- public Song(string directory)
- {
- OpenFileDialog openFile = new OpenFileDialog();
- openFile.FileName = directory;
- this.name = openFile.SafeFileName;
- this.directory = directory;
- }
- #endregion
- }
- #endregion
- #region Random Unused
- //Duration of the song
- private void label1_Click(object sender, EventArgs e)
- {
- }
- //currentSec
- private void label2_Click(object sender, EventArgs e)
- {
- }
- //Progress bar showing how far the song is
- public void progressBar1_Click(object sender, EventArgs e)
- {
- }
- //Necessary >D
- private void Form1_Load(object sender, EventArgs e)
- {
- label3.Visible = false;
- txtUrl.Visible = false;
- timer7.Start();
- }
- private void txtUrl_TextChanged(object sender, EventArgs e)
- {
- }
- private void label3_Click(object sender, EventArgs e)
- {
- }
- #endregion
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement