当前位置: 首页>>代码示例>>C#>>正文


C# AtomCollection.SetChanInfoGenre方法代码示例

本文整理汇总了C#中AtomCollection.SetChanInfoGenre方法的典型用法代码示例。如果您正苦于以下问题:C# AtomCollection.SetChanInfoGenre方法的具体用法?C# AtomCollection.SetChanInfoGenre怎么用?C# AtomCollection.SetChanInfoGenre使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AtomCollection的用法示例。


在下文中一共展示了AtomCollection.SetChanInfoGenre方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: BroadcastStart_Click

 private void BroadcastStart_Click(object sender, EventArgs args)
 {
   Uri source;
   if (Uri.TryCreate(bcStreamUrl.Text, UriKind.Absolute, out source)) {
     StreamSource = source;
   }
   else {
     StreamSource = null;
   }
   var reader = bcContentType.SelectedItem as ContentReaderItem;
   if (reader!=null) ContentReaderFactory = reader.ContentReaderFactory;
   var yp = bcYP.SelectedItem as YellowPageItem;
   if (yp!=null) YellowPage = yp.YellowPage;
   var info = new AtomCollection();
   int bitrate;
   if (Int32.TryParse(bcBitrate.Text, out bitrate)) {
     info.SetChanInfoBitrate(bitrate);
   }
   info.SetChanInfoName(bcChannelName.Text);
   info.SetChanInfoGenre(bcGenre.Text);
   info.SetChanInfoDesc(bcDescription.Text);
   info.SetChanInfoComment(bcComment.Text);
   info.SetChanInfoURL(bcContactUrl.Text);
   ChannelInfo = new ChannelInfo(info);
   var track = new AtomCollection();
   track.SetChanTrackTitle(bcTrackTitle.Text);
   track.SetChanTrackGenre(bcTrackGenre.Text);
   track.SetChanTrackAlbum(bcAlbum.Text);
   track.SetChanTrackCreator(bcCreator.Text);
   track.SetChanTrackURL(bcTrackURL.Text);
   ChannelTrack = new ChannelTrack(track);
   if (StreamSource!=null && ContentReaderFactory!=null && !String.IsNullOrEmpty(ChannelInfo.Name)) {
     DialogResult = DialogResult.OK;
   }
 }
开发者ID:kumaryu,项目名称:peercaststation,代码行数:35,代码来源:BroadcastDialog.cs

示例2: ChannelInfoViewModel

        public ChannelInfoViewModel()
        {
            update = new Command(() =>
            {
              var info = new AtomCollection(channel.ChannelInfo.Extra);
              info.SetChanInfoGenre(genre);
              info.SetChanInfoDesc(description);
              info.SetChanInfoURL(contactUrl);
              info.SetChanInfoComment(comment);
              channel.ChannelInfo = new ChannelInfo(info);

              var track = new AtomCollection(channel.ChannelTrack.Extra);
              track.SetChanTrackAlbum(trackAlbum);
              track.SetChanTrackCreator(trackArtist);
              track.SetChanTrackTitle(trackTitle);
              track.SetChanTrackGenre(trackGenre);
              track.SetChanTrackURL(trackUrl);
              channel.ChannelTrack = new ChannelTrack(track);
              IsModified = false;
            },
            () => channel!=null && IsTracker && IsModified);
        }
开发者ID:psjp,项目名称:peercaststation,代码行数:22,代码来源:ChannelInfoViewModel.cs

