コード例 #1
0
        private static Expression GetPriSearchExpression <T>(ParameterExpression pe, SearchElement searchItem)
        {
            //List<Item> gruopfields = search_Parse_Pri_List.ToList();
            Expression innerExp = null; //Or in the same field

            //Expression outerExp = null; //Or in the same field

            if (searchItem.keyword.Length == 0)
            {
                return(null);
            }
            //If it is SearchingField Group
            foreach (string keyWord in searchItem.keyword)
            {
                if (innerExp == null) //Start Building Expression
                {
                    innerExp = GetPriSearchExpression <T>(pe, searchItem.FieldName, keyWord);
                }
                else
                {
                    innerExp = Expression.OrElse(innerExp, GetPriSearchExpression <T>(pe, searchItem.FieldName, keyWord));
                }
            }
            if (searchItem.isInclude)
            {
                return(innerExp);
            }

            return(Expression.Not(innerExp));
        }
        /// <summary>
        /// Searches for product.
        /// </summary>
        /// <param name="productName">Name of the product.</param>
        public virtual void SearchForProduct(string productName)
        {
            var currentWindowHandle = WrappedDriver.CurrentWindowHandle;

            ProductNameElement.SetValue(productName);
            SearchElement.Click();

            WrappedDriver
            .Wait(TimeSpan.FromSeconds(2))
            .Until(d => !ProductsGrid.IsBusy());

            var firstCheckbox = ProductsGrid
                                .GetCell(0, 0)
                                .FindElement(By.TagName("input"));

            var checkbox = new CheckboxElement(firstCheckbox);

            checkbox.Check(true);
            SaveElement.Click();

            // Wait for the page to close.
            WrappedDriver
            .Wait(TimeSpan.FromSeconds(10))
            .Until(d => !d.WindowHandles.Contains(currentWindowHandle));
        }
コード例 #3
0
        public void SearchElementPerformance_WithNoSearchData()
        {
            var searchElement = new SearchElement {
                SearchDelay = 0, GlobalStringComparison = StringComparison.Ordinal
            };

            var originalData = Generate(100000);
            var filteredData = new List <TestData>();

            searchElement.RegisterSearchQueryHandler <TestData>(search =>
            {
                foreach (var element in search.Apply(originalData))
                {
                    filteredData.Add(element);
                }
            });

            Measure.Method(() =>
            {
                searchElement.Search("Mat");
            })
            .WarmupCount(1)
            .MeasurementCount(1)
            .Run();

            Assert.That(filteredData.Count, Is.EqualTo(0));
        }
コード例 #4
0
        public void Search_PropertiesBackendSkipFilterTokens(string input)
        {
            var searchElement = new SearchElement();

            searchElement.RegisterSearchBackend(CreateSearchBackend <EquatableAndComparableTestData>(SearchBackendType.Properties));

            var sourceData = new[]
            {
                new EquatableAndComparableTestData {
                    Name = "hello"
                },
                new EquatableAndComparableTestData {
                    Name = "hola"
                },
            };

            EquatableAndComparableTestData[] filtered = null;

            searchElement.RegisterSearchQueryHandler <EquatableAndComparableTestData>(q => filtered = q.Apply(sourceData).ToArray());
            searchElement.AddSearchDataProperty(new PropertyPath(nameof(EquatableAndComparableTestData.Name)));
            searchElement.AddSearchFilterPopupItem("c", "component type");

            searchElement.Search(input);
            Assert.That(filtered, Is.EquivalentTo(sourceData));
        }
コード例 #5
0
        /// <summary>
        /// (De)Select the element choosed when the user select an element of the ComboBox
        /// </summary>
        private void MultiSelectCombox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (MultiSelectCombox.SelectedIndex != -1 && IsMouseWheeling == false)
            {
                // (De)select the selected element
                SearchElement elemSelected = (SearchElement)MultiSelectCombox.SelectedItem;
                elemSelected.IsSelected = !elemSelected.IsSelected;

                // If it's was the "All Element" then we (de)select the others elements consequently
                if (elemSelected.Name == All)
                {
                    if (elemSelected.IsSelected)
                    {
                        SelectAllElement();
                    }
                    else
                    {
                        DeselectAllElement();
                    }
                }
                // Update the control
                VerifyIfAllElementsAreSelected();
                SetText();
                // Set the tag to true so the pop up stay open
                MultiSelectCombox.Tag = true;
                // Set the selected index to -1 so the user can reselect the same item for inversing its state
                MultiSelectCombox.SelectedIndex = -1;
            }
        }
コード例 #6
0
        /// <summary>
        /// Set the element to selected when we click on the checkbox
        /// </summary>
        private void CheckBox_Click(object sender, RoutedEventArgs e)
        {
            CheckBox      cbx             = (CheckBox)sender;
            SearchElement selectedElement = (SearchElement)cbx.DataContext;

            ListElements.Find(x => x.Id == selectedElement.Id).IsSelected = (bool)cbx.IsChecked;
        }
コード例 #7
0
 public void SetUp()
 {
     m_SearchElement = new SearchElement {
         SearchDelay = 0
     };
     m_PropertyElement = new PropertyElement();
     m_Window.rootVisualElement.Add(m_SearchElement);
     m_Window.rootVisualElement.Add(m_PropertyElement);
 }
コード例 #8
0
 public void Initilization(double height, double positionTask)
 {
     this.height       = height;
     FileElements      = new List <TaskElement>();
     search            = new SearchElement(5);
     exit              = new ExitElement(6);
     this.positionTask = positionTask;
     this.Draw();
 }
コード例 #9
0
        public void SearchElTest()
        {
            // Arrange
            int[] arraySort = { 1, 2, 3, 4, 5 };

            // Act
            var searchEl = new SearchElement();

            // Assert
            Assert.IsTrue(searchEl.SearchEl(arraySort, 3));
        }
コード例 #10
0
        public void ReturnIndex()
        {
            //Arrange
            int[] inputArray = new int[] { 5, 6, 4, 3, 1, 9 };
            int   value      = 6;

            //Act

            //Assert
            Assert.Equal(4, SearchElement.SearchIndex(value, SearchElement.InsertionSort(inputArray)));
        }
