• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# MediaType类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中MediaType的典型用法代码示例。如果您正苦于以下问题:C# MediaType类的具体用法?C# MediaType怎么用?C# MediaType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



MediaType类属于命名空间,在下文中一共展示了MediaType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: GetDraft

		/// <summary>
		/// Gets the draft data for the media entity with the given id.
		/// </summary>
		/// <param name="id">The id</param>
		/// <param name="type">The media type</param>
		/// <returns>The draft media data, null if the data wasn't found</returns>
		public virtual byte[] GetDraft(Guid id, MediaType type = MediaType.Media) {
			var path = GetPath(id, true, type);

			if (File.Exists(path))
				return File.ReadAllBytes(path);
			return null;
		}
开发者ID:jerry-he,项目名称:Piranha,代码行数:13,代码来源:LocalMediaProvider.cs


示例2: Put

		/// <summary>
		/// Stores the given data for the media entity with the given id.
		/// </summary>
		/// <param name="id">The id</param>
		/// <param name="data">The media data</param>
		/// <param name="type">The media type</param>
		public void Put(Guid id, byte[] data, MediaType type = MediaType.Media) {
			var blob = GetBlock(type, id, false) ;

			using (var stream = new MemoryStream(data)) {
				blob.UploadFromStream(stream) ;
			}
		}
开发者ID:nikhilsreeni,项目名称:Piranha,代码行数:13,代码来源:AzureMediaProvider.cs


示例3: ChannelChangedEventArgs

 /// <summary>
 /// 
 /// </summary>
 /// <param name="channelName"></param>
 /// <param name="channelUri"></param>
 /// <param name="trackTitle"></param>
 public ChannelChangedEventArgs(MediaType mediaType, string channelName, Uri channelUri, string trackTitle)
 {
     _mediaType = mediaType;
     _trackName = trackTitle;
     _channelUri = channelUri;
     _channelName = channelName;
 }
开发者ID:jaypatrick,项目名称:dica,代码行数:13,代码来源:ChannelChangedEventArgs.cs


示例4: Get

		/// <summary>
		/// Gets the data for the cached image with the given dimensions. In case of
		/// a cache miss null is returned.
		/// </summary>
		/// <param name="id">The id</param>
		/// <param name="width">The width of the image</param>
		/// <param name="height">The optional height of the image</param>
		/// <param name="type">The media type</param>
		/// <returns>The binary data, null in case of a cache miss</returns>
		public virtual byte[] Get(Guid id, int width, int? height, MediaType type = MediaType.Media) {
			var path = GetPath(id, false, width, height, type) ;

			if (File.Exists(path))
				return File.ReadAllBytes(path) ;
			return null ;
		}
开发者ID:nikhilsreeni,项目名称:Piranha,代码行数:16,代码来源:LocalMediaCacheProvider.cs


示例5: GivenARequest

        public void GivenARequest(string verb, string uri, byte[] content, MediaType contentType)
        {
            var destinationUri = new Uri("http://127.0.0.1:" + this.port + uri);

            WebRequest request = WebRequest.Create(destinationUri);
            request.Timeout = int.MaxValue;
            request.Method = verb;
            request.ContentLength = content != null ? content.Length : 0;

            if (request.ContentLength > 0)
            {
                request.ContentType = contentType.ToString();
                using (Stream requestStream = request.GetRequestStream())
                {
                    requestStream.Write(content, 0, content.Length);
                }
            }

            try
            {
                this.theResponse = request.GetResponse() as HttpWebResponse;
            }
            catch (WebException exception)
            {
                this.theResponse = exception.Response as HttpWebResponse;
            }
        }
开发者ID:endjin,项目名称:openrasta-stable,代码行数:27,代码来源:server_context.cs


示例6: ForMediaType

        public ICodecWithMediaTypeDefinition ForMediaType(MediaType mediaType)
        {
            var model = new MediaTypeModel { MediaType = mediaType };
            this.codecRegistration.MediaTypes.Add(model);

            return new CodecMediaTypeDefinition(this, model);
        }
开发者ID:endjin,项目名称:openrasta-stable,代码行数:7,代码来源:CodecDefinition.cs


