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

C# Asset类代码示例

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

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



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

示例1: GetUpdateAttribute

        private static Tuple<string, YamlNode> GetUpdateAttribute(JProperty prop)
        {
            var propValueType = prop.Value.Type;
            var value = string.Empty;

            if (propValueType == JTokenType.Object || propValueType == JTokenType.Array)
            {
                if (propValueType == JTokenType.Array)
                {
                    var nodes = new YamlSequenceNode();
                    foreach(var item in prop.Value as JArray)
                    {
                        var asset = new Asset(item as dynamic);
                        var yamlNode = GetNodes(asset);
                        nodes.Add(yamlNode);
                    }
                    return new Tuple<string, YamlNode>(prop.Name, nodes);
                }

                return new Tuple<string, YamlNode>(prop.Name, new YamlScalarNode(string.Empty));
            }
            else
            {
                value = (prop.Value as JValue).Value.ToString();
                return new Tuple<string, YamlNode>(prop.Name, new YamlScalarNode(value));
            }
        }
开发者ID:JogoShugh,项目名称:VersionOneRestSharpClient,代码行数:27,代码来源:QueryYamlPayloadBuilder.cs


示例2: GetNodes

        public static YamlNode GetNodes(Asset source)
        {
            var root = new YamlMappingNode();
            var assetType = source.AssetType;
            root.Add("asset", assetType);
            JObject obj = JObject.FromObject(source.GetChangesDto());
            obj.Remove("AssetType");

            YamlMappingNode attributes = new YamlMappingNode();

            var tuples = (from prop in
                            (
                                from token in JToken.FromObject(obj)
                                where token.Type == JTokenType.Property
                                select token as JProperty
                             )
                          select GetUpdateAttribute(prop)
                        );
            foreach (var tuple in tuples)
            {
                attributes.Add(tuple.Item1, tuple.Item2);
            }

            root.Add("attributes", attributes);

            return root;
        }
开发者ID:JogoShugh,项目名称:VersionOneRestSharpClient,代码行数:27,代码来源:QueryYamlPayloadBuilder.cs


示例3: runAssetFile

        public override void runAssetFile(Asset asset)
        {
            foreach (var obj in asset.ObjectInfos) {
                ulong oldSize = 0;
                mSizeDic.TryGetValue(obj.classID, out oldSize);
                mSizeDic[obj.classID] = oldSize + obj.length;
                totalSize += obj.length;
                var typeTree = typeTreeDatabase.GetType(asset.AssetVersion, obj.classID);
                if (typeTree != null) {
                    try {
                        SerializeObject sobj = new SerializeObject(typeTree, obj.data);
                        var property = sobj.FindProperty("m_Resource.m_Size");
                        if (property != null) {
                            ulong resSize = (ulong)property.Value;
                            totalSize += resSize;
                            mSizeDic[obj.classID] += resSize;
                        }
                    } catch {
                        Debug.LogError("Can't Create SerializeObject.TypeVerion:{0},TypeClassID:{1},TypeName:{2}",
                       typeTree.version, obj.classID, typeTree.type);
                    }

                }
            }
        }
开发者ID:qq573011406,项目名称:UnityAssetTool,代码行数:25,代码来源:AssetSizeInfoCommand.cs


示例4: RegisterUser

        // Register is always used for someone not in the database, only first time User or first time Asset use this method
        public async Task<AccountResult> RegisterUser(RegistrationModelBase model)
        {
            UserProfile profile;
            User user = null;

            switch (model.Type)
            {
                case IdentityTypes.USER:
                    profile = new UserProfile(model as UserRegistrationModel);
                    user = new User(model as UserRegistrationModel, profile);
                    break;
                case IdentityTypes.BIKE_MESSENGER:
                case IdentityTypes.CNG_DRIVER:
                    profile = new AssetProfile(model as AssetRegistrationModel);
                    user = new Asset(model as AssetRegistrationModel, profile as AssetProfile);
                    break;
                case IdentityTypes.ENTERPRISE:
                    var enterpriseProfile = new EnterpriseUserProfile(model as EnterpriseUserRegistrationModel);
                    user = new EnterpriseUser(model as EnterpriseUserRegistrationModel, enterpriseProfile);
                    break;

            }
            var identityResult = await accountManager.CreateAsync(user, model.Password);
            var creationResult = new AccountResult(identityResult, user);

            return creationResult;
        }
