示例#1
0
        public override IFilterInstance Identify(NGSpotlightWindow window, string keywords, string lowerKeywords)
        {
            if (lowerKeywords.Length >= 7 && lowerKeywords[0] == ':' && lowerKeywords[1] == 'l' && lowerKeywords[2] == 'a' && lowerKeywords[3] == 'y' && lowerKeywords[4] == 'e' && lowerKeywords[5] == 'r' && lowerKeywords[6] == '=')
            {
                if (lowerKeywords.Length == 7)
                {
                    window.error.Add("A layer is required.");
                }
                else
                {
                    string layer = keywords.Substring(7);

                    for (int i = 0; i < UnityEditorInternal.InternalEditorUtility.layers.Length; i++)
                    {
                        if (UnityEditorInternal.InternalEditorUtility.layers[i] == layer)
                        {
                            return(new GameObjectLayerInstance(this, layer));
                        }
                    }

                    window.error.Add("Layer \"" + layer + "\" does not exist. (" + string.Join(", ", UnityEditorInternal.InternalEditorUtility.layers) + ")");
                }
            }

            return(null);
        }
        public override IFilterInstance Identify(NGSpotlightWindow window, string keywords, string lowerKeywords)
        {
            if (lowerKeywords.Length >= 6 && lowerKeywords[0] == ':' && lowerKeywords[1] == 'c' && lowerKeywords[2] == 'o' && lowerKeywords[3] == 'm' && lowerKeywords[4] == 'p' && lowerKeywords[5] == '=')
            {
                if (lowerKeywords.Length == 6)
                {
                    window.error.Add("A type Component is required.");
                }
                else
                {
                    keywords = keywords.Substring(6);
                    Type type = Type.GetType(keywords);

                    if (type == null)
                    {
                        type = Utility.GetType(keywords);
                    }

                    if (type == null)
                    {
                        window.error.Add("Component \"" + keywords + "\" does not exist. (MeshRenderer, Rigidbody, Light, Camera, etc...)");
                    }
                    else if (typeof(Component).IsAssignableFrom(type) == false)
                    {
                        window.error.Add("Type \"" + type.FullName + "\" must derive from Component.");
                    }
                    else
                    {
                        return(new GameObjectComponentInstance(this, type));
                    }
                }
            }

            return(null);
        }
示例#3
0
        public override IFilterInstance Identify(NGSpotlightWindow window, string keywords, string lowerKeywords)
        {
            if (lowerKeywords.Length >= 5 && lowerKeywords[0] == ':' && lowerKeywords[1] == 't' && lowerKeywords[2] == 'a' && lowerKeywords[3] == 'g' && lowerKeywords[4] == '=')
            {
                if (lowerKeywords.Length == 5)
                {
                    window.error.Add("A tag is required.");
                }
                else
                {
                    string tag = keywords.Substring(5);

                    for (int i = 0; i < UnityEditorInternal.InternalEditorUtility.tags.Length; i++)
                    {
                        if (UnityEditorInternal.InternalEditorUtility.tags[i] == tag)
                        {
                            return(new GameObjectTagInstance(this, tag));
                        }
                    }

                    window.error.Add("Tag \"" + tag + "\" does not exist. (" + string.Join(", ", UnityEditorInternal.InternalEditorUtility.tags) + ")");
                }
            }

            return(null);
        }
 void IFilterInstance.OnGUI(Rect r, NGSpotlightWindow window)
 {
     if (GUI.Button(r, this.label, GeneralStyles.ToolbarButton) == true)
     {
         window.RemoveFilterInstance(this);
     }
 }
示例#5
0
        public override IFilterInstance Identify(NGSpotlightWindow window, string keywords, string lowerKeywords)
        {
            if (lowerKeywords.Length >= 8 && lowerKeywords[0] == ':' && lowerKeywords[1] == 'f' && lowerKeywords[2] == 'o' && lowerKeywords[3] == 'r' && lowerKeywords[4] == 'm' && lowerKeywords[5] == 'a' && lowerKeywords[6] == 't' && lowerKeywords[7] == '=')
            {
                if (lowerKeywords.Length == 8)
                {
                    window.error.Add("A texture format is required.");
                }
                else
                {
                    keywords = keywords.Substring(8);

                    try
                    {
                        TextureImporterFormat value = (TextureImporterFormat)Enum.Parse(typeof(TextureImporterFormat), keywords, true);

                        return(new TextureFormatInstance(this, value));
                    }
                    catch
                    {
                        window.error.Add("Texture importer format \"" + keywords + "\" does not exist. (" + string.Join(", ", Enum.GetNames(typeof(TextureImporterFormat))) + ")");
                    }
                }
            }

            return(null);
        }