示例3: BroadcastChannel

      private string BroadcastChannel(
        int?    yellowPageId,
        string  sourceUri,
        string  contentReader,
        JObject info,
        JObject track,
        string  sourceStream=null)
      {
        IYellowPageClient yp = null;
        if (yellowPageId.HasValue) {
          yp = PeerCast.YellowPages.FirstOrDefault(y => GetObjectId(y)==yellowPageId.Value);
          if (yp==null) throw new RPCError(RPCErrorCode.InvalidParams, "Yellow page not found");
        }
        if (sourceUri==null) throw new RPCError(RPCErrorCode.InvalidParams, "source uri required");
        Uri source;
        try {
          source = new Uri(sourceUri);
        }
        catch (UriFormatException) {
          throw new RPCError(RPCErrorCode.InvalidParams, "Invalid Uri");
        }
        var content_reader = PeerCast.ContentReaderFactories.FirstOrDefault(reader => reader.Name==contentReader);
        if (content_reader==null) throw new RPCError(RPCErrorCode.InvalidParams, "Content reader not found");
        var source_stream = PeerCast.SourceStreamFactories
          .Where(sstream => (sstream.Type & SourceStreamType.Broadcast)!=0)
          .FirstOrDefault(sstream => sstream.Name==sourceStream);
        if (source_stream==null) {
          source_stream = PeerCast.SourceStreamFactories
            .Where(sstream => (sstream.Type & SourceStreamType.Broadcast)!=0)
            .FirstOrDefault(sstream => sstream.Scheme==source.Scheme);
        }
        if (source_stream==null) throw new RPCError(RPCErrorCode.InvalidParams, "Source stream not found");

        var new_info = new AtomCollection();
        if (info!=null) {
          info.TryGetThen("name",    v => new_info.SetChanInfoName(v));
          info.TryGetThen("url",     v => new_info.SetChanInfoURL(v));
          info.TryGetThen("genre",   v => new_info.SetChanInfoGenre(v));
          info.TryGetThen("desc",    v => new_info.SetChanInfoDesc(v));
          info.TryGetThen("comment", v => new_info.SetChanInfoComment(v));
        }
        var channel_info  = new ChannelInfo(new_info);
        if (channel_info.Name==null || channel_info.Name=="") {
          throw new RPCError(RPCErrorCode.InvalidParams, "Channel name must not be empty");
        }
        var channel_id = PeerCastStation.Core.BroadcastChannel.CreateChannelID(
          PeerCast.BroadcastID,
          channel_info.Name,
          channel_info.Genre ?? "",
          source.ToString());
        var channel = PeerCast.BroadcastChannel(yp, channel_id, channel_info, source, source_stream, content_reader);
        if (track!=null) {
          var new_track = new AtomCollection(channel.ChannelTrack.Extra);
          track.TryGetThen("name",    v => new_track.SetChanTrackTitle(v));
          track.TryGetThen("genre",   v => new_track.SetChanTrackGenre(v));
          track.TryGetThen("album",   v => new_track.SetChanTrackAlbum(v));
          track.TryGetThen("creator", v => new_track.SetChanTrackCreator(v));
          track.TryGetThen("url",     v => new_track.SetChanTrackURL(v));
          channel.ChannelTrack = new ChannelTrack(new_track);
        }
        return channel.ChannelID.ToString("N").ToUpper();
      }
开发者ID:kumaryu,项目名称:peercaststation,代码行数:62,代码来源:APIHost.cs

示例4: SetChannelInfo

 private void SetChannelInfo(string channelId, JObject info, JObject track)
 {
   var channel = GetChannel(channelId);
   if (channel!=null && channel.IsBroadcasting) {
     if (info!=null) {
       var new_info = new AtomCollection(channel.ChannelInfo.Extra);
       if (info["name"]!=null)    new_info.SetChanInfoName((string)info["name"]);
       if (info["url"]!=null)     new_info.SetChanInfoURL((string)info["url"]);
       if (info["genre"]!=null)   new_info.SetChanInfoGenre((string)info["genre"]);
       if (info["desc"]!=null)    new_info.SetChanInfoDesc((string)info["desc"]);
       if (info["comment"]!=null) new_info.SetChanInfoComment((string)info["comment"]);
       channel.ChannelInfo = new ChannelInfo(new_info);
     }
     if (track!=null) {
       var new_track = new AtomCollection(channel.ChannelTrack.Extra);
       if (track["name"]!=null)    new_track.SetChanTrackTitle((string)track["name"]);
       if (track["genre"]!=null)   new_track.SetChanTrackGenre((string)track["genre"]);
       if (track["album"]!=null)   new_track.SetChanTrackAlbum((string)track["album"]);
       if (track["creator"]!=null) new_track.SetChanTrackCreator((string)track["creator"]);
       if (track["url"]!=null)     new_track.SetChanTrackURL((string)track["url"]);
       channel.ChannelTrack = new ChannelTrack(new_track);
     }
   }
 }
开发者ID:kumaryu,项目名称:peercaststation,代码行数:24,代码来源:APIHost.cs

示例5: CreateChannelInfo

 private ChannelInfo CreateChannelInfo(BroadcastViewModel viewModel)
 {
     var info = new AtomCollection();
       if (viewModel.bitrate.HasValue) info.SetChanInfoBitrate(viewModel.bitrate.Value);
       info.SetChanInfoName(viewModel.channelName);
       info.SetChanInfoGenre(viewModel.genre);
       info.SetChanInfoDesc(viewModel.description);
       info.SetChanInfoComment(viewModel.comment);
       info.SetChanInfoURL(viewModel.contactUrl);
       return new ChannelInfo(info);
 }