コード例 #11
0
        public async Task <IEnumerable <JrySeries> > QueryAsync(SearchElement search, int skip, int take)
        {
            var builder = Builders <JrySeries> .Filter;
            FilterDefinition <JrySeries> filter;

            switch (search.Type)
            {
            case SearchElement.ElementType.Text:
                filter = builder.Or(
                    builder.Regex(z => z.Names, new BsonRegularExpression(new Regex(Regex.Escape(search.Value), RegexOptions.IgnoreCase))),
                    builder.Regex("Videos.Names", new BsonRegularExpression(new Regex(Regex.Escape(search.Value), RegexOptions.IgnoreCase))));
                break;

            case SearchElement.ElementType.SeriesId:
                return((await this.FindAsync(search.Value)).IntoArray());

            case SearchElement.ElementType.VideoId:
                filter = builder.Eq("Videos.Id", search.Value);
                break;

            case SearchElement.ElementType.EntityId:
                var it = await this.Engine.VideoCollection.FindAsync(Builders <Model.JryVideo> .Filter.Eq("Entities.Id", search.Value));

                var en = (await it.ToListAsync()).FirstOrDefault();
                if (en == null)
                {
                    return(Enumerable.Empty <JrySeries>());
                }
                else
                {
                    filter = builder.Eq("Videos.Id", en.Id);
                }
                break;

            case SearchElement.ElementType.DoubanId:
                filter = builder.Eq("Videos.DoubanId", search.Value);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            return(await(await this.Collection.FindAsync(
                             filter,
                             options: new FindOptions <JrySeries, JrySeries>()
            {
                Skip = skip,
                Limit = take,
                Sort = this.BuildDefaultSort()
            }))
                   .ToListAsync());
        }
コード例 #12
0
        private void SelectElement(SearchElement el)
        {
            this.Close();
            if (this == _window && el != null)
            {
                if (CallbackInfo.instance != null)
                {
                    CallbackInfo.instance.SignalChange(el.Type);
                }

                _window = null;
            }
        }
コード例 #13
0
        void AddSearchElement(VisualElement root)
        {
            m_SearchElement = AddSearchElement <SystemForSearch>(root, UssClasses.DotsEditorCommon.SearchFieldContainer);
            m_SearchElement.RegisterSearchQueryHandler <SystemForSearch>(query =>
            {
                var parseResult = SearchQueryParser.ParseSearchQuery(query);
                m_SystemTreeView.SetFilter(query, parseResult);
            });

            m_SearchElement.AddSearchFilterPopupItem(Constants.SystemSchedule.k_ComponentToken.Substring(0, 1), k_FilterComponentType, k_FilterComponentTypeTooltip);
            m_SearchElement.AddSearchFilterPopupItem(Constants.SystemSchedule.k_SystemDependencyToken.Substring(0, 2), k_FilterSystemDependencies, k_FilterSystemDependenciesTooltip);

            m_SearchElement.AddSearchDataProperty(new PropertyPath(nameof(SystemForSearch.SystemName)));
            m_SearchElement.AddSearchFilterProperty(Constants.SystemSchedule.k_ComponentToken.Substring(0, 1), new PropertyPath(nameof(SystemForSearch.ComponentNamesInQuery)));
            m_SearchElement.AddSearchFilterProperty(Constants.SystemSchedule.k_SystemDependencyToken.Substring(0, 2), new PropertyPath(nameof(SystemForSearch.SystemDependency)));
            m_SearchElement.EnableAutoComplete(ComponentTypeAutoComplete.Instance);
        }
コード例 #14
0
        public static void Process(string SearchName)
        {
            /* determin which dataacquirer and which dataindexer to be instantiated with "Arg" argument */
            SearchElement search = Config.Searches[SearchName];

            Type AcquirerType = Type.GetType(search.DataAcquirer);
            Type IndexerType  = Type.GetType(search.DataIndexer);


            dataAcquirer = (IDataAcquirer)Activator.CreateInstance(AcquirerType, new object[] { search });
            dataIndexer  = (IDataIndexer)Activator.CreateInstance(IndexerType, new object[] { search });
            /* end */

            List <ISearchEntity> data = dataAcquirer.GetData();

            List <ISearchEntity> CreateEntities = new List <ISearchEntity>();
            List <ISearchEntity> DeleteEntities = new List <ISearchEntity>();

            foreach (ISearchEntity entity in data)
            {
                if (entity.ProcessType == EntityProcessType.insert)
                {
                    AddCreateIndex(CreateEntities, entity);
                }
                else if (entity.ProcessType == EntityProcessType.update)
                {
                    AddCreateIndex(CreateEntities, entity);
                }
                else if (entity.ProcessType == EntityProcessType.delete)
                {
                    DeleteEntities.Add(entity);
                }
                else
                {
                    continue;
                }
            }

            dataIndexer.CreateIndex(CreateEntities);
            dataIndexer.DeleteIndex(DeleteEntities);

            Console.Read();
        }
コード例 #15
0
        static void Main(string[] args)
        {
            int[]    array  = { 1, 10, 2, 45, 4, 5, 1, 2, 4, 2, 67, 5, 4, 3, 5, 3 };
            int[]    array2 = { 5, 4, 3, 2, 6, -99, 3, 43, -2, 4, 5, -3, 5, 2, 3, 5, 3 };
            string[] array3 = { "one", "two", "three", "four", "one" };

            //var showArray = new ShowArray();
            var sortSwap        = new BubbleSort();
            var sortInsertion   = new InsertionSort();
            var searchEl        = new SearchElement();
            var factorial       = new Factorial();
            var bracketSequence = new BracketSequence();

            Cwl("Exercise: 1");
            Cwl("Array: ");
            //showArray.Show(arraySort); - способ показать массив в "ручную"
            Cwl(string.Join(", ", array));

            Cwl("Array sort Bubble: ");
            Cwl(string.Join(", ", sortSwap.Bubble(array)));

            Cwl("Array sort Insertion: ");
            sortInsertion.Insertion(ref array2);
            Cwl(string.Join(", ", array2));

            Cwl("Exercise: 2");
            Cwl("Search element: ");
            Cwl(searchEl.SearchEl(array2, 4));

            Cwl("Exercise: 3");
            Cwl("Search strings: ");
            searchEl.SearchEl(array3);

            Cwl("Exercise: 4");
            Cwl("5! =");
            Cwl(factorial.Fact(5));

            Cwl("Exercise: 5");
            Cwl("BracketSequence: ");
            Cwl(bracketSequence.BracketSeq("(())[][()]{}"));

            Console.ReadKey();
        }
コード例 #16
0
        public void Search_TokensShouldBeEmptyOnEmptySearchString(SearchBackendType backendType)
        {
            var searchElement = new SearchElement();

            searchElement.RegisterSearchBackend(CreateSearchBackend <TestData>(backendType));

            searchElement.RegisterSearchQueryHandler <TestData>(q =>
            {
                Assert.DoesNotThrow(() =>
                {
                    var i = q.Tokens.Count;
                });
            });
            searchElement.AddSearchDataProperty(new PropertyPath(nameof(TestData.Name)));

            searchElement.Search(string.Empty);
            searchElement.Search(null);
            searchElement.Search("   ");
        }
コード例 #17
0
ファイル: Extensions.cs プロジェクト: ITLec/Dynamics-365-XEP
        private static void ConfigureProviderSettings(SearchElement searchElement, CrmWebsite website)
        {
            var searchIndexPath       = GetSearchIndexPath("Adxstudio.Xrm.Search", true);
            var indexQueryName        = website.Settings.Get <string>("Search/IndexQueryName") ?? "Portal Search";
            var languageSiteSetting   = website.Settings.Get <string>("KnowledgeManagement/Article/Language") ?? string.Empty;
            var displayNotesSetting   = website.Settings.Get <string>("KnowledgeManagement/DisplayNotes") ?? string.Empty;
            var notesFilterSetting    = website.Settings.Get <string>("KnowledgeManagement/NotesFilter") ?? string.Empty;
            var useEncryptedDirectory = GetUseEncryptedDirectory();
            var isOnlinePortal        = GetIsOnlinePortal();

            var defaultProvider = searchElement.DefaultProvider ?? "Portal";

            searchElement.DefaultProvider = defaultProvider;

            var settings = new ProviderSettings
            {
                Name = defaultProvider,
                Type = "Adxstudio.Xrm.Search.PortalSearchProvider, Adxstudio.Xrm"
            };

            settings.Parameters.Add("portalName", "Xrm");
            settings.Parameters.Add("dataContextName", "Xrm");
            settings.Parameters.Add("indexPath", searchIndexPath);
            settings.Parameters.Add("indexQueryName", indexQueryName);
            settings.Parameters.Add("useEncryptedDirectory", useEncryptedDirectory.ToString());
            settings.Parameters.Add("isOnlinePortal", isOnlinePortal.ToString());
            settings.Parameters.Add("websiteId", website.Id.ToString());
            settings.Parameters.Add("articlesLanguageCode", languageSiteSetting);
            settings.Parameters.Add("displayNotes", displayNotesSetting);
            settings.Parameters.Add("notesFilter", notesFilterSetting);

            searchElement.Providers.Add(settings);

            if (useEncryptedDirectory)
            {
                // In case of encryption key changes we have requirment to drop old search indexes on application startup.
                Search.Store.Encryption.EncryptedDirectoryUtils.CleanupLegacy(searchIndexPath, isOnlinePortal);
            }
        }
コード例 #18
0
        void CreateToolbar()
        {
            m_Header = new VisualElement();
            Resources.Templates.EntityHierarchyToolbar.Clone(m_Header);
            var leftSide  = m_Header.Q <VisualElement>(className: UssClasses.EntityHierarchyWindow.Toolbar.LeftSide);
            var rightSide = m_Header.Q <VisualElement>(className: UssClasses.EntityHierarchyWindow.Toolbar.RightSide);

            leftSide.Add(CreateWorldSelector());

            AddSearchIcon(rightSide, UssClasses.DotsEditorCommon.SearchIcon);
            m_SearchElement = AddSearchElement <EntityHierarchyItem>(m_Header, UssClasses.DotsEditorCommon.SearchFieldContainer);
            m_SearchElement.RegisterSearchQueryHandler <EntityHierarchyItem>(query =>
            {
                var result = m_EntityHierarchyQueryBuilder.BuildQuery(query.SearchString);
                QueryDesc  = result.QueryDesc;

                m_EntityHierarchy.SetFilter(query, result);
            });
            m_SearchElement.AddSearchFilterPopupItem("c", k_FilterComponentType, k_FilterComponentTypeTooltip);
            m_SearchElement.AddSearchDataProperty(new PropertyPath(nameof(EntityHierarchyItem.m_CachedLowerCaseName)));
            m_SearchElement.EnableAutoComplete(ComponentTypeAutoComplete.Instance);

            m_Root.Add(m_Header);
        }
コード例 #19
0
        /// <summary>
        /// Parse html search result.
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        private List <HltbData> SearchParser(string data)
        {
            List <HltbData> ReturnData = new List <HltbData>();

            if (data != "")
            {
                try {
                    HtmlParser    parser       = new HtmlParser();
                    IHtmlDocument htmlDocument = parser.Parse(data);

                    string Name   = "";
                    int    Id     = 0;
                    string UrlImg = "";
                    string Url    = "";

                    long MainStory     = 0;
                    long MainExtra     = 0;
                    long Completionist = 0;
                    long Solo          = 0;
                    long CoOp          = 0;
                    long Vs            = 0;

                    bool IsMainStory     = true;
                    bool IsMainExtra     = true;
                    bool IsCompletionist = true;

                    foreach (var SearchElement in htmlDocument.QuerySelectorAll("li.back_darkish"))
                    {
                        var ElementA   = SearchElement.QuerySelector(".search_list_image a");
                        var ElementImg = SearchElement.QuerySelector(".search_list_image a img");
                        Name   = ElementA.GetAttribute("title");
                        Id     = int.Parse(ElementA.GetAttribute("href").Replace("game?id=", ""));
                        UrlImg = ElementImg.GetAttribute("src");
                        Url    = UrlBase + ElementA.GetAttribute("href");

                        var ElementDetails = SearchElement.QuerySelector(".search_list_details_block");
                        var Details        = ElementDetails.QuerySelectorAll(".search_list_tidbit");
                        if (Details.Length == 0)
                        {
                            Details = ElementDetails.QuerySelectorAll("div");
                        }
                        int iElement = 0;

                        foreach (var El in Details)
                        {
                            switch (iElement)
                            {
                            case 0:
                                IsMainStory = (El.InnerHtml == "Main Story");
                                break;

                            case 1:
                                if (El.InnerHtml != "")
                                {
                                    if (IsMainStory)
                                    {
                                        MainStory = ConvertStringToLong(El.InnerHtml);
                                    }
                                    else
                                    {
                                        Solo = ConvertStringToLong(El.InnerHtml);
                                    }
                                }
                                break;

                            case 2:
                                IsMainExtra = (El.InnerHtml == "Main + Extra");
                                break;

                            case 3:
                                if (El.InnerHtml != "")
                                {
                                    if (IsMainExtra)
                                    {
                                        MainExtra = ConvertStringToLong(El.InnerHtml);
                                    }
                                    else
                                    {
                                        CoOp = ConvertStringToLong(El.InnerHtml);
                                    }
                                }
                                break;

                            case 4:
                                IsCompletionist = (El.InnerHtml == "Completionist");
                                break;

                            case 5:
                                if (El.InnerHtml != "")
                                {
                                    if (IsCompletionist)
                                    {
                                        Completionist = ConvertStringToLong(El.InnerHtml);
                                    }
                                    else
                                    {
                                        Vs = ConvertStringToLong(El.InnerHtml);
                                    }
                                }
                                break;
                            }
                            iElement += 1;
                        }

                        //logger.Debug($"Name: {Name} - MainStory: {MainStory} - MainExtra: {MainExtra} - Completionist: {Completionist} - Solo: {Solo} - CoOp: {CoOp} - Vs: {Vs}");
                        ReturnData.Add(new HltbData
                        {
                            Name          = Name,
                            Id            = Id,
                            UrlImg        = UrlImg,
                            Url           = Url,
                            MainStory     = MainStory,
                            MainExtra     = MainExtra,
                            Completionist = Completionist,
                            Solo          = Solo,
                            CoOp          = CoOp,
                            Vs            = Vs
                        });
                    }
                }
                catch (Exception ex)
                {
                    var    LineNumber = new StackTrace(ex, true).GetFrame(0).GetFileLineNumber();
                    string FileName   = new StackTrace(ex, true).GetFrame(0).GetFileName();
                    logger.Error(ex, $"HowLongToBeat [{FileName} {LineNumber}] ");
                }
            }

            return(ReturnData);
        }
コード例 #20
0
ファイル: AStar.cs プロジェクト: patriotpie/AIProject_2
 public SearchElement(GameObject g, float d, SearchElement f)
 {
     point = g;
     dist = d;
     from = f;
 }
コード例 #21
0
        private void SelectElement(SearchElement el)
        {
            this.Close();
            if (this == _window && el != null)
            {
                if (CallbackInfo.instance != null)
                {
                    CallbackInfo.instance.SignalChange(el.Type);
                }

                _window = null;
            }
        }
コード例 #22
0
 public DataAcquirerNews(SearchElement Element)
 {
     ConfigElement = Element;
 }
コード例 #23
0
 public DataAcquirerProduct(SearchElement Element)
 {
     ConfigElement = Element;
 }
コード例 #24
0
        //Associated with Plaeholder text on search bar

        private void SearchPlaceHolderElementGotFocus(object sender, RoutedEventArgs e)
        {
            SearchPlaceHolderElement.Visibility = System.Windows.Visibility.Collapsed;
            SearchElement.Visibility            = System.Windows.Visibility.Visible;
            SearchElement.Focus();
        }
コード例 #25
0
 /// <summary>
 /// Click the search button/field
 /// </summary>
 public virtual void ClickSearch()
 {
     SearchElement.WaitAndClick(_driver, 200000);
 }
コード例 #26
0
 public DataIndexerNews(SearchElement Element)
 {
     ConfigElement = Element;
 }
コード例 #27
0
 public DataIndexerProduct(SearchElement Element)
 {
     ConfigElement = Element;
 }
コード例 #28
0
ファイル: AStar.cs プロジェクト: patriotpie/AIProject_2
 public SearchElement(GameObject g, float d)
 {
     point = g;
     dist = d;
     from = null;
 }
コード例 #29
0
ファイル: AStar.cs プロジェクト: patriotpie/AIProject_2
    private void CalculatePath()
    {
        //Debug.Log("Calculating...");

        navmesh = GameObject.Find("NavmeshGenerator").GetComponent<NavmeshSpawner>().GetNavmesh();
        path = new ArrayList();

        // cast rays up, down, left, right and if its longer than it should be, ignore the impact
        float expectedDist = navmesh.gameUnitStep + fudge;

        // Start the calculation by finding the closest node to the player (or GameObject to which we are attached)
        GameObject startPoint = FindClosestNavmeshPointTo(this.gameObject);
        Debug.Log ("Starting from: (" + startPoint.transform.position.x + ", " + startPoint.transform.position.y + ")");

        SearchElement startElement = new SearchElement(startPoint, 0.0f);

        // Then find the closest GameObject to the target
        endPoint = FindClosestNavmeshPointTo(target.gameObject);
        //Debug.Log ("Ending at: (" + endPoint.transform.position.x + ", " + endPoint.transform.position.y + ")");

        // Keep a priority queue of points on the frontier, sorted in increasing order by F = G + H
        // The CompareTo() function of each SearchElement takes into account the H value
        SortedList openSet = new SortedList();
        // Keep a list of NavmeshPoints we have already found in the SPT
        ArrayList closedSet = new ArrayList();

        openSet.Add(startElement, null);

        SearchElement finalSearchElement = null;

        while (openSet.Count > 0) {

            // Dequeue the element in the openSet with the smallest distance
            SearchElement current = openSet.GetKey(0) as SearchElement;

            // Is this what we are looking for?
            if (current.point == endPoint) {
                closedSet.Add(current.point);
                finalSearchElement = current;
                break;

            }

            // Remove this NavmeshPoint from the openSet and add it to the closedSet
            openSet.Remove(current);
            closedSet.Add(current.point);
            current.point.layer = 9;

            //Debug.Log ("Processing point at (" + current.point.transform.position.x
            //           + ", " + current.point.transform.position.y + ")");

            // Get all NavmeshPoints adjacent to this point in the form of SearchElements whose dists are current.dist
            // plus however long the edge from current to the adjacent point is (measured in terms of game space dist)
            ArrayList adj = GetAdjacentPoints(current, expectedDist);

            // Find out if any points adjacent to current are already in the openSet
            // If they are, find out if the distance through the current path is shorter than the distance
            // they are currently at through other paths. If the distance through current is shorter, update the dist
            // to be the dist through current, and update the from field to be current.

            // Note: We do not explicitly handle the heuristic estimate at this time, as it is taken care of for us
            // behind the scenes in the openSet.Add() function by the IComparable interface implemented by SearchElement
            foreach (SearchElement newFrontierElement in adj) {

                bool elementInOpenSet = false;
                bool replaceExistingElement = false;
                SearchElement existingElementIndex = null;

                foreach (SearchElement establishedFrontierElement in openSet.Keys) {
                    if (newFrontierElement.point == establishedFrontierElement.point) {

                        // This NavmeshPoint exists in the openSet
                        elementInOpenSet = true;

                        if (newFrontierElement.dist < establishedFrontierElement.dist) {

                            // The new path is a better path than the current path
                            replaceExistingElement = true;
                            existingElementIndex = establishedFrontierElement;
                        }

                        // Break out of the openSet for-loop; we are done here since we found a match
                        break;
                    }
                }

                if (!elementInOpenSet) {
                    openSet.Add(newFrontierElement, null);
                }
                else if (elementInOpenSet && replaceExistingElement) {
                    openSet.Remove(existingElementIndex);
                    openSet.Add(newFrontierElement, null);
                }

                foreach (SearchElement e in openSet.Keys) {
                    //Debug.Log("(" + e.point.transform.position.x + ", " + e.point.transform.position.y + "): "
                    //          + (e.dist + Vector2.Distance(e.point.transform.position, endPoint.transform.position)).ToString()
                    //          + "   ");
                }
            }

        }

        // We either ran out of elements in the navmesh and should throw an error, or we arrived at the target
        if (finalSearchElement == null) {
            throw new Exception("Target element not found by A* algorithm");
        }
        else {

            // We shouldn't show the close navpoints any longer
            this.gameObject.GetComponent<ShowNearbyNavpoints>().SendMessage("Cleanup");

            // Reconstruct the path that won
            path = new ArrayList();
            pathDist = 0.0f;

            SearchElement pathPoint = finalSearchElement;
            while (pathPoint != null) {
                path.Add(pathPoint.point);
                pathDist += pathPoint.dist;
                pathPoint = (SearchElement)pathPoint.from;
            }

            // Finally, reverse the path, since we added elements to it in reverse order (i.e. starting from target)
            path.Reverse();
            foreach (GameObject navmeshPoint in path) {
                SpriteRenderer sr = navmeshPoint.GetComponent<SpriteRenderer>();
                sr.enabled = true;
                sr.color = Color.red;
            }

            this.gameObject.GetComponent<FollowPath>().StartFollowing(path);

            //Debug.Log ("Final path distance: " + pathDist);

        }
    }
コード例 #30
0
ファイル: AStar.cs プロジェクト: patriotpie/AIProject_2
    // Returns an ArrayList of up to four adjacent SearchElements in the up, down, left, right directions
    // relative to element, with their relevant fields filled out
    private ArrayList GetAdjacentPoints(SearchElement element, float expectedDist)
    {
        // Set the NavmeshPoint pointed to by element.point to be invisible to raycasting so that we can raycast
        // from inside it
        int oldLayer = element.point.layer;
        element.point.layer = 8;

        // Cast rays up, down, left, right
        // We don't need to cast diagonally because we will have path smoothing kicking in for that later
        // If they intersect with a GameObject with tag NavmeshObject in <= expectedDist, add that point to AdjPoints
        ArrayList adj = new ArrayList();

        RaycastHit2D raycastHitUp = Physics2D.Raycast(element.point.transform.position, Vector2.up, expectedDist, layerMask);
        RaycastHit2D raycastHitDown = Physics2D.Raycast(element.point.transform.position, -Vector2.up, expectedDist, layerMask);
        RaycastHit2D raycastHitLeft = Physics2D.Raycast(element.point.transform.position, -Vector2.right, expectedDist, layerMask);
        RaycastHit2D raycastHitRight = Physics2D.Raycast(element.point.transform.position, Vector2.right, expectedDist, layerMask);

        RaycastHit2D raycastHitUpLeft = Physics2D.Raycast(element.point.transform.position, (Vector2.up - Vector2.right), expectedDist*sqrt_2, layerMask);
        RaycastHit2D raycastHitUpRight = Physics2D.Raycast(element.point.transform.position, (Vector2.up + Vector2.right), expectedDist*sqrt_2, layerMask);
        RaycastHit2D raycastHitDownLeft = Physics2D.Raycast(element.point.transform.position, (-Vector2.up - Vector2.right), expectedDist*sqrt_2, layerMask);
        RaycastHit2D raycastHitDownRight = Physics2D.Raycast(element.point.transform.position, (-Vector2.up + Vector2.right), expectedDist*sqrt_2, layerMask);

        // If the raycast hits something, and it's a NavmeshPoint, add it to adj with dist = G (we account for H later,
        // when adding to the priority queue) and with its from field pointing to element
        //Debug.Log ("Rays are cast");
        if (raycastHitUp.collider != null) {
            if (raycastHitUp.collider.gameObject.CompareTag("NavmeshObject")) {
                adj.Add(new SearchElement(raycastHitUp.collider.gameObject,
                                          element.dist
                                          + Vector2.Distance(raycastHitUp.point, element.point.transform.position),
                                          element));
                //Debug.Log ("Adding frontier element at ("
                //           + raycastHitUp.collider.gameObject.transform.position.x
                //           + ", "
                //           + raycastHitUp.collider.gameObject.transform.position.y
                //           + ")");
            }
        }
        if (raycastHitDown.collider != null) {
            if (raycastHitDown.collider.gameObject.CompareTag("NavmeshObject")) {
                adj.Add(new SearchElement(raycastHitDown.collider.gameObject,
                                          element.dist
                                          + Vector2.Distance(raycastHitDown.point, element.point.transform.position),
                                          element));
                //Debug.Log ("Adding frontier element at ("
                //           + raycastHitDown.collider.gameObject.transform.position.x
                //           + ", "
                //           + raycastHitDown.collider.gameObject.transform.position.y
                //           + ")");
            }
        }
        if (raycastHitLeft.collider != null) {
            if (raycastHitLeft.collider.gameObject.CompareTag("NavmeshObject")) {
                adj.Add(new SearchElement(raycastHitLeft.collider.gameObject,
                                          element.dist
                                          + Vector2.Distance(raycastHitLeft.point, element.point.transform.position),
                                          element));
                //Debug.Log ("Adding frontier element at ("
                //           + raycastHitLeft.collider.gameObject.transform.position.x
                //           + ", "
                //           + raycastHitLeft.collider.gameObject.transform.position.y
                //           + ")");
            }
        }
        if (raycastHitRight.collider != null) {
            if (raycastHitRight.collider.gameObject.CompareTag("NavmeshObject")) {
                adj.Add(new SearchElement(raycastHitRight.collider.gameObject,
                                          element.dist
                                          + Vector2.Distance(raycastHitRight.point, element.point.transform.position),
                                          element));
                //Debug.Log ("Adding frontier element at ("
                //           + raycastHitRight.collider.gameObject.transform.position.x
                //           + ", "
                //           + raycastHitRight.collider.gameObject.transform.position.y
                //           + ")");
            }
        }
        if (raycastHitUpLeft.collider != null) {
            if (raycastHitUpLeft.collider.gameObject.CompareTag("NavmeshObject")) {
                adj.Add(new SearchElement(raycastHitUpLeft.collider.gameObject,
                                          element.dist
                                          + Vector2.Distance(raycastHitUpLeft.point, element.point.transform.position),
                                          element));
                //Debug.Log ("Adding frontier element at ("
                //           + raycastHitUpLeft.collider.gameObject.transform.position.x
                //           + ", "
                //           + raycastHitUpLeft.collider.gameObject.transform.position.y
                //           + ")");
            }
        }
        if (raycastHitUpRight.collider != null) {
            if (raycastHitUpRight.collider.gameObject.CompareTag("NavmeshObject")) {
                adj.Add(new SearchElement(raycastHitUpRight.collider.gameObject,
                                          element.dist
                                          + Vector2.Distance(raycastHitUpRight.point, element.point.transform.position),
                                          element));
                //Debug.Log ("Adding frontier element at ("
                //           + raycastHitUpRight.collider.gameObject.transform.position.x
                //           + ", "
                //           + raycastHitUpRight.collider.gameObject.transform.position.y
                //           + ")");
            }
        }
        if (raycastHitDownLeft.collider != null) {
            if (raycastHitDownLeft.collider.gameObject.CompareTag("NavmeshObject")) {
                adj.Add(new SearchElement(raycastHitDownLeft.collider.gameObject,
                                          element.dist
                                          + Vector2.Distance(raycastHitDownLeft.point, element.point.transform.position),
                                          element));
                //Debug.Log ("Adding frontier element at ("
                //           + raycastHitDownLeft.collider.gameObject.transform.position.x
                //           + ", "
                //           + raycastHitDownLeft.collider.gameObject.transform.position.y
                //           + ")");
            }
        }
        if (raycastHitDownRight.collider != null) {
            if (raycastHitDownRight.collider.gameObject.CompareTag("NavmeshObject")) {
                adj.Add(new SearchElement(raycastHitDownRight.collider.gameObject,
                                          element.dist
                                          + Vector2.Distance(raycastHitDownRight.point, element.point.transform.position),
                                          element));
                //Debug.Log ("Adding frontier element at ("
                //           + raycastHitDownRight.collider.gameObject.transform.position.x
                //           + ", "
                //           + raycastHitDownRight.collider.gameObject.transform.position.y
                //           + ")");
            }
        }

        // Reset old element.point.layer
        element.point.layer = oldLayer;

        return adj;
    }
        /// <summary>
        /// Searches using the search model.
        /// </summary>
        /// <param name="searchModel">The search model.</param>
        /// <returns></returns>
        /// <exception cref="ArgumentNullException">searchModel</exception>
        public virtual IListPage Search(CustomerSearchModel searchModel)
        {
            if (searchModel == null)
            {
                throw new ArgumentNullException(nameof(searchModel));
            }

            EmailElement.SetValue(searchModel.Email);
            FirstNameElement.SetValue(searchModel.FirstName);
            LastNameElement.SetValue(searchModel.LastName);

            if (searchModel.DateOfBirth.HasValue)
            {
                DateOfBirthMonthElement.SelectByValue(
                    searchModel.DateOfBirth.Value.Month.ToString());

                DateOfBirthDayElement.SelectByValue(
                    searchModel.DateOfBirth.Value.Day.ToString());
            }
            else
            {
                DateOfBirthMonthElement.SelectByIndex(0);
                DateOfBirthDayElement.SelectByIndex(0);
            }

            CompanyElement.SetValue(searchModel.Company);
            IpAddressElement.SetValue(searchModel.IpAddress);

            var currentlySelectedItems = CustomerRoles.GetSelectedOptions();

            if (searchModel.CustomerRoles != null)
            {
                foreach (var opt in currentlySelectedItems)
                {
                    if (!searchModel.CustomerRoles?.Contains(opt) ?? true)
                    {
                        CustomerRoles.DeselectItem(opt);
                    }

                    // Check if there are items that have yet to be selected.
                    if (searchModel.CustomerRoles?.Except(currentlySelectedItems).Any() ?? false)
                    {
                        foreach (var _opt in searchModel.CustomerRoles)
                        {
                            CustomerRoles.SelectItem(_opt);
                        }
                    }
                }
            }

            SearchElement.Click();

            // Wait for the ajax indicator to toggle.
            WrappedDriver
            .Wait(TimeSpan.FromSeconds(10))
            .TrySequentialWait(
                out var exception,
                d => IsAjaxBusy(),
                d => !IsAjaxBusy());

            // Page should reload.
            Load();

            return(this);
        }
コード例 #32
0
        public override IDeepCopyable CopyTo(IDeepCopyable other)
        {
            var dest = other as CompartmentDefinition;

            if (dest == null)
            {
                throw new ArgumentException("Can only copy to an object of the same type", "other");
            }

            base.CopyTo(dest);
            if (UrlElement != null)
            {
                dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopy();
            }
            if (NameElement != null)
            {
                dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopy();
            }
            if (TitleElement != null)
            {
                dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopy();
            }
            if (StatusElement != null)
            {
                dest.StatusElement = (Code <Hl7.Fhir.Model.PublicationStatus>)StatusElement.DeepCopy();
            }
            if (ExperimentalElement != null)
            {
                dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopy();
            }
            if (DateElement != null)
            {
                dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopy();
            }
            if (PublisherElement != null)
            {
                dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopy();
            }
            if (Contact != null)
            {
                dest.Contact = new List <Hl7.Fhir.Model.ContactDetail>(Contact.DeepCopy());
            }
            if (Description != null)
            {
                dest.Description = (Hl7.Fhir.Model.Markdown)Description.DeepCopy();
            }
            if (Purpose != null)
            {
                dest.Purpose = (Hl7.Fhir.Model.Markdown)Purpose.DeepCopy();
            }
            if (UseContext != null)
            {
                dest.UseContext = new List <Hl7.Fhir.Model.UsageContext>(UseContext.DeepCopy());
            }
            if (Jurisdiction != null)
            {
                dest.Jurisdiction = new List <Hl7.Fhir.Model.CodeableConcept>(Jurisdiction.DeepCopy());
            }
            if (CodeElement != null)
            {
                dest.CodeElement = (Code <Hl7.Fhir.Model.CompartmentType>)CodeElement.DeepCopy();
            }
            if (SearchElement != null)
            {
                dest.SearchElement = (Hl7.Fhir.Model.FhirBoolean)SearchElement.DeepCopy();
            }
            if (Resource != null)
            {
                dest.Resource = new List <Hl7.Fhir.Model.CompartmentDefinition.ResourceComponent>(Resource.DeepCopy());
            }
            return(dest);
        }
コード例 #33
0
        public List <ItadGiveaway> GetGiveaways(IPlayniteAPI PlayniteApi, string PluginUserDataPath, bool CacheOnly = false)
        {
            // Load previous
            string PluginDirectoryCache            = PluginUserDataPath + "\\cache";
            string PluginFileCache                 = PluginDirectoryCache + "\\giveways.json";
            List <ItadGiveaway> itadGiveawaysCache = new List <ItadGiveaway>();

            try
            {
                if (!Directory.Exists(PluginDirectoryCache))
                {
                    Directory.CreateDirectory(PluginDirectoryCache);
                }

                if (File.Exists(PluginFileCache))
                {
                    string fileData = File.ReadAllText(PluginFileCache);
                    itadGiveawaysCache = JsonConvert.DeserializeObject <List <ItadGiveaway> >(fileData);
                }
            }
            catch (Exception ex)
            {
                Common.LogError(ex, "IsThereAnyDeal", "Error in GetGiveAway() with cache data");
            }


            // Load on web
            List <ItadGiveaway> itadGiveaways = new List <ItadGiveaway>();

            if (!CacheOnly && itadGiveawaysCache != new List <ItadGiveaway>())
            {
                string url = @"https://isthereanydeal.com/specials/#/filter:&giveaway,&active";
                try
                {
                    string responseData = DownloadStringData(url).GetAwaiter().GetResult();

                    if (responseData != string.Empty)
                    {
                        HtmlParser    parser       = new HtmlParser();
                        IHtmlDocument htmlDocument = parser.Parse(responseData);
                        foreach (var SearchElement in htmlDocument.QuerySelectorAll("div.giveaway"))
                        {
                            bool HasSeen = (SearchElement.ClassName.IndexOf("Seen") > -1);

                            var row1 = SearchElement.QuerySelector("div.bundle-row1");

                            DateTime?bundleTime = null;
                            if (!row1.QuerySelector("div.bundle-time").GetAttribute("title").IsNullOrEmpty())
                            {
                                bundleTime = Convert.ToDateTime(row1.QuerySelector("div.bundle-time").GetAttribute("title"));
                            }

                            string TitleAll = row1.QuerySelector("div.bundle-title a").InnerHtml.Trim();

                            List <string> arrBundleTitle = TitleAll.Split('-').ToList();

                            string bundleShop = arrBundleTitle[arrBundleTitle.Count - 1].Trim();
                            bundleShop = bundleShop.Replace("FREE Games on", string.Empty).Replace("Always FREE For", string.Empty)
                                         .Replace("FREE For", string.Empty).Replace("FREE on", string.Empty);

                            string bundleTitle = string.Empty;
                            arrBundleTitle.RemoveAt(arrBundleTitle.Count - 1);
                            bundleTitle = String.Join("-", arrBundleTitle.ToArray()).Trim();

                            string bundleLink = row1.QuerySelector("div.bundle-title a").GetAttribute("href");

                            var row2 = SearchElement.QuerySelector("div.bundle-row2");

                            string bundleDescCount = row2.QuerySelector("div.bundle-desc span.lg").InnerHtml;

                            itadGiveaways.Add(new ItadGiveaway
                            {
                                TitleAll = TitleAll,
                                Title    = bundleTitle,
                                Time     = bundleTime,
                                Link     = bundleLink,
                                ShopName = bundleShop,
                                Count    = bundleDescCount,
                                HasSeen  = HasSeen
                            });
                        }
                    }
                }
                catch (Exception ex)
                {
                    Common.LogError(ex, "IsThereAnyDeal", "Error in GetGiveAway() with web data");
                }
            }

            // Compare new with cache
            if (itadGiveaways.Count != 0)
            {
#if DEBUG
                logger.Debug("IsThereAnyDeal - Compare with cache");
#endif
                foreach (ItadGiveaway itadGiveaway in itadGiveawaysCache)
                {
                    if (itadGiveaways.Find(x => x.TitleAll == itadGiveaway.TitleAll) != null)
                    {
                        itadGiveaways.Find(x => x.TitleAll == itadGiveaway.TitleAll).HasSeen = true;
                    }
                }
            }
            // No data
            else
            {
                logger.Warn("IsThereAnyDeal - No new data for GetGiveaways()");
                itadGiveaways = itadGiveawaysCache;
            }

            // Save new
            try
            {
                File.WriteAllText(PluginFileCache, JsonConvert.SerializeObject(itadGiveaways));
            }
            catch (Exception ex)
            {
                Common.LogError(ex, "IsThereAnyDeal", "Error in GetGiveAway() with save data");
            }

            return(itadGiveaways);
        }
コード例 #34
0
        /// <summary>
        /// Parse html search result.
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        private List <HltbDataUser> SearchParser(string data)
        {
            List <HltbDataUser> ReturnData = new List <HltbDataUser>();

            if (data != string.Empty)
            {
                try {
                    HtmlParser    parser       = new HtmlParser();
                    IHtmlDocument htmlDocument = parser.Parse(data);

                    string Name   = string.Empty;
                    int    Id     = 0;
                    string UrlImg = string.Empty;
                    string Url    = string.Empty;

                    foreach (var SearchElement in htmlDocument.QuerySelectorAll("li.back_darkish"))
                    {
                        var ElementA   = SearchElement.QuerySelector(".search_list_image a");
                        var ElementImg = SearchElement.QuerySelector(".search_list_image a img");
                        Name   = ElementA.GetAttribute("title");
                        Id     = int.Parse(ElementA.GetAttribute("href").Replace("game?id=", string.Empty));
                        UrlImg = ElementImg.GetAttribute("src");
                        Url    = UrlBase + ElementA.GetAttribute("href");

                        var ElementDetails = SearchElement.QuerySelector(".search_list_details_block");
                        var Details        = ElementDetails.QuerySelectorAll(".search_list_tidbit");
                        if (Details.Length == 0)
                        {
                            Details = ElementDetails.QuerySelectorAll("div");
                        }

                        long MainStory     = 0;
                        long MainExtra     = 0;
                        long Completionist = 0;
                        long Solo          = 0;
                        long CoOp          = 0;
                        long Vs            = 0;

                        bool IsMainStory     = true;
                        bool IsMainExtra     = true;
                        bool IsCompletionist = true;
                        bool IsCoOp          = true;
                        bool IsVs            = true;
                        bool IsSolo          = true;

                        int iElement = 0;
                        foreach (var El in Details)
                        {
                            if (iElement % 2 == 0)
                            {
                                IsMainStory     = (El.InnerHtml == "Main Story");
                                IsMainExtra     = (El.InnerHtml == "Main + Extra");
                                IsCompletionist = (El.InnerHtml == "Completionist");
                                IsCoOp          = (El.InnerHtml == "Co-Op");
                                IsVs            = (El.InnerHtml == "Vs.");
                                IsSolo          = (El.InnerHtml == "Solo");
                            }
                            else
                            {
                                if (IsMainStory)
                                {
                                    MainStory = ConvertStringToLong(El.InnerHtml);
                                }
                                if (IsMainExtra)
                                {
                                    MainExtra = ConvertStringToLong(El.InnerHtml);
                                }
                                if (IsCompletionist)
                                {
                                    Completionist = ConvertStringToLong(El.InnerHtml);
                                }
                                if (IsCoOp)
                                {
                                    CoOp = ConvertStringToLong(El.InnerHtml);
                                }
                                if (IsVs)
                                {
                                    Vs = ConvertStringToLong(El.InnerHtml);
                                }
                                if (IsSolo)
                                {
                                    Solo = ConvertStringToLong(El.InnerHtml);
                                }
                            }

                            iElement += 1;
                        }

                        ReturnData.Add(new HltbDataUser
                        {
                            Name         = Name,
                            Id           = Id,
                            UrlImg       = UrlImg,
                            Url          = Url,
                            GameHltbData = new HltbData
                            {
                                MainStory     = MainStory,
                                MainExtra     = MainExtra,
                                Completionist = Completionist,
                                Solo          = Solo,
                                CoOp          = CoOp,
                                Vs            = Vs
                            }
                        });
                    }
                }
                catch (Exception ex)
                {
                    Common.LogError(ex, "HowLongToBeat", $"Error on SearchParser()");
                }
            }

            return(ReturnData);
        }
        public override VisualElement Build()
        {
            var context = GetContext <Explorer.Context>();

            context.NewPropertyBagsDetected += () =>
            {
                m_ListView.Refresh();
                m_SearchElement.Search();
                m_ListView.selectedIndex = string.IsNullOrEmpty(m_SearchElement.value)
                    ? PropertyBagDebugInfoStore.IndexOf(context.SelectedType)
                    : Target.FindIndex(pbd => pbd.Type == context.SelectedType);
            };
            var root = Resources.Templates.Explorer.PropertyBagList.CloneWithoutTemplateContainer();

            m_SearchElement = root.Q <SearchElement>(className: k_Search);
            m_SearchElement.RegisterCallback <ChangeEvent <string>, Explorer.Context>(
                (evt, ctx) => ctx.StringSearch = evt.newValue, context);
            m_SearchElement.RegisterSearchQueryHandler <PropertyBagDebugInfo>(search =>
            {
                Target.Clear();
                Target.AddRange(search.Apply(PropertyBagDebugInfoStore.AllDebugInfos));
                m_ListView.Refresh();
                m_ListView.selectedIndex = string.IsNullOrEmpty(m_SearchElement.value)
                    ? PropertyBagDebugInfoStore.IndexOf(context.SelectedType)
                    : Target.FindIndex(pbd => pbd.Type == context.SelectedType);
            });

            m_ListView = root.Q <ListView>(className: k_ListView);
            m_ListView.selectionType = SelectionType.Single;
            m_ListView.itemsSource   = Target;
            m_ListView.makeItem      = () =>
            {
                var element = new TypeNameLabel();
                element.style.paddingLeft = 15;
                return(element);
            };
            m_ListView.bindItem = (element, i) =>
            {
                if (element is TypeNameLabel typeName)
                {
                    typeName.value = Target[i].Type;
                }
            };

            m_SearchElement.value = context.StringSearch;

            context.Update();
            m_ListView.selectedIndex = string.IsNullOrEmpty(m_SearchElement.value)
                ? PropertyBagDebugInfoStore.IndexOf(context.SelectedType)
                : Target.FindIndex(pbd => pbd.Type == context.SelectedType);

            context.OnPropertyBagSelected += detail =>
            {
                context.Update();
                m_ListView.selectedIndex = string.IsNullOrEmpty(m_SearchElement.value)
                    ? PropertyBagDebugInfoStore.IndexOf(context.SelectedType)
                    : Target.FindIndex(pbd => pbd.Type == context.SelectedType);
                m_ListView.ScrollToItem(m_ListView.selectedIndex);
            };

            m_ListView.onSelectionChange += objects =>
            {
                foreach (var obj in objects)
                {
                    if (obj is PropertyBagDebugInfo detail)
                    {
                        context.SelectPropertyBag(detail);
                        return;
                    }
                }
            };

            return(root);
        }