开发者ID:NerdCats,项目名称:TaskCat,代码行数:28,代码来源:AccountContext.cs


示例5: AddDefaultExtractSettingsToAsset

        public static void AddDefaultExtractSettingsToAsset(Asset asset, string siteRootParentAssetId)
        {
            // Get starting path for all other paths
              var parentAssetId = int.Parse(siteRootParentAssetId);
              var parentAsset = Asset.LoadDirect(parentAssetId);
              var basePath = parentAsset.AssetPath.ToString();

              // Get paths needed by the site builder tool
              var pro_library_folder = Asset.LoadDirect(basePath + "/Project/Library").GetLink(LinkType.Internal);

              if (string.IsNullOrEmpty(pro_library_folder))
              pro_library_folder = Asset.LoadDirect(basePath + "/Project/Client Library").GetLink(LinkType.Internal);

              var pro_model_folder = Asset.LoadDirect(basePath + "/Project/Models").GetLink(LinkType.Internal);
              var pro_nav_wrap_location = Asset.LoadDirect(basePath + "/Project/Templates/MasterPage").GetLink(LinkType.Internal);
              var pro_project_folder = Asset.LoadDirect(basePath + "/Project").GetLink(LinkType.Internal);
              var pro_site_root_folder = Asset.LoadDirect(basePath + "/Site Root").GetLink(LinkType.Internal);
              var pro_template_folder = Asset.LoadDirect(basePath + "/Project/Templates").GetLink(LinkType.Internal);

              var fields = new Dictionary<string, string>();
              fields.Add("export_site_option", "yes");
              fields.Add("extract_type", "project");
              fields.Add("include_binaries", "true");
              fields.Add("include_contents", "true");
              fields.Add("include_wrappers", "true");
              fields.Add("pro_library_folder", pro_library_folder);
              fields.Add("pro_model_folder", pro_model_folder);
              fields.Add("pro_nav_wrap_location", pro_nav_wrap_location);
              fields.Add("pro_project_folder", pro_project_folder);
              fields.Add("pro_site_root_folder", pro_site_root_folder);
              fields.Add("pro_template_folder", pro_template_folder);

              asset.SaveContent(fields);
        }
开发者ID:rickeygalloway,项目名称:Test,代码行数:34,代码来源:IhSiteBuilderUtils.cs


示例6: AssetDesc

		/// <summary>
		///	Create asset description from asset.
		/// </summary>
		/// <param name="asset"></param>
		public AssetDesc ( Asset asset ) 
		{
			Path		=	asset.AssetPath;
			Type		=	asset.GetType().Name;
			Parameters	=	new List<KeyValuePair<string,string>>();

			foreach ( var prop in asset.GetType().GetProperties() ) {

				if (!prop.CanWrite || !prop.CanRead) {
					continue;
				}

				if (prop.IsList()) {

					var list = prop.GetList( asset );
					var type = prop.GetListElementType();

					foreach ( var element in list ) {
						var conv	= TypeDescriptor.GetConverter( type );
						var value	= conv.ConvertToInvariantString( element );

						Parameters.Add( new KeyValuePair<string,string>(prop.Name, value) );
					}
						
				} else {

					var conv	= TypeDescriptor.GetConverter( prop.PropertyType );
					var value	= conv.ConvertToInvariantString( prop.GetValue( asset ) );
						
					Parameters.Add( new KeyValuePair<string,string>(prop.Name, value) );
				}
			}
		}
开发者ID:demiurghg,项目名称:FusionEngine,代码行数:37,代码来源:AssetDescription.cs


示例7: Date

 public Date(Entry entry)
 {
     StartDate = entry.Date.ToString("yyyy,M,d");
     Headline = entry.Title;
     Text = entry.Text;
     Asset = new Asset(entry.Asset);
 }