示例#6
0
 void IDrawableElement.Execute(NGSpotlightWindow window, EntryRef key)
 {
     if (EditorApplication.ExecuteMenuItem(this.path) == true)
     {
         NGSpotlightWindow.UseEntry(key);
     }
 }
示例#7
0
 public override IFilterInstance Identify(NGSpotlightWindow window, string keywords, string lowerKeywords)
 {
     if (lowerKeywords.Length == 3 && lowerKeywords[0] == ':' && lowerKeywords[1] == 'm' && lowerKeywords[2] == 'i')
     {
         return(this);
     }
     return(null);
 }
示例#8
0
        void IDrawableElement.Execute(NGSpotlightWindow window, EntryRef key)
        {
            NGSpotlightWindow.UseEntry(key);
            Object file = AssetDatabase.LoadAssetAtPath <Object>(this.path);

            EditorGUIUtility.PingObject(file);
            AssetDatabase.OpenAsset(file, 0);
        }
示例#9
0
 public override IFilterInstance Identify(NGSpotlightWindow window, string keywords, string lowerKeywords)
 {
     if (lowerKeywords == this.key)
     {
         return(this);
     }
     return(null);
 }
示例#10
0
 void IFilterInstance.OnGUI(Rect r, NGSpotlightWindow window)
 {
     if (GUI.Button(r, string.Empty, GeneralStyles.ToolbarButton) == true)
     {
         window.RemoveFilterInstance(this);
     }
     GUI.DrawTexture(r, this.icon, ScaleMode.ScaleToFit);
 }
示例#11
0
        private static void     BrowseGameObject(string key, GameObject go)
        {
            NGSpotlightWindow.AddEntry(key, new SceneGameObjectDrawer(go));

            for (int i = 0; i < go.transform.childCount; i++)
            {
                ScenesImporter.BrowseGameObject(key, go.transform.GetChild(i).gameObject);
            }
        }
示例#12
0
        bool IFilterInstance.CheckFilterIn(NGSpotlightWindow window, IDrawableElement element)
        {
            DefaultAssetDrawer drawer = element as DefaultAssetDrawer;

            if (drawer != null)
            {
                return(drawer.type == this.type);
            }

            return(element.GetType() == type);
        }
示例#13
0
        public override bool    CheckFilterRequirements(NGSpotlightWindow window)
        {
            for (int i = 0; i < window.filterInstances.Count; i++)
            {
                if (window.filterInstances[i] is MenuItemFilter)
                {
                    return(false);
                }
            }

            return(true);
        }
        public override bool    CheckFilterRequirements(NGSpotlightWindow window)
        {
            for (int i = 0; i < window.filterInstances.Count; i++)
            {
                if (window.filterInstances[i].FilterLevel == 0 &&
                    window.filterInstances[i].FamilyMask == 1 << 0)
                {
                    return(true);
                }
            }

            return(false);
        }
示例#15
0
        public override bool    CheckFilterRequirements(NGSpotlightWindow window)
        {
            for (int i = 0; i < window.filterInstances.Count; i++)
            {
                DefaultFilter filter = window.filterInstances[i] as DefaultFilter;
                if (filter != null && filter.key == this.key)
                {
                    return(false);
                }
            }

            return(true);
        }
示例#16
0
        private static void     ScanScene(UnityEngine.SceneManagement.Scene scene)
        {
            NGSpotlightWindow.DeleteKey(scene.path);

            if (scene.isLoaded == true)
            {
                scene.GetRootGameObjects(ScenesImporter.roots);

                for (int j = 0; j < ScenesImporter.roots.Count; j++)
                {
                    ScenesImporter.BrowseGameObject(scene.path, ScenesImporter.roots[j]);
                }
            }
        }
示例#17
0
            bool IFilterInstance.CheckFilterIn(NGSpotlightWindow window, IDrawableElement element)
            {
                IHasGameObject hasGameObject = element as IHasGameObject;

                try
                {
                    return(hasGameObject != null && hasGameObject.GameObject != null && hasGameObject.GameObject.CompareTag(this.tag) == true);
                }
                catch
                {
                    // In case tags are programmatically changed... We never know.
                }

                return(false);
            }
