// Begin first scan private void ScanFirst(ISearchType type, ISearchMethod method, ulong start, ulong stop, object[] param) { Invoke((MethodInvoker) delegate { this.BtBeginScan.Enabled = false; this.BtStopScan.Text = "Stop"; this.BtStopScan.Enabled = true; this.ResultBox.List = new NetCheatX.Core.Containers.SearchResultContainer <ISearchResult>(); }); this.ResultBox.ScanFirst(type, method, new Types.MemoryRange[] { new Types.MemoryRange() { start = start, stop = stop } }, param, (p, v, m, t) => { if (method == p) { try { Invoke((MethodInvoker) delegate { this.PbScanProgress.LeftText = t; this.PbScanProgress.Maximum = 100; this.PbScanProgress.Value = (int)(100f * ((float)v / (float)m)); }); } catch (Exception e) { } } }); Invoke((MethodInvoker) delegate { this.BtBeginScan.Text = "Next Scan"; this.BtBeginScan.Enabled = true; this.BtStopScan.Text = "New Scan"; }); this._scanState = Types.SearchMode.Next; }
private void UpdateSearchMethods(ISearchType type) { CBItem oldItem = CbScanMethod.SelectedIndex < 0 ? null : (CBItem)CbScanMethod.SelectedItem; CBItem item; CbScanMethod.BeginUpdate(); CbScanMethod.SuspendLayout(); CbScanMethod.Items.Clear(); for (int x = 0; x < _host.SearchMethods.Count; x++) { if (_host.SearchMethods[x].SupportSearchType(type) && (_host.SearchMethods[x].Mode == Types.SearchMode.Both || (_host.SearchMethods[x].Mode == Types.SearchMode.First && _isFirstScan) || (_host.SearchMethods[x].Mode == Types.SearchMode.Next && !_isFirstScan))) { item = new CBItem(_host.SearchMethods[x]); CbScanMethod.Items.Add(item); if (!_cbScanMethodToolTips.Keys.Contains(_host.SearchMethods[x])) { _cbScanMethodToolTips.Add(_host.SearchMethods[x], item.ToTooltip()); } if (oldItem != null && oldItem.Plugin == item.Plugin) { CbScanMethod.SelectedIndex = CbScanMethod.Items.Count - 1; } } } CbScanMethod.ResumeLayout(true); CbScanMethod.EndUpdate(); }
public bool sameType(ISearchType st) { if (st is SearchGroups) { return(true); } return(false); }
public void TestNumberSearch() { SearchCriteria sc = new SearchCriteria(); sc.SearchType = enmSearchTypes.NumberSearch; sc.IDNumber = 123456; ISearchFactory numberFactory = SearchFactory.GetFactory(sc.SearchType); ISearchType searchType = numberFactory.CreateSearchType(sc); List <ISearchResult> result = searchType.Search(); }
public void TestNameSearch() { SearchCriteria sc = new SearchCriteria(); sc.SearchType = enmSearchTypes.NameSearch; sc.Name = "TextName"; ISearchFactory nameFactory = SearchFactory.GetFactory(sc.SearchType); ISearchType searchType = nameFactory.CreateSearchType(sc); List <ISearchResult> result = searchType.Search(); }
public void ScanFirst(ISearchType type, ISearchMethod method, Types.MemoryRange[] ranges, object[] args, Types.SetProgressCallback setProgress) { if (_list == null) { throw new Exception("Results list is null on start of initial scan."); } PopulateColumns(); method.FirstScan(ref _list, type, args, ranges, setProgress); this._stopWatch.Stop(); Invoke((MethodInvoker) delegate { this.VirtualListSize = _list.Count; }); }
private IEnumerable <UserRecord> ProcessSearch(ISearchType search) { switch (search.SearchType) { case nameof(UserRecord.SearchOptions.None): { return(db.UserRecords.OrderBy(u => u.HDBUserName).ToList()); } case nameof(UserRecord.SearchOptions.Email): { int value = (search as UserRecordsSearch <int>).Value; var items = db.UserRecords.Where(c => c.PreferredEmailId == value).OrderBy(r => r.HDBUserName); return(items.ToList()); } case nameof(UserRecord.SearchOptions.PayPalEmail): { int value = (search as UserRecordsSearch <int>).Value; var items = db.UserRecords.Where(c => c.PayPalEmailId == value).OrderBy(r => r.HDBUserName); return(items.ToList()); } case nameof(UserRecord.SearchOptions.PhoneNumber): { string value = (search as UserRecordsSearch <string>).Value; var items = db.UserRecords.Where(c => c.PhoneNumber.Contains(value)).OrderBy(r => r.HDBUserName); return(items.ToList()); } case nameof(UserRecord.SearchOptions.Name): { string value = (search as UserRecordsSearch <string>).Value.ToUpper(); var items = db.UserRecords.Where(c => c.FirstName.ToUpper().Contains(value) || c.LastName.ToUpper().Contains(value)).OrderBy(r => r.HDBUserName); return(items.ToList()); } } return(null); }
public bool SupportSearchType(ISearchType sType) { // Not Equal To should support all search types return(true); }
public void NextScan(ref NetCheatX.Core.Containers.SearchResultContainer <ISearchResult> result, ISearchType searchType, object[] args, Types.SetProgressCallback setProgress) { if (_host == null || result == null || result.Count == 0) { return; } // Grab parameters byte[] param0 = (byte[])args[0]; bool sign = (bool)args[1]; // Perform scan Search.NextScan(_host, this, setProgress, result, Search.SearchType.GreaterThanOrEqualTo, sign, param0); }
public bool SupportSearchType(ISearchType sType) { // Greater Than Or Equal To should support all search types return(true); }
public bool SupportSearchType(ISearchType sType) { // Less Than should support all search types return(true); }
public void FirstScan(ref NetCheatX.Core.Containers.SearchResultContainer <ISearchResult> result, ISearchType searchType, object[] args, Types.MemoryRange[] range, Types.SetProgressCallback setProgress) { if (result == null) { result = new NetCheatX.Core.Containers.SearchResultContainer <ISearchResult>(); } if (_host == null) { return; } // Grab parameters byte[] param0 = (byte[])args[0]; // Loop through each range and scan foreach (Types.MemoryRange r in range) { Search.FirstScan(_host, this, setProgress, r, result, Search.SearchType.GreaterThanOrEqualTo, searchType.Signed, searchType.Alignment, param0); } }
// Populate parameters panel with the required UserControls private void UpdateParameters(ISearchMethod method, ISearchType type) { UserControl ctrl; MetroFramework.Controls.MetroLabel label; Point initPoint = new Point(12, 4); SplitContainer2.Panel2.SuspendLayout(); SplitContainer2.Panel2.Enabled = false; SplitContainer2.Panel2.Controls.Clear(); if (method.Params != null) { foreach (Types.SearchParam param in method.Params) { // Get the UserControl if (param.process) { ctrl = GetTypeEditor(param.name, type.ParamType); } else { ctrl = GetTypeEditor(param.name, param.type); } if (ctrl == null) { MessageBox.Show("Failed to create UserControl type editor for parameter " + param.name + " of type " + (param.process ? type.ParamType : param.type)); continue; } label = new MetroFramework.Controls.MetroLabel() { Theme = MetroFramework.MetroThemeStyle.Light, UseCustomBackColor = true, BackColor = Color.Transparent, Text = param.name, Location = new Point(initPoint.X, initPoint.Y), Tag = ctrl }; label.Top += (ctrl.Height - label.Height) / 2; MetroToolTip1.SetToolTip(label, param.description); ctrl.Name = param.name; ctrl.Location = new Point(initPoint.X + label.Width + 5, initPoint.Y); ctrl.Width = SplitContainer2.Panel2.Width - ctrl.Left - 4; initPoint.Y += ctrl.Height + 6; SplitContainer2.Panel2.Controls.Add(label); SplitContainer2.Panel2.Controls.Add(ctrl); } } // Adjust controls SplitContainer1.SplitterDistance = 110 + initPoint.Y + 5; SplitContainer2.SplitterDistance = 110; SplitContainer2.Panel2.Enabled = true; SplitContainer2.Panel2.ResumeLayout(true); }
// Get all search arguments private GetScanArgsResult GetScanArgs(out ISearchType type, out ISearchMethod method, out ulong start, out ulong stop, out object[] param) { Types.SearchParam sParam; ITypeEditor editor; int i; type = null; method = null; start = 0; stop = 0; param = null; // Check we have Scan Type and Method selected if (CbScanDataType.SelectedIndex < 0) { return(GetScanArgsResult.NO_SCAN_TYPE); } if (CbScanMethod.SelectedIndex < 0) { return(GetScanArgsResult.NO_SCAN_METHOD); } // Try to get variables try { type = (ISearchType)(CbScanDataType.SelectedItem as CBItem).Plugin; method = (ISearchMethod)(CbScanMethod.SelectedItem as CBItem).Plugin; start = Convert.ToUInt64(TbStartAddress.Text, 16); stop = Convert.ToUInt64(TbStopAddress.Text, 16); } catch { return(GetScanArgsResult.INVALID_ADDRESS_RANGE); } if (start >= stop) { return(GetScanArgsResult.INVALID_ADDRESS_RANGE); } param = new object[method.Params.Length]; // Try to get search params from Type Editor controls i = 0; foreach (Control ctrl in SplitContainer2.Panel2.Controls) { if (!(ctrl is MetroFramework.Controls.MetroLabel) && ctrl.Name != null && ctrl.Name != "") { sParam = method.Params.Where(x => x.name == ctrl.Name).FirstOrDefault(); if (sParam.process) // Convert to byte array { editor = _host.TypeEditors.Where(x => x.EditorType == ((ISearchType)(CbScanDataType.SelectedItem as CBItem).Plugin).ParamType).FirstOrDefault(); if (!editor.ProcessParam((UserControl)ctrl, out var ba)) { return(GetScanArgsResult.INVALID_PARAMETER); } param[i++] = ba; } else { editor = _host.TypeEditors.Where(x => x.EditorType == sParam.type).FirstOrDefault(); editor.GetUnprocessedParam((UserControl)ctrl, out object obj); param[i++] = obj; } } } return(GetScanArgsResult.SUCCESS); }
private IEnumerable <Cart> ProcessSearch(ISearchType cartSearch) { switch (cartSearch.SearchType) { case nameof(Cart.SearchOptions.None): { var logs = db.LogRecords.Where(l => l.RecordType == Utilities.RecordType.New && l.Guid == typeof(Cart).GUID).OrderByDescending(l => l.DateTime).Take(15); var list = logs.Select(l => db.Carts.FirstOrDefault(c => c.Id == l.RecordId)); return(list.ToList()); } case nameof(Cart.SearchOptions.BuyerEmail): { int value = (cartSearch as CartSearch <int>).Value; var carts = db.Carts.Where(c => c.BuyerEmailId == value).OrderByDescending(r => r.Id); return(carts.ToList()); } case nameof(Cart.SearchOptions.BuyerUsername): { int value = (cartSearch as CartSearch <int>).Value; var carts = db.Carts.Where(c => c.BuyerId == value).OrderByDescending(r => r.Id); return(carts.ToList()); } case nameof(Cart.SearchOptions.SellerUsername): { int value = (cartSearch as CartSearch <int>).Value; var carts = db.Carts.Where(c => c.Transactions.Any(t => t.SellerId == value)).OrderByDescending(r => r.Id); return(carts.ToList()); } case nameof(Cart.SearchOptions.Date): { DateTime d1 = (cartSearch as CartSearch <DateTime>).Value; DateTime d2 = (cartSearch as CartSearch <DateTime>).Value; var carts = db.Carts.Where(c => d1 <= c.SaleDate && c.SaleDate <= d2).OrderByDescending(r => r.Id); return(carts.ToList()); } case nameof(Cart.SearchOptions.BuyerName): { string name = (cartSearch as CartSearch <string>).Value.ToUpper(); var carts = db.Carts.Where(c => c.Buyer.FirstName.ToUpper().Contains(name) || c.Buyer.LastName.ToUpper().Contains(name)).OrderByDescending(r => r.Id); return(carts.ToList()); } case nameof(Cart.SearchOptions.CartNumber): { string value = (cartSearch as CartSearch <string>).Value.ToUpper(); var carts = db.Carts.Where(c => c.CartNumber.ToString().Contains(value)).OrderByDescending(r => r.Id); return(carts.ToList()); } case nameof(Cart.SearchOptions.SellerName): { string name = (cartSearch as CartSearch <string>).Value.ToUpper(); var carts = db.Carts.Where(c => c.Transactions.Any(t => t.Seller.FirstName.ToUpper().Contains(name) || t.Seller.LastName.ToUpper().Contains(name))).OrderByDescending(r => r.Id); return(carts.ToList()); } } return(null); }
public void NextScan(ref NetCheatX.Core.Containers.SearchResultContainer <ISearchResult> result, ISearchType searchType, object[] args, Types.SetProgressCallback setProgress) { if (_host == null || result == null || result.Count == 0) { return; } // Grab parameters byte[] param0 = (byte[])args[0]; byte[] param1 = (byte[])args[1]; // Perform scan Search.NextScan(_host, this, setProgress, result, Search.SearchType.ValueBetween, searchType.Signed, param0, param1); }
public bool SupportSearchType(ISearchType sType) { // Value Between should support all search types return(true); }