예제 #1
0
        public static List <string> ReadLoginFile()
        {
            List <string> read = new List <string>();
            // Open the stream and read it back.
            string content = FileEncrypterDecrypter.FileDecrypt(userFile);

            string       line;
            StringReader sr = new StringReader(content);

            while ((line = sr.ReadLine()) != null)
            {
                read.Add(line);
            }

            return(read);
        }
예제 #2
0
        public static void WriteLoginFile(List <string> inputs)
        {
            // Create the file.
            Directory.CreateDirectory(userDirectory);
            FileStream fs = File.Create(userFile);

            fs.Close();

            StringWriter sw = new StringWriter();

            // Add some information to the file.
            foreach (string input in inputs)
            {
                sw.WriteLine(HashGenerator.GetHash(input));
            }

            sw.Close();

            FileEncrypterDecrypter.FileEncrypt(sw.ToString(), userFile);
        }