开发者ID:psjp,项目名称:peercaststation,代码行数:11,代码来源:BroadcastViewModel.cs

示例6: chanInfoUpdateButton_Click

 private void chanInfoUpdateButton_Click(object sender, EventArgs e)
 {
   var item = channelList.SelectedItem as ChannelListItem;
   if (item!=null) {
     var channel = item.Channel;
     if (!channel.IsBroadcasting) return;
     var info = new AtomCollection(channel.ChannelInfo.Extra);
     if (info!=null) {
       info.SetChanInfoComment(chanInfoComment.Text);
       info.SetChanInfoGenre(chanInfoGenre.Text);
       info.SetChanInfoDesc(chanInfoDesc.Text);
       info.SetChanInfoURL(chanInfoContactURL.Text);
       info.SetChanInfoComment(chanInfoComment.Text);
       channel.ChannelInfo = new ChannelInfo(info);
     }
     var track = new AtomCollection(channel.ChannelTrack.Extra);
     if (track!=null) {
       track.SetChanTrackAlbum(chanTrackAlbum.Text);
       track.SetChanTrackCreator(chanTrackArtist.Text);
       track.SetChanTrackTitle(chanTrackTitle.Text);
       track.SetChanTrackGenre(chanTrackGenre.Text);
       track.SetChanTrackURL(chanTrackContactURL.Text);
       channel.ChannelTrack = new ChannelTrack(track);
     }
   }
 }
开发者ID:kumaryu,项目名称:peercaststation,代码行数:26,代码来源:MainForm.cs

示例7: BroadcastChannel

            private string BroadcastChannel(int? yellowPageId, string sourceUri, string contentReader, JObject info, JObject track)
            {
                IYellowPageClient yp = null;
                if (yellowPageId.HasValue) {
                  yp = PeerCast.YellowPages.FirstOrDefault(y => y.GetHashCode()==yellowPageId.Value);
                  if (yp==null) throw new RPCError(RPCErrorCode.InvalidParams, "Yellow page not found");
                }
                if (sourceUri==null) throw new RPCError(RPCErrorCode.InvalidParams, "source uri required");
                Uri source;
                try {
                  source = new Uri(sourceUri);
                }
                catch (UriFormatException) {
                  throw new RPCError(RPCErrorCode.InvalidParams, "Invalid Uri");
                }
                var content_reader = PeerCast.ContentReaderFactories.FirstOrDefault(reader => reader.Name==contentReader);
                if (content_reader==null) throw new RPCError(RPCErrorCode.InvalidParams, "Content reader not found");

                var new_info = new AtomCollection();
                if (info!=null) {
                  if (info["name"]!=null)    new_info.SetChanInfoName(   (string)info["name"]);
                  if (info["url"]!=null)     new_info.SetChanInfoURL(    (string)info["url"]);
                  if (info["genre"]!=null)   new_info.SetChanInfoGenre(  (string)info["genre"]);
                  if (info["desc"]!=null)    new_info.SetChanInfoDesc(   (string)info["desc"]);
                  if (info["comment"]!=null) new_info.SetChanInfoComment((string)info["comment"]);
                }
                var channel_info  = new ChannelInfo(new_info);
                if (channel_info.Name==null || channel_info.Name=="") {
                  throw new RPCError(RPCErrorCode.InvalidParams, "Channel name must not be empty");
                }
                var channel_id = Utils.CreateChannelID(
                  PeerCast.BroadcastID,
                  channel_info.Name,
                  channel_info.Genre ?? "",
                  source.ToString());
                var channel = PeerCast.BroadcastChannel(yp, channel_id, channel_info, source, content_reader);
                if (track!=null) {
                  var new_track = new AtomCollection(channel.ChannelTrack.Extra);
                  if (track["name"]!=null)    new_track.SetChanTrackTitle((string)track["name"]);
                  if (track["genre"]!=null)   new_track.SetChanTrackGenre((string)track["genre"]);
                  if (track["album"]!=null)   new_track.SetChanTrackAlbum((string)track["album"]);
                  if (track["creator"]!=null) new_track.SetChanTrackCreator((string)track["creator"]);
                  if (track["url"]!=null)     new_track.SetChanTrackURL((string)track["url"]);
                  channel.ChannelTrack = new ChannelTrack(new_track);
                }
                return channel.ChannelID.ToString("N").ToUpper();
            }
开发者ID:psjp,项目名称:peercaststation,代码行数:47,代码来源:APIHost.cs


注:本文中的AtomCollection.SetChanInfoGenre方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。