Beispiel #1
0
        private void FadeOut()
        {
            Invoke(new MethodInvoker(() => { UserGroup.Dispose(); }));

            System.Timers.Timer t = new System.Timers.Timer(10);
            t.AutoReset = true;
            t.Elapsed  += (se, ev) => {
                Invoke(new MethodInvoker(() =>
                {
                    Opacity         -= 0.02;
                    desktop.Opacity += 0.02;

                    if (Opacity <= 0)
                    {
                        desktop.Taskbar.TopMost = true;
                        t?.Dispose();
                        Dispose();
                    }
                }));
            };
            t.Start();
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            string    accName               = string.Empty;
            string    userName              = string.Empty;
            string    usrIdName             = string.Empty;
            UserGroup ugProxy               = null;
            XmlNode   usrsNode              = null;
            XElement  usrDoc                = null;
            IEnumerable <XElement> userEles = null;
            string         DASHED_LINE      = "......................................................";
            string         userDomain       = string.Empty;
            ConsoleKeyInfo key;

            try
            {
                SITE_URL = ConfigurationManager.AppSettings["SITE_URL"];
                Console.Write("Please enter a valid user name: ");
                USER_NAME = Console.ReadLine();
                Console.Write("Please enter the password: "******"*");
                    }
                    else
                    {
                        if (key.Key == ConsoleKey.Backspace && PASSWORD.Length > 0)
                        {
                            PASSWORD = PASSWORD.Substring(0, (PASSWORD.Length - 1));
                            Console.Write("\b \b");
                        }
                    }
                }
                // Stops Receving Keys Once Enter is Pressed
                while (key.Key != ConsoleKey.Enter);
                Console.WriteLine();
                Console.Write("Please enter a valid domain: ");
                DOMAIN = Console.ReadLine();
                Console.WriteLine("Starting to get Invalid Users from the site.");
                ugProxy             = new UserGroup();
                ugProxy.Credentials = new NetworkCredential(USER_NAME, PASSWORD, DOMAIN);
                ugProxy.Url         = SITE_URL + "_vti_bin/usergroup.asmx";
                usrsNode            = ugProxy.GetAllUserCollectionFromWeb();
                usrDoc   = XElement.Parse(usrsNode.InnerXml);
                userEles = usrDoc.Descendants();
                Console.WriteLine("Total User Count: " + userEles.Count());
                Console.WriteLine(DASHED_LINE);
                int failedCnt = 0;
                foreach (var userEle in userEles)
                {
                    usrIdName  = userEle.Attribute(XName.Get("ID")).Value + ";#" + userEle.Attribute(XName.Get("Name")).Value;
                    accName    = userEle.Attribute(XName.Get("LoginName")).Value;
                    userName   = accName.Substring(accName.LastIndexOf('\\') + 1);
                    userDomain = accName.Replace("\\" + userName, string.Empty);
                    if (userDomain.ToUpperInvariant() == DOMAIN.ToUpperInvariant())
                    {
                        bool bln = CheckUserExists(userName);
                        if (!bln)
                        {
                            LogHelper.LogUserDetails(userName, userEle.Attribute("Name").Value, accName, userEle.Attribute("Email").Value);
                            Console.WriteLine("UserName: "******" : IsValid: " + bln.ToString());
                            failedCnt++;
                        }
                    }
                }
                Console.WriteLine(DASHED_LINE);
                Console.WriteLine("Invalid user count: " + failedCnt);
                Console.WriteLine("Completed getting Invalid Users from the site.");
                Console.ReadLine();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
                Console.ReadLine();
            }
            finally
            {
                if (ugProxy != null)
                {
                    ugProxy.Dispose();
                    ugProxy = null;
                }
                usrsNode = null;
                usrDoc   = null;
                userEles = null;
            }
        }