/// <summary> /// Converts a the HTML styles of an element to a list of /// <see cref="iText.StyledXmlParser.Css.CssDeclaration"/> /// instances. /// </summary> /// <param name="element">the element</param> /// <returns> /// the resulting list of /// <see cref="iText.StyledXmlParser.Css.CssDeclaration"/> /// instances. /// </returns> public static IList <CssDeclaration> Convert(IElementNode element) { List <CssDeclaration> convertedHtmlStyles = new List <CssDeclaration>(); if (element.GetAdditionalHtmlStyles() != null) { Dictionary <String, String> additionalStyles = new Dictionary <String, String>(); foreach (IDictionary <String, String> styles in element.GetAdditionalHtmlStyles()) { additionalStyles.AddAll(styles); } convertedHtmlStyles.EnsureCapacity(convertedHtmlStyles.Count + additionalStyles.Count); foreach (KeyValuePair <String, String> entry in additionalStyles) { convertedHtmlStyles.Add(new CssDeclaration(entry.Key, entry.Value)); } } foreach (IAttribute a in element.GetAttributes()) { HtmlStylesToCssConverter.IAttributeConverter aConverter = htmlAttributeConverters.Get(a.GetKey()); if (aConverter != null && aConverter.IsSupportedForElement(element.Name())) { convertedHtmlStyles.AddAll(aConverter.Convert(element, a.GetValue())); } } return(convertedHtmlStyles); }
public static Dictionary <string, string> MergeTags(Dictionary <string, string> tags1, Dictionary <string, string> tags2) { if (tags2 != null && tags2.Count > 0) { if (tags1 != null) { if (tags1.Count == 0) { return(tags2); } else { var result = new Dictionary <string, string>(tags1); result.AddAll(tags2); return(result); } } else { return(tags2); } } else { return(tags1); } }
public static Dictionary <TK, TV> Replicate <TK, TV>(this Dictionary <TK, TV> dict) { Dictionary <TK, TV> d = new Dictionary <TK, TV>(); d.AddAll(dict); return(d); }
public static Dictionary <TK, TV> Copy <TK, TV>([NotNull] this IDictionary <TK, TV> dict) { var dictionary = new Dictionary <TK, TV>(); dictionary.AddAll(dict); return(dictionary); }
public EditProjectGeospatialAreasViewDataForAngular(MapInitJson mapInitJson, List <ProjectFirmaModels.Models.GeospatialArea> geospatialAreasInViewModel, GeospatialAreaType geospatialAreaType, List <ProjectFirmaModels.Models.fGeoServerGeospatialAreaAreasContainingProjectLocation_Result> geospatialAreasContainingProjectSimpleLocation, bool hasProjectLocationPoint) { MapInitJson = mapInitJson; FindGeospatialAreaByNameUrl = SitkaRoute <ProjectGeospatialAreaController> .BuildUrlFromExpression(c => c.FindGeospatialAreaByName(geospatialAreaType, null)); TypeAheadInputId = "geospatialAreaSearch"; GeospatialAreaMapServiceLayerName = geospatialAreaType.GeospatialAreaLayerName; MapServiceUrl = geospatialAreaType.MapServiceUrl(); GeospatialAreaTypeName = geospatialAreaType.GeospatialAreaTypeName; GeospatialAreaTypeNamePluralized = geospatialAreaType.GeospatialAreaTypeNamePluralized; GeospatialAreaNameByID = geospatialAreasInViewModel.ToDictionary(x => x.GeospatialAreaID, x => x.GeospatialAreaShortName); GeospatialAreaNameByID.AddAll( geospatialAreasContainingProjectSimpleLocation .Where(x => !GeospatialAreaNameByID.ContainsKey(x.GeospatialAreaID)).ToDictionary( x => x.GeospatialAreaID, x => x.GeospatialAreaShortName)); GeospatialAreaIDsContainingProjectSimpleLocation = geospatialAreasContainingProjectSimpleLocation .Select(x => x.GeospatialAreaID).ToList(); HasProjectLocationPoint = hasProjectLocationPoint; }
//public virtual void NotifyChangeColumnType_RefsOnly(IColumnStructure newcol) { } //public bool IsFreezed { get { return m_isFreezed; } } //public IAbstractObjectStructure FreezeUntyped() //{ // if (IsFreezed) return this; // if (m_freezedCopy != null) return m_freezedCopy; // m_freezedCopy = (AbstractObjectStructure)CloneUntyped(); // m_freezedCopy.m_isFreezed = true; // return m_freezedCopy; //} //public abstract IAbstractObjectStructure CloneUntyped(); protected void CopyFromObject(IAbstractObjectStructure source) { // groupid is NOT merged m_specificData.Clear(); m_specificData.AddAll(source.SpecificData); Comment = source.Comment; XmlTool.CopyProperties(source, this); }
private T CreateCode <T>(Type type, CodedValue value_ren, ILOG.J2CsMapping.Collections.Generics.ISet <Type> implementedTypes) where T : Code { IDictionary <String, String> displayTextMap = new Dictionary <String, String>(); displayTextMap.AddAll(value_ren.Descriptions); return(type.Cast <T>(this.codeFactory.Create(type, implementedTypes, value_ren.Code, value_ren.CodeSystem.Oid, value_ren.CodeSystem.Name, displayTextMap, 1, true, true))); }
/// <summary> /// Make a deep copy of the styles and attributes of this renderer /// Helper method for deep copying logic /// </summary> /// <param name="deepCopy">renderer to insert the deep copied attributes into</param> protected internal virtual void DeepCopyAttributesAndStyles(ISvgNodeRenderer deepCopy) { IDictionary <String, String> stylesDeepCopy = new Dictionary <String, String>(); if (this.attributesAndStyles != null) { stylesDeepCopy.AddAll(this.attributesAndStyles); deepCopy.SetAttributesAndStyles(stylesDeepCopy); } }
public virtual IDictionary <String, String> GetAttributeMapCopy() { Dictionary <String, String> copy = new Dictionary <String, String>(); if (attributesAndStyles == null) { return(copy); } copy.AddAll(attributesAndStyles); return(copy); }
private IDictionary <string, string> GetLogicAndActualTables(RouteUnit routeUnit) { ICollection <string> tableNames = sqlCommandContext.GetTablesContext().GetTableNames(); IDictionary <string, string> result = new Dictionary <string, string>(tableNames.Count); foreach (var tableMapper in routeUnit.TableMappers) { result.Add(tableMapper.LogicName.ToLower(), tableMapper.ActualName); result.AddAll(shardingRule.GetLogicAndActualTablesFromBindingTable(routeUnit.DataSourceMapper.LogicName, tableMapper.LogicName, tableMapper.ActualName, tableNames)); } return(result); }
public IDictionary <TPrimaryKey, IDictionary <TSecondaryKey, TValue> > ToDictionary() { var result = new Dictionary <TPrimaryKey, IDictionary <TSecondaryKey, TValue> >(dictionary.Count); foreach (var entry in dictionary) { var secondaryEntry = new Dictionary <TSecondaryKey, TValue>(entry.Value.Count); secondaryEntry.AddAll(entry.Value); result.Put(entry.Key, secondaryEntry); } return(result); }
/// <summary>Finalize the columns.</summary> /// <returns> /// this /// <see cref="ColgroupWrapper"/> /// instance /// </returns> public virtual iText.Html2pdf.Attach.Wrapelement.ColgroupWrapper FinalizeCols() { if (indexToColMapping != null) { return(this); } if (columns.IsEmpty()) { columns.Add(new ColWrapper(span).SetCellCssProps(cellCssProps).SetWidth(width)); } else { if (cellCssProps != null) { foreach (ColWrapper col in columns) { IDictionary <String, String> colStyles = new Dictionary <String, String>(cellCssProps); if (col.GetCellCssProps() != null) { colStyles.AddAll(col.GetCellCssProps()); } if (colStyles.Count > 0) { col.SetCellCssProps(colStyles); } if (col.GetWidth() == null) { col.SetWidth(width); } } } } columns = JavaCollectionsUtil.UnmodifiableList(columns); int ncol = 0; foreach (ColWrapper col in columns) { ncol += col.GetSpan(); } indexToColMapping = new int[ncol]; span = 0; for (int i = 0; i < columns.Count; ++i) { int colSpan = columns[i].GetSpan(); for (int j = 0; j < colSpan; ++j) { indexToColMapping[span + j] = i; } span += colSpan; } return(this); }
/** * Get logic and actual binding tables. * * @param dataSourceName data source name * @param logicTable logic table name * @param actualTable actual table name * @param availableLogicBindingTables available logic binding table names * @return logic and actual binding tables */ public IDictionary <string, string> GetLogicAndActualTablesFromBindingTable(string dataSourceName, string logicTable, string actualTable, ICollection <string> availableLogicBindingTables) { IDictionary <string, string> result = new Dictionary <string, string>(); var bindingTableRule = FindBindingTableRule(logicTable); if (bindingTableRule != null) { result.AddAll(bindingTableRule.GetLogicAndActualTables(dataSourceName, logicTable, actualTable, availableLogicBindingTables)); } return(result); }
public async Task <List <IBaseNode> > ListVersionsAsync(JObject options = null, JObject pagination = null) { string uri = URI + "/versions/"; IDictionary <string, string> queryParams = new Dictionary <string, string>(); if (options != null) { queryParams.AddAll(options.ToObject <Dictionary <string, string> >()); } if (pagination != null) { queryParams.AddAll(pagination.ToObject <Dictionary <string, string> >()); } JObject response = await Driver.GetAsync(uri, queryParams); JArray nodeArray = (JArray)response.SelectToken("rows"); List <IBaseNode> nodes = NodeUtil.NodeList(nodeArray, Branch); return(nodes); }
/// <summary> /// Gets all child transforms of the field transform. /// </summary> /// <returns>The all children.</returns> /// <param name="transform">Transform.</param> private Dictionary <string, Transform> GetAllChildren(Transform transform) { Dictionary <string, Transform> children = new Dictionary <string, Transform> (); foreach (Transform t in transform) { children.Add(t.name, t); if (t.childCount > 0) { children.AddAll(GetAllChildren(t)); } } return(children); }
/// <summary> /// Groups en enumerable to a dictionary of partitions of new items. /// </summary> /// <typeparam name="TElem">The type of the item in the enumerable.</typeparam> /// <typeparam name="TKey">The type of the discriminator.</typeparam> /// <typeparam name="TValue">The type of the partition's item.</typeparam> /// <param name="source">The enumerable to partition.</param> /// <param name="keySelector">The discriminator selector.</param> /// <param name="valueSelector">The partition's item selector.</param> /// <param name="comparer">The discriminator's comparer.</param> /// <returns>A dictionary of partitions</returns> public static Dictionary <TKey, IEnumerable <TValue> > GroupToDictionary <TElem, TKey, TValue>( this IEnumerable <TElem> source, Func <TElem, TKey> keySelector, Func <TElem, TValue> valueSelector, IEqualityComparer <TKey> comparer = null) { var result = new Dictionary <TKey, IEnumerable <TValue> >(comparer); result.AddAll(source.GroupBy( keySelector, valueSelector, (key, coll) => new KeyValuePair <TKey, IEnumerable <TValue> >(key, coll), comparer)); return(result); }
protected override void OnDataChanged(List <User> list) { if (list.Count == 0) { return; } var users = UserIdList.Create(list.ConvertAll(it => it.Id)); Communities.AreFriends(users, areFriends => { _areFriends.AddAll(areFriends); }, error => _console.LogE(error.Message)); Communities.IsFollowing(UserId.CurrentUser(), FollowQuery.Users(users), follows => { _follows.AddAll(follows); }, error => _console.LogE(error.Message)); }
public void Update(ResourceData originalData) { FixedDeltaTimeValue = originalData.FixedDeltaTimeValue; AvailableResources.Clear(); AvailableResources.AddAll(originalData.AvailableResources); MaxResources.Clear(); MaxResources.AddAll(originalData.MaxResources); ModsCurrentlyRunning.Clear(); ModsCurrentlyRunning.AddRange(originalData.ModsCurrentlyRunning); FixedUpdateCalledMods.Clear(); FixedUpdateCalledMods.AddRange(originalData.FixedUpdateCalledMods); OverheatMultiplier = originalData.OverheatMultiplier; }
public Dictionary <string, object> CollateParams(TargetDeliveryRequest deliveryRequest = default, RequestDetails requestDetails = default) { var result = new Dictionary <string, object>(); var geo = deliveryRequest?.DeliveryRequest?.Context?.Geo; if (geo == null) { result.AddAll(DefaultGeoParams); return(result); } result.Add(GeoLatitude, geo.Latitude); result.Add(GeoLongitude, geo.Longitude); result.Add(GeoCity, string.IsNullOrEmpty(geo.City) ? string.Empty : geo.City.Replace(" ", string.Empty).ToUpperInvariant()); result.Add(GeoRegion, string.IsNullOrEmpty(geo.StateCode) ? string.Empty : geo.StateCode.ToUpperInvariant()); result.Add(GeoCountry, string.IsNullOrEmpty(geo.CountryCode) ? string.Empty : geo.CountryCode.ToUpperInvariant()); return(result); }
private Dictionary <string, object> CaptureMetadata(ImageMetadata imageMetadata, string query) { var ret = new Dictionary <string, object>(); var bitmapMetadata = imageMetadata as BitmapMetadata; if (bitmapMetadata != null) { foreach (string relativeQuery in bitmapMetadata) { string fullQuery = query + relativeQuery; object metadataQueryReader = bitmapMetadata.GetQuery(relativeQuery); var innerBitmapMetadata = metadataQueryReader as BitmapMetadata; if (innerBitmapMetadata != null) { ret.AddAll(CaptureMetadata(innerBitmapMetadata, fullQuery)); } else if (!(metadataQueryReader is BitmapMetadataBlob)) { ret[fullQuery] = metadataQueryReader; } } } return(ret); }
public async override Task<Dictionary<string, string>> RequestSearchIndexAsync(CancellationToken ct) { var index = new Dictionary<string, string>(); string site = await Util.RequestSimplifiedHtmlSiteAsync(GetWebsiteLink() + "cartoon-list/"); ct.ThrowIfCancellationRequested(); index.AddAll(ParseSeriesOverview(site)); int nextIndex = site.IndexOf("next page-numbers"); while (nextIndex != -1) { ct.ThrowIfCancellationRequested(); string nextPage = site.GetSubstringBetween(nextIndex, "href=\"", "\""); site = await Util.RequestSimplifiedHtmlSiteAsync(nextPage); index.AddAll(ParseSeriesOverview(site)); nextIndex = site.IndexOf("next page-numbers"); } ct.ThrowIfCancellationRequested(); site = await Util.RequestSimplifiedHtmlSiteAsync(GetWebsiteLink() + "anime-dubbed/"); index.AddAll(ParseSeriesOverview(site)); nextIndex = site.IndexOf("next page-numbers"); while (nextIndex != -1) { ct.ThrowIfCancellationRequested(); string nextPage = site.GetSubstringBetween(nextIndex, "href=\"", "\""); site = await Util.RequestSimplifiedHtmlSiteAsync(nextPage); index.AddAll(ParseSeriesOverview(site)); nextIndex = site.IndexOf("next page-numbers"); } ct.ThrowIfCancellationRequested(); return index; }
private IDictionary<string, object> LoadMetadata() { var metadata = new Dictionary<string, object> (); foreach (var file in Files.GetAllFiles (BaseDir)) { var map = ProcessMetadata (file); if (map != null) { metadata.AddAll (map); } } return metadata; }
/// <summary> /// Attach some custom data to the promo code. /// </summary> /// <param name="data">Custom data.</param> /// <returns>Instance of builder for method chaining.</returns> public PromoCodeBuilder AddData(Dictionary <string, string> data) { _data.AddAll(data); return(this); }
public ColumnReference(string colname, Dictionary <string, string> specData) { ColumnName = colname; SpecificData = new Dictionary <string, string>(); SpecificData.AddAll(specData); }
public UserUpdate AddPrivateProperties(Dictionary <string, string> properties) { _privateProperties.AddAll(properties); return(this); }
/// <summary> /// Attach some custom data to the promo code. /// </summary> /// <param name="data">Custom data.</param> /// <returns>Instance of builder for method chaining.</returns> public PromoCodeContent AddProperties(Dictionary <string, string> data) { Data.AddAll(data); return(this); }
// ReSharper restore FunctionNeverReturns private void AddToKnownCharacters(IList <IEveCharacter> newChars) { _knownCharacters.AddAll(newChars, character => character.Name); }
/// <summary> /// Add all keys and values from map to template placeholders. /// </summary> /// <param name="templateData">template placeholders map.</param> /// <returns>notification content for methods chaining</returns> public NotificationContent AddTemplatePlaceholders(Dictionary <string, string> templateData) { _templatePlaceholders.AddAll(templateData); return(this); }
public Builder AddActionData(Dictionary <string, string> data) { _data.AddAll(data); return(this); }
//+ UTILITY FUNCTIONS //? Strip Functions private static void StripByMatch <K, V>(Dictionary <K, V> original, Dictionary <K, V> modded, Predicate <KeyValuePair <K, V> > predicate) { modded.AddAll(original, predicate); original.RemoveAll(predicate); }
private static void ParseGuides <T>(XmlNodeList nodes, MessageFactory <T> mfact) where T : IsoMessage { List <XmlElement> subs = null; var guides = new Dictionary <int, Dictionary <int, FieldParseInfo> >(); for (var i = 0; i < nodes.Count; i++) { var elem = (XmlElement)nodes.Item(i); if (elem == null) { continue; } var type = ParseType(elem.GetAttribute("type")); if (type == -1) { throw new IOException("Invalid ISO8583 type for parse guide: " + elem.GetAttribute("type")); } if (elem.GetAttribute("extends") != null && !elem.GetAttribute("extends").IsEmpty()) { subs ??= new List <XmlElement>(nodes.Count - i); subs.Add(elem); continue; } var parseMap = new Dictionary <int, FieldParseInfo>(); var fields = elem.GetElementsByTagName("field"); for (var j = 0; j < fields.Count; j++) { var f = (XmlElement)fields.Item(j); if (f == null || f.ParentNode != elem) { continue; } var num = int.Parse(f.GetAttribute("num")); parseMap.Add( num, GetParser( f, mfact)); } mfact.SetParseMap( type, parseMap); if (guides.ContainsKey(type)) { guides[type] = parseMap; } else { guides.Add( type, parseMap); } } if (subs == null) { return; } foreach (var elem in subs) { var type = ParseType(elem.GetAttribute("type")); var @ref = ParseType(elem.GetAttribute("extends")); if (@ref == -1) { throw new ArgumentException( "Message template " + elem.GetAttribute("type") + " extends invalid template " + elem.GetAttribute("extends")); } var parent = guides[@ref]; if (parent == null) { throw new ArgumentException( "Parsing guide " + elem.GetAttribute("type") + " extends nonexistent guide " + elem.GetAttribute("extends")); } var child = new Dictionary <int, FieldParseInfo>(); child.AddAll(parent); var fields = GetDirectChildrenByTagName( elem, "field"); foreach (var f in fields) { var num = int.Parse(f.GetAttribute("num")); var typedef = f.GetAttribute("type"); if ("exclude".Equals(typedef)) { child.Remove(num); } else { child.Add( num, GetParser( f, mfact)); } } mfact.SetParseMap( type, child); if (guides.ContainsKey(type)) { guides[type] = child; } else { guides.Add( type, child); } } }
public ColumnReference(IColumnReference src) { ColumnName = src.ColumnName; SpecificData = new Dictionary <string, string>(); SpecificData.AddAll(src.SpecificData); }
public void Init() { var parent = Path.GetDirectoryName (DiskPath); var siblings = new SortedDictionary<string, Page> (); foreach (var i in Tacker.Pages) { if (i.DiskPath.Equals (parent)) { Parent = i; } if (parent.Equals (Path.GetDirectoryName (i.DiskPath)) && i != this && !i.IsFloating) { siblings.Add (Path.GetFileName (i.DiskPath), i); } } Siblings = new List<Page> (siblings.Values); var metadata = new Dictionary<string, object> (); var assets = new HashSet<string> (); foreach (var i in Files.GetAllFiles (DiskPath)) { var md = Tacker.ProcessMetadata (i); if (md != null) { Template = Template ?? Path.GetFileNameWithoutExtension (i); metadata.AddAll (md); continue; } var markup = Tacker.ProcessMarkup (i); if (markup != null) { metadata.Add (Path.GetFileNameWithoutExtension (i), markup); continue; } assets.Add (i); } var pagePaths = new HashSet<string> (); foreach (var page in Tacker.Pages) { pagePaths.Add (page.DiskPath); } foreach (var subdir in Files.EnumerateAllSubdirs (DiskPath)) { if (!pagePaths.Contains (subdir)) { assets.AddAll (Files.GetAllFiles (subdir)); } } Assets = new HashSet<string> (assets.Select (x => x.Replace (DiskPath, ""))); Variables = metadata; inited = true; }