开发者ID:Traan,项目名称:TimelinePhoto,代码行数:7,代码来源:Date.cs


示例8: GetAllHashes

 public static Dictionary<UFile, ObjectId> GetAllHashes(Asset asset)
 {
     var hashes = TryGet(asset, AbsoluteSourceHashesKey);
     var result = new Dictionary<UFile, ObjectId>();
     hashes?.ForEach(x => result.Add(x.Key, x.Value));
     return result;
 }
开发者ID:Kryptos-FR,项目名称:xenko-reloaded,代码行数:7,代码来源:SourceHashesHelper.cs


示例9: AssetProperties

 public AssetProperties(Asset asset)
 {
     foreach (AssetValue val in asset)
     {
         //is this one supposed to be different from the others? "DisplayName vs Name"
         if (val.DisplayName.Equals("Color") && val.ValueType == AssetValueTypeEnum.kAssetValueTypeColor)
         {
             color = ((ColorAssetValue) val).Value;
         }
         /*    //I am unable to find any reference to gloss in the API, and I've found the value changes from material to material
         else if (val.Name.Equals("generic_glossiness") && val.ValueType == AssetValueTypeEnum.kAssetValueTypeFloat)
         {
             generic_glossiness = ((FloatAssetValue)val).Value;
         }
         */
         //opacity is a double
         else if (val.DisplayName.Equals("Transparency") && val.ValueType == AssetValueTypeEnum.kAssetValueTypeFloat)
         {
             transparency = ((FloatAssetValue) val).Value;
         }
         else if (val.DisplayName.Equals("Translucency") && val.ValueType == AssetValueTypeEnum.kAssetValueTypeFloat)
         {
             translucency = ((FloatAssetValue) val).Value;
         }
         else if (val.ValueType == AssetValueTypeEnum.kAssetValueTextureType)
         {
             AssetTexture tex = ((TextureAssetValue) val).Value;
         }
         else if (val.Name.Contains("reflectivity") && val.Name.Contains("0deg") && val.ValueType == AssetValueTypeEnum.kAssetValueTypeFloat)
         {
             specular = ((FloatAssetValue) val).Value;
         }
     }
 }
开发者ID:CADmeum-Simulator,项目名称:Exporter,代码行数:34,代码来源:AssetProperties.cs


示例10: Update

        public void Update(Asset entity, bool commit)
        {
            if (entity == null)
                throw new ArgumentNullException("entity");

            _db.SaveChanges();
        }
开发者ID:seshbot,项目名称:asset-tracker,代码行数:7,代码来源:AssetRepository.cs


