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


C# Asset类代码示例

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


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


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