public static void Add_Mail_To_DB(string mail)
        {
            lock (locker)
            {
                UsedEmailDatabase mAIL_DATABASE = JsonConvert.DeserializeObject <UsedEmailDatabase>(File.ReadAllText(Main.Used_Mail_DB_Path));
                AlreadyUsed       UsedMail      = mAIL_DATABASE.AlreadyUsed.Where(a => a.EMAIL == mail).FirstOrDefault();

                if (UsedMail != null)
                {
                    UsedMail.LinkedAccounts++;
                }
                else
                {
                    AlreadyUsed Used = new AlreadyUsed {
                        LinkedAccounts = 1, EMAIL = mail
                    };
                    mAIL_DATABASE.AlreadyUsed.Add(Used);
                }
                File.WriteAllText(Main.Used_Mail_DB_Path, JsonConvert.SerializeObject(mAIL_DATABASE, Formatting.Indented));

                var ml = Main.EMAIl_LIST.Where(a => a.EMAIL == mail).FirstOrDefault();
                if (ml != null)
                {
                    ml.LinkedAccounts++;
                }
            }
        }
        public static void CheckDiretory()
        {
            #region File_create_IfNoExist

            if (!Directory.Exists(Main.Database_Path))
            {
                Directory.CreateDirectory(Main.Database_Path);
                Directory.CreateDirectory(Main.Database_Path + "Created_Accounts");
            }


            if (!File.Exists(Main.Used_Mail_DB_Path))
            {
                AlreadyUsed usado = new AlreadyUsed {
                    EMAIL = "*****@*****.**", LinkedAccounts = 0
                };
                List <AlreadyUsed> usados = new List <AlreadyUsed>();
                usados.Add(usado);

                UsedEmailDatabase usedEmailDatabase = new UsedEmailDatabase {
                    AlreadyUsed = usados
                };

                File.WriteAllText(Main.Used_Mail_DB_Path, JsonConvert.SerializeObject(usedEmailDatabase, Formatting.Indented));
            }

            if (!File.Exists(Main.CreationidDB_Path))
            {
                creationid_DB creationid_DB = new creationid_DB {
                    Creationid = new List <string>()
                };

                File.WriteAllText(Main.CreationidDB_Path, JsonConvert.SerializeObject(creationid_DB, Formatting.Indented));
            }


            if (!File.Exists(Main.Pop3Domains_Path))
            {
                try
                {
                    var response = new RequestBuilder("https://raw.githubusercontent.com/Cappi1998/SteamAccountCreateHelper/master/SteamAccountCreateHelper/DatabaseFiles/Pop3Domains.json").GET()
                                   .Execute();

                    if (response.StatusCode == System.Net.HttpStatusCode.OK)
                    {
                        List <Pop3> pop3 = JsonConvert.DeserializeObject <List <Pop3> >(response.Content);
                        File.WriteAllText(Main.Pop3Domains_Path, JsonConvert.SerializeObject(pop3, Formatting.Indented));
                        Log.info($"Pop3Domains.json automatically downloaded from the repository https://github.com/Cappi1998/SteamAccountCreateHelper");
                    }
                }
                catch
                {
                    List <Pop3> pop3 = new List <Pop3>();
                    File.WriteAllText(Main.Pop3Domains_Path, JsonConvert.SerializeObject(pop3, Formatting.Indented));
                }
            }

            #endregion
        }
Esempio n. 3
0
        //returns the address for a random file
        public string RandomFile()
        {
            //Randomly selects a file from the filelist
            string selectedFile = FileList[rnd.Next(0, FileList.Count())];

            //Checks if the randomly selected file has already been used and has a valid extension, if not, it selects another.
            while (!ValidExtensions.Any(selectedFile.Contains) || AlreadyUsed.Any(file => file == selectedFile))
            {
                selectedFile = FileList[rnd.Next(0, FileList.Count())];
            }

            AlreadyUsed.Add(selectedFile);

            return(selectedFile);
        }