public static void ListBoxKeyEventSearch(object sender, KeyEventArgs e, ref Timer listTimer, ref string searchString, bool suppress = true)
        {
            e.Handled = true;

            e.SuppressKeyPress = suppress;

            ListBox lbox = (ListBox)sender;

            if (((Keys.D9 < e.KeyCode) && (e.KeyCode < Keys.LWin)) || (e.KeyCode == Keys.OemMinus) || (e.KeyCode == Keys.Oemplus))
            {
                if (listTimer.Enabled)
                {
                    listTimer.Enabled = false;
                }

                if ((e.KeyCode == Keys.OemMinus) && (e.Shift == true))
                {
                    searchString += "_";
                }

                else if ((e.KeyCode == Keys.OemMinus) && (e.Shift == false))
                {
                    searchString += "-";
                }

                else if ((e.KeyCode == Keys.Oemplus) && (e.Shift == true))
                {
                    searchString += "*";
                }

                else if ((e.KeyCode == Keys.Oemplus) && (e.Shift == false))
                {
                    searchString += "+";
                }

                else
                {
                    searchString += e.KeyCode.ToString();
                }

                int currow = lbox.FindString(searchString, 0);

                lbox.SelectedIndex = currow;

                GlobalControlHandler.StartTimer(listTimer);
            }

            else
            {
                ListBoxKeyEvent(sender, e);
            }
        }
Beispiel #2
0
        private void ListBox_KeyEvents(object sender, KeyEventArgs e)
        {
            if ((e.KeyCode == Keys.Enter) || (e.KeyCode == Keys.Return))
            {
                if (((ListBox)sender).Name == "lbClasses")
                {
                    UpdateFilter(this.lbClasses, SPECIAL_OP.Equals);
                }

                else
                {
                    UpdateFilter(this.lbAttribs, SPECIAL_OP.Equals);
                }
            }

            else
            {
                GlobalControlHandler.ListBoxKeyEventSearch(sender, e, ref this.ListTimer, ref this.ListQuery);
            }
        }
Beispiel #3
0
 private void tvLdap_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
 {
     GlobalControlHandler.TreeNodeMouseClickSelect(sender, e);
 }
