private void displayCreditFromTxtFile(Object path) { BinaryFormatter bf = new BinaryFormatter(); StringReader reader = null; if (path is OpenFileDialog) { FileStream stream = new FileStream(((OpenFileDialog)path).FileName, FileMode.Open, FileAccess.Read); reader = new StringReader((string)bf.Deserialize(stream)); } else if (path is string) { FileStream stream = new FileStream((string)path, FileMode.Open, FileAccess.Read); reader = new StringReader((string)bf.Deserialize(stream)); } string computedHashForCurrentUserEmail = encryptionClassInstance.calculHash(currentUserEmailAddress); if (computedHashForCurrentUserEmail.Equals(reader.ReadLine())) { string[] creditParsed = new string[9]; string creditTxt; while ((creditTxt = reader.ReadLine()) != null) { if (creditTxt != null) { creditParsed = creditTxt.Split(','); } try { if (creditParsed.Length > 8) { if (creditParsed[8].Equals("perioadaDeGratie")) { CreditStudiu nouCredit = new CreditStudiu(DateTime.Parse(creditParsed[1]), double.Parse(creditParsed[3]), int.Parse(creditParsed[5]), int.Parse(creditParsed[9])); MessageBox.Show(nouCredit.ToString()); } } else { Credite nouCredit = new Credite(DateTime.Parse(creditParsed[1]), double.Parse(creditParsed[3]), int.Parse(creditParsed[5])); MessageBox.Show(nouCredit.ToString()); } } catch (Exception ex) { MessageBox.Show("Integritatea datelor a fost compromisa, nu se pot prelucra!" + Environment.NewLine + ex.StackTrace); break; } } } else { MessageBox.Show("Aceste date nu va apartin! Va rugam sa utilizati doar date asociate sau trimise contului dvs.!"); } reader.Close(); }