Example #1
0
        public byte GetPresentationID(FindType type)
        {
            byte id = 0;

            if (Association != null)
            {
                switch (type)
                {
                case FindType.Patient:
                case FindType.PatientSeries:
                    id = Association.FindAbstract(DicomUidType.PatientRootQueryFind);
                    break;

                case FindType.Study:
                case FindType.StudySeries:
                    id = Association.FindAbstract(DicomUidType.StudyRootQueryFind);
                    break;

                case FindType.MWLBroad:
                case FindType.MWLPatient:
                    id = Association.FindAbstract(DicomUidType.ModalityWorklistFind);
                    break;
                }
            }
            return(id);
        }
Example #2
0
        /// TODO: Look into this method for setting date in calendar control.
        ///<summary>
        /// Sets the date on the date control.
        /// </summary>
        /// <param name="locator">The locator.</param>
        /// <param name="value">Date time value to be set.</param>
        /// <param name="type">Type of locator.</param>
        public void SetDateControlText(string locator, DateTime value, FindType type)
        {
            IWebElement element = FindElement(locator, type);

            element?.Click();

            new WebDriverWait(_webDriver, TimeSpan.FromSeconds(40)).Until(ExpectedConditions.ElementIsVisible(By.Id("ui-datepicker-div")));
            IWebElement dateControl = _webDriver.FindElement(By.Id("ui-datepicker-div"));

            List <IWebElement> divElements = dateControl.FindElements(By.TagName("select")).ToList();

            divElements[0].SendKeys(CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(value.Month));
            Thread.Sleep(TimeSpan.FromSeconds(15));
            divElements[1].SendKeys(value.Year.ToString());

            List <IWebElement> datecolumns = dateControl.FindElements(By.TagName("td")).ToList();

            datecolumns.FirstOrDefault(x => x.Text.EqualsIgnoreCase(value.Day.ToString()))?.Click();

            //_webDriver.Manage().Timeouts().SetScriptTimeout(TimeSpan.FromSeconds(10));

            //IJavaScriptExecutor exec = _webDriver as IJavaScriptExecutor;

            //exec.ExecuteScript("$('#{0}').val('{1}');".FormatWith(locator, value.Date.ToString()), "");
        }
Example #3
0
        public void UseWindowTitle(string windowTitle)
        {
            this.windowTitle = windowTitle;
            findType         = FindType.Title;

            timerCallback();
        }
Example #4
0
        public void UseWindowHandle(IntPtr windowHandle)
        {
            this.windowHandle = windowHandle;
            findType          = FindType.Handle;

            timerCallback();
        }
Example #5
0
        private FindResult Find(FindType findType)
        {
            var allAgeDifferences = CalculateAllAgeDifferences();

            var answer = new FindResult();

            if (allAgeDifferences.Any())
            {
                var ordered = from result in allAgeDifferences
                              orderby result.Difference ascending
                              select result;

                switch (findType)
                {
                    case FindType.Closest:
                        answer = ordered.First();
                        break;
                    case FindType.Furthest:
                        answer = ordered.Last();
                        break;
                }
            }

            return answer;
        }
        /// <summary>
        /// Looks for and returns the matching item. Will load additional sections if not found.
        /// </summary>
        /// <param name="identifier"></param>
        /// <returns></returns>
        public BaseItemWP Find(Guid identifier, FindType type = FindType.All)
        {
            if (identifier == Guid.Empty)
            {
                return(null);
            }

            BaseItemWP found = FindFromLoaded(identifier);

            if (found != null)
            {
                return(found);
            }

            //make sure everything's loaded
            if (type.HasFlag(FindType.Semesters))
            {
                foreach (SemesterSection s in SemesterSections)
                {
                    s.Load();
                }
            }

            if (type.HasFlag(FindType.Grades))
            {
                foreach (GradesSection g in GradesSections)
                {
                    g.Load();
                }
            }

            //try again
            return(FindFromLoaded(identifier));
        }
Example #7
0
        public FindResult Find(FindType findType)
        {
            int resultCount = 0;
            FindResult closest = null;
            FindResult furthest = null;

            foreach (var person1 in _personList)
            {
                foreach (var person2 in _personList)
                {
                    // don't compare person to itself
                    if (person1 == person2) continue;

                    var result = FindResult.Compare(person1, person2);

                    if (furthest == null || result.AgeDifference > furthest.AgeDifference)
                        furthest = result;

                    if (closest == null || result.AgeDifference < closest.AgeDifference)
                        closest = result;

                    resultCount++;
                }
            }

            if (resultCount < 1)
                return new FindResult();

            return (findType == FindType.ClosestInAge) ? closest : furthest;
        }
Example #8
0
        private bool FindNode(string text, ref Node afterNode, FindType findType, Stack <int> path)
        {
            if (afterNode == null)
            {
                if ((findType & FindType.Text) > 0 && (this.Text?.ToLower()?.Contains(text.ToLower()) ?? false))
                {
                    return(true);
                }
                if ((findType & FindType.TypeName) > 0 && (this.TypeName?.ToLower()?.Contains(text.ToLower()) ?? false))
                {
                    return(true);
                }
                if ((findType & FindType.ObjectValues) > 0 && (this.Obj?.ToString()?.ToLower()?.Contains(text.ToLower()) ?? false))
                {
                    return(true);
                }
            }
            if (afterNode == this)
            {
                afterNode = null;
            }
            for (int i = 0; i < Nodes.Count; i++)
            {
                var node = Nodes[i];

                if (node.FindNode(text, ref afterNode, findType, path))
                {
                    path.Push(i);
                    return(true);
                }
            }
            return(false);
        }
