示例#1
0
 /// <summary>
 /// ѕереключает форму в режим замены
 /// </summary>
 public void SwitchToReplaceMode()
 {
     if (this.searchingMode == SearchingMode.Replace)
     {
         return;
     }
     this.pReplaceWithContainer.Show();
     this.pReplaceContainer.Show();
     this.pReplaceAllContainer.Show();
     this.Height            += this.pReplaceAllContainer.Height + pReplaceWithContainer.Height + 2;
     this.tsbReplace.Checked = true;
     this.tsbFind.Checked    = false;
     this.searchingMode      = SearchingMode.Replace;
 }
示例#2
0
 /// <summary>
 /// ѕереключает форму в режим простого поиска
 /// </summary>
 public void SwitchToFindMode()
 {
     if (this.searchingMode == SearchingMode.Find)
     {
         return;
     }
     this.pReplaceWithContainer.Hide();
     this.pReplaceContainer.Hide();
     this.pReplaceAllContainer.Hide();
     this.Height            -= this.pReplaceAllContainer.Height + this.pReplaceWithContainer.Height + 2;
     this.tsbFind.Checked    = true;
     this.tsbReplace.Checked = false;
     this.searchingMode      = SearchingMode.Find;
 }
示例#3
0
 protected static bool match(SearchingMode _searchMode, String _typedString, String _string)
 {
     if (_typedString == null)
     {
         return(true);
     }
     if (_string == null)
     {
         return(false);
     }
     if (_searchMode == SearchingMode.WHOLE_STRING)
     {
         if (!_string.Equals(_typedString))
         {
             return(false);
         }
     }
     if (_searchMode == SearchingMode.SUBSTRING)
     {
         if (!_string.Contains(_typedString))
         {
             return(false);
         }
     }
     if (_searchMode == SearchingMode.REG_EXP)
     {
         Regex reg_ = new Regex(_typedString);
         if (!reg_.IsMatch(_string))
         {
             return(false);
         }
     }
     if (_searchMode == SearchingMode.META_CHARACTER)
     {
         if (!StringList.match(_string, _typedString))
         {
             return(false);
         }
     }
     return(true);
 }
示例#4
0
        public void Initial(ICollection <ColumnInfo> columns, int chosing = -1)
        {
            try
            {
                comboBox1.DataSource = new BindingSource(SearchingMode.GetModes(), null);

                var source = columns
                             .Where(f => f.Visible)
                             .ToList();
                comboBox.DataSource = new BindingSource(source, null);

                var column = columns.SingleOrDefault(f => f.Num == chosing);
                if (column != null)
                {
                    comboBox.SelectedItem = column;
                }
            }
            catch (Exception e)
            {
                _console?.AddException(e);
            }
        }
示例#5
0
        public static async Task <string> SearchingData(DateTime searchingDate, int hour, int min, SearchingMode searchingMode)  //time format hh\seperate code -,:\
        {
            try
            {
                string logData = await GetLoggerData(searchingDate);

                if (string.IsNullOrEmpty(logData))
                {
                    return(string.Empty);
                }

                switch (searchingMode)
                {
                case SearchingMode.SDAY:
                    return(logData);

                case SearchingMode.SHOUR:
                    return(string.Join("\r\n", SearchingByHour(logData, hour)));

                case SearchingMode.SHOUR_AND_MIN:
                    return(string.Join("\r\n", SearchingByHourAndMin(logData, hour, min)));
                }
            }
            catch { }
            return(string.Empty);
        }
示例#6
0
 protected static bool match(SearchingMode _searchMode, String _typedString, StringList _list)
 {
     if (_typedString == null || _typedString.isEmpty())
     {
         return(true);
     }
     if (_searchMode == SearchingMode.WHOLE_STRING)
     {
         bool contained_ = false;
         foreach (String s in _list)
         {
             if (s == null)
             {
                 continue;
             }
             if (s.Equals(_typedString))
             {
                 contained_ = true;
                 break;
             }
         }
         if (!contained_)
         {
             return(false);
         }
     }
     if (_searchMode == SearchingMode.SUBSTRING)
     {
         bool contained_ = false;
         foreach (String s in _list)
         {
             if (s == null)
             {
                 continue;
             }
             if (s.Contains(_typedString))
             {
                 contained_ = true;
                 break;
             }
         }
         if (!contained_)
         {
             return(false);
         }
     }
     if (_searchMode == SearchingMode.REG_EXP)
     {
         if (_list.filter(_typedString).isEmpty())
         {
             return(false);
         }
     }
     if (_searchMode == SearchingMode.META_CHARACTER)
     {
         if (_list.filterByMultiWords(_typedString).isEmpty())
         {
             return(false);
         }
     }
     return(true);
 }
            public EnumData(string data, int maxCount, Point3 exePoint)
            {
                if (data[0] != '@')
                {
                    throw new Exception("use @a/r/p/e[<argument=value>] for creature searching");
                }

                x = exePoint.X;
                y = exePoint.Y;
                z = exePoint.Z;

                switch (data[1])
                {
                case 'a':
                    name  = "player";
                    count = maxCount;
                    mode1 = SearchingMode1.Regular;
                    break;

                case 'r':
                    name  = "player";
                    count = 1;
                    mode1 = SearchingMode1.Random;
                    break;

                case 'p':
                    name  = "player";
                    count = 1;
                    mode1 = SearchingMode1.Nearest;
                    break;

                case 'e':
                    name  = string.Empty;
                    count = maxCount;
                    mode1 = SearchingMode1.Regular;
                    break;

                default:
                    throw new Exception("use @a/r/p/e[<argument=value>] for creature searching");
                }

                SearchingMode = SearchingMode.None;
                r             = 0;
                r2            = 0;
                dx            = -1;
                dy            = -1;
                dz            = -1;

                if (data.Length != 2)
                {
                    StringBuilder key    = new StringBuilder();
                    StringBuilder val    = new StringBuilder();
                    int           i      = 3;
                    int           length = data.Length;
                    bool          iskey  = true;
                    while (i < length)
                    {
                        switch (data[i])
                        {
                        case '=':
                            iskey = false;
                            break;

                        case ',':
                            iskey = true;
                            ReadKeyValue(key.ToString(), val.ToString());
                            key.Clear();
                            val.Clear();
                            break;

                        case ']':
                            ReadKeyValue(key.ToString(), val.ToString());
                            key.Clear();
                            val.Clear();
                            i = length;
                            break;

                        case '_':
                            if (iskey)
                            {
                                key.Append(' ');
                            }
                            else
                            {
                                val.Append(' ');
                            }
                            break;

                        default:
                            if (iskey)
                            {
                                key.Append(data[i]);
                            }
                            else
                            {
                                val.Append(data[i]);
                            }
                            break;
                        }
                        i++;
                    }

                    if (dx != -1 && dy != -1 && dz != -1)
                    {
                        SearchingMode = SearchingMode.Volume;
                    }
                    else if (r != 0)
                    {
                        SearchingMode = SearchingMode.Radius;
                        r2            = r * r;
                    }
                }
            }