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


C# MediaType类代码示例

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


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


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