Example #9
0
        private void FindObject(FindType findType)
        {
            if (!string.IsNullOrEmpty(this.whatComboBox.Text))
            {
                for (int i = 0; i < this.whatComboBox.Items.Count; ++i)
                {
                    string what = (string)this.whatComboBox.Items[i];

                    if (what == this.whatComboBox.Text)
                    {
                        this.whatComboBox.Items.RemoveAt(i);
                        this.whatComboBox.Text = what;
                        break;
                    }
                }

                this.whatComboBox.Items.Insert(0, this.whatComboBox.Text);

                while (this.whatComboBox.Items.Count > 20)
                {
                    this.whatComboBox.Items.RemoveAt(this.whatComboBox.Items.Count - 1);
                }

                if (this.rangeComboBox.SelectedIndex > -1)
                {
                    FindObject(this.whatComboBox.Text,
                               (FindRange)this.rangeComboBox.SelectedIndex,
                               this.matchCaseCheckBox.Checked,
                               this.matchWholeWordCheckBox.Checked,
                               this.nodeTypeCheckBox.Checked,
                               Settings.Default.ShowVersionInfo && this.nodeIdCheckBox.Checked,
                               findType);
                }
            }
        }
Example #10
0
        /// <summary>
        /// 根据特性 获取父级
        /// </summary>
        /// <param name="findType"></param>
        /// <param name="param"></param>
        /// <returns></returns>
        private Transform GetParent(FindType findType, string param)
        {
            Transform ret = null;

            if (_uiParentDic.ContainsKey(param))
            {
                ret = _uiParentDic[param];
            }
            else if (findType == FindType.Name)
            {
                GameObject gameObject = GameObject.Find(param);
                if (gameObject == null)
                {
                    LWDebug.LogError(string.Format("当前没有找到{0}这个GameObject对象", param));
                }
                ret = gameObject.transform;
                _uiParentDic.Add(param, ret);
            }
            else if (findType == FindType.Tag)
            {
                GameObject gameObject = GameObject.FindGameObjectWithTag(param);
                if (gameObject == null)
                {
                    LWDebug.LogError(string.Format("当前没有找到{0}这个Tag GameObject对象", param));
                }
                ret = gameObject.transform;
                _uiParentDic.Add(param, ret);
            }
            return(ret);
        }
Example #11
0
        private void findAllBtn_Click(object sender, EventArgs e)
        {
            if (forgeComboBox.SelectedIndex < 0 || forgeComboBox.Items.Count == 0)
            {
                Message.Fail("Either no .forge file is open/expanded in Blacksmith or none have been selected from the dropdown.");
                return;
            }

            dataGridView.Rows.Clear();

            FindType type = FindType.NORMAL;

            if (filterComboBox.SelectedIndex == 2 || filterComboBox.SelectedIndex == 3)
            {
                type = FindType.REGEX;
            }
            else if (filterComboBox.SelectedIndex == 4 || filterComboBox.SelectedIndex == 5)
            {
                type = FindType.WILDCARD;
            }

            OnFindAll(new FindEventArgs
            {
                Query           = queryTextBox.Text,
                Type            = type,
                ForgeToSearchIn = forges.Where(x => FormatName(x) == (string)forgeComboBox.SelectedItem).FirstOrDefault(),
                FilterBy        = (FilterBy)filterByComboBox.SelectedIndex,
                CaseSensitive   = ((string)filterComboBox.SelectedItem).Contains("Case-Sensitive")
            });
        }
Example #12
0
        /// <summary>
        /// Shows the find form
        /// </summary>
        /// <param name="view">The view control</param>
        /// <param name="where">Which location should be highlighted by default</param>
        /// <param name="type">If this is a new search or just search again</param>
        public static void Find(RequestTrafficView view, FindLocation where, FindType type)
        {
            lock (_lock)
            {
                if (_instance == null)
                {
                    _instance = new ImmediateFinder();
                }

                if (type == FindType.NewFind)
                {
                    _instance._comboLocation.SelectedIndex = (int)where;
                    _instance._view = view;

                    _instance.Show();
                }
                else
                {
                    if (_instance._matches.Count > 0)
                    {
                        _instance.FindAgain();
                    }
                    else
                    {
                        _instance.Show();
                    }
                }
            }
        }
Example #13
0
 public Find(GvoWorldInfo.CulturalSphere cs, string tooltip_str) : this()
 {
     m_type                     = FindType.CulturalSphere;
     m_info_name                = GvoWorldInfo.GetCulturalSphereString(cs);
     m_cultural_sphere          = cs;
     m_cultural_sphere_tool_tip = tooltip_str;
 }
