Ejemplo n.º 1
0
        public static ICollection <KeyValuePair <string, string> > ReadFileWithCheckSum(string path)
        {
            FilesWithHash = new Dictionary <string, string>();


            try
            {
                using (StreamReader sr = new StreamReader(path))
                {
                    string FileLine;
                    string FilePath;
                    string FileHash;

                    while (!sr.EndOfStream)
                    {
                        FileLine = sr.ReadLine();
                        FilePath = FileLine.Substring(0, FileLine.IndexOf("|"));
                        FileHash = FileLine.Substring(FileLine.IndexOf("|") + 1, FileLine.Length - 1 - FilePath.Length);
                        FilesWithHash.Add(new KeyValuePair <string, string>(FilePath, FileHash));
                        //  Console.WriteLine(FilePath + " " + FileHash);
                    }
                }
            }

            catch (Exception e) { Console.WriteLine(e.Message + "\n" + e.StackTrace); }

            return(FilesWithHash);
        }