示例7: MyMsrpSession

        public MyMsrpSession(MySipStack sipStack, MsrpSession session, MediaType mediaType, String remoteUri)
            : base(sipStack)
        {
            this.mCallback = new MyMsrpCallback(this);
            base.mMediaType = mediaType;
            base.remotePartyUri = remoteUri;

            if (session == null)
            {
                base.outgoing = true;
            #if WINDOWS_PHONE
                mSession = org.doubango.WindowsPhone.BackgroundProcessController.Instance.rtMsrpSessionNew(sipStack.WrappedStack, mCallback);
            #else
                mSession = new MsrpSession(sipStack.WrappedStack, mCallback);
            #endif
            }
            else
            {
                base.outgoing = false;
                mSession = session;
                mSession.setCallback(mCallback);
            }

            // commons
            base.init();

            // SigComp
            base.SigCompId = sipStack.SigCompId;
            mSession.addHeader("Subject", "FIXME");
        }
开发者ID:xolile,项目名称:boghe,代码行数:30,代码来源:MyMsrpSession.cs


示例8: GetHttpEntity

 public static HttpEntity GetHttpEntity(InMemoryRequest postRequest, string data, MediaType MediaType)
 {
     var bytes = Encoding.UTF8.GetBytes(data);
     var httpEntity = new HttpEntity(postRequest.Entity.Headers, new MemoryStream(bytes)) { ContentLength = bytes.Length };
     httpEntity.ContentType = MediaType;
     return httpEntity;
 }
开发者ID:arneeiri,项目名称:OpenRestWorkshop,代码行数:7,代码来源:Utils.cs


示例9: PersonalMessage

 public PersonalMessage(string personalmsg, MediaType mediatype, string[] currentmediacontent)
 {
     Message = personalmsg;
     mediaType = mediatype;
     content = currentmediacontent;
     Format = "{0}";
 }
开发者ID:quynh68,项目名称:msnp-sharp,代码行数:7,代码来源:PersonalMessage.cs


示例10: AtomLink

		/// <summary>
		/// Represents an <see cref="AtomLink"/> instance initialized with the given <see cref="Uri"/>,
		/// title, <see cref="Relationship"/> and <see cref="Type"/>.
		/// </summary>
		/// <param name="href">The <see cref="Uri"/> of the link.</param>
		/// <param name="rel">The <see cref="Relationship"/> of the link.</param>
		/// <param name="type">The <see cref="Type"/> of the link.</param>
		/// <param name="title">The <see cref="Title"/> of the link.</param>
		public AtomLink(Uri href, Relationship rel, MediaType type, string title)
		{
			this.HRef = href;
			this.Title = title;
			this.Rel = rel;
			this.Type = type;
		}
开发者ID:bossaia,项目名称:alexandrialibrary,代码行数:15,代码来源:AtomLink.cs


示例11: DownloadList

 public DownloadList(MediaType mediaType, ListDownloadStatusEventHandler onDownloadStatusChange = null, int poolSize = 3)
 {
     MediaType = mediaType;
     OnListDownloadStatusChange = onDownloadStatusChange;
     _ignoreDownloaded = false;
     _poolSize = poolSize;
 }
开发者ID:babythong,项目名称:MS.Youtube.Playlist.Downloader,代码行数:7,代码来源:DownloadList.cs


示例12: Serialize

        private static string Serialize(MediaType mediaType, object value)
        {
            Stream stream = null;

            try
            {
                stream = new MemoryStream();

                new JsonFormat().Serialize(mediaType, value, stream);
                stream.Position = 0;

                using (StreamReader reader = new StreamReader(stream))
                {
                    stream = null;
                    return reader.ReadToEnd();
                }
            }
            finally
            {
                if (stream != null)
                {
                    stream.Dispose();
                }
            }
        }
开发者ID:ChadBurggraf,项目名称:small-fry,代码行数:25,代码来源:JsonFormatTests.cs


示例13: MPAInfo

        public MPAInfo(MPAHeader hdr, UInt64 duration)
        {
            ai_ = new AudioInfo();
            ai_.bitRate = MPAHeaderParser.bitrate(hdr);
            ai_.bitsPerSample = 16;
            ai_.channels = (UInt16)(hdr.channelMode < 3 ? 2 : 1);
            ai_.sampleRate = MPAHeaderParser.samplingRate(hdr);
            ai_.layer = (UInt16)(4 - hdr.layer);
            ai_.vbr = false; //todo

            duration_ = duration;

            switch (hdr.version)
            {
                case 3:
                    {
                        mt_ = MediaType.MPEG10; break;
                    }
                case 2:
                    {
                        mt_ = MediaType.MPEG20; break;
                    }
                case 0:
                    {
                        mt_ = MediaType.MPEG25; break;
                    }
            }
        }
