internal static string GetContactRecipientIMAddress(string email, UserContext userContext, bool addSipPrefix) { if (email == null) { throw new ArgumentNullException("email"); } if (userContext == null) { throw new ArgumentNullException("userContext"); } string text = null; using (ContactsFolder contactsFolder = ContactsFolder.Bind(userContext.MailboxSession, DefaultFolderType.Contacts)) { using (FindInfo <Contact> findInfo = contactsFolder.FindByEmailAddress(email, new PropertyDefinition[0])) { if (findInfo.FindStatus == FindStatus.Found) { Contact result = findInfo.Result; result.Load(new PropertyDefinition[] { ContactSchema.IMAddress }); text = (result.TryGetProperty(ContactSchema.IMAddress) as string); } } } if (addSipPrefix && !string.IsNullOrEmpty(text) && text.IndexOf("sip:", StringComparison.OrdinalIgnoreCase) != 0) { text = "sip:" + text; } return(text); }
/// <summary> /// Constructor. /// </summary> /// <param name="ifc">Content interface object</param> /// <param name="findInfo">Find info object</param> /// <param name="sordZ">Element selector</param> public FWFindSordsCache(FWContentInterface ifc, FindInfo findInfo, SordZ sordZ) : base(ifc.Conn.Ix, findInfo) { this.ifc = ifc; this.sordZVal = new SordZ(sordZ != null ? sordZ.bset : 0L); this.sordZVal.bset |= SordC.mbMinMembers; }
/// <summary> /// Create a FindInfo object initialized by the given parameters. /// </summary> /// <param name="parentFolder">List children of this folder.</param> /// <param name="inclFolders">Include child folders.</param> /// <param name="inclDocs">Include child documents.</param> /// <returns></returns> protected static FindInfo makeFindInfo(FWFolder parentFolder, bool inclFolders, bool inclDocs) { FindInfo fi = new FindInfo(); FindChildren fc = new FindChildren(); fc.parentId = Convert.ToString(parentFolder.Id); fi.findChildren = fc; if (inclFolders && inclDocs) { // do not need to constrain } else //(inclFolders || inclDocs) { FindByType ft = new FindByType(); ft.typeStructures = inclFolders; ft.typeDocuments = inclDocs; fi.findByType = ft; } //FindOptions fo = new FindOptions(); //fo.sortOrder = SortOrderC.NONE; //fi.findOptions = fo; return(fi); }
// Helper function to find the subentries of an object private String internalFindSordIdsInParent(IXConnection ix, String parentId) { IXServicePortC CONST = ix.CONST; FindInfo findInfo = new FindInfo(); findInfo.findChildren = new EloixClient.IndexServer.FindChildren(); findInfo.findChildren.parentId = parentId; FindResult findResult = ix.Ix.findFirstSords(findInfo, 100, SordC.mbOnlyId); if (findResult.ids == null) { return(""); } if (findResult.searchId != null) { ix.Ix.findClose(findResult.searchId); } String strList = ""; for (int i = 0; i < findResult.ids.Length; i++) { if (i != 0) { strList += ","; } strList += findResult.ids[i]; } return(strList); }
public void StartsWithTest() { SetSearchString("cvc"); Assert.AreEqual(true, FindInfo.FindFirst(false)); Assert.AreEqual(true, IsCurrCellLocation(0, 1)); Assert.AreEqual(true, FindInfo.Find(false)); Assert.AreEqual(true, IsCurrCellLocation(1, 1)); Assert.AreEqual(true, FindInfo.FindFirst(false)); Assert.AreEqual(true, IsCurrCellLocation(3, 1)); Assert.AreEqual(true, FindInfo.Find(false)); Assert.AreEqual(true, IsCurrCellLocation(4, 1)); Assert.AreEqual(true, FindInfo.Find(false)); Assert.AreEqual(true, IsCurrCellLocation(5, 1)); // Looping back to the top so use FindFirst() Assert.AreEqual(true, FindInfo.FindFirst(false)); Assert.AreEqual(true, IsCurrCellLocation(0, 1)); m_findDlg.StartsWith = true; ResetStartCell(); SetSearchString("cvc"); Assert.AreEqual(true, FindInfo.FindFirst(false)); Assert.AreEqual(true, IsCurrCellLocation(0, 1)); Assert.AreEqual(true, FindInfo.Find(false)); Assert.AreEqual(true, IsCurrCellLocation(1, 1)); Assert.AreEqual(true, FindInfo.FindFirst(false)); Assert.AreEqual(true, IsCurrCellLocation(3, 1)); // Looping back to the top so use FindFirst() Assert.AreEqual(true, FindInfo.FindFirst(false)); Assert.AreEqual(true, IsCurrCellLocation(0, 1)); }
private void AddFindResult(GameObject refGo, string componentName, string refMemeberName) { FindInfo findInfo = GetFindInfoOf(refGo); if (findInfo == null) { findInfo = new FindInfo(); findInfo.target = refGo; findInfo.Component_Filds.Add(componentName, new List <string>() { refMemeberName }); mFindInfos.Add(findInfo); } else { if (findInfo.Component_Filds.ContainsKey(componentName)) { if (!findInfo.Component_Filds[componentName].Contains(refMemeberName)) { findInfo.Component_Filds[componentName].Add(refMemeberName); } } else { findInfo.Component_Filds.Add(componentName, new List <string>() { refMemeberName }); } } }
private void internalFindBooks(IXConnection ix, IXServicePortC CONST, String parentId, String author, String price) { Logger.instance().log("find author=" + author + ", price=" + price); // select names only SordZ mbName = new SordZ(); mbName.bset = SordC.mbName; // find FindInfo findInfo = internalMakeFindInfo(parentId, author, price); Sord[] sords = ix.Ix.findFirstSords(findInfo, 1000, mbName).sords; String nameList = ""; for (int i = 0; i < sords.Length; i++) { if (i != 0) { nameList += ","; } nameList += sords[i].name; } Logger.instance().log("find OK, sords=" + nameList); }
/// <summary> /// Find sords. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void bnFindSords_Click(object sender, EventArgs e) { // Prompt for short description String s = InputBox.Show("Find", "Short description:"); if (s != null && s.Length != 0) { // Prepare FindInfo object FindInfo findInfo = new FindInfo(); findInfo.findByIndex = new FindByIndex(); findInfo.findByIndex.name = s; this.Cursor = Cursors.WaitCursor; try { // Find FWFindSordsCache <FWSord> findCache = conn.Content.FindSords(findInfo); // Before retrieving any results, set the Sord members to be read from the archive findCache.SordZ.bset |= SordC.mbRefPaths | SordC.mbDocVersionMembers; // Show result in list box FormSordList.ShowList(conn, findCache); } finally { this.Cursor = Cursors.Default; } } }
/// ------------------------------------------------------------------------------------ protected bool OnGroupBySortedField(object args) { if (!m_activeView) { return(false); } if (WordListGrid.IsGroupedByField) { WordListGrid.GroupByField = null; } else if (WordListGrid.SortOptions.SortFields != null && WordListGrid.SortOptions.SortFields.Count > 0) { WordListGrid.GroupByField = WordListGrid.SortOptions.SortFields[0].Field; if (Properties.Settings.Default.CollapseWordListsOnGrouping) { WordListGrid.ToggleGroupExpansion(false); } } if (!WordListGrid.CurrentCell.Displayed && WordListGrid.CurrentCell != null) { WordListGrid.ScrollRowToMiddleOfGrid(WordListGrid.CurrentCell.RowIndex); } FindInfo.ResetStartSearchCell(true); FindInfo.CanFindAgain = true; return(true); }
public void FindWholeWordWithDiacriticInData() { Initialize("foghorn aeo\u032Fu leghorn", "cvv vvc cvc", "one two three"); m_findDlg.MatchEntireWord = true; SetSearchString("u"); Assert.IsFalse(FindInfo.FindFirst(false)); // Forward find }
public void FindMissingTest() { SetSearchString("ebaywantsyou"); Assert.AreEqual(false, FindInfo.FindFirst(false)); // Forward find ResetStartCell(); Assert.AreEqual(false, FindInfo.FindFirst(true)); // Reverse find }
public static List <Sord> FindChildren(String objId, IXConnection ixConn, bool references) { Console.WriteLine("FindChildren: objId " + objId, " ixConn " + ixConn); try { ixConn.Ix.checkoutSord(objId, SordC.mbAll, LockC.NO); } catch (Exception) { return(new List <Sord>()); } List <Sord> children = new List <Sord>(); FindInfo findInfo = new FindInfo(); FindChildren findChildren = new FindChildren(); FindByType findByType = new FindByType(); FindByIndex findByIndex = new FindByIndex(); Boolean includeReferences = references; SordZ sordZ = SordC.mbAll; Boolean recursive = true; int level = 3; ObjKey[] objKeys = new ObjKey[] { }; findChildren.parentId = objId; findChildren.mainParent = !includeReferences; findChildren.endLevel = (recursive) ? level : 1; findInfo.findChildren = findChildren; findInfo.findByIndex = findByIndex; FindResult findResult = new FindResult(); try { int idx = 0; findResult = ixConn.Ix.findFirstSords(findInfo, 1000, sordZ); while (true) { for (int i = 0; i < findResult.sords.Length; i++) { children.Add(findResult.sords[i]); } if (!findResult.moreResults) { break; } idx += findResult.sords.Length; findResult = ixConn.Ix.findNextSords(findResult.searchId, idx, 1000, sordZ); } } finally { if (findResult != null) { ixConn.Ix.findClose(findResult.searchId); } } return(children); }
private void FindPathCallback(object obj) { // Debug.Log("Star find path"); FindInfo info = (FindInfo)obj; bool found = FindPath(info.StartPosition, info.EndPosition); info.DoneCallback?.Invoke(this, found); // Debug.Log("find path complete"); }
public void FindPrevPrevTest() { SetSearchString("drillbit"); Assert.AreEqual(true, FindInfo.FindFirst(true)); Assert.AreEqual(true, IsCurrCellLocation(4, 2)); Assert.AreEqual(true, FindInfo.Find(true)); Assert.AreEqual(true, IsCurrCellLocation(4, 0)); }
public void FindBackForTest() { SetSearchString("ebay"); Assert.AreEqual(true, FindInfo.FindFirst(true)); // Forward find Assert.AreEqual(true, IsCurrCellLocation(2, 2)); // finds "glebay" SetSearchString("glbitter"); Assert.AreEqual(true, FindInfo.FindFirst(false)); // Reverse find Assert.AreEqual(true, IsCurrCellLocation(3, 2)); }
public void FindForLastColBackTest() { SetSearchString("glbitter"); Assert.IsTrue(FindInfo.FindFirst(false), "Did not find first forward"); // Forward find Assert.IsTrue(IsCurrCellLocation(1, 2), "Curr. Cell Location is not 1,3"); Assert.IsTrue(FindInfo.Find(false), "Did not find next forward"); // Forward find Assert.IsTrue(IsCurrCellLocation(3, 2), "Curr. Cell Location is not 3,3"); Assert.IsTrue(FindInfo.Find(true), "Did not find backward"); // Backward find Assert.IsTrue(IsCurrCellLocation(1, 2), "Curr. Cell Location is not 1,3"); }
public void FindBackBackForTest() { SetSearchString("glebay"); Assert.AreEqual(true, FindInfo.FindFirst(true)); Assert.AreEqual(true, IsCurrCellLocation(2, 2)); // glebay Assert.AreEqual(true, FindInfo.Find(true)); Assert.AreEqual(true, IsCurrCellLocation(2, 2)); // glebay Assert.AreEqual(true, FindInfo.Find(false)); Assert.AreEqual(true, IsCurrCellLocation(2, 2)); // glebay }
public void FindBackFirstColForTest() { m_findDlg.StartsWith = true; SetSearchString("bit"); Assert.AreEqual(true, FindInfo.FindFirst(true)); Assert.AreEqual(true, IsCurrCellLocation(3, 0)); // bitter Assert.AreEqual(true, FindInfo.Find(true)); Assert.AreEqual(true, IsCurrCellLocation(1, 0)); // bit Assert.AreEqual(true, FindInfo.Find(false)); Assert.AreEqual(true, IsCurrCellLocation(3, 0)); // bitter }
private void Form1_Load(object sender, EventArgs e) { FindInfo findInfo = XMLWorker.Read(); if (findInfo != null) { start_directory.Text = findInfo.FilePath; template_text.Text = findInfo.Template_text; template_name.Text = findInfo.Template_name; } btnStop.Enabled = false; }
private FindInfo GetFindInfoOf(GameObject refGo) { FindInfo findInfo = null; foreach (FindInfo fi in mFindInfos) { if (fi.target == refGo) { findInfo = fi; } } return(findInfo); }
public FindControl(FindInfo findInfo, Configurator configurator, Dispatcher dispatcher) { Configurator = configurator; Dispatcher = dispatcher; InitializeComponent(); findInfo = findInfo ?? new FindInfo(); TextComboBox.Text = findInfo.Pattern; CaseSensitiveCheckBox.Checked = findInfo.CaseSensitive; WholeWordCheckbox.Checked = findInfo.WholeWord; RegexCheckBox.Checked = findInfo.UseRegex; }
public void run() { IXConnFactory connFact = null; IXConnection ix = null; try { IXProperties connProps = IXConnFactory.CreateConnProperties(url); IXProperties sessOpts = IXConnFactory.CreateSessionOptions("IX-Examples", "1.0"); connFact = new IXConnFactory(connProps, sessOpts); Logger.instance().log("create IXConnFactory OK"); // LOGIN Logger.instance().log("login..."); ix = connFact.Create(userName, userPwd, "myComputer", null); // ci = ix.Login.ci Logger.instance().log("login OK"); FindInfo findInfo = new FindInfo(); findInfo.findDirect = new FindDirect(); findInfo.findDirect.query = "buch sord.type:[254 TO 255]"; findInfo.findDirect.searchInFulltext = true; findInfo.findDirect.searchInIndex = true; findInfo.findDirect.searchInMemo = true; findInfo.findDirect.searchInSordName = true; FindResult findResult = ix.Ix.findFirstSords(findInfo, 100, SordC.mbAll); for (int i = 0; i < findResult.sords.Length; i++) { Logger.instance().log(findResult.sords[i].name + "," + findResult.sords[i].type); } ix.Ix.findClose(findResult.searchId); } catch (Exception e) { throw e; } finally { // Logout // -- if (ix != null) { Logger.instance().log("IX logout..."); ix.Logout(); Logger.instance().log("IX logout OK"); } } }
public void RegularExpressionTest() { m_findDlg.MatchCase = true; m_findDlg.StartsWith = true; SetSearchString("GL"); Assert.AreEqual(true, FindInfo.FindFirst(false)); Assert.AreEqual(true, IsCurrCellLocation(0, 2)); ResetStartCell(); m_findDlg.IsRegularExpression = true; SetSearchString("(?-i)^GL.*$"); Assert.AreEqual(true, FindInfo.FindFirst(false)); Assert.AreEqual(true, IsCurrCellLocation(0, 2)); }
public void MatchCaseTest() { SetSearchString("glfib"); m_findDlg.MatchCase = false; Assert.IsTrue(FindInfo.Find(false)); Assert.IsTrue(IsCurrCellLocation(0, 2)); m_findDlg.MatchCase = true; SetSearchString("glfib"); Assert.IsFalse(FindInfo.FindFirst(false)); SetSearchString("GLFIB"); Assert.IsTrue(FindInfo.Find(false)); Assert.IsTrue(IsCurrCellLocation(0, 2)); }
public static List<FindInfo> FindTagPeople(string text, string tagname) { if (!tagname.HasValue()) throw new UserInputException("No Tag"); var csv = new CsvReader(new StringReader(text), true, '\t'); if (!csv.Any()) throw new UserInputException("No Data"); var cols = csv.GetFieldHeaders(); if (!cols.Contains("First") || !cols.Contains("Last")) throw new UserInputException("Both First and Last are required"); if (!cols.Any(name => new[] { "Birthday", "Email", "Phone", "Phone2", "Phone3" }.Contains(name))) throw new UserInputException("One of Birthday, Email, Phone, Phone2 or Phone3 is required"); var list = new List<FindInfo>(); while (csv.ReadNextRecord()) { var row = new FindInfo { First = FindColumn(csv, "First"), Last = FindColumn(csv, "Last"), Birthday = FindColumnDate(csv, "Birthday"), Email = FindColumn(csv, "Email"), Phone = FindColumnDigits(csv, "Phone"), Phone2 = FindColumnDigits(csv, "Phone2"), Phone3 = FindColumnDigits(csv, "Phone3") }; var pids = DbUtil.Db.FindPerson3(row.First, row.Last, row.Birthday, row.Email, row.Phone, row.Phone2, row.Phone3).ToList(); row.Found = pids.Count; if(pids.Count == 1) row.PeopleId = pids[0].PeopleId; list.Add(row); } var q = from pi in list where pi.PeopleId.HasValue select pi.PeopleId; foreach (var pid in q.Distinct()) Person.Tag(DbUtil.Db, pid ?? 0, tagname, Util.UserPeopleId, DbUtil.TagTypeId_Personal); DbUtil.Db.SubmitChanges(); return list; }
private FindInfo internalMakeFindInfo(String parentId, String author, String price) { FindInfo findInfo = new FindInfo(); // constrain results to children of s1 findInfo.findChildren = new EloixClient.IndexServer.FindChildren(); findInfo.findChildren.parentId = parentId; findInfo.findByIndex = new FindByIndex(); ObjKey okeyAuthor = null; if (author.Length != 0) { okeyAuthor = new ObjKey(); okeyAuthor.name = "AUTHOR"; okeyAuthor.data = new String[] { author }; } ObjKey okeyPrice = null; if (price.Length != 0) { okeyPrice = new ObjKey(); okeyPrice.name = "PRICE"; okeyPrice.data = new String[] { price }; } int n = ((okeyAuthor != null) ? 1 : 0) + ((okeyPrice != null) ? 1 : 0); findInfo.findByIndex.objKeys = new ObjKey[n]; int i = 0; if (okeyAuthor != null) { findInfo.findByIndex.objKeys[i++] = okeyAuthor; } if (okeyPrice != null) { findInfo.findByIndex.objKeys[i++] = okeyPrice; } return(findInfo); }
static bool isItemExist(string folder, string actFolder, bool isFile) { bool result = false; FindInfo fi = new FindInfo(); fi.findChildren = new FindChildren(); fi.findChildren.parentId = actFolder; fi.findChildren.endLevel = 0; FindResult fr = conn.Ix.findFirstSords(fi, findMax, SordC.mbMin); foreach (Sord sord in fr.sords) { if (!isFile && sord.name == folder && sord.type < SordC.LBT_DOCUMENT && 0 < sord.type) result = true; if (isFile && sord.name == folder && sord.type < SordC.LBT_DOCUMENT_MAX && SordC.LBT_DOCUMENT < sord.type) result = true; } return result; }
private void internalFindEmailsFromTo(IXConnection ix, IXServicePortC CONST, String parentId, String from, String to) { Logger.instance().log("find from=" + from + ", to=" + to + "..."); // select names only SordZ mbName = new SordZ(); mbName.bset = SordC.mbName; // find FindInfo findInfo = internalMakeFindInfo(parentId, from, to); Sord[] sords = ix.Ix.findFirstSords(findInfo, 1000, mbName).sords; String nameList = ""; for (int i = 0; i < sords.Length; i++) { if (i != 0) nameList += ","; nameList += sords[i].name; } Logger.instance().log("find OK, sords=" + nameList); }
public static FindInfo Read() { try { FindInfo info = new FindInfo(); XmlDocument doc = new XmlDocument(); doc.Load("Findinfo.xml"); XmlElement root = doc.DocumentElement; XmlNode fileinfo = root["fileinfo"]; info.FilePath = fileinfo["path"].InnerText; info.Template_name = fileinfo["template_name"].InnerText; info.Template_text = fileinfo["template_text"].InnerText; return(info); } catch (Exception) { //Значит файл не создан, ничего страшного, при запуске создастся return(null); } }
//========================================================================= //ShowResult //========================================================================= private void ShowFindResult() { if (mFindInfos.Count <= 0) { GUILayout.Label("未能找到有引用该对象的组件"); return; } mScrollVec = EditorGUILayout.BeginScrollView(mScrollVec); for (int i = 0; i < mFindInfos.Count; i++) { FindInfo fi = mFindInfos[i]; fi.isFadeOut = EditorGUILayout.Foldout(fi.isFadeOut, "引用" + (i + 1)); if (fi.isFadeOut) { //EditorGUILayout.TextField("引用对象层级:"+NGUITools.GetHierarchy(fi.target)); GUILayout.BeginHorizontal(); GUILayout.Label("引用结点:"); EditorGUILayout.ObjectField(fi.target, typeof(MonoBehaviour), true, GUILayout.Width(250)); GUILayout.EndHorizontal(); foreach (KeyValuePair <string, List <string> > kv in fi.Component_Filds) { foreach (string v in kv.Value) { GUILayout.BeginHorizontal(); GUILayout.Label("引用字段:"); GUILayout.Label(kv.Key + " / " + v, GUILayout.Width(250)); GUILayout.EndHorizontal(); } } } GUILayout.Space(10); } EditorGUILayout.EndScrollView(); }
// Token: 0x06002C60 RID: 11360 RVA: 0x000F7198 File Offset: 0x000F5398 private Stream GetContactPictureStream(OwaStoreObjectId storeId, string attId, string email, out string contentType) { contentType = string.Empty; if (storeId != null) { using (Item item = Utilities.GetItem <Item>(base.UserContext, storeId, new PropertyDefinition[0])) { return(this.GetContactPictureStream(item, attId, out contentType)); } } using (ContactsFolder contactsFolder = ContactsFolder.Bind(base.UserContext.MailboxSession, DefaultFolderType.Contacts)) { using (FindInfo <Contact> findInfo = contactsFolder.FindByEmailAddress(email, new PropertyDefinition[0])) { if (findInfo.FindStatus == FindStatus.Found) { return(this.GetContactPictureStream(findInfo.Result, attId, out contentType)); } } } return(new MemoryStream()); }
private FindInfo internalMakeFindInfo(String parentId, String from, String to) { FindInfo findInfo = new FindInfo(); // constrain results to children of s1 findInfo.findChildren = new EloixClient.IndexServer.FindChildren(); findInfo.findChildren.parentId = parentId; findInfo.findByIndex = new FindByIndex(); findInfo.findByIndex.objKeys = new ObjKey[2]; findInfo.findByIndex.objKeys[0] = new ObjKey(); findInfo.findByIndex.objKeys[0].name = "ELOOUTL1"; findInfo.findByIndex.objKeys[0].data = new String[] {from}; findInfo.findByIndex.objKeys[1] = new ObjKey(); findInfo.findByIndex.objKeys[1].name = "ELOOUTL2"; findInfo.findByIndex.objKeys[1].data = new String[] {to}; return findInfo; }
public ActionResult FindTagPeople(string text, string tagname) { if (!tagname.HasValue()) return Content("no tag"); var csv = new CsvReader(new StringReader(text), false, '\t').ToList(); if (!csv.Any()) return Content("no data"); var line0 = csv.First().ToList(); var names = line0.ToDictionary(i => i.TrimEnd(), i => line0.FindIndex(s => s == i)); var ActiveNames = new List<string> { "First", "Last", "Birthday", "Email", "CellPhone", "HomePhone", }; var hasvalidcolumn = false; foreach (var name in names.Keys) if (ActiveNames.Contains(name)) { hasvalidcolumn = true; break; } if (!hasvalidcolumn) return Content("no valid column"); var list = new List<FindInfo>(); foreach (var a in csv.Skip(1)) { var row = new FindInfo(); row.First = FindColumn(names, a, "First"); row.Last = FindColumn(names, a, "Last"); row.Birthday = FindColumnDate(names, a, "Birthday"); row.Email = FindColumn(names, a, "Email"); row.CellPhone = FindColumnDigits(names, a, "CellPhone"); row.HomePhone = FindColumnDigits(names, a, "HomePhone"); var pids = DbUtil.Db.FindPerson3(row.First, row.Last, row.Birthday, row.Email, row.CellPhone, row.HomePhone, null); row.Found = pids.Count(); if (row.Found == 1) row.PeopleId = pids.Single().PeopleId.Value; list.Add(row); } var q = from pi in list where pi.PeopleId.HasValue select pi.PeopleId; foreach (var pid in q.Distinct()) Person.Tag(DbUtil.Db, pid.Value, tagname, Util.UserPeopleId, DbUtil.TagTypeId_Personal); DbUtil.Db.SubmitChanges(); return View(list); }