示例#1
0
        public bool MatchNode(MapNode n)
        {
            if (Icons.Count != 0)
            {
                if (MatchAllIcons)
                {
                    if (!Icons.All(icon => n.Icons.Contains(icon)))
                    {
                        return(false);
                    }
                }
                else
                {
                    if (!Icons.Any(icon => n.Icons.Contains(icon)))
                    {
                        return(false);
                    }
                }
            }

            return
                (n.Text.IndexOf(Text, StringComparison) >= 0 ||
                 (n.HasNoteText && !ExcludeNote && n.NoteText.IndexOf(Text, StringComparison) >= 0)
                );
        }
示例#2
0
 private void AddServices(IEnumerable <IControlService> services)
 {
     services?.Where(s => Icons.Any(i => i.Service == s) == false)
     .ToList()
     .Where(s => _resolver.CanCreate(s))
     .Select(s => (ControlServiceViewModel)_resolver.Create(s))
     .ForEach(Icons.Add);
 }
        /// <summary>
        /// Check if the manifest is valid
        /// </summary>
        public bool IsValid(out string error)
        {
            if (string.IsNullOrEmpty(Name) || string.IsNullOrEmpty(ShortName) || string.IsNullOrEmpty(StartUrl) || Icons == null)
            {
                error = $"The fields 'name', 'short_name', 'start_url' and 'icons' must be set  in {FileName}";
                return(false);
            }

            if (!Icons.Any(i => i.Sizes?.Equals("512x512", StringComparison.OrdinalIgnoreCase) == true))
            {
                error = $"Missing icon in size 512x512 in {FileName}";
                return(false);
            }

            if (!Icons.Any(i => i.Sizes?.Equals("192x192", StringComparison.OrdinalIgnoreCase) == true))
            {
                error = $"Missing icon in size 192x192 in {FileName}";
                return(false);
            }

            error = "";
            return(true);
        }