本文整理汇总了C#中AssetType.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# AssetType.Equals方法的具体用法?C# AssetType.Equals怎么用?C# AssetType.Equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AssetType
的用法示例。
在下文中一共展示了AssetType.Equals方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetSubList
/// <summary>
/// Filters only the folder or files from the selected folder.
/// </summary>
public static Dictionary<string, Asset> GetSubList(Asset _asset, AssetType _assetType)
{
Dictionary<string, Asset> dtAssets = new Dictionary<string, Asset>();
List<Asset> lasAssets;
if (_assetType.Equals(AssetType.Folder))
lasAssets = _asset.GetFolderList();
else
lasAssets = _asset.GetFileList();
foreach (Asset asAsset in lasAssets)
{
if (!dtAssets.Keys.Contains(asAsset.BranchId.ToString()))
dtAssets.Add(asAsset.BranchId.ToString(), asAsset);
}
return dtAssets;
}
示例2: CreateNewAsset
/// <summary>
/// Create a file or a folder based on the path (provide full path including with file name like "/FirstFolder/SecondFolder/FileName.jpg".
/// <para>If the folders in the middle don't exist, it will create them.</para>
/// </summary>
public static Asset CreateNewAsset(string _path, AssetType _assetType)
{
Asset asAsset = Asset.Load(_path);
if (!asAsset.IsLoaded)
{
List<string> lsPath = ParsePath(_path);
string szPath = "/";
for (int i = 0; i < lsPath.Count; i++)
{
asAsset = Asset.Load(szPath + lsPath[i]);
if (i + 1 == lsPath.Count && !asAsset.IsLoaded)
{
Asset asModel;
if (_assetType.Equals(AssetType.Folder))
asModel = IhSiteBuilderHelper.BaseFolderModel;
else
asModel = IhSiteBuilderHelper.BaseFileModel;
asAsset = Asset.CreateNewAsset(lsPath[i], Asset.Load(szPath), asModel, new Dictionary<string, string>());
}
else if (!asAsset.IsLoaded)
asAsset = Asset.CreateNewAsset(lsPath[i], Asset.Load(szPath), IhSiteBuilderHelper.BaseFolderModel, new Dictionary<string, string>());
szPath += lsPath[i] + "/";
}
}
return asAsset;
}
示例3: GetFilterList
/// <summary>
/// Filters everything even subfolders from the selected folder. Key = AssetID, Value = Asset.
/// <para>If AssetType.Unspecified is selected, it will return all folders and files.</para>
/// </summary>
public static List<Asset> GetFilterList(Asset _assetFolder, AssetType _assetType = AssetType.Unspecified, string _path = "", bool excludeProjectTypes = false, List<string> excludeFolders = null, IhSiteBuilderLog siteLog = null)
{
FilterParams fpFilter = new FilterParams();
fpFilter.ExcludeProjectTypes = excludeProjectTypes;
if (!_assetType.Equals(AssetType.Unspecified))
fpFilter.Add(Comparison.Equals, _assetType);
Dictionary<string, Asset> dtAssets = new Dictionary<string, Asset>();
if (!string.IsNullOrWhiteSpace(_path))
{
if (Asset.Load(_path).IsLoaded)
_assetFolder = Asset.Load(_path);
}
List<Asset> laAssets = _assetFolder.GetFilterList(fpFilter);
if (excludeFolders != null)
{
laAssets = ExcludeFolderList(laAssets, excludeFolders);
}
foreach (Asset asAsset in laAssets)
{
if (!dtAssets.Keys.Contains(asAsset.BranchId.ToString()))
{
if (asAsset.Type.Equals(AssetType.Folder))
{
dtAssets.Add(asAsset.BranchId.ToString(), asAsset);
}
else if (asAsset.Type.Equals(AssetType.File))
{
if (asAsset.WorkflowStatus.Name.Equals("Live") || asAsset.WorkflowStatus.Name.Equals("Stage") || asAsset.WorkflowStatus.Name.Equals("Draft") || asAsset.WorkflowStatus.Name.Equals(""))
{
dtAssets.Add(asAsset.BranchId.ToString(), asAsset);
}
}
}
else
{
if (asAsset.WorkflowStatus.Name.Equals("Live"))
{
dtAssets[asAsset.BranchId.ToString()] = asAsset;
}
else if (asAsset.WorkflowStatus.Name.Equals("Stage"))
{
if (!dtAssets[asAsset.BranchId.ToString()].WorkflowStatus.Name.Equals("Live") && !dtAssets[asAsset.BranchId.ToString()].WorkflowStatus.Name.Equals("Stage"))
{
dtAssets[asAsset.BranchId.ToString()] = asAsset;
}
}
else if (asAsset.WorkflowStatus.Name.Equals("Draft"))
{
if (!dtAssets[asAsset.BranchId.ToString()].WorkflowStatus.Name.Equals("Live") && !dtAssets[asAsset.BranchId.ToString()].WorkflowStatus.Name.Equals("Stage") && !dtAssets[asAsset.BranchId.ToString()].WorkflowStatus.Name.Equals("Draft"))
{
dtAssets[asAsset.BranchId.ToString()] = asAsset;
}
}
}
}
return dtAssets.Values.ToList<Asset>();
}
示例4: CreateContent
/// <summary>
/// Creates all assets including sub-folders based on the selected asset folder. It will retrieve either all folders or files depending on the asset type selected.
/// </summary>
/// <param name="_asset">Root Asset Folder</param>
/// <param name="_assetType">Choose either file or folder</param>
private string CreateContent(Asset _asset, AssetType _assetType, string _TagName = "asset", bool includeContent = true, List<string> excludeFolders = null, bool excludeProjectTypes = false)
{
StringBuilder sbOutput = new StringBuilder();
//If asset type is a folder include the root folder in XML
if (_assetType.Equals(AssetType.Folder))
{
sbOutput.AppendLine(GetAssetAttributes(_asset, _TagName));
if (includeContent)
{
sbOutput.AppendLine(GetAssetContent(_asset));
}
sbOutput.AppendLine(string.Format("</{0}>", _TagName));
}
foreach (Asset asAsset in IhSiteBuilderHelper.GetFilterList(_asset, _assetType, excludeProjectTypes: excludeProjectTypes, excludeFolders: excludeFolders))
{
IhSiteBuilderHelper.SaveLog(dicLog, "File Name: " + asAsset.AssetPath);
//If Asset is a binary file, it will skip
if (_assetType.Equals(AssetType.File) && asAsset.TemplateId.Equals(0))
{
BuildAsset(asAsset, sbBinary);
if (!liBinaryFiles.Contains(asAsset.Id))
liBinaryFiles.Add(asAsset.Id);
}
else
{
BuildAsset(asAsset, sbOutput);
if (_assetType.Equals(AssetType.File))
{
if (IhSiteBuilderHelper.IsBinaryAttached(asAsset))
{
if (!liBinaryWrapped.Contains(asAsset.Id))
liBinaryWrapped.Add(asAsset.Id);
}
}
}
if (!liTemplates.Contains(asAsset.TemplateId) && asAsset.TemplateId > 0)
{
if (!Asset.Load(asAsset.TemplateId).AssetPath.ToString().Contains("/Basis/"))
{
liTemplates.Add(asAsset.TemplateId);
}
}
if (!liModels.Contains(asAsset.ModelId) && asAsset.ModelId > 0)
{
if (!Asset.Load(asAsset.ModelId).AssetPath.ToString().Contains("/Basis/"))
{
liModels.Add(asAsset.ModelId);
}
}
}
return sbOutput.ToString();
}