Exemplo n.º 1
0
        public void OnRegisterNewChannelSuccesful(RequestSuccesfulEventArgs args)
        {
            Channel.Channel channel = ChannelManager.GetChannelById(args.TempId);

            if (args.Accepted)
            {
                if (channel == null)
                {
                    channel.SendRegisterChannelRequestSuccesful(false, args.Id);
                    Console.WriteLine("New channel request wasn't succesful!");
                    return;
                }

                SharpFly_Packet_Library.Helper.Cluster cluster = new SharpFly_Packet_Library.Helper.Cluster();
                cluster.Id = ClusterId;
                channel.ChannelData.Parent = cluster;
                channel.ChannelData.Id     = args.Id;

                channel.SendRegisterChannelRequestSuccesful(args.Accepted, args.Id);
                Console.WriteLine("New channel request succesful!");
                return;
            }

            channel.SendRegisterChannelRequestSuccesful(false, args.Id);
            Console.WriteLine("New channel request wasn't succesful!");
        }
Exemplo n.º 2
0
 private void InitializeIdListFromChannel(Channel.Channel channel)
 {
     foreach (var item in channel.Items)
     {
         IdList.Add(item.Id.VideoId);
     }
 }
Exemplo n.º 3
0
        public async Task DownLoad()
        {
            string link       = GetStringForChannel();
            var    stringTask = HttpClient.GetStringAsync(link);
            string json       = await stringTask;

            Channel.Channel channel = GetMediaObject(json);
            InitializeIdListFromChannel(channel);
            ChannelTitle = channel.Items[0].Snippet.ChannelTitle;
            Download(IdList, ChannelTitle);
        }
Exemplo n.º 4
0
        public void PlayDsp(Dsp.Dsp dsp, bool paused, Channel.Channel chn)
        {
            IntPtr channel = chn.DangerousGetHandle();

            Error.Code ReturnCode = PlayDsp(this.DangerousGetHandle(), Channel.Index.Reuse, dsp.DangerousGetHandle(), paused, ref channel);
            Error.Errors.ThrowError(ReturnCode);

            //This can't really happend.
            //Check just in case...
            if (chn.DangerousGetHandle() != channel)
            {
                throw new Exception("Channel handle got changed by Fmod.");
            }
        }
Exemplo n.º 5
0
 /// <summary>Constructor for follow</summary>
 public Follow(string apiResponse, bool successful = true)
 {
     IsFollowing = successful;
     if (successful)
     {
         JObject json = JObject.Parse(apiResponse);
         CreatedAt        = Convert.ToDateTime(json.SelectToken("created_at").ToString());
         TimeSinceCreated = DateTime.UtcNow - CreatedAt;
         if ((bool)json.SelectToken("notifications"))
         {
             Notifications = true;
         }
         Channel = new Channel.Channel(json.SelectToken("channel"));
     }
 }
Exemplo n.º 6
0
        private void PlaySound(Sound.Sound snd, bool paused, Channel.Channel chn)
        {
            //FIXME The handle is changed most of the time on some system.
            //Only use the other metods to be safe.

            IntPtr channel = chn.DangerousGetHandle();

            Error.Code ReturnCode = PlaySound(this.DangerousGetHandle(), Channel.Index.Reuse, snd.DangerousGetHandle(), paused, ref channel);
            Error.Errors.ThrowError(ReturnCode);

            //This can't really happend.
            //Check just in case...
            if (chn.DangerousGetHandle() == channel)
            {
                throw new Exception("Channel handle got changed by Fmod.");
            }
        }
Exemplo n.º 7
0
        /// <summary>Stream object constructor.</summary>
        public Stream(JToken twitchStreamData)
        {
            bool   isPlaylist;
            long   id;
            int    viewers, videoHeight, delay;
            double averageFps;

            if (bool.TryParse(twitchStreamData.SelectToken("is_playlist").ToString(), out isPlaylist) && isPlaylist)
            {
                IsPlaylist = true;
            }
            if (long.TryParse(twitchStreamData.SelectToken("_id").ToString(), out id))
            {
                Id = id;
            }
            if (int.TryParse(twitchStreamData.SelectToken("viewers").ToString(), out viewers))
            {
                Viewers = viewers;
            }
            if (int.TryParse(twitchStreamData.SelectToken("video_height").ToString(), out videoHeight))
            {
                VideoHeight = videoHeight;
            }
            if (int.TryParse(twitchStreamData.SelectToken("delay").ToString(), out delay))
            {
                Delay = delay;
            }
            if (double.TryParse(twitchStreamData.SelectToken("average_fps").ToString(), out averageFps))
            {
                AverageFps = averageFps;
            }

            Game             = twitchStreamData.SelectToken("game").ToString();
            CreatedAt        = Common.Helpers.DateTimeStringToObject(twitchStreamData.SelectToken("created_at").ToString());
            TimeSinceCreated = DateTime.UtcNow - CreatedAt;
            Channel          = new Channel.Channel((JObject)twitchStreamData.SelectToken("channel"));
            Preview          = new Preview(twitchStreamData.SelectToken("preview"));
        }