Example #14
0
        /// <summary>
        /// Find a two-person pair using a list of two or more people and the FindType. Populates FirstPerson
        /// and SecondPerson in ascending order based on birth date.
        /// </summary>
        /// <param name="findType"></param>
        /// <returns></returns>
        public FindResult Find(FindType findType)
        {
            var findResult = new FindResult();

            // verify at least 2 persons in list before executing find
            if (_persons.Count > 1)
            {
                var results = GetFindResults();

                findResult = results[0];

                foreach (var result in results)
                {
                    if (findType == FindType.Closest && result.DateTimeSpan < findResult.DateTimeSpan)
                    {
                        findResult = result;
                    }
                    else if (findType == FindType.Furthest && result.DateTimeSpan > findResult.DateTimeSpan)
                    {
                        findResult = result;
                    }
                }
            }

            return(findResult);
        }
Example #15
0
        /// <summary>
        /// Selects one or more rows in a table for given column names
        /// </summary>
        /// <param name="locator">The locator</param>
        /// <param name="columnTexts">The text for consecutive columns</param>
        /// <param name="type">Type of locator</param>
        /// <returns>True if succeeded</returns>
        public bool SelectTableRows(string locator, StringCollection columnTexts, FindType type)
        {
            if (columnTexts == null)
            {
                throw new ArgumentNullException("columnTexts");
            }

            bool succeeded = false;

            //Concat the table text columns each delimited by 2 space chars. WebDriver is providing the Row text in this
            //manner.

            StringBuilder searchColText = new StringBuilder();

            foreach (String columnText in columnTexts)
            {
                searchColText.Append(columnText);
                searchColText.Append("  ");
            }

            searchColText.Remove(searchColText.Length - 2, columnTexts.Count > 1 ? 2 : 1);

            IWebElement tableElement = FindElement(locator, type);

            if (tableElement != null) //Get the table by class name.
            {
                ReadOnlyCollection <IWebElement> tableRows = tableElement.FindElements(By.XPath("tbody/tr"));
                foreach (var row in tableRows) //Get all rows in the table.
                {
                    String rowText = row.Text.Trim();

                    bool found = (columnTexts.Count > 1) ? (0 == string.Compare(rowText, searchColText.ToString(), StringComparison.OrdinalIgnoreCase)) :
                                 (rowText.StartsWith(searchColText.ToString(), StringComparison.OrdinalIgnoreCase));
                    if (found) //Get the complete text of the table and compare.
                    {
                        ReadOnlyCollection <IWebElement> tableColumns = row.FindElements(By.XPath("td"));

                        foreach (var tableColumn in tableColumns) //For each column in the row, click the HTML input element.
                        {
                            try
                            {
                                IWebElement inputElement = tableColumn.FindElement(By.TagName("INPUT"));

                                inputElement.Click(); //Set the focus.
                                if (!inputElement.Selected)
                                {
                                    inputElement.Click();
                                }
                                succeeded = true;
                            }
                            catch (NoSuchElementException)
                            {
                            }
                        }
                    }
                }
            }
            return(succeeded);
        }
Example #16
0
 public static List <Cliente> GetAll(FindType findType, Empresa empresa, string nombre)
 {
     return
         ((
              from query in Query.GetClientes(findType, empresa, nombre)
              select query
              ).ToList <Cliente>());
 }
Example #17
0
    static int IntToEnum(IntPtr L)
    {
        int      arg0 = (int)LuaDLL.lua_tonumber(L, 1);
        FindType o    = (FindType)arg0;

        ToLua.Push(L, o);
        return(1);
    }
Example #18
0
        //! Возвращает словарь из диалогов для локализации (устаревшие, актуальные или все)
        public DifferenceDict getDialogDifference(string locale, FindType findType)
        {
            //System.Console.WriteLine("CDialogs::getDialogDifference");
            DifferenceDict ret = new DifferenceDict();

            if (this.locales.Keys.Contains(locale))
            {
                var cur_locale_info = this.locales[locale];
                foreach (var npc_name in dialogs.Keys)
                {
                    if (!cur_locale_info.Keys.Contains(npc_name))
                    {
                        continue;
                    }
                    var locale_dialogs = cur_locale_info[npc_name];
                    foreach (var dialog in dialogs[npc_name].Values)
                    {
                        var locale_version = 0;
                        if (locale_dialogs.Keys.Contains(dialog.DialogID))
                        {
                            locale_version = locale_dialogs[dialog.DialogID].version;
                        }

                        if (!ret.Keys.Contains(npc_name))
                        {
                            ret.Add(npc_name, new Dictionary <int, CDifference>());
                        }
                        switch (findType)
                        {
                        case FindType.all:
                            ret[npc_name].Add(dialog.DialogID, new CDifference(dialog.version, locale_version));
                            break;

                        case FindType.outdatedOnly:
                            if (dialog.version != locale_version)
                            {
                                ret[npc_name].Add(dialog.DialogID, new CDifference(dialog.version, locale_version));
                            }
                            break;

                        case FindType.actualOnly:
                            if (dialog.version == locale_version)
                            {
                                ret[npc_name].Add(dialog.DialogID, new CDifference(dialog.version, locale_version));
                            }
                            break;
                        }
                    }
                }
            }
            //foreach (var name in ret.Keys)
            //    {
            //        System.Console.WriteLine(name + ":");
            //        foreach (var id in ret[name])
            //            System.Console.WriteLine("id:"+id.ToString());
            //    }
            return(ret);
        }
