void AddNativeLibraries(ArchiveFileList files, string supportedAbis, System.Collections.Generic.IEnumerable <LibInfo> libs) { if (libs.Any(lib => lib.Abi == null)) { Log.LogCodedWarning( "4301", "Could not determine abi of some native libraries, ignoring those: " + string.Join(", ", libs.Where(lib => lib.Abi == null).Select(lib => lib.Path))); } libs = libs.Where(lib => lib.Abi != null); var abis = supportedAbis.Split(new char[] { ',', ';' }, StringSplitOptions.RemoveEmptyEntries); libs = libs.Where(lib => abis.Contains(lib.Abi)); foreach (var arm in ArmAbis) { foreach (var info in libs.Where(lib => lib.Abi == arm)) { AddNativeLibrary(files, info.Path, info.Abi); } } foreach (var info in libs.Where(lib => !ArmAbis.Contains(lib.Abi))) { AddNativeLibrary(files, info.Path, info.Abi); } }
void AddNativeLibraries (ArchiveFileList files, string [] supportedAbis, System.Collections.Generic.IEnumerable<LibInfo> libs) { if (libs.Any (lib => lib.Abi == null)) Log.LogCodedWarning ( "XA4301", Properties.Resources.XA4301_ABI_Ignoring, string.Join (", ", libs.Where (lib => lib.Abi == null).Select (lib => lib.Path))); libs = libs.Where (lib => lib.Abi != null); libs = libs.Where (lib => supportedAbis.Contains (lib.Abi)); foreach (var info in libs) AddNativeLibrary (files, info.Path, info.Abi, info.ArchiveFileName); }
/// <summary> /// Getting left navigation menu from Sitecore content tree based on context item's parent with its childs /// Also displays only the items which has the options "Include in Left navigation" selected in sitecore /// </summary> /// <returns>Left navigation</returns> public ILeftNavigation GetLeftNavigation() { IMvcContext mvcContext = _mvcContext(); INavigable rootItem = mvcContext.GetContextItem <INavigable>(); //Setting default to context item _leftNavigation.ParentNavigationItem = rootItem; _leftNavigation.CurrentNavigationItem = rootItem; //Getting current item is Mediacenter based on its template id System.Collections.Generic.IEnumerable <Item> mediaCenter = rootItem.ContextItem.Axes.GetAncestors().Where(p => ID.Parse(p.TemplateID.ToGuid()).Equals(ID.Parse(SitecoreSettings.MediaCenterTemplateID))); if (mediaCenter.Any()) { //If context item is child of media center item template then have parent has Mediacenter _leftNavigation.ParentNavigationItem = mvcContext.SitecoreService.GetItem <INavigable>(mediaCenter.FirstOrDefault().ID.ToGuid()); //All nested childs will always have CurrentItemNavigation has its Mediacenter immediate child from where its(context item) comes from. IEnumerable <Item> currentItem = mediaCenter.FirstOrDefault().Children.Where(p => rootItem.ContextItem.Paths.LongID.Contains(p.ID.ToString())).Select(p => p); if (currentItem.Any()) { _leftNavigation.CurrentNavigationItem = _mvcContext()?.SitecoreService.GetItem <INavigable>(currentItem.FirstOrDefault().ID.ToGuid()); } } else { //Setting Current navigation item to context item _leftNavigation.CurrentNavigationItem = rootItem; } //Getting Parent item based on the following templates (Mediacenter,Generic contentpage and contentpage) switch (rootItem) { case var template when ID.Parse(rootItem.TemplateId).Equals(ID.Parse(SitecoreSettings.MediaCenterTemplateID)): _leftNavigation.ParentNavigationItem = _mvcContext()?.SitecoreService.GetItem <INavigable>(rootItem.Id); break; case var template when rootItem.BaseTemplateId.AsEnumerable().Any(p => p.Equals(SitecoreSettings.GenericContentPageTemplateID)) || ID.Parse(rootItem.TemplateId).Equals(ID.Parse(SitecoreSettings.GenericContentPageTemplateID)): _leftNavigation.ParentNavigationItem = _mvcContext()?.SitecoreService.GetItem <INavigable>(rootItem.Parent.Id); break; case var template when rootItem.BaseTemplateId.AsEnumerable().Any(p => p.Equals(SitecoreSettings.GenericContentRootPageTemplateID)) || ID.Parse(rootItem.TemplateId).Equals(ID.Parse(SitecoreSettings.GenericContentRootPageTemplateID)): _leftNavigation.ParentNavigationItem = rootItem; break; default: break; } return(_leftNavigation); }
private async Task MontaCabecalho(ObterRelatorioParecerConclusivoQuery request, RelatorioParecerConclusivoDto retorno, System.Collections.Generic.IEnumerable <RelatorioParecerConclusivoRetornoDto> parecesParaTratar) { retorno.Ano = (request.filtroRelatorioParecerConclusivoDto.Anos != null && request.filtroRelatorioParecerConclusivoDto.Anos.Length > 0) ? request.filtroRelatorioParecerConclusivoDto.Anos[0] : "Todos"; retorno.AnoLetivo = parecesParaTratar.Any() ? parecesParaTratar.FirstOrDefault().AnoLetivo : request.filtroRelatorioParecerConclusivoDto.AnoLetivo.ToString(); if (request.filtroRelatorioParecerConclusivoDto.Ciclo == 0) { retorno.Ciclo = "Todos"; } else { retorno.Ciclo = parecesParaTratar.FirstOrDefault(a => a.CicloId == request.filtroRelatorioParecerConclusivoDto.Ciclo).Ciclo; } retorno.Data = DateTime.Now.ToString("dd/MM/yyyy"); if (string.IsNullOrEmpty(request.filtroRelatorioParecerConclusivoDto.DreCodigo)) { retorno.DreNome = "Todas"; } else { var dreDoCabecalho = await mediator.Send(new ObterDrePorCodigoQuery() { DreCodigo = request.filtroRelatorioParecerConclusivoDto.DreCodigo }); retorno.DreNome = dreDoCabecalho.Abreviacao; } if (string.IsNullOrEmpty(request.filtroRelatorioParecerConclusivoDto.UeCodigo)) { retorno.UeNome = "Todas"; } else { var ueDoCabecalho = await mediator.Send(new ObterUePorCodigoQuery(request.filtroRelatorioParecerConclusivoDto.UeCodigo)); retorno.UeNome = ueDoCabecalho.NomeComTipoEscola; } retorno.RF = request.UsuarioRf; retorno.Usuario = request.filtroRelatorioParecerConclusivoDto.UsuarioNome; }
public bool IsReachable(FightActor actor) { System.Collections.Generic.IEnumerable <MapPoint> adjacentCells = actor.Position.Point.GetAdjacentCells((short entry) => this.Fight.Map.Cells[(int)entry].Walkable && !this.Fight.Map.Cells[(int)entry].NonWalkableDuringFight && this.Fight.IsCellFree(this.Fight.Map.Cells[(int)entry])); return(adjacentCells.Any <MapPoint>()); }
public override bool IsValid(object value) { if (value == null) { return(true); } if (!(value is ContentArea)) { throw new ValidationException("AvailableContentTypesAttribute is intended only for use with ContentArea properties"); } ContentArea contentArea = value as ContentArea; System.Collections.Generic.List <string> list = new System.Collections.Generic.List <string>(); if (contentArea != null) { if (IncludeFrom != null) { var includedTypes = ((AvailableContentTypesAttribute)Attribute .GetCustomAttribute(IncludeFrom, typeof(AvailableContentTypesAttribute))) .IfNotNull(x => x.Include); if (includedTypes != null) { Include = Include != null?Include.Union(includedTypes).ToArray() : includedTypes; } } if (this.Include != null) { System.Collections.Generic.IEnumerable <IContent> source = from x in contentArea.Contents where !this.ContainsType(this.Include, x.GetType()) select x; if (source.Any <IContent>()) { list.AddRange( from x in source select string.Format("[{2}] {0} ({1})", x.Name, x.ContentLink.ID, GetFriendlyBlockTypeName(x))); } } if (this.Exclude != null) { System.Collections.Generic.IEnumerable <IContent> source = from x in contentArea.Contents where this.ContainsType(this.Exclude, x.GetType()) select x; if (source.Any <IContent>()) { list.AddRange( from x in source select string.Format("[{2}] {0} ({1})", x.Name, x.ContentLink.ID, GetFriendlyBlockTypeName(x))); } } } bool result; if (list.Any <string>()) { base.ErrorMessage = "contains invalid content items: "; foreach (string current in list) { base.ErrorMessage = base.ErrorMessage + " " + current + ", "; } base.ErrorMessage = base.ErrorMessage.TrimEnd(new char[] { ',', ' ' }); ErrorMessage += ". Supported block types: " + string.Join(", ", Include.Select(type => GetFriendlyName(type.Name))) + "."; result = false; } else { result = true; } return(result); }
public static bool IsNotNullOrEmpty <T>(this System.Collections.Generic.IEnumerable <T> source) { return(source != null && source.Any()); }
private void Editor_ContextMenuOpening(object sender, ContextMenuEventArgs e) { this.Editor.ContextMenu = this.EditorContextMenu; if (this.SpellCheckProvider == null) { return; } TextViewPosition?positionFromPoint = this.Editor.GetPositionFromPoint(Mouse.GetPosition(this.Editor)); if (!positionFromPoint.HasValue) { return; } int offset = this.Editor.Document.GetOffset(positionFromPoint.Value.Line, positionFromPoint.Value.Column); System.Collections.Generic.IEnumerable <TextSegment> spellCheckErrors = this.SpellCheckProvider.GetSpellCheckErrors(); TextSegment textSegment = spellCheckErrors.FirstOrDefault((TextSegment segment) => segment.StartOffset <= offset && segment.EndOffset >= offset); if (textSegment == null) { return; } DocumentLine lineByOffset = this.Editor.Document.GetLineByOffset(offset); if (offset == lineByOffset.Offset || offset == lineByOffset.EndOffset) { return; } System.Collections.Generic.IEnumerable <string> spellcheckSuggestions = this.SpellCheckProvider.GetSpellcheckSuggestions(this.Editor.Document.GetText(textSegment)); int num = 0; if (spellcheckSuggestions.Any <string>()) { foreach (string current in spellcheckSuggestions) { MenuItem menuItem = new MenuItem { Header = current, FontWeight = FontWeights.Bold, Tag = textSegment }; menuItem.Click += new RoutedEventHandler(this.SuggestionItem_Click); this.Editor.ContextMenu.Items.Insert(num, menuItem); num++; } } MenuItem menuItem2 = new MenuItem { Header = LocalizationProvider.GetLocalizedString("MenuItem_AddToDictionary", false, "MarkdownPadStrings"), Tag = textSegment }; menuItem2.Click += delegate(object o, RoutedEventArgs args) { MenuItem menuItem3 = args.OriginalSource as MenuItem; TextSegment segment = (TextSegment)menuItem3.Tag; string text = this.Editor.Document.GetText(segment); this.SpellingService.AddWordToCustomDictionary(text); this.SpellCheckProvider.DoSpellCheck(); }; this.Editor.ContextMenu.Items.Insert(num, menuItem2); num++; Separator insertItem = new Separator(); this.Editor.ContextMenu.Items.Insert(num, insertItem); }