private void Main_Timer_Tick(object sender, EventArgs e)
        {
            WebHelperResult whr = WebHelperHook.GetStatus();

            try
            {
                if (!whr.isRunning)
                {
                    StatusLabel.Text       = "Spotify is not running";
                    lastArtistName         = "N/A";
                    lblOpenSpotify.Visible = true;
                }
                else if (!whr.isPlaying)
                {
                    StatusLabel.Text = "Spotify is paused";
                    lastArtistName   = "N/A";
                }
                else // Song is playing
                {
                    if (lastArtistName != whr.artistName)
                    {
                        StatusLabel.Text = "Playing: " + whr.artistName + " - " + whr.trackName;
                        lastArtistName   = whr.artistName;
                        File.WriteAllText(Settings.Default.SaveLocation, CustomOutput(Settings.Default.OutputText));
                    }
                }
            }
            catch (Exception except)
            {
                StatusLabel.Text = "Connection Error";
                WebHelperHook.CheckWebHelper();
                Console.WriteLine(except);
                File.WriteAllText(logPath, except.ToString());
            }
        }
        public string CustomOutput(string text)
        {
            WebHelperResult whr = WebHelperHook.GetStatus();

            if (text != string.Empty)
            {
                string back;

                back = text.Replace("{artist}", whr.artistName).Replace("{song}", whr.trackName);

                return(back);
            }
            else
            {
                return(null);
            }
        }
        public MainForm()
        {
            if (!HasNet35())
            {
                MessageBox.Show(".Net Framework 3.5 not found. NPS may not work properly.", "NPS");
            }

            InitializeComponent();

            if (Settings.Default.FirstTime == 1)
            {
                Settings.Default.SaveLocation = Application.StartupPath + @"\NPS.txt";
                Settings.Default.FirstTime    = 0;
                Settings.Default.Save();
            }

            try
            {
                if (!File.Exists(jsonPath))
                {
                    File.WriteAllBytes(jsonPath, Properties.Resources.Newtonsoft_Json);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
                MessageBox.Show("Error loading NPS dependencies. Please run NPS as administrator or put NPS in a user folder.");
            }
            WebHelperResult whr = WebHelperHook.GetStatus();

            // Front Page

            enabled = false;

            if (!whr.isRunning)
            {
                StatusLabel.Text       = "Spotify is not running";
                lblOpenSpotify.Visible = true;
            }

            // Settings Page

            tbCustomizeOutput.Text = Settings.Default.OutputText;
            cbUpdate.Checked       = Properties.Settings.Default.UpdateSettings;

            if (Properties.Settings.Default.UpdateSettings == true)
            {
                CheckUpdate();
            }

            // About Page

            lblVersion.Text = "v." + Settings.Default.Version;

            // Else
            txtLocation.Text = Settings.Default.SaveLocation;

            try
            {
                if (!File.Exists(jsonPath))
                {
                    File.WriteAllBytes(jsonPath, Properties.Resources.Newtonsoft_Json);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
                MessageBox.Show("Error loading NPS dependencies. Please run NPS as administrator or put NPS in a user folder.");
            }
        }