Example #19
0
 /// <summary>
 /// Click on a button/ radio-button/ check-box present in the page
 /// </summary>
 /// <param name="locator">The locator.</param>
 /// <param name="type">Type of locator</param>
 public void Click(string locator, FindType type = FindType.ById)
 {
     _selenium.ChooseOkOnNextConfirmation();
     _selenium.Click(locator);
     if (_selenium.IsConfirmationPresent())
     {
         _selenium.GetConfirmation();
     }
 }
Example #20
0
    public static void FindReference(FindType findType)
    {
        Stopwatch stopwatch = new Stopwatch();

        stopwatch.Start();
        string[]      guids    = Selection.assetGUIDs;
        List <string> pathList = new List <string>();

        for (int i = 0; i < guids.Length; i++)
        {
            string path = AssetDatabase.GUIDToAssetPath(guids[i]);

            if (path.IndexOf(".") == -1) //文件夹
            {
                string[] files = Directory.GetFiles(path, "*", SearchOption.AllDirectories);
                for (int j = 0; j < files.Length; j++)
                {
                    string file = files[j];
                    if (file.IndexOf(".meta") > 0)
                    {
                        continue;
                    }
                    else
                    {
                        pathList.Add(file);
                    }
                }
            }
            else //文件
            {
                pathList.Add(path);
            }
        }

        for (int i = 0; i < pathList.Count; i++)
        {
            Debug.Log(pathList[i]);
        }

        if (findType == FindType.Prefab)
        {
            string[] ids   = AssetDatabase.FindAssets("t:Prefab", new string[] { "Assets" });
            string[] paths = new string[ids.Length];
            for (int i = 0; i < ids.Length; i++)
            {
                string path = AssetDatabase.GUIDToAssetPath(ids[i]);
                EditorUtility.DisplayProgressBar("Hold On", path, (float)i / ids.Length);
                string[] depends = AssetDatabase.GetDependencies(path);
                for (int j = 0; j < depends.Length; j++)
                {
                    for (int k = 0; k < pathList.Count; k++)
                    {
                    }
                }
            }
        }
    }
 // 显示所有Prefab
 private void DrawFindAllPrefab()
 {
     GUI.backgroundColor = Color.green;
     if (GUILayout.Button("显示所有Prefab"))
     {
         findType = FindType.ShowAllPrefab;
         CollectAndRun();
     }
     GUI.backgroundColor = Color.white;
 }
Example #22
0
 /*-------------------------------------------------------------------------
  *
  * ---------------------------------------------------------------------------*/
 private Find()
 {
     this.m_type                     = FindType.InfoName;
     this.m_data                     = (GvoWorldInfo.Info.Group.Data)null;
     this.m_database                 = (ItemDatabase.Data)null;
     this.m_info_name                = "";
     this.m_lang                     = (string)null;
     this.m_cultural_sphere          = GvoWorldInfo.CulturalSphere.Unknown;
     this.m_cultural_sphere_tool_tip = "";
 }
Example #23
0
        public Pair Find(FindType findType)
        {
            var results = GetPairs();

            if(results.Count() < 1)
                return new Pair();

            if (findType == FindType.ClosestAge)
                return results.OrderBy(x => x.Delta).First();
            return results.OrderByDescending(x => x.Delta).First();
        }
Example #24
0
        /// <summary>
        /// Get the value of the text-box
        /// </summary>
        /// <param name="locator">The locator.</param>
        /// <param name="type">Type of locator</param>
        /// <returns>text of the locator</returns>
        public string GetText(string locator, FindType type)
        {
            IWebElement element = FindElement(locator, type);

            if (null != element)
            {
                return(element.Text);
            }

            return(string.Empty);
        }
 public FindReplaceDialogHelper(FindType findType, string findText, Regex regEx, string replaceText, int left, int top, int startLineIndex)
 {
     FindType           = findType;
     _findText          = findText;
     _replaceText       = replaceText;
     _regEx             = regEx;
     _findTextLenght    = findText.Length;
     WindowPositionLeft = left;
     WindowPositionTop  = top;
     StartLineIndex     = startLineIndex;
 }
 public FindReplaceDialogHelper(FindType findType, string findText, Regex regEx, string replaceText, int left, int top, int startLineIndex)
 {
     FindType = findType;
     _findText = findText;
     _replaceText = replaceText;
     _regEx = regEx;
     _findTextLenght = findText.Length;
     WindowPositionLeft = left;
     WindowPositionTop = top;
     StartLineIndex = startLineIndex;
 }
 public FindReplaceDialogHelper(FindType findType, string findText, Regex regEx, string replaceText, int left, int top, int startLineIndex)
 {
     FindType = findType;
     this.findText = findText ?? string.Empty;
     this.replaceText = replaceText ?? string.Empty;
     this.regEx = regEx;
     this.findTextLenght = findText == null ? 0 : findText.Length;
     WindowPositionLeft = left;
     WindowPositionTop = top;
     StartLineIndex = startLineIndex;
 }
