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


C# Resource.ToString方法代码示例

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


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

示例1: TryReserveResource

 bool TryReserveResource(Resource res)
 {
     if (notReservedResourceNumber(res) > 0)
     {
         if (reservedResources.ContainsKey(res)){
             reservedResources[res] += 1;
         } else
         {
             reservedResources[res] = 1;
         }
         
         Debug.Log("Reserved " + reservedResources[res] + " of " + res.ToString());
         return true;
     }
     return false;
 }
开发者ID:kosstbarz,项目名称:Scripts,代码行数:16,代码来源:ResourceController.cs

示例2: ToStringShouldReturnResourceKey

        public void ToStringShouldReturnResourceKey()
        {
            var resource = new Resource("My_resource", "Banana's are good");

            resource.ToString().ShouldBe("My_resource");
        }
开发者ID:tygerbytes,项目名称:ResourceFitness,代码行数:6,代码来源:ResourceTests.cs

示例3: GetResKey

        uint GetResKey(Resource r, bool create)
        {
            if (r == null) return 0;
            if ((object)r == (object)Statement.DefaultMeta) return 1;

            object keyobj = GetResourceKey(r);
            if (keyobj != null) return (uint)keyobj;

            uint key = 0;

            string stringval = null;
            if (r is Literal) {
                stringval = "L" + r.ToString();
            } else if (r.Uri != null) {
                stringval = "U" + r.Uri;
            }

            if (stringval != null) {
                keyobj = db_value_to_id.Get(stringval);
                if (keyobj != null) key = (uint)keyobj;
            }

            if (key == 0) {
                if (!create) return 0;

                lastid++;
                key = lastid;
                SetResourceKey(r, key);

                if (stringval != null) {
                    db_id_to_value.Put(key, stringval);
                    db_value_to_id.Put(stringval, key);
                }
            }

            return key;
        }
开发者ID:JoshData,项目名称:semweb-dotnet,代码行数:37,代码来源:BDBStore.cs

示例4: TradeHelper

 public TradeHelper(Resource _r, int _max, Vector2 position)
 {
     r = _r;
     max = _max;
     resource = new Visual(position, RSIZE, RSIZE, _r.ToString()).setBorder(false);
     plus = new Button(position + new Vector2(RSIZE + MARGIN, 0), RSIZE, RSIZE, null, null, "plus", false);
     minus = new Button(position + new Vector2((RSIZE + MARGIN) * 2, 0), RSIZE, RSIZE, null, null, "minus", false);
     total = new Visual(position + new Vector2((RSIZE + MARGIN) * 3, 0), RSIZE, RSIZE, num.ToString(), "Font1", null, Color.Gray, "line", 0).setBorder(false);
     setVisible(false);
 }
开发者ID:Will2817,项目名称:COMP3004,代码行数:10,代码来源:TradeInterface.cs

示例5: S

		string S(Resource r, string v) {
			if (r == null) {
				return v;
			} else if (r is Literal) {
				return r.ToString();
			} else if (r.Uri != null) {
				if (r.Uri.IndexOf('>') != -1)
					throw new ArgumentException("Invalid URI: " + r.Uri);
				return "<" + r.Uri + ">";
			} else {
				throw new ArgumentException("Blank node in select not supported.");
			}
		}
开发者ID:AminBonyadUni,项目名称:facedetect-f-spot,代码行数:13,代码来源:Remote.cs

示例6: GetResource

 /// <summary>
 /// Give a player an amount of some resource
 /// If there are no more cards in the pile an NoMoreCardsException is thrown
 /// </summary>
 /// <param name="player">The player to give resources to</param>
 /// <param name="resource">The type of resource he receives</param>
 /// <param name="quantity">The amount of the resource he receives (default 1)</param>
 private void GetResource(Player player, Resource resource, int quantity = 1)
 {
     for (int i = 0; i < quantity; i++)
     {
         if (resourceBank[(int)resource] == 0) throw new NoMoreCardsException("Resource bank is out of " + resource.ToString());
         player.Resources.Add(resource);
         resourceBank[(int)resource]--;
     }
 }
开发者ID:rasmusgreve,项目名称:catan,代码行数:16,代码来源:GameController.cs

示例7: GetHash

        // Computes a hash for a resource used as its key in the database.
        private string GetHash(Resource resource)
        {
            // TODO: Do this with fewer new object creations.
            string data;
            if (resource == Statement.DefaultMeta) {
                data = "X" + DEFAULT_META_KEY;
            } else if (resource is BNode) {
                data = "B" + ((BNode)resource).GetGUID().ToString("N");
            } else if (resource is Entity) {
                data = "U" + resource.Uri.ToString();
            } else if (resource is Literal) {
                data = "L" + resource.ToString();
            } else {
                throw new Exception("Not reachable.");
            }

            byte[] bytedata = System.Text.Encoding.Unicode.GetBytes(data);
            byte[] hash = sha.ComputeHash(bytedata);
            return Convert.ToBase64String(hash);
        }
开发者ID:JoshData,项目名称:semweb-dotnet,代码行数:21,代码来源:SQLStore2.cs


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