示例#18
0
        public static void      DeleteEntry(string key, int i)
        {
            List <IDrawableElement> list;

            if (NGSpotlightWindow.entries.TryGetValue(key, out list) == true)
            {
                list.RemoveAt(i);

                if (list.Count == 0)
                {
                    NGSpotlightWindow.DeleteKey(key);
                }
            }

            Utility.RepaintEditorWindow(typeof(NGSpotlightWindow));
        }
示例#19
0
        void IDrawableElement.OnGUI(Rect r, NGSpotlightWindow window, EntryRef k, int i)
        {
            if (MenuItemDrawer.style == null)
            {
                MenuItemDrawer.style              = new GUIStyle(EditorStyles.label);
                MenuItemDrawer.style.alignment    = TextAnchor.MiddleLeft;
                MenuItemDrawer.style.padding.left = 32;
                MenuItemDrawer.style.fontSize     = 15;
                MenuItemDrawer.style.richText     = true;
            }

            GUI.Box(r, "");

            if (Event.current.type == EventType.Repaint)
            {
                if (r.Contains(Event.current.mousePosition) == true)
                {
                    Utility.DrawUnfillRect(r, HQ.Settings != null ? HQ.Settings.Get <SpotlightSettings>().hoverSelectionColor : NGSpotlightWindow.HighlightedEntryColor);
                }
                else if (window.selectedEntry == i)
                {
                    Utility.DrawUnfillRect(r, HQ.Settings != null ? HQ.Settings.Get <SpotlightSettings>().outlineSelectionColor : NGSpotlightWindow.SelectedEntryColor);
                }
            }

            if (this.lastChange != window.changeCount)
            {
                this.lastChange            = window.changeCount;
                this.cachedHighlightedName = window.HighlightWeightContent(this.lowerPath, this.path, window.cleanLowerKeywords);
            }

            //GUI.DrawTexture(iconR, this.icon, ScaleMode.ScaleToFit);
            GUI.Label(r, this.cachedHighlightedName, MenuItemDrawer.style);

            if ((Event.current.type == EventType.KeyDown && window.selectedEntry == i && Event.current.keyCode == KeyCode.Return) ||
                (Event.current.type == EventType.MouseDown && r.Contains(Event.current.mousePosition) == true))
            {
                if (EditorApplication.ExecuteMenuItem(this.path) == true)
                {
                    NGSpotlightWindow.UseEntry(k);
                }
                window.Close();
                Event.current.Use();
            }
        }
示例#20
0
        public static void      Open()
        {
            Utility.CloseAllEditorWindows(typeof(NGSpotlightWindow));

            POINT pos = new POINT();

            NativeMethods.GetCursorPos(out pos);

            Rect r = Utility.GetEditorMainWindowPos();
            NGSpotlightWindow window = EditorWindow.CreateInstance <NGSpotlightWindow>();

            window.titleContent.text = NGSpotlightWindow.Title;
            window.position          = new Rect(Mathf.Clamp(pos.x - NGSpotlightWindow.WindowWidth * .5F, r.x + 5F, r.xMax - NGSpotlightWindow.WindowWidth - 5F), r.y + r.height * .5F - NGSpotlightWindow.WindowHeight * .5F, NGSpotlightWindow.WindowWidth, NGSpotlightWindow.WindowHeight);
            window.minSize           = new Vector2(NGSpotlightWindow.WindowWidth, NGSpotlightWindow.WindowHeight);
            window.maxSize           = window.minSize;
            window.ShowPopup();
            window.Focus();
        }
示例#21
0
        public override IFilterInstance Identify(NGSpotlightWindow window, string keywords, string lowerKeywords)
        {
            if (lowerKeywords.Length > 2 && lowerKeywords[0] == ':' && lowerKeywords[1] == '.')
            {
                string ext = lowerKeywords.Substring(1);

                for (int i = 0; i < window.filterInstances.Count; i++)
                {
                    ExtensionFileInstance filter = window.filterInstances[i] as ExtensionFileInstance;

                    if (filter != null && filter.extension != ext)
                    {
                        window.error.Add("Extension \"" + ext + "\" is already present.");
                        return(null);
                    }
                }

                return(new ExtensionFileInstance(this, ext));
            }

            return(null);
        }
 bool IFilterInstance.CheckFilterRequirements(NGSpotlightWindow window)
 {
     return(this.parent.CheckFilterRequirements(window));
 }