Example #28
0
    public static List <Units> FilterTargets(Units self, List <Units> targets, FindType findType, object param)
    {
        if (targets == null)
        {
            return(null);
        }
        List <Units> result = new List <Units>(targets);

        FindTargetHelper.FilterTargetsRef(self, ref result, findType, param);
        return(result);
    }
Example #29
0
            public Find(FindType _type, string _info_name, GvoWorldInfo.Info.Group.Data _data) : this()
            {
                m_type = _type;

                m_data = _data;
                if (m_data != null)
                {
                    m_database = m_data.ItemDb;
                }
                m_info_name = _info_name;
            }
Example #30
0
        /// <summary>
        /// Locates the element by type and wrap it to Select a Element
        /// </summary>
        /// <param name="locator">The locator to find</param>
        /// <param name="type">Type of locator</param>
        /// <returns></returns>
        public SelectElement FindSelectElement(string locator, FindType type)
        {
            SelectElement selectElement = null;
            IWebElement   webElement    = FindElement(locator, type);

            if (null != webElement)
            {
                selectElement = new SelectElement(webElement);
            }

            return(selectElement);
        }
Example #31
0
        /// <summary>
        /// Unchecks a specified locator
        /// </summary>
        /// <param name="locator">The locator</param>
        /// <param name="type">Type of locator</param>
        public void Uncheck(string locator, FindType type)
        {
            IWebElement element = FindElement(locator, type);

            if (null != element && element.Selected)
            {
                element.Click();

                // wait for specified time before returning the control back
                Thread.Sleep(ElementOperationDelay);
            }
        }
Example #32
0
        private bool ReInit()
        {
            string sql = string.Empty;
            DataTable dt = null;

            if (FindByNodeText)
            {
                findType = FindType.FindNodeText;

                sql = string.Format("select distinct [{0}] from {1} where [{0}] like '%{2}%' order by [{0}]", mapField, animation_npcTableName, FindValue);
                dt = GetDataTable(sql, Conn);
                if (dt == null)
                {
                    return false;
                }
                FindResultMapRows = dt.Rows;

                sql = string.Format("select [{0}], {1}, {2} from {3} where {1} like '%{4}%' order by [{0}], {1}", mapField, ModelField, RepresentIdField, npcTableName, FindValue);
                dt = GetDataTable(sql, Conn);
                if (dt == null)
                {
                    return false;
                }
                FindResultModelRows = dt.Rows;

            }
            else if (FindField.ToLower() == RepresentIdField.ToLower())
            {
                findType = FindType.FindRepresentId;

                sql = string.Format("select [{0}], {1} from {2} where {1} = {3} order by [{0}], {1} ", mapField, RepresentIdField, animation_npcTableName, FindValue);
                dt = GetDataTable(sql, Conn);
                if (dt == null)
                {
                    return false;
                }
                FindResultRows = dt.Rows;
            }
            else
            {
                findType = FindType.FindAnimationID;

                sql = string.Format("select [{0}], {1}, {2} from {3} where {2} = {4} order by [{0}], {1}, {2} ", mapField, RepresentIdField, AnimationIDField, animation_npcTableName, FindValue);
                dt = GetDataTable(sql, Conn);
                if (dt == null)
                {
                    return false;
                }
                FindResultRows = dt.Rows;
            }

            return true;
        }
Example #33
0
        /// <summary>
        /// Set the value of the Browse Control
        /// </summary>
        /// <param name="locator">The locator.</param>
        /// <param name="value">The value to be set in browse control.</param>
        /// <param name="type">Type of locator</param>
        public void SetBrowseControlText(string locator, string value, FindType type)
        {
            IWebElement element = FindElement(locator, type);

            if (null != element)
            {
                element.SendKeys(value);

                // wait for specified time before returning the control back
                Thread.Sleep(ElementOperationDelay);
            }
        }
Example #34
0
        /// <summary>
        /// Selects the list item from a listbox, dropdown box based on the value.
        /// </summary>
        /// <param name="selectLocator">The select locator.</param>
        /// <param name="value">The value to be selected.</param>
        /// <param name="type">Type of locator</param>
        public void SelectByValue(string selectLocator, string value, FindType type)
        {
            SelectElement select = FindSelectElement(selectLocator, type);

            if (null != select)
            {
                select.SelectByValue(value);

                // wait for specified time before returning the control back
                Thread.Sleep(ElementOperationDelay);
            }
        }
