Example #1
0
 private void CueCompleteChanged()
 {
     if (CueComplete)
     {
         if (LoadedCue > 0)
         {
             var nextCue = Cues.Skip(LoadedCue).FirstOrDefault(cue => cue.Enabled && cue.IsConsistent);
             Plc.Upload(nextCue);
         }
     }
 }
Example #2
0
        public Stream OpenDataStream(string fileName)
        {
            AcbCueRecord cue;

            try {
                cue = Cues.Single(c => c.CueName == fileName);
            } catch (InvalidOperationException ex) {
                throw new InvalidOperationException($"File '{fileName}' is not found or it has multiple entries.", ex);
            }
            return(GetDataStreamFromCueInfo(cue, fileName));
        }
Example #3
0
        public Stream OpenDataStream(uint cueId)
        {
            AcbCueRecord cue;
            var          tempFileName = $"cue #{cueId}";

            try {
                cue = Cues.Single(c => c.CueId == cueId);
            } catch (InvalidOperationException ex) {
                throw new InvalidOperationException($"File '{tempFileName}' is not found or it has multiple entries.", ex);
            }
            return(GetDataStreamFromCueInfo(cue, tempFileName));
        }
 private void OnEventTypeChanged(object sender, RoutedEventArgs e)
 {
     if (e != null)
     {
         string ev = e.OriginalSource as string;
         if (!string.IsNullOrEmpty(ev) && Cues != null)
         {
             if (!Cues.Contains(ev))
             {
                 Cues.Add(ev);
             }
         }
     }
 }
Example #5
0
        public override void RegisterCues()
        {
            var gameState = StateManager.ActiveState as GameState; // HIGH: This stinks real bad

            if (gameState == null)
            {
                throw new ApplicationException("GameState could not be retrieved... crap.");                   //HIGH: Dont leave this here
            }
            Control.Click += (sender, args) =>
            {
                var changeStageBeat = Cues.OfType <OnClickCue>().Single().Beats.OfType <ChangeStageBeat>().Single();
                gameState.PlayTransitionVideo(changeStageBeat.TransitionVideo); // This should live in the static control's class
                // HIGH: Do we need to wait for transition video to finish? Its event subs in GameState _should_ prevent the state from showing before the transition completes
                gameState.ChangeStage(changeStageBeat.DestinationStage);
            };
        }
Example #6
0
        /// <summary>
        ///     Parses the given track URL and initializes this instance with it's data.
        /// </summary>
        /// <param name="trackUrl">The track URL to create this instance from.</param>
        private void Parse(string trackUrl)
        {
            Uri    url   = new Uri(trackUrl);
            string query = url.Query.Substring(1); //omit the question mark

            string[] items = query.Split('&');
            Dictionary <string, string> parameters = items.ToDictionary(item => item.Split('=').First(),
                                                                        item => item.Split('=').Last());

            //now go thru the parameters
            foreach (KeyValuePair <string, string> parameter in parameters)
            {
                string decodedKey   = HttpUtility.UrlDecode(parameter.Key);
                string decodedValue = HttpUtility.UrlDecode(parameter.Value);

                if (decodedKey == "media")
                {
                    MediaUrl = new Uri(decodedValue);
                }
                else if (decodedKey == "title")
                {
                    Title = decodedValue;
                }
                else if (decodedKey == "artist")
                {
                    Artist = decodedValue;
                }
                else if (decodedKey == "album")
                {
                    Album = decodedValue;
                }
                else
                {
                    double position;
                    if (Double.TryParse(decodedKey, out position))
                    {
                        Cues.Add(new Cue(position, decodedValue));
                    }
                }
            }
        }