public string Render(StylesheetBundle unusedParameter) { if (isDebuggingEnabled && Assets.Any()) { return(fallbackRenderer.Render(this)); } var conditionalRenderer = new ConditionalRenderer(); return(conditionalRenderer.Render(Condition, RenderLink)); }
public override IEnumerable <string> GetUrls(bool isDebuggingEnabled, IUrlGenerator urlGenerator) { if (isDebuggingEnabled && Assets.Any()) { return(base.GetUrls(true, urlGenerator)); } else { return(new[] { ExternalUrl }); } }
public string GetUniqueFileName(string[] hierarchy, string filename, string extension) { int n = 1; string ret = filename; while (Assets.Any(x => x.Hierarchy.SequenceEqual(hierarchy) && x.Name == ret && x.Extension == extension)) { ret = string.Format("{0} ({1})", filename, n++); } return(ret); }
public string Render(ScriptBundle unusedParameter) { if (isDebuggingEnabled && Assets.Any()) { return(fallbackRenderer.Render(this)); } var conditionalRenderer = new ConditionalRenderer(); return(conditionalRenderer.Render(Condition, html => { if (Assets.Any()) { RenderScriptHtmlWithFallback(html); } else { RenderScriptHtml(html); } })); }
public string Render(StylesheetBundle unusedParameter) { if (isDebuggingEnabled && Assets.Any()) { return(FallbackRenderer.Render(this)); } var conditionalRenderer = new ConditionalRenderer(); return(conditionalRenderer.Render(Condition, html => { if (string.IsNullOrEmpty(Media)) { RenderLink(html); } else { RenderLinkWithMedia(html); } })); }
/// <summary> /// Adds the specified game object as an asset. /// </summary> /// <remarks> /// If you add a game object that already is an asset it will return that instance instead. /// </remarks> /// <param name="gameObject">The game object.</param> /// <returns>The asset that was created from the game object.</returns> public Asset Add(GameObject gameObject) { if (Assets.Any(a => a.GameObject == gameObject)) { Debug.LogWarning(string.Format("GameObject {0} is already added as an asset, can't add twice.", gameObject.name)); return(Assets.First(a => a.GameObject == gameObject)); } var asset = new Asset { GameObject = gameObject, Name = gameObject.name, Category = ProjectManager.Project.Value.ProjectName, SubCategory = "", SnapCenter = true, GridSubdivision = 1, HeightDelta = 0.25f }; Add(asset); return(asset); }
bool IAddChildViewModel.CanAddChildren(IReadOnlyCollection <object> children, AddChildModifiers modifiers, out string message) { if (children.Any(x => (x is IIsEditableViewModel) && !((IIsEditableViewModel)x).IsEditable)) { message = "Some source items are read-only"; return(false); } if (!Package.IsEditable) { message = "Read-only package"; return(false); } message = $"Add to {Path}"; foreach (var child in children) { var mountPoint = child as MountPointViewModel; var directory = child as DirectoryViewModel; var asset = child as AssetViewModel; if (mountPoint != null) { message = DragDropBehavior.InvalidDropAreaMessage; return(false); } if (directory != null) { if (directory == this) { message = "Can't drop a folder on itself or its children"; return(false); } if (directory.Root.GetType() != Root.GetType()) { message = "Incompatible folder"; return(false); } if (directory.Root is ProjectViewModel && Root != directory.Root) { message = "Can't move source files between projects"; return(false); } if (SubDirectories.Any(x => x.Name == directory.Name)) { message = $"Directory {((this is DirectoryViewModel) ? Path : Name)} already contains a subfolder named {directory.Name}"; return(false); } if (children.OfType <DirectoryViewModel>().Any(x => x != child && string.Compare(x.Name, directory.Name, StringComparison.OrdinalIgnoreCase) == 0)) { message = "Can't move directories with duplicate names"; return(false); } var currentParent = Parent; while (currentParent != null) { if (currentParent == directory) { message = "Can't drop a directory on itself or its children"; return(false); } currentParent = currentParent.Parent; } } else if (asset != null) { if (asset.IsLocked) { message = $"Asset {asset.Url} can't be moved"; return(false); } if (Assets.Any(x => string.Compare(x.Name, asset.Name, StringComparison.OrdinalIgnoreCase) == 0)) { message = $"{(!string.IsNullOrEmpty(Path) ? $"Directory {Path}" : "This directory")} already contains an asset named {asset.Name}"; return(false); } if (children.OfType <AssetViewModel>().Any(x => x != child && string.Compare(x.Name, asset.Name, StringComparison.OrdinalIgnoreCase) == 0)) { message = "Can't move assets with duplicate names"; return(false); } if (asset.Directory.Root.GetType() != Root.GetType()) { message = "Incompatible folder"; return(false); } if (asset.Directory.Root is ProjectViewModel && Root != asset.Directory.Root) { message = "Can't move source files between projects"; return(false); } } else { message = "Only folders can be dropped"; return(false); } } return(true); }
private bool HasBitcodeAssets() => Assets.Any(a => a.ItemSpec.EndsWith(".bc", StringComparison.OrdinalIgnoreCase));
private bool HasBitcodeAssets() => Assets.Any(asset => BitCodeExtensions.Any(ext => asset.ItemSpec.EndsWith(ext, StringComparison.OrdinalIgnoreCase)));
//--------------------------------------------------------------------------- public bool IsNameAvailable(string name) { return(!Assets.Any(asset => asset.Name == name)); }
public ApplicationContext(DbContextOptions <ApplicationContext> options) : base(options) { Database.EnsureCreated(); IsEmpty = !(Users.Any() || Assets.Any() || Transactions.Any() || Categories.Any()); }