Example #35
0
        private bool ReInit()
        {
            string    sql = string.Empty;
            DataTable dt  = null;

            if (FindByNodeText)
            {
                findType = FindType.FindNodeText;

                sql = string.Format("select distinct [{0}] from {1} where [{0}] like '%{2}%' order by [{0}]", mapField, animation_npcTableName, FindValue);
                dt  = GetDataTable(sql, Conn);
                if (dt == null)
                {
                    return(false);
                }
                FindResultMapRows = dt.Rows;

                sql = string.Format("select [{0}], {1}, {2} from {3} where {1} like '%{4}%' order by [{0}], {1}", mapField, ModelField, RepresentIdField, npcTableName, FindValue);
                dt  = GetDataTable(sql, Conn);
                if (dt == null)
                {
                    return(false);
                }
                FindResultModelRows = dt.Rows;
            }
            else if (FindField.ToLower() == RepresentIdField.ToLower())
            {
                findType = FindType.FindRepresentId;

                sql = string.Format("select [{0}], {1} from {2} where {1} = {3} order by [{0}], {1} ", mapField, RepresentIdField, animation_npcTableName, FindValue);
                dt  = GetDataTable(sql, Conn);
                if (dt == null)
                {
                    return(false);
                }
                FindResultRows = dt.Rows;
            }
            else
            {
                findType = FindType.FindAnimationID;

                sql = string.Format("select [{0}], {1}, {2} from {3} where {2} = {4} order by [{0}], {1}, {2} ", mapField, RepresentIdField, AnimationIDField, animation_npcTableName, FindValue);
                dt  = GetDataTable(sql, Conn);
                if (dt == null)
                {
                    return(false);
                }
                FindResultRows = dt.Rows;
            }

            return(true);
        }
Example #36
0
        internal static IQueryable <Persona> GetPersonas(FindType findType, string filter)
        {
            switch (findType)
            {
            case FindType.StartsWith: return(from usuario in GetPersonas() where (usuario.Nombre.StartsWith(filter)) select usuario);

            case FindType.Contains: return(from usuario in GetPersonas() where (usuario.Nombre.Contains(filter)) select usuario);

            case FindType.EndsWith: return(from usuario in GetPersonas() where (usuario.Nombre.EndsWith(filter)) select usuario);

            default: return(from usuario in GetPersonas() where (usuario.Nombre == filter) select usuario);
            }
        }
        public FindReplaceDialogHelper(FindType findType, bool matchWholeWord, string findText, Regex regEx, string replaceText, int startLineIndex)
        {
            FindType = findType;
            _findText = findText;

            _replaceText = replaceText;
            if (_replaceText != null)
            {
                _replaceText = _replaceText.Replace("\\n", Environment.NewLine);
            }

            _regEx = regEx;
            _findTextLenght = findText.Length;
            StartLineIndex = startLineIndex;
            MatchWholeWord = matchWholeWord;
        }
Example #38
0
        public AgeDifference Find(FindType findType)
        {
            var AgeDifferenceList = GetAgeDifferenceList();

            AgeDifference ageDifferenceResult = new AgeDifference();

            if (AgeDifferenceList.Count > 0) {
                if (findType == FindType.MaximumDiff) {
                    AgeDifferenceList.Reverse();
                } else {
                    AgeDifferenceList.Sort();
                }
                ageDifferenceResult = AgeDifferenceList[0];
            }

            return ageDifferenceResult;
        }
        public FindReplaceDialogHelper(FindType findType, string findText, Regex regEx, string replaceText, int left, int top, int startLineIndex)
        {
            FindType = findType;
            _findText = findText;

            _replaceText = replaceText;
            if (_replaceText != null)
            {
                _replaceText = _replaceText.Replace("\\n", Environment.NewLine);
            }

            _regEx = regEx;
            _findTextLenght = findText.Length;
            WindowPositionLeft = left;
            WindowPositionTop = top;
            StartLineIndex = startLineIndex;
        }
 public static void Main(string[] args)
 {
   FindType ft = new FindType();
   try
   {
     SetOptions(args, ft);      
     ft.Search();
   }
   catch(SecurityException)
   {
     Console.WriteLine("This sample has failed to run due to a security limitation!");
     Console.WriteLine("Try running the sample from a local drive or using CasPol.exe to turn off security.");
   }
   catch
   {
     PrintUsage();
   }      
 }
Example #41
0
        private void FindObject(string findWhat, FindRange findRange, bool matchCase,
                                bool matchWholeWord, bool onlyByNodeType, bool onlyByNodeId, FindType findType) {
            if (string.IsNullOrEmpty(findWhat)) {
                return;
            }

            saveFindSettings();

            try {
                List<Nodes.Node> rootNodes = GetRootNodes(findRange);
                List<ObjectPair> findObjects = new List<ObjectPair>();

                if (!onlyByNodeType) {
                    // by Id
                    int id = int.MinValue;

                    if (int.TryParse(findWhat, out id)) {
                        foreach(Nodes.Node root in rootNodes) {
                            DefaultObject obj = Plugin.GetObjectById(root, id);

                            if (obj != null) {
                                findObjects.Add(new ObjectPair(root, obj));
                            }
                        }
                    }
                }

                if (!onlyByNodeId) {
                    // by Type
                    foreach(Nodes.Node root in rootNodes) {
                        root.GetObjectsByType(root, findWhat, matchCase, matchWholeWord, ref findObjects);
                    }
                }

                if (!onlyByNodeId && !onlyByNodeType) {
                    foreach(Nodes.Node root in rootNodes) {
                        root.GetObjectsByPropertyMethod(root, findWhat, matchCase, matchWholeWord, ref findObjects);
                    }
                }

                if (findObjects.Count > 0) {
                    if (Plugin.CompareTwoObjectLists(_findObjects, findObjects)) {
                        if (findType == FindType.Next) {
                            _objectIndex++;

                            if (_objectIndex >= findObjects.Count) {
                                _objectIndex = 0;
                            }

                        } else if (findType == FindType.Previous) {
                            _objectIndex--;

                            if (_objectIndex < 0) {
                                _objectIndex = findObjects.Count - 1;
                            }
                        }

                    } else {
                        _objectIndex = 0;
                        _findObjects = findObjects;
                    }

                    if (findType == FindType.All) {
                        FindFileDock.Inspect(findWhat, rootNodes.Count, findObjects);

                    } else {
                        ShowObject(findObjects[_objectIndex]);
                    }

                    return;
                }

            } catch (Exception) {
            }

            MessageBox.Show(Resources.FindWarningInfo, Resources.FindWarning, MessageBoxButtons.OK);
        }
