コード例 #1
0
ファイル: JsonLightResult.cs プロジェクト: zhonli/odata.net
        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));
            }
        }
コード例 #2
0
ファイル: JsonResult.cs プロジェクト: zhonli/odata.net
        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));
            }
        }
コード例 #3
0
        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);
        }
コード例 #4
0
ファイル: EventFrame.cs プロジェクト: heavenlydynasty/optick
        public void MergeWith(EventFrame frame)
        {
            Categories.AddRange(frame.Categories);
            Categories.Sort();

            Entries.AddRange(frame.Entries);
            Entries.Sort();
        }
コード例 #5
0
 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)));
 }
コード例 #6
0
        /// <inheritdoc />
        public void AddEntries(IReadOnlyList <ITableEntry> newEntries, bool removeAllEntries = false)
        {
            if (removeAllEntries)
            {
                RemoveAllEntries();
            }

            Entries.AddRange(newEntries);
        }
コード例 #7
0
 /// <summary>
 /// Creates a new object.
 /// </summary>
 public GoogleMapStyleTypeConverter()
 {
     Entries.AddRange(new string[] {
         "HYBRID",
         "ROADMAP",
         "SATELLITE",
         "TERRAIN"
     });
 }
コード例 #8
0
 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);
 }
コード例 #9
0
        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();
        }
コード例 #10
0
ファイル: EventFrame.cs プロジェクト: qjxkid/brofiler
        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);
        }
コード例 #11
0
        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();
                }
            }
        }
コード例 #12
0
        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();
        }
コード例 #13
0
 /// <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;
 }
コード例 #14
0
        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;
            }
        }
コード例 #15
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));
        }
コード例 #16
0
        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 { }
            }
        }
コード例 #17
0
        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);
        }
コード例 #18
0
        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));
            }
        }
コード例 #19
0
 /// <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);
 }
コード例 #20
0
 public BridgeDayEntries([NotNull] HouseholdKey householdKey, [NotNull] List <DateTime> dateTimes)
 {
     HouseholdKey = householdKey;
     Entries.AddRange(dateTimes);
 }
コード例 #21
0
 private void SetFrom(PrintingQueuesConfiguration value)
 {
     Entries.AddRange(value.Entries);
 }
コード例 #22
0
 public DynamoDBList(IEnumerable <DynamoDBEntry> entries)
     : this()
 {
     Entries.AddRange(entries);
 }
コード例 #23
0
        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)));
            }
        }
コード例 #24
0
        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);
                    }
                }
            }
        }