示例#23
0
        void IDrawableElement.OnGUI(Rect r, NGSpotlightWindow window, EntryRef k, int i)
        {
            // Init once.
            if (this.lastChange == -1)
            {
                this.asset = AssetDatabase.LoadAssetAtPath(this.path, typeof(Object));
            }

            if (this.asset == null)
            {
                NGSpotlightWindow.DeleteEntry(k.key, k.i);
                return;
            }

            if (DefaultAssetDrawer.style == null)
            {
                DefaultAssetDrawer.style           = new GUIStyle(EditorStyles.label);
                DefaultAssetDrawer.style.alignment = TextAnchor.MiddleLeft;
                DefaultAssetDrawer.style.fontSize  = 15;
                DefaultAssetDrawer.style.richText  = true;

                DefaultAssetDrawer.defaultIcon = InternalEditorUtility.GetIconForFile(".png");
            }

            if (this.iconIsPreview == true && this.asset != null && (this.icon == null || this.icon == DefaultAssetDrawer.defaultIcon))
            {
                this.icon = AssetPreview.GetAssetPreview(this.asset);
                window.Repaint();
            }

            if (this.icon == null)
            {
                this.icon = DefaultAssetDrawer.defaultIcon;
            }

            Rect iconR = r;

            iconR.width = iconR.height;

            GUI.Box(r, "");
            GUI.DrawTexture(iconR, this.icon, ScaleMode.ScaleToFit);

            if (this.lastChange != window.changeCount)
            {
                this.lastChange            = window.changeCount;
                this.cachedHighlightedName = window.HighlightWeightContent(this.lowerName, this.name, window.cleanLowerKeywords);
            }

            if (Event.current.type == EventType.Repaint)
            {
                if (r.Contains(Event.current.mousePosition) == true)
                {
                    Utility.DrawUnfillRect(r, HQ.Settings != null ? HQ.Settings.Get <SpotlightSettings>().hoverSelectionColor : NGSpotlightWindow.HighlightedEntryColor);
                }
                if (window.selectedEntry == i)
                {
                    Utility.DrawUnfillRect(r, HQ.Settings != null ? HQ.Settings.Get <SpotlightSettings>().outlineSelectionColor : NGSpotlightWindow.SelectedEntryColor);
                }
            }
            else if (Event.current.type == EventType.MouseDrag)
            {
                if (i.Equals(DragAndDrop.GetGenericData("i")) == true)
                {
                    DragAndDrop.StartDrag("Drag Asset");
                    Event.current.Use();
                }
            }
            else if (Event.current.type == EventType.MouseDown)
            {
                if (r.Contains(Event.current.mousePosition) == true)
                {
                    DragAndDrop.PrepareStartDrag();
                    DragAndDrop.SetGenericData("i", i);
                    DragAndDrop.objectReferences = new Object[] { this.asset };
                }
            }
            else if (Event.current.type == EventType.DragExited)
            {
                DragAndDrop.PrepareStartDrag();
            }

            if ((Event.current.type == EventType.KeyDown && window.selectedEntry == i && Event.current.keyCode == KeyCode.Return) ||
                (Event.current.type == EventType.MouseUp && r.Contains(Event.current.mousePosition) == true && i.Equals(DragAndDrop.GetGenericData("i")) == true))
            {
                if (Event.current.type == EventType.MouseUp && r.Contains(Event.current.mousePosition) == true)
                {
                    DragAndDrop.PrepareStartDrag();
                }

                if (window.selectedEntry == i || Event.current.button != 0)
                {
                    NGSpotlightWindow.UseEntry(k);
                    Selection.activeObject = this.asset;
                    window.Close();
                }
                else
                {
                    window.SelectEntry(i);
                }

                Event.current.Use();
            }

            r.xMin += iconR.width;
            GUI.Label(r, this.cachedHighlightedName, DefaultAssetDrawer.style);
        }
            bool IFilterInstance.CheckFilterIn(NGSpotlightWindow window, IDrawableElement element)
            {
                IHasGameObject hasGameObject = element as IHasGameObject;

                return(hasGameObject != null && hasGameObject.GameObject != null && hasGameObject.GameObject.GetComponent(this.type) != null);
            }