开发者ID:da8eat,项目名称:AVSharp,代码行数:28,代码来源:MPAInfo.cs


示例14: Get

		/// <summary>
		/// Gets the data for the media entity with the given id.
		/// </summary>
		/// <param name="id">The id</param>
		/// <param name="type">The media type</param>
		/// <returns>The media data, null if the data wasn't found</returns>
		public byte[] Get(Guid id, MediaType type = MediaType.Media) {
			var path = GetPath(id, false, type) ;

			if (File.Exists(path))
				return File.ReadAllBytes(path) ;
			return null ;
		}
开发者ID:primus1989,项目名称:Piranha,代码行数:13,代码来源:LocalMediaProvider.cs


示例15: ParseMediaType

        //These methods should only be used when an exact match was found
        private bool ParseMediaType(string input, out MediaType value)
        {
            input = input.CutToTag("title", true);
            input = input.CutToLast('(', CutDirection.Left, true);
            input = input.CutToFirst(')', CutDirection.Right, true);

            value = MediaType.Movie;
            return true;
            //if (!input.Contains(" "))
            //{
            //    value = ResultType.None;
            //    return true;
            //}

            //input = input.CutToLast(' ', CutDirection.Right, true);
            //switch (input.ToString())
            //{
            //    case "Video Game":
            //        value = ResultType.VideoGame;
            //        return true;
            //    case "Video":
            //        value = ResultType.Video;
            //        return true;
            //    case "TV":
            //        value = ResultType.TV;
            //        return true;
            //    case "TV series":
            //        value = ResultType.TVseries;
            //        return true;
            //    default:
            //        value = ResultType.None;
            //        return false;
            //}
        }
开发者ID:Tonaplo,项目名称:DeadDog.Movies,代码行数:35,代码来源:SearchTitlePage.cs


示例16: Initialize

        protected void Initialize()
        {
            if (!isInitialized)
            {
                lock (syncRoot)
                {
                    if (!isInitialized)
                    {
                        string viewer = this.Request["view"];
                        if (!string.IsNullOrEmpty(viewer))
                        {
                            if (!Enum.TryParse<MediaType>(viewer, true, out view))
                            {
                                view = MediaType.Photo;
                            }
                        }

                        url = Request.QueryString[Constants.UrlIdentifier] as string;
                        string query = Query; // read once to initialize

                        isInitialized = true;
                    }
                }
            }
        }
开发者ID:ratnazone,项目名称:ratna,代码行数:25,代码来源:MediaBasePage.cs


示例17: TheBaseTypeIsProcessedCorrectly

 public void TheBaseTypeIsProcessedCorrectly()
 {
     MediaType content = new MediaType("application/xml");
     content.TopLevelMediaType.ShouldBe("application");
     content.Subtype.ShouldBe("xml");
     content.Quality.ShouldBe(1.0f);
 }
开发者ID:dhootha,项目名称:openrasta-core,代码行数:7,代码来源:MediaType_Specification.cs


示例18: Delete

        /// <summary>
        /// Deletes all cached images related to the given id, both draft and published.
        /// </summary>
        /// <param name="id">The id</param>
        /// <param name="type">The media type</param>
        public virtual void Delete(Guid id, MediaType type = MediaType.Media)
        {
            var dir = new DirectoryInfo(type == MediaType.Media ? MediaPath : UploadPath);

            foreach (var file in dir.GetFiles(id.ToString() + "*"))
                file.Delete();
        }
开发者ID:cnascimento,项目名称:Paladino,代码行数:12,代码来源:LocalMediaCacheProvider.cs


示例19: MediaFileInfo

 public MediaFileInfo(MediaType mediaType, ContainerType containerType, EncodingType encondingType, String path)
 {
     mMediaType = mediaType;
     mContainerType = containerType;
     mEncondingType = encondingType;
     mPath = path;
 }
开发者ID:sarandogou,项目名称:thialgou,代码行数:7,代码来源:MediaFileInfo.cs


示例20: UpdateGenres

 private void UpdateGenres(MediaType mediaType)
 {
     GenreFilter.Items.Clear();
     GenreFilter.Items.Add("All");
     GenreFilter.Items.AddRange(rentIt.GetAllGenres(mediaType));
     GenreFilter.SelectedIndex = 0;
 }
开发者ID:ltj,项目名称:rentit,代码行数:7,代码来源:SearchResultsControl.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# MediaTypeFormatterCollection类代码示例发布时间:2022-05-24
下一篇:
C# MediaStreamType类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap