private void Parse() { var deserializer = new JavaScriptSerializer { MaxJsonLength = Response.ResponseStr.Length }; var d = (Dictionary <string, object>)deserializer.Deserialize(Response.ResponseStr, typeof(object)); if (d.ContainsKey("value")) { if (d.ContainsKey("odata.count")) { InLineCount = long.Parse(d["odata.count"].ToString()); } if (d.ContainsKey("value")) { var values = (object[])d["value"]; Entries.AddRange(values.OfType <Dictionary <string, object> >().Select(this.ParseEntry)); } } else { Entries.Add(this.ParseEntry(d)); } }
private void Parse() { var deserializer = new JavaScriptSerializer { MaxJsonLength = Response.ResponseStr.Length }; var dictionary = (Dictionary <string, object>)deserializer.Deserialize(Response.ResponseStr, typeof(object)); var itemd = dictionary["d"]; if (itemd is Dictionary <string, object> ) { var d = itemd as Dictionary <string, object>; if (d.ContainsKey("results")) { var results = (object[])d["results"]; Entries.AddRange(results.OfType <Dictionary <string, object> >().Select(this.ParseEntry)); if (d.ContainsKey("__count")) { InLineCount = long.Parse(d["__count"].ToString()); } } else { Entries.Add(this.ParseEntry(d)); } } else if (itemd is object[]) { var d = itemd as object[]; Entries.AddRange(d.OfType <Dictionary <string, object> >().Select(this.ParseEntry)); } }
private void SortEntries() { ArrayList list = new ArrayList(); foreach (GumpEntry entry in new ArrayList(Entries)) { if (entry is GumpBackground) { list.Add(entry); Entries.Remove(entry); } } foreach (GumpEntry entry in new ArrayList(Entries)) { if (entry is GumpAlphaRegion) { list.Add(entry); Entries.Remove(entry); } } list.AddRange(Entries); Entries.Clear(); Entries.AddRange(list); }
public void MergeWith(EventFrame frame) { Categories.AddRange(frame.Categories); Categories.Sort(); Entries.AddRange(frame.Entries); Entries.Sort(); }
private void LoadSnapshot(CompetitionSnapshot snapshot, ISnapshotMetadata metadata, CancellationToken cancellationToken) { Competitionname = snapshot.Competitionname; IsDeleted = snapshot.IsDeleted; User = snapshot.User; Entries.Clear(); Entries.AddRange(snapshot.Entries.Select(e => new EntryEntity(e))); }
/// <inheritdoc /> public void AddEntries(IReadOnlyList <ITableEntry> newEntries, bool removeAllEntries = false) { if (removeAllEntries) { RemoveAllEntries(); } Entries.AddRange(newEntries); }
/// <summary> /// Creates a new object. /// </summary> public GoogleMapStyleTypeConverter() { Entries.AddRange(new string[] { "HYBRID", "ROADMAP", "SATELLITE", "TERRAIN" }); }
public SpellCheckingContextMenuDefinition(string word, SpellingManager manager) { _currentWord = word; _spellingManager = manager; Entries.AddRange(GetSpellingSuggestions()); Entries.Add(CommandId.IgnoreOnce, true, false); Entries.Add(CommandId.IgnoreAll, false, false); Entries.Add(CommandId.AddToDictionary, false, false); Entries.Add(CommandId.OpenSpellingForm, false, false); }
private async Task LoadAsync() { IsLoading = true; TimelineListResponse response = await Api.GetTimelineListAsync(offset); Entries.AddRange(response.Entries); HasMore = response.HasMore; offset = Entries.Count; IsLoading = false; StateHasChanged(); }
public void MergeWith(EventFrame frame) { Categories.AddRange(frame.Categories); Categories.Sort(); Entries.AddRange(frame.Entries); Entries.Sort(); root = new EventTree(this, Entries); board = new Board <EventBoardItem, EventDescription, EventNode>(root); CategoriesTree = new EventTree(this, Categories); }
public async Task Load(string fileName) { if (File.Exists(fileName)) { bool success = false; var streamReader = new StreamReader(fileName); string content = await streamReader.ReadToEndAsync(); streamReader.Close(); Entries.Clear(); CustomDisplayLists.Clear(); try { var settings = JObject.Parse(content).ToObject <TextureFormatSettings>(); Entries.AddRange(settings.Entries); CustomDisplayLists.AddRange(settings.CustomDisplayLists); success = true; } catch (Exception) { } if (!success) { try { Entries.AddRange(JArray.Parse(content).ToObject <Entry[]>()); success = true; } catch (Exception) { } } if (!success) { var sr = new StringReader(content); while (sr.Peek() > -1) { #pragma warning disable CS0612 // Typ oder Element ist veraltet var e = Entry.FromString(await sr.ReadLineAsync()); #pragma warning restore CS0612 // Typ oder Element ist veraltet Entries.Add(e); } sr.Close(); sr.Dispose(); } } }
public void Refresh() { ResultNodes.Clear(); int nodeCounter = 0; List <AttributeTypeDTO> required = ClassNode.ServerNode.ServerDTO.Connection.SchemaManager.GetRequiredAttributes(ClassNode.DisplayName); required.ForEach(x => x.IsOptional = false); List <AttributeTypeDTO> optional = ClassNode.ServerNode.ServerDTO.Connection.SchemaManager.GetOptionalAttributes(ClassNode.DisplayName); optional.ForEach(x => x.IsOptional = true); Entries = required; Entries.AddRange(optional); foreach (var item in Entries) { var resultNode = new ResultNode { DisplayName = item.Name }; resultNode.ImageIndex = (int)VMDirSchemaTreeImageIndex.Attribute; resultNode.Tag = nodeCounter++; resultNode.SubItemDisplayNames.Add(Convert.ToString(item.IsOptional)); resultNode.SubItemDisplayNames.Add(item.Type); this.ResultNodes.Add(resultNode); } this.Sort(0); this.DescriptionBarText = this.ResultNodes.Count.ToString(); }
/// <summary> /// Initializes a new instance of <strong>X509CertificateTrustListBuilder</strong> from existing trust list. All data from existing /// list is copied to builder. /// </summary> /// <param name="ctl">Existing trust list to use as a base object.</param> /// <exception cref="ArgumentNullException"> /// <strong>ctl</strong> parameter is null. /// </exception> public X509CertificateTrustListBuilder(X509CertificateTrustList ctl) { if (ctl == null) { throw new ArgumentNullException(nameof(ctl)); } ListIdentifier = ctl.ListIdentifier; SequenceNumber = ctl.GetSequenceNumber(); foreach (Oid usage in ctl.SubjectUsage) { SubjectUsages.Add(usage); } Entries.AddRange(ctl.Entries); HashAlgorithm = ctl.SubjectAlgorithm; ThisUpdate = ctl.ThisUpdate; NextUpdate = ctl.NextUpdate; }
public void AddEpisodes(IList <Episode> episodes, int?newIndex = null) { if (episodes.Count == 0) { return; } var entriesToAdd = new List <PlaylistEntry>(); foreach (var episode in episodes) { var entry = GetEntryForEpisode(episode); if (entry != null) { continue; } entry = new PlaylistEntry { Enclosure = episode.Enclosure, Position = episode.Position }; episode.IsPlayed = false; entriesToAdd.Add(entry); } if (entriesToAdd.Count > 0) { Entries.AddRange(entriesToAdd); } RaisePropertyChanged(nameof(CanGoNext)); RaisePropertyChanged(nameof(CanGoPrev)); if (newIndex.HasValue) { CurrentIndex = newIndex.Value; } if (CurrentIndex == -1) { CurrentIndex = 0; } }
/// <inheritdoc /> public void Contribute() { if (Finalized) { return; } Finalized = true; var subMenus = Contributor.Store .Where(a => Submenus.Contains(a.Key)) .Select(a => a.Value) .Cast <ConcreteSubmenuBuilder>() .ToList(); subMenus.ForEach(a => a.Contribute()); Entries.ForEach(a => ((IMenuEntryBuilder)a).Contribute()); Entries.AddRange(subMenus); Entries.Sort((a, b) => a.Priority.CompareTo(b.Priority)); }
public static void UpdateLists() { while (true) { try { var Files = Directory.GetFiles("Data"); foreach (var File in Files) { if (File.EndsWith(".json")) { try { var _List = System.IO.File.ReadAllText(File); var newList = JsonConvert.DeserializeObject <List <Entry> >(_List); List <Entry> NewEntries = new List <Entry>(); foreach (var en in newList) { if (!Entries.Any(x => x.Link == en.Link)) { NewEntries.Add(en); } } if (NewEntries.Any()) { Entries.AddRange(NewEntries); Zorro.MongoDB.PushBatch(NewEntries); } } catch { } } } #if DEBUG Thread.Sleep(5000); #else Thread.Sleep(60000); #endif } catch { } } }
public static List <AutomationElement> GetAllProcessWindows(int processId, int count = -10) { Entries.Add(new LogEntry { Count = count, retryCount = -1, StackTrace = Environment.StackTrace }); int retryCount = 0; retry: var result = GetRecursiveProcessWindows(AutomationElement.RootElement, processId); Entries.AddRange(result.Select(r => new LogEntry { Count = count, retryCount = retryCount, ClassName = r.SafeGet(p => p.ClassName, "error"), Name = r.SafeGet(p => p.Name, "error"), RuntimeId = r.GetRuntimeId().ToString("."), ItemStatus = r.SafeGet(p => p.ItemStatus, "error"), })); if (result.IsEmpty() || result.Any(a => a.SafeGet(p => p.ClassName.StartsWith("HwndWrapper"), false))) { if (retryCount > 4) { throw new InvalidOperationException("No windows found after {0} retries".FormatWith(retryCount)); } retryCount++; goto retry; } return(result); }
private void Parse(XElement rootElement) { Links.AddRange(rootElement.Elements(AtomNS + "link").Select(ParseLink)); XElement inlineCount = rootElement.Elements(MetadataNS + "count").SingleOrDefault(); if (inlineCount != null) { InLineCount = long.Parse(inlineCount.Value); } else { InLineCount = -1; } if (rootElement.Name.Equals(AtomNS + "entry")) { Entries.Add(ParseEntry(rootElement)); } else { Entries.AddRange(rootElement.Elements(AtomNS + "entry").Select(ParseEntry)); } }
/// <summary> /// Initializes a new instance of the <see cref="ExFatMetaDirectoryEntry"/> class. /// </summary> /// <param name="entries">The entries.</param> public ExFatMetaDirectoryEntry(IEnumerable <ExFatDirectoryEntry> entries) { Entries.AddRange(entries); }
public BridgeDayEntries([NotNull] HouseholdKey householdKey, [NotNull] List <DateTime> dateTimes) { HouseholdKey = householdKey; Entries.AddRange(dateTimes); }
private void SetFrom(PrintingQueuesConfiguration value) { Entries.AddRange(value.Entries); }
public DynamoDBList(IEnumerable <DynamoDBEntry> entries) : this() { Entries.AddRange(entries); }
public AtomFeed(IFeed source) { // ** IFeedMetadata // ID Id = source.ID.ToString(); // Title string title = source.Title; if (!string.IsNullOrWhiteSpace(title)) { Title = title; } // Description string description = source.Description; if (!string.IsNullOrEmpty(description)) { SubTitle = description; } // Author string author = source.Author; if (!string.IsNullOrEmpty(author)) { Authors.Add(new AtomPerson { Name = author }); } // Published DateTime?published = source.Published; if (published.HasValue) { Updated = published.Value; } // Updated DateTime?updated = source.Updated; if (updated.HasValue) { Updated = updated.Value; } // Link Uri link = source.Link; if (link != null) { Links.Add(new AtomLink { Href = link.ToString(), Rel = "self" }); } // ImageLink Uri imageLink = source.ImageLink; if (imageLink != null) { Logo = imageLink.ToString(); } // ** IFeed // Copyright string copyright = source.Copyright; if (!string.IsNullOrEmpty(copyright)) { Rights = new AtomText(copyright); } // Items IList <IFeedItem> sourceItems = source.Items; if (sourceItems != null) { Entries.AddRange(sourceItems.Select(x => new AtomEntry(x))); } }
public EvolutionTree(byte[][] data, GameVersion game, PersonalTable personal) { Personal = personal; switch (game) { case GameVersion.SM: Entries.AddRange(data.Select(d => new EvolutionSet7(d))); break; case GameVersion.ORAS: Entries.AddRange(data.Select(d => new EvolutionSet6(d))); break; } // Create Lineages Lineage = new EvolutionLineage[Entries.Count]; for (int i = 0; i < Entries.Count; i++) { Lineage[i] = new EvolutionLineage(); } // Populate Lineages for (int i = 1; i < Lineage.Length; i++) { // Iterate over all possible evolutions var s = Entries[i]; foreach (EvolutionMethod evo in s.PossibleEvolutions) { int index = getIndex(evo); if (index < 0) { continue; } var sourceEvo = evo.Copy(i); Lineage[index].Insert(sourceEvo); // If current entries has a pre-evolution, propagate to evolution as well if (Lineage[i].Chain.Count > 0) { Lineage[index].Insert(Lineage[i].Chain[0]); } if (index >= i) { continue; } // If destination species evolves into something (ie a 'baby' Pokemon like Cleffa) // Add it to the corresponding parent chains foreach (EvolutionMethod mid in Entries[index].PossibleEvolutions) { int newIndex = getIndex(mid); if (newIndex < 0) { continue; } Lineage[newIndex].Insert(sourceEvo); } } } }