示例11: CreateAsset

        public Asset CreateAsset(Asset info)
        {
            try
            {
                string sqlCommand = @"INSERT INTO ""ASSET"" (""ASSETNO"",""ASSETCATEGORYID"",""ASSETNAME"",""STORAGE"",""STATE"",""DEPRECIATIONYEAR"",""UNITPRICE"",""BRAND"",""MANAGEMODE"",""FINANCECATEGORY"",""SUPPLIERID"",""PURCHASEDATE"",""EXPIREDDATE"",""ASSETSPECIFICATION"",""STORAGEFLAG"",""SUBCOMPANY"",""CONTRACTID"",""CONTRACTDETAILID"") VALUES (:Assetno,:Assetcategoryid,:Assetname,:Storage,:State,:Depreciationyear,:Unitprice,:Brand,:Managemode,:Financecategory,:Supplierid,:Purchasedate,:Expireddate,:Assetspecification,:Storageflag,:Subcompany,:Contractid,:Contractdetailid)";
                this.Database.AddInParameter(":Assetno", info.Assetno);//DBType:VARCHAR2
                this.Database.AddInParameter(":Assetcategoryid", info.Assetcategoryid);//DBType:VARCHAR2
                this.Database.AddInParameter(":Assetname", info.Assetname);//DBType:NVARCHAR2
                this.Database.AddInParameter(":Storage", info.Storage);//DBType:NVARCHAR2
                this.Database.AddInParameter(":State", info.State);//DBType:NUMBER
                this.Database.AddInParameter(":Depreciationyear", info.Depreciationyear);//DBType:NUMBER
                this.Database.AddInParameter(":Unitprice", info.Unitprice);//DBType:NUMBER
                this.Database.AddInParameter(":Brand", info.Brand);//DBType:NVARCHAR2
                this.Database.AddInParameter(":Managemode", info.Managemode);//DBType:NUMBER
                this.Database.AddInParameter(":Financecategory", info.Financecategory);//DBType:NUMBER
                this.Database.AddInParameter(":Supplierid", info.Supplierid);//DBType:NVARCHAR2
                this.Database.AddInParameter(":Purchasedate", info.Purchasedate);//DBType:DATE
                this.Database.AddInParameter(":Expireddate", info.Expireddate);//DBType:DATE
                this.Database.AddInParameter(":Assetspecification", info.Assetspecification);//DBType:NVARCHAR2
                this.Database.AddInParameter(":Storageflag", info.Storageflag);//DBType:NVARCHAR2
                this.Database.AddInParameter(":Subcompany", info.Subcompany);//DBType:VARCHAR2
                this.Database.AddInParameter(":Contractid", info.Contractid);//DBType:VARCHAR2
                this.Database.AddInParameter(":Contractdetailid", info.Contractdetailid);//DBType:VARCHAR2
                this.Database.ExecuteNonQuery(sqlCommand);

            }
            finally
            {
                this.Database.ClearParameter();
            }
            return info;
        }
开发者ID:chutinhha,项目名称:fixed-asset-system,代码行数:32,代码来源:AssetManagement.cs


示例12: Sorter

		public Sorter(Dictionary<string, Asset> assets)
		{
			List<Asset> list = new List<Asset>();

			foreach (Asset asset in assets.Values)
			{
				foreach (string provides in asset.Provides)
				{
					var newAsset = new Asset()
					{
						Name = asset.Path
					};
					newAsset.Provides.Add(provides);
					newAsset.Requires.AddRange(asset.Requires);
					list.Add(newAsset);
				}
			}

			this.GenericSorter(list);

			foreach (int i in this.result)
			{
				if (!Sorted.Contains(list[i].Name))
				{
					Sorted.Add(list[i].Name);
				}
			}
		}
开发者ID:fakedarren,项目名称:Packager.NET,代码行数:28,代码来源:Packager.Sorter.cs


示例13: GetParent

        public Asset GetParent(Asset asset)
        {
            Asset ret;
            switch (asset.Type)
            {
                case AssetType.Namespace:
                    NamespaceInfo nsInfo = (NamespaceInfo)asset.Target;
                    ret = ReflectionServices.GetAsset(nsInfo.Assembly);
                    break;
                case AssetType.Type:
                    Type type = (Type)asset.Target;
                    if (type.IsNested)
                        ret = ReflectionServices.GetAsset(type.DeclaringType);
                    else
                        ret = ReflectionServices.GetAsset(type.Assembly, type.Namespace);
                    break;
                case AssetType.Method:
                case AssetType.Field:
                case AssetType.Event:
                case AssetType.Property:
                    Type parent = ((MemberInfo)asset.Target).ReflectedType;
                    ret = ReflectionServices.GetAsset(parent);
                    break;
                case AssetType.Assembly:
                    ret = null;
                    break;
                default:
                    throw new ArgumentException(string.Format("Cannot find parent of asset of type {0}", asset.Type));
            }

            return ret;
        }
开发者ID:LBiNetherlands,项目名称:LBi.LostDoc,代码行数:32,代码来源:ReflectionExplorer.cs


示例14: Add

        public void Add(Asset asset)
        {
            AssertAssetIsValid(asset);

            var assetItem = listService.CreateItem();
            unitOfWork.AddInsert(asset, assetItem);
        }
开发者ID:danielalexandrecosta,项目名称:domaindrivensharepoint,代码行数:7,代码来源:UOWAssetRepository.cs


