public void Init(object sender, EventArgs e) { string PreShow = File.ReadAllLines("./ShowData.txt")[0]; string Show = File.ReadAllLines("./ShowData.txt")[1]; string PostShow = File.ReadAllLines("./ShowData.txt")[2]; bool ShowTime = Boolean.Parse(File.ReadAllLines("./ShowData.txt")[5]); TimeSpan TimeVariance = GetVariance(); string StartValue = File.ReadAllLines("./ShowData.txt")[3]; DateTime StartTime = DateTime.Parse(File.ReadAllLines("./ShowData.txt")[3]) - TimeVariance; DateTime EndTime = DateTime.Parse(File.ReadAllLines("./ShowData.txt")[4]) - TimeVariance; if (ShowTime) { MessageBox.Show(DateTime.UtcNow.ToString()); } if (ShowTime) { MessageBox.Show((DateTime.Parse(File.ReadAllLines("./ShowData.txt")[3]) - TimeVariance).ToString()); } Streamer.URL = PreShow; Application.DoEvents(); this.Refresh(); Streamer.Refresh(); VolumeSlider.Refresh(); while (DateTime.UtcNow < StartTime) { try { WaitTimer.Text = "The Show will begin in: " + Math.Abs((DateTime.UtcNow - StartTime).Days).ToString() + " Days, " + Math.Abs((DateTime.UtcNow - StartTime).Hours).ToString() + " Hours, " + Math.Abs((DateTime.UtcNow - StartTime).Minutes).ToString() + " Minutes, " + Math.Abs((DateTime.UtcNow - StartTime).Seconds).ToString() + " Seconds."; } catch (Exception exception) { MessageBox.Show(exception.ToString()); } Application.DoEvents(); } WaitTimer.Text = ""; if (DateTime.UtcNow > EndTime) { WaitTimer.Text = "The Stream has ended."; return; } Streamer.URL = Show; Streamer.Ctlcontrols.currentPosition = 0; Streamer.Ctlcontrols.pause(); Streamer.settings.volume = 100; if (DateTime.UtcNow > StartTime && DateTime.UtcNow < EndTime) { Streamer.Ctlcontrols.currentPosition = (DateTime.UtcNow - StartTime).TotalSeconds; } while (DateTime.UtcNow >= StartTime && DateTime.UtcNow <= EndTime) { string mins = (DateTime.UtcNow - StartTime).Minutes.ToString(); if (mins.Length == 1) { mins = "0" + mins; } string secs = (DateTime.UtcNow - StartTime).Seconds.ToString(); if (secs.Length == 1) { secs = "0" + secs; } WaitTimer.Text = mins + ":" + secs; Application.DoEvents(); } Streamer.URL = PostShow; WaitTimer.Text = "The Stream has ended."; WaitTimer.ForeColor = System.Drawing.Color.Red; }