/// <summary> /// Přečte TXT řádek po řádku a přiřadí je do listu stringů /// </summary> public void LineByLine() { long lineInd = 0; long nextCheck = 100000; int nullLines = 0; string line; System.IO.StreamReader file = new System.IO.StreamReader(filePath); while ((line = file.ReadLine()) != null) { if (line != null) { string name = line.Substring(0, line.IndexOf('@')); string email = line.Substring(0, line.IndexOf(':')); string typeOfMail = line.Substring(line.IndexOf('@'), (line.IndexOf(':') - line.IndexOf('@'))); string password = line.Substring(line.IndexOf(':') + 1); dbMethods.AddAccount(new Account { Email = email, Password = password, CustomData = typeOfMail, CustomData02 = name }); lineInd++; } else { log.WriteLine("Null line"); nullLines++; lineInd++; } if (lineInd == nextCheck) { Int32 unixTimestampNextChech = (Int32)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds; log.WriteLine("Prenesono " + lineInd + "radku v čase: " + (unixTimestampNextChech - unixTimestamp).ToString()); nextCheck = nextCheck + 100000; } } file.Close(); log.WriteLine("Import from file to DB complete " + unixTimestamp.ToString()); }