I need help trying to compare files that a user has selected. I cant seem to figure out exactly how to do it. I have the following code so far. The language is C#, and its a GUI application. At first I tried to assign a bool type variable and compare the files that way, but the compare button wouldn't work. I would really appreciate some kind of input from someone.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
namespace FileComparison
{
public partial class Form1 : Form
{
long fileSize1, fileSize2;
FileInfo fileInfo1, fileInfo2;
string fileName1, fileName2;
double ratio;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
OpenFileDialog openFileDialog1 = new OpenFileDialog();
if(openFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
fileName1 = openFileDialog1.FileName;
label3.Text = label3.Text + fileName1;
fileInfo1 = new FileInfo(fileName1);
fileSize1 = fileInfo1.Length;
}
}
private void button2_Click(object sender, EventArgs e)
{
OpenFileDialog openFileDialog2 = new OpenFileDialog();
if (openFileDialog2.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
fileName2 = openFileDialog2.FileName;
label4.Text = label4.Text + fileName2;
fileInfo2 = new FileInfo(fileName2);
fileSize2 = fileInfo2.Length;
}
}
private void button3_Click(object sender, EventArgs e)
{
}