示例#25
0
 void IDrawableElement.Select(NGSpotlightWindow window, EntryRef key)
 {
     EditorGUIUtility.PingObject(this.asset);
 }
示例#26
0
 void IDrawableElement.Execute(NGSpotlightWindow window, EntryRef key)
 {
     NGSpotlightWindow.UseEntry(key);
     EditorGUIUtility.PingObject(this.asset);
     Selection.activeObject = this.asset;
 }
示例#27
0
            bool IFilterInstance.CheckFilterIn(NGSpotlightWindow window, IDrawableElement element)
            {
                DefaultAssetDrawer hasGameObject = element as DefaultAssetDrawer;

                if (hasGameObject != null)
                {
                    TextureImporter textureImporter = AssetImporter.GetAtPath(hasGameObject.path) as TextureImporter;

                    if (textureImporter != null)
                    {
                        string platform;

                        switch (EditorUserBuildSettings.activeBuildTarget)
                        {
                        case BuildTarget.StandaloneLinux:
                        case BuildTarget.StandaloneLinux64:
                        case BuildTarget.StandaloneLinuxUniversal:
                        case (BuildTarget)4:                                 // BuildTarget.StandaloneOSXIntel
                        case (BuildTarget)27:                                // BuildTarget.StandaloneOSXIntel64
                        case (BuildTarget)2:                                 // BuildTarget.StandaloneOSXUniversal
                        case BuildTarget.StandaloneWindows:
                        case BuildTarget.StandaloneWindows64:
                            platform = "Standalone";
                            break;

                        case BuildTarget.Android:
                            platform = "Android";
                            break;

                        case BuildTarget.iOS:
                            platform = "iPhone";
                            break;

                        case BuildTarget.N3DS:
                            platform = "Nintendo 3DS";
                            break;

                        case BuildTarget.PS4:
                            platform = "PS4";
                            break;

                        case BuildTarget.PSP2:
                            platform = "PSP2";
                            break;

                        case BuildTarget.Switch:                                 // Documentation of Unity does not state on this one.
                            platform = "Switch";
                            break;

                        case BuildTarget.tvOS:
                            platform = "tvOS";
                            break;

                        case BuildTarget.WebGL:
                            platform = "WebGL";
                            break;

                        case BuildTarget.WSAPlayer:
                            platform = "Windows Store Apps";
                            break;

                        case BuildTarget.XboxOne:
                            platform = "XboxOne";
                            break;

                        default:
                            return(false);
                        }

                        int mts;
                        TextureImporterFormat textureFormat;

                        if (textureImporter.GetPlatformTextureSettings(platform, out mts, out textureFormat) == true)
                        {
                            return((int)textureFormat == (int)this.format);
                        }
                    }
                }

                return(false);
            }
示例#28
0
 /// <summary>Defines if the current keywords match this filter.</summary>
 /// <param name="window"></param>
 /// <param name="keywords"></param>
 /// <param name="lowerKeywords"></param>
 /// <returns></returns>
 public abstract IFilterInstance Identify(NGSpotlightWindow window, string keywords, string lowerKeywords);
示例#29
0
 /// <summary>Defines if the filter can show up in the available list of filters.</summary>
 /// <param name="window"></param>
 /// <param name="parent"></param>
 /// <returns></returns>
 public abstract bool    CheckFilterRequirements(NGSpotlightWindow window);
