Achamenes.ID3Tests.TagTest.CompareFiles C# (CSharp) Метод

CompareFiles() приватный Метод

private CompareFiles ( string file1, string file2 ) : bool
file1 string
file2 string
Результат bool
        private bool CompareFiles(string file1, string file2)
        {
            System.Console.WriteLine (file1);
            System.Console.WriteLine (file2);
            FileStream stream1=File.OpenRead(file1);
            FileStream stream2=File.OpenRead(file2);
            try
            {
                if(stream1.Length!=stream2.Length)
                {
                    return false;
                }

                while(stream1.Position<stream1.Length)
                {
                    int b1 = stream1.ReadByte();
                    int b2 = stream2.ReadByte();
                    if(b1!=b2)
                    {
                        return false;
                    }
                    if(b1==-1)
                    {
                        break;
                    }
                }
                return true;
            }
            finally
            {
                if(stream1!=null)
                {
                    stream1.Close();
                }
                if(stream2!=null)
                {
                    stream2.Close();
                }
            }
        }