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


C# Category.GetType方法代码示例

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


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

示例1: GetAccountsFromCategory

 /// <summary>
 /// Gets an <see cref="Accounts"/> from a <see cref="Category"/>.
 /// </summary>
 /// <param name="category">The category.</param>
 /// <returns>the <see cref="Accounts"/> value.</returns>
 public static Accounts GetAccountsFromCategory(Category category)
 {
     List<Category> categoryList = new List<Category>();
     foreach (Category cat in Enum.GetValues(category.GetType()))
     {
         if (category.HasFlag(cat))
             categoryList.Add(cat);
     }
     Accounts accounts = Accounts.Facebook;
     foreach (var item in categoryList)
     {
         if (item != Category.None && item != Category.Cat1)
             accounts |= GetAccountsFromCategoryIntern(item);
     }
     if (!categoryList.Contains(Category.Cat10))
         accounts &= ~Accounts.Facebook;
     return accounts;
 }
开发者ID:dtomovdimitrov,项目名称:Tangible,代码行数:23,代码来源:CategoryMappings.cs

示例2: GetVideos

		public override List<VideoInfo> GetVideos(Category category)
		{
			
			if (category.GetType().ToString().Equals("OnlineVideos.Sites.DirectVideo")) {
				return getDirectVideoList((DirectVideo)category);
			}
			
			List<VideoInfo> videoList = new List<VideoInfo>();
			
			string idForStream = category.Other.ToString();
			
			if (string.IsNullOrEmpty(idForStream)) {
				Log.Debug("Could not get id for stream, leaving");
			}
			
			string authTokenString = getAuthToken();
			
			// get Live games
			Boolean isOnDemand = false;
			string getStreamUrlPart = "";
			if (category.GetType().ToString().Equals("OnlineVideos.Sites.LiveGame")) {
				getStreamUrlPart = apiUrl_getLiveStream;
			} else {
				getStreamUrlPart = apiUrl_getOnDemandStream;
				isOnDemand = true;
			}
			string getStreamUrl = string.Format("{0}?id={1}&location={2}&token={3}", getStreamUrlPart, idForStream, location, authTokenString);
			
			string jsonResponse =  GetWebData(getStreamUrl,null,null,null,null, false, false, useragent, null, null, false);
			
			JObject jsonStreams = JObject.Parse(jsonResponse);
			
			
			if (jsonStreams != null &&
			    jsonStreams.Value<JToken>("HDstreams") != null) {
				int i = 0;
				string streamTag = "TrueLiveHD"; // for live games
				if (isOnDemand) {
					streamTag = "streams";
				}
				foreach(JToken stream in jsonStreams.Value<JToken>(streamTag)) {

					VideoInfo vi = new VideoInfo();
					
					Log.Debug("HockeyStreams - stream json : " + stream.ToString());
					
//					vi.Id = i++;
					vi.Title = string.Format("{0} - {1}", stream.Value<string>("type"), stream.Value<string>("location"));
					string url = stream.Value<string>("src");
					
					
//					if ("Flash".Equals(stream.Value<string>("type"))) {
//					if (stream.Value<string>("src").Contains("HD")) {
//						/*
//						 * URL looks like this:
//						 * http://174.127.101.96/vod2/HSTV4_03132013/PREMIUM_HSTV_4.f4m
//						 * 
//						 * Which gives back this doc with real urls:
//						 * <manifest>
//						 * 		<media href="http://174.127.101.96/hds-vod2/HSTV4_03132013/feed1.f4f.f4m" bitrate="500"/>
//						 *      <media href="http://174.127.101.96/hds-vod2/HSTV4_03132013/feed2.f4f.f4m" bitrate="1500"/>
//						 * </manifest>
//						 * 
//						 * OR (live game) like this:
//						 * URL: http://174.127.101.96/PREMIUM_HSTV_2.f4m
//						 * 
//						 * <manifest xmlns="http://ns.adobe.com/f4m/2.0"> 
//						 *      <baseURL>http://174.127.101.96/hds-live/publishing/PREMIUM_HSTV_2/liveevent/</baseURL> 
//						 *		<dvrInfo windowDuration="10800"/> 
//						 *		<media href="livestream1.f4m" bitrate="800"/> 
//						 *		<media href="livestream2.f4m" bitrate="1500"/> 
//						 *	</manifest> 
//						 */
//						XmlDocument xml = GetWebData<XmlDocument>(url);
//						XmlElement root = xml.DocumentElement;
//						XmlNodeList nodes = root.GetElementsByTagName("media");
//						XmlNodeList baseUrl = root.GetElementsByTagName("baseURL");
//						
//						string baseUrlStr = "";
//						if (baseUrl	!= null &&
//						    baseUrl.Item(0) != null) {
//							XmlNode baseUrlNode = baseUrl.Item(0);
//							baseUrlStr = baseUrlNode.InnerText;
//						}
//						
//						/*
//						 * populate the playback options so that a popup will prompt the user what bandwidth stream 
//						 * they want to watch.
//						 * 
//						 * getMultipleVideoUrl() is called after this and it will return the values in playback options
//						 */
//						vi.PlaybackOptions = new Dictionary<string, string>();
//						foreach(XmlNode node in nodes) {
//							string desc = "Flash - " + node.Attributes["bitrate"].Value + "k";
//							string vidUrl = baseUrlStr + node.Attributes["href"].Value;
//							vi.PlaybackOptions.Add(desc, vidUrl);
//							Log.Info("HockeyStreams - flash playback option vid url: " + vidUrl);
//						}
//							
//					} 
//.........这里部分代码省略.........
开发者ID:leesanghyun2,项目名称:mp-onlinevideos2,代码行数:101,代码来源:HockeyStreams.cs

示例3: TestToStringOnNoKey

        public void TestToStringOnNoKey()
        {
            Category t1 = new Category();
            t1.Id = 12;
            Category t2 = new Category();
            t2.Id = 13;

            t1.ToString().Should().Be(t1.GetType().FullName);
            t2.ToString().Should().Be(t2.GetType().FullName);
        }
开发者ID:juanplopes,项目名称:simple,代码行数:10,代码来源:EntityHelperIntegrationFixture.cs

示例4: InsertCategory

        public void InsertCategory(CategoryModel catModel, int storeId)
        {
            var context = new StorManEntities();

            var cat = new Category
            {
                Code = catModel.Code,
                Name = catModel.Name,
                CrDate = DateTime.Now,
                StoreID = storeId,

            };
            context.Categories.Add(cat);

            if (catModel.Parent != null)
            {
                var parentCat = context.Categories.FirstOrDefault(x => x.StoreID == storeId && x.Code == catModel.Parent.Code);
                if (parentCat != null)
                {
                    cat.ParentID = parentCat.ID;
                }
                else
                {
                    cat.GetType();
                }
            }

            context.SaveChanges();

            if (catModel.Attributes != null)
            {
                foreach (var attModel in catModel.Attributes)
                {
                    var att = context.Attributes.FirstOrDefault(x => x.ID == attModel.id);
                    if (att == null)
                    {
                        att = new Attribute
                        {
                            ID = (int) attModel.id,
                            Name = attModel.name,
                            IsMandatory = attModel.mandatory,
                            IsMultipleSelect = attModel.multipleSelect,
                            //inputMethod = attModel.inputMethod
                        };
                        context.Attributes.Add(att);
                        context.SaveChanges();

                        var i = 0;

                        foreach (var keyValuePair in attModel.values)
                        {
                            var attValue = new AttributeValue
                            {
                                Attribute = att,
                                Name = keyValuePair.Value
                            };
                            context.AttributeValues.Add(attValue);

                            i++;
                            if (i%50 == 0)
                            {
                                var rowCount = context.SaveChanges();
                                System.Diagnostics.Debug.WriteLine("Saved {0} rows, i={1}", rowCount, i);
                            }
                        }
                        context.SaveChanges();
                    }

                    cat.Attributes.Add(att);
                    context.SaveChanges();
                }
            }
        }
开发者ID:ertanyavuz,项目名称:GGyor,代码行数:73,代码来源:N11Repository.cs


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