示例#30
0
        private void    RefreshResult(bool limitResults = true)
        {
            if (NGSpotlightWindow.UpdatingResult != null)
            {
                NGSpotlightWindow.UpdatingResult();
            }

            ++this.changeCount;
            this.results.Clear();
            this.weight.Clear();

            this.error.Clear();
            this.cleanLowerKeywords = string.Empty;

            string filter = this.ExtractFilterInKeywords();

            if (this.keywords.Length > 0 && this.keywords[0] == ':')
            {
                this.UpdateAvailableFilters();

                if (filter != null)
                {
                    if (this.IdentifyFilter(filter) == true)
                    {
                        this.keywords = string.Empty;
                        this.RefreshResult();
                        GUI.FocusControl(null);
                        this.focusTextfieldOnce = false;
                        this.Repaint();
                    }
                    else
                    {
                        this.error.Add("Filter not recognized with \"" + filter + "\".");
                    }
                }

                return;
            }

            SpotlightSettings settings = HQ.Settings != null?HQ.Settings.Get <SpotlightSettings>() : null;

            int  maxResult = limitResults == true && settings != null ? settings.maxResult : int.MaxValue;
            bool keepResultsWithPartialMatch = settings != null ? settings.keepResultsWithPartialMatch : true;

            if (this.keywords.Length == 0 && this.filterInstances.Count > 0)
            {
                foreach (var registry in NGSpotlightWindow.entries)
                {
                    for (int i = 0; i < registry.Value.Count; i++)
                    {
                        if (registry.Value[i] == null)
                        {
                            continue;
                        }

                        int j      = 0;
                        int family = 0;

                        // At least one level 0 filter must filter it in.
                        for (; j < this.filterInstances.Count; j++)
                        {
                            if (this.filterInstances[j].FilterLevel == 0 && this.filterInstances[j].CheckFilterIn(this, registry.Value[i]) == true)
                            {
                                family |= this.filterInstances[j].FamilyMask;
                            }
                        }

                        if (family == 0)
                        {
                            continue;
                        }

                        j = 0;

                        for (; j < this.filterInstances.Count; j++)
                        {
                            if ((family & this.filterInstances[j].FamilyMask) != 0)
                            {
                                if (this.filterInstances[j].FilterLevel > 0 && this.filterInstances[j].CheckFilterIn(this, registry.Value[i]) == false)
                                {
                                    break;
                                }
                            }
                        }

                        if (j < this.filterInstances.Count)
                        {
                            continue;
                        }

                        if (this.results.Count < maxResult)
                        {
                            this.results.Add(new EntryRef()
                            {
                                key = registry.Key, i = i
                            });
                        }
                        else
                        {
                            return;
                        }
                    }
                }
            }
            else if (this.keywords.Length > 0)
            {
                string lowerKeywords = this.keywords.ToLower();
                this.cleanLowerKeywords = lowerKeywords;

                if (filter != null)
                {
                    this.cleanLowerKeywords = lowerKeywords.Substring(filter.Length);
                }

                // Custom implementation of fuzzy search.
                foreach (var registry in NGSpotlightWindow.entries)
                {
                    for (int i = 0; i < registry.Value.Count; i++)
                    {
                        if (registry.Value[i] == null)
                        {
                            continue;
                        }

                        if (this.filterInstances.Count > 0)
                        {
                            int j      = 0;
                            int family = 0;

                            // At least one level 0 filter must filter it in.
                            for (; j < this.filterInstances.Count; j++)
                            {
                                if (this.filterInstances[j].FilterLevel == 0 && this.filterInstances[j].CheckFilterIn(this, registry.Value[i]) == true)
                                {
                                    family |= this.filterInstances[j].FamilyMask;
                                }
                            }

                            if (family == 0)
                            {
                                continue;
                            }

                            j = 0;

                            for (; j < this.filterInstances.Count; j++)
                            {
                                if ((family & this.filterInstances[j].FamilyMask) != 0)
                                {
                                    if (this.filterInstances[j].FilterLevel > 0 && this.filterInstances[j].CheckFilterIn(this, registry.Value[i]) == false)
                                    {
                                        break;
                                    }
                                }
                            }

                            if (j < this.filterInstances.Count)
                            {
                                continue;
                            }
                        }

                        int weight;

                        if (this.WeightContent(keepResultsWithPartialMatch, registry.Value[i].LowerStringContent, this.cleanLowerKeywords, out weight) == true)
                        {
                            int k = 0;

                            for (; k < this.weight.Count; k++)
                            {
                                if (weight < this.weight[k])
                                {
                                    this.weight.Insert(k, weight);
                                    this.results.Insert(k, new EntryRef()
                                    {
                                        key = registry.Key, i = i
                                    });
                                    break;
                                }
                            }

                            if (k == this.weight.Count && this.results.Count < maxResult)
                            {
                                this.results.Add(new EntryRef()
                                {
                                    key = registry.Key, i = i
                                });
                                this.weight.Add(weight);
                            }
                            else if (this.results.Count > maxResult)
                            {
                                this.results.RemoveAt(this.results.Count - 1);
                                this.weight.RemoveAt(this.weight.Count - 1);
                            }
                        }
                    }
                }
            }
        }