Beispiel #4
0
        private void WalkSubs(TreeNode parentNode)
        {
            GlobalControlHandler.UpdateLabel(this.lbProcess, "walking children");

            this.Cursor = Cursors.WaitCursor;

            bool isbad;
            DirectoryAttribute dat;

            string[] attribs = new string[] { "ou", "cn", "distinguishedName", "objectClass", "objectGUID", "lastKnownParent", "msDS-LastKnownRDN", "isDeleted", "isRecycled" };

            List <SearchResultEntry> result = ThisForestInfo.Query(DC,
                                                                   parentNode.Name,
                                                                   "(objectClass=*)",
                                                                   attribs,
                                                                   SearchScope.OneLevel,
                                                                   ReferralChasingOptions.None,
                                                                   QueryCtrl,
                                                                   returnResults: true);

            if (ThisForestInfo.HasError)
            {
                GlobalControlHandler.UpdateLabel(this.lbProcess, "Failed: walking children: " + ThisForestInfo.ErrorMSG);
            }

            else
            {
                GlobalControlHandler.UpdateLabel(this.lbProcess, "Found " + result.Count);


                long cnt  = 0;
                long step = 100;

                bool storedecodeguid = MainBase.UserSettings.DecodeGUID;

                MainBase.UserSettings.DecodeGUID = true;

                foreach (SearchResultEntry res in result)
                {
                    ADObjectInfo oinfo = new ADObjectInfo();

                    cnt++;

                    if (cnt == step)
                    {
                        GlobalControlHandler.UpdateLabel(this.lbProcess, String.Format("Found {0} (walked {1})", result.Count, cnt));

                        step += 100;
                    }

                    string nodename     = String.Empty;
                    string nodepath     = String.Empty;
                    string objectclass  = OBJECT_TYPES.DEFAULT.ToString();
                    int    successcount = 0;

                    if (res.Attributes.Contains("ou"))
                    {
                        dat = res.Attributes["ou"];

                        oinfo.Name = ThisForestInfo.DecodeStringData(dat, ActiveDirectorySyntax.CaseIgnoreString, out isbad, true)[0];

                        successcount = 1;
                    }

                    else if (res.Attributes.Contains("cn"))
                    {
                        dat = res.Attributes["cn"];

                        oinfo.Name = ThisForestInfo.DecodeStringData(dat, ActiveDirectorySyntax.CaseIgnoreString, out isbad, true)[0];

                        successcount = 1;
                    }

                    if (res.Attributes.Contains("distinguishedName"))
                    {
                        dat = res.Attributes["distinguishedName"];

                        oinfo.Path = ThisForestInfo.DecodeStringData(dat, ActiveDirectorySyntax.DN, out isbad, true)[0];

                        if (nodename.Length == 0)
                        {
                            nodename = nodepath;
                        }

                        successcount++;
                    }

                    if (res.Attributes.Contains("objectClass"))
                    {
                        dat = res.Attributes["objectClass"];

                        List <string> ocl = ThisForestInfo.DecodeStringData(dat, ActiveDirectorySyntax.DirectoryString, out isbad, true);

                        oinfo.ObjectClass = ocl[ocl.Count - 1];
                    }

                    if (res.Attributes.Contains("objectGuid"))
                    {
                        dat = res.Attributes["objectGuid"];

                        List <string> guidl = ThisForestInfo.DecodeByteData(dat, ActiveDirectorySyntax.OctetString, out isbad, false, true);

                        oinfo.ObjectGuid = guidl[0];
                    }

                    if (res.Attributes.Contains("lastKnownParent"))
                    {
                        dat = res.Attributes["lastKnownParent"];

                        oinfo.LastKnownParent = ThisForestInfo.DecodeStringData(dat, ActiveDirectorySyntax.DN, out isbad, true)[0];
                    }

                    if (res.Attributes.Contains("msDS-LastKnownRDN"))
                    {
                        dat = res.Attributes["msDS-LastKnownRDN"];

                        oinfo.LastKnownRDN = ThisForestInfo.DecodeStringData(dat, ActiveDirectorySyntax.DirectoryString, out isbad, true)[0];
                    }

                    if (res.Attributes.Contains("isDeleted"))
                    {
                        dat = res.Attributes["isDeleted"];

                        string temp = ThisForestInfo.DecodeStringData(dat, ActiveDirectorySyntax.Bool, out isbad, true)[0];

                        bool btmp = false;

                        Boolean.TryParse(temp, out btmp);

                        oinfo.IsDeleted = btmp;
                    }

                    if (res.Attributes.Contains("isRecycled"))
                    {
                        dat = res.Attributes["isRecycled"];

                        string temp = ThisForestInfo.DecodeStringData(dat, ActiveDirectorySyntax.Bool, out isbad, true)[0];

                        bool btmp = false;

                        Boolean.TryParse(temp, out btmp);

                        oinfo.IsRecycled = btmp;
                    }

                    if (successcount == 2)
                    {
                        AddEntry(ref parentNode, oinfo);
                    }
                }

                MainBase.UserSettings.DecodeGUID = storedecodeguid;

                GlobalControlHandler.UpdateLabel(this.lbProcess, visible: false);
            }

            this.Cursor = Cursors.Default;
        }
Beispiel #5
0
 private void Attributes_CopyAll_ContextItem_Click(object sender, EventArgs e)
 {
     GlobalControlHandler.CopyListBoxItems(sender);
 }
Beispiel #6
0
 private void Classes_Copy_ContextItem_Click(object sender, EventArgs e)
 {
     GlobalControlHandler.CopyFromListBox(sender);
 }
Beispiel #7
0
 private void ListBox_KeyDownEvents(object sender, KeyEventArgs e)
 {
     GlobalControlHandler.KeySuppress(e);
 }