Example #42
0
        private void FindObject(FindType findType) {
            if (!string.IsNullOrEmpty(this.whatComboBox.Text)) {
                for (int i = 0; i < this.whatComboBox.Items.Count; ++i) {
                    string what = (string)this.whatComboBox.Items[i];

                    if (what == this.whatComboBox.Text) {
                        this.whatComboBox.Items.RemoveAt(i);
                        this.whatComboBox.Text = what;
                        break;
                    }
                }

                this.whatComboBox.Items.Insert(0, this.whatComboBox.Text);

                while (this.whatComboBox.Items.Count > 20) {
                    this.whatComboBox.Items.RemoveAt(this.whatComboBox.Items.Count - 1);
                }

                if (this.rangeComboBox.SelectedIndex > -1) {
                    FindObject(this.whatComboBox.Text,
                               (FindRange)this.rangeComboBox.SelectedIndex,
                               this.matchCaseCheckBox.Checked,
                               this.matchWholeWordCheckBox.Checked,
                               this.nodeTypeCheckBox.Checked,
                               Settings.Default.ShowVersionInfo && this.nodeIdCheckBox.Checked,
                               findType);
                }
            }
        }
Example #43
0
    private void FindByRevelationPlaceControls_Enter(object sender, EventArgs e)
    {
        this.AcceptButton = null;
        FindType = FindType.Revelation;

        ResetFindBySimilarityResultTypeLabels();
        ResetFindByNumbersResultTypeLabels();
        ResetFindByFrequencyResultTypeLabels();
    }
Example #44
0
 public FindMessage(Type t, FindType findType, string value)
 {
     Type = t;
     FindType = findType;
     Value = value;
 }
Example #45
0
 protected static extern IntPtr FindFirst(IntPtr pFolder, string lpSearch, FindType eFind);
Example #46
0
 /// <summary>
 /// 寻找迷宫的通路
 /// </summary>
 /// <param name="type">寻路所使用的算法</param>
 /// <param name="start">寻路起点</param>
 /// <param name="end">寻路终点</param>
 public void FindPath(FindType type, Point start, Point end = new Point())
 {
     Stopwatch findStopwatch=new Stopwatch();
     findStopwatch.Start();
     if (end == new Point(0, 0))
     {
         end = new Point(MazeMap.GetUpperBound(0) - 1, MazeMap.GetUpperBound(1) - 1);
     }
     switch (type)
     {
         case FindType.DfsFind:
             DfsFind(start, end);
             break;
         case FindType.AStarFind:
             AStarFind(start, end);
             break;
         case FindType.BFSFind:
             BFSFind(start, end);
             break;
     }
     findStopwatch.Stop();
     FindTime = findStopwatch.Elapsed;
 }
Example #47
0
        /// <summary>
        /// Find a X509 certificate of matching thumbprint or SubjectName from the LocalMachine/My
        /// certificate store and LocalMachine/Personal store
        /// </summary>
        /// <param name="str">content of ThumbPrint or SubjectName</param>
        /// <param name="type">ThumbPrint or SubjectName</param>
        /// <returns>an X509Certificate2 object</returns>
        public static X509Certificate2 FindCertificate(string str, FindType type)
        {
            // Find certificate for personal store
            X509Store store = new X509Store(StoreName.My, StoreLocation.CurrentUser);
            store.Open(OpenFlags.ReadOnly);

            X509Certificate2Collection collection;
            try
            {
                if (type == FindType.Thumbprint)
                {
                    collection = store.Certificates.Find(X509FindType.FindByThumbprint, str, true);
                }
                else
                {
                    collection = store.Certificates.Find(X509FindType.FindBySubjectName, str, true);
                }

                if (collection != null && collection.Count > 0)
                {
                    if (collection[0].HasPrivateKey)
                    {
                        return collection[0];
                    }
                }
            }
            finally
            {
                store.Close();
            }

            string err = string.Format("No private key certificate that matches thumbprint or SubjectName {0} could be found in the personal certificate store of the current user or the local computer. For more information, see http://go.microsoft.com/fwlink/?LinkId=228597.", str);
            throw new InvalidOperationException(err);
        }