示例15: outputBase

 public string outputBase(Asset asset, OutputContext context, string name, string index = "")
 {
     StringBuilder sbContent = new StringBuilder();
     sbContent.Append(componentMarkup);
      String markup = ComponentLibraryHelper.updateMarkupForPreviewPublish(context, sbContent.ToString());
     return markup;
 }
开发者ID:rickeygalloway,项目名称:Test,代码行数:7,代码来源:Components_IhModuleInstanceBase.cs


示例16: Date

 public Date(Entry entry)
 {
     startDate = entry.Date.ToString("yyyy,M,d");
     headline = entry.Title;
     text = entry.Text;
     asset = new Asset(entry.Asset);
 }
开发者ID:Traan,项目名称:TimelinePhoto,代码行数:7,代码来源:Date.cs


示例17: Save

 public void Save(Asset asset)
 {
     if(asset.IsValid())
     {
         AssetRepo.Save(asset);
     }
 }
开发者ID:mkhj,项目名称:EcoHotels,代码行数:7,代码来源:AssetService.cs


示例18: AddReference

        public bool AddReference(Asset asset)
        {
            if (asset == null)
                throw new ArgumentNullException("asset");

            //if (string.IsNullOrEmpty(asset))
            //    throw new ArgumentException("Argument cannot be null or empty.", "asset");

            //AssetIdentifier aid = AssetIdentifier.Parse(asset);

            //Debug.Assert(aid.ToString().Equals(asset, StringComparison.Ordinal),
            //             "AssetIdentifier '{0}' failed to roundtrip.", asset);

            //if (aid.AssetId[aid.AssetId.Length - 1] == ']')
            //    aid = new AssetIdentifier(aid.AssetId.Substring(0, aid.AssetId.LastIndexOf('[')),
            //                              aid.Version);

            //object resolve = this.AssetResolver.Resolve(aid);
            //Debug.Assert(resolve != null);

            //Debug.Assert(!string.IsNullOrWhiteSpace(aid.AssetId));

            if (this._references.Add(asset))
            {
                TraceSources.GeneratorSource.TraceEvent(TraceEventType.Verbose, 1, "Reference: {0}", asset.Id);
                return true;
            }

            return false;
        }
开发者ID:LBiNetherlands,项目名称:LBi.LostDoc,代码行数:30,代码来源:ProcessingContext.cs


示例19: Asset_Received

 public void Asset_Received(AssetDownload trans, Asset asset)
 {
     var Running = ExportCommand.Exporting;
     var item = SourceItem;
     UUID itemID = item.UUID;
     //if (trans.AssetID != item.AssetUUID) return;
     if (!trans.Success)
     {
         Error = "" + trans.Status;
         if (waiting != null) waiting.Set();
         lock (Running.TaskAssetWaiting)
         {
             ExportTaskAsset exportTaskAsset;
             if (!Running.CompletedTaskItem.Contains(itemID))
             {
                 Request();
                 return;
             }
         }
     }
     Running.Assets_OnReceived(trans, asset);
     //AddRelated(item.AssetUUID, item.AssetType);
     Running.TaskItemComplete(O.ID, itemID, asset.AssetID, asset.AssetType);
     if (waiting != null) waiting.Set();
 }
开发者ID:drzo,项目名称:opensim4opencog,代码行数:25,代码来源:ExportCommand_TaskInv.cs


示例20: ValidateSingleFieldByAttribute

		public void ValidateSingleFieldByAttribute() {
			Asset asset = new Asset(AssetType(DefectTypeName));
			IAttributeDefinition defectNameDef = asset.AssetType.GetAttributeDefinition(TitleAttributeName);
			Assert.IsFalse(validator.Validate(asset, defectNameDef));

			asset.LoadAttributeValue(defectNameDef, "Valid defect name");
			Assert.IsTrue(validator.Validate(asset, defectNameDef));
		}
开发者ID:RedwardsiPipeline,项目名称:VersionOne.SDK.NET.APIClient,代码行数:8,代码来源:RequiredFieldValidatorTester.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# AssetBase类代码示例发布时间:2022-05-24
下一篇:
C# AssertionConditionType类代码示例发布时间: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