Example #48
0
    private void FindBySimilarityControls_Enter(object sender, EventArgs e)
    {
        this.AcceptButton = FindBySimilarityButton;
        FindType = FindType.Similarity;

        ResetFindBySimilarityResultTypeLabels();
        ResetFindByNumbersResultTypeLabels();
        ResetFindByFrequencyResultTypeLabels();

        switch (m_similarity_source)
        {
            case SimilaritySource.Verse:
                {
                    FindBySimilarityVerseSourceLabel.BackColor = Color.SteelBlue;
                    FindBySimilarityVerseSourceLabel.BorderStyle = BorderStyle.Fixed3D;
                }
                break;
            case SimilaritySource.Book:
                {
                    FindBySimilarityBookSourceLabel.BackColor = Color.SteelBlue;
                    FindBySimilarityBookSourceLabel.BorderStyle = BorderStyle.Fixed3D;
                }
                break;
        }

        FindByTextButton.Enabled = false;
        FindBySimilarityButton.Enabled = true;
        FindByNumbersButton.Enabled = false;
        FindByFrequencySumButton.Enabled = false;
    }
Example #49
0
 public Item FindNext(Item item, string search, FindType find)
 {
     return new Item(FindNext(ItemPtr, item.ItemPtr, search, find));
 }
Example #50
0
 /// <summary>
 /// The search button_ click.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The e.</param>
 /// <remarks></remarks>
 private void searchButton_Click(object sender, EventArgs e)
 {
     // Search selected TAG
     FindType[] finds = new FindType[0];
     if (this.searchComboBox.SelectedIndex == 0)
     {
         Control metaPanel = metaEditor1.Controls[0];
         searchPanel(metaPanel, searchTextBox.Text, ref finds);
     }
 }
Example #51
0
        internal void Initialize(string selectedText, FindReplaceDialogHelper findHelper)
        {
            if (Configuration.Settings.Tools.FindHistory.Count > 0)
            {
                textBoxFind.Visible = false;
                comboBoxFind.Visible = true;
                comboBoxFind.Text = selectedText;
                comboBoxFind.SelectAll();
                comboBoxFind.Items.Clear();
                for (int index = 0; index < Configuration.Settings.Tools.FindHistory.Count; index++)
                {
                    string s = Configuration.Settings.Tools.FindHistory[index];
                    comboBoxFind.Items.Add(s);
                }
            }
            else
            {
                comboBoxFind.Visible = false;
                textBoxFind.Visible = true;
                textBoxFind.Text = selectedText;
                textBoxFind.SelectAll();
            }

            if (findHelper != null)
            {
                FindType = findHelper.FindType;
            }
        }
Example #52
0
 protected static extern IntPtr FindNext(IntPtr pFolder, IntPtr pItem, string lpSearch, FindType eFind);
Example #53
0
        private void FindDoubleWordsToolStripMenuItemClick(object sender, EventArgs e)
        {
            var regex = new Regex(@"\b(\w+)\s+\1\b");
            _clearLastFind = true;
            if (_findHelper != null)
            {
                _clearLastFindType = _findHelper.FindType;
                _clearLastFindText = _findHelper.FindText;
            }
            _findHelper = new FindReplaceDialogHelper(FindType.RegEx, false, string.Format(_language.DoubleWordsViaRegEx, regex), regex, string.Empty, 0, 0, _subtitleListViewIndex);

            ReloadFromSourceView();
            FindNext();
        }
Example #54
0
 public Item FindFirst(string search, FindType find)
 {
     return new Item(FindFirst(ItemPtr, search, find));
 }
Example #55
0
        /// <summary>
        /// The search panel.
        /// </summary>
        /// <param name="dataControl">The data control.</param>
        /// <param name="searchValue">The search value.</param>
        /// <param name="finds">The finds.</param>
        /// <remarks></remarks>
        private void searchPanel(Control dataControl, string searchValue, ref FindType[] finds)
        {
            if (dataControl.HasChildren)
            {
                foreach (Control childControl in dataControl.Controls)
                {
                    searchPanel(childControl, searchValue, ref finds);
                    if (childControl.Name == "reflexive")
                    {
                        // childControl.
                    }

                    if (childControl.Text.Contains(searchValue))
                    {
                        MessageBox.Show(childControl.Name + " - " + childControl.Text);
                        finds = new FindType[finds.Length + 1];
                        finds[finds.Length - 1].Text = childControl.Text;
                        finds[finds.Length - 1].Location = childControl;
                    }
                }
            }
        }
Example #56
0
    private void FindByTextControls_Enter(object sender, EventArgs e)
    {
        this.AcceptButton = FindByTextButton;
        FindType = FindType.Text;

        FindByTextButton.Enabled = true;
        FindBySimilarityButton.Enabled = false;
        FindByNumbersButton.Enabled = false;
        FindByFrequencySumButton.Enabled = false;

        ResetFindBySimilarityResultTypeLabels();
        ResetFindByNumbersResultTypeLabels();
        ResetFindByFrequencyResultTypeLabels();
    }
Example #57
0
 protected static extern IntPtr GetItemByName(IntPtr pItem, string lpName, FindType eFind);
Example #58
0
 public Item GetItemByName(string name, FindType find)
 {
     return new Item(GetItemByName(ItemPtr, name, find));
 }
Example #59
0
 public Item GetItemByPath(string path, FindType find)
 {
     return new Item(GetItemByPath(ItemPtr, path, find));
 }
Example #60
0
 protected static extern IntPtr GetItemByPath(IntPtr pItem, string lpPath, FindType eFind);