• 大小: 39KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-06-09
  • 语言: C#
  • 标签:

资源简介

比较C#代码文件 比较C#文件 比较C#代码 部区分大小,空格,但是象引号==还是要区别的

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;
namespace CompareFile
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void btnClose_Click(object sender EventArgs e)
        {
            this.Close();
        }

        private void btnSource_Click(object sender EventArgs e)
        {
            OpenFileDialog op1 = new OpenFileDialog();
            op1.Filter = “ (*.cs)|*.cs|(*.txt)|*.txt|All files (*.*)|*.*“;
            if (op1.ShowDialog() == DialogResult.OK)
            {
                this.txtSource.Text = op1.FileName;
            }
        }

        private void btnTarget_Click(object sender EventArgs e)
        {
            OpenFileDialog op1 = new OpenFileDialog();
            op1.Filter = “ (*.cs)|*.cs|(*.txt)|*.txt“;
            if (op1.ShowDialog() == DialogResult.OK)
            {
                this.txtTarget.Text = op1.FileName;
            }
        }

        private void butCompare_Click(object sender EventArgs e)
        {
            listSorce.Items.Clear();
            listTarget.Items.Clear();
            using (StreamReader readerSource = new StreamReader(txtSource.Text.Trim()) readerTarget = new StreamReader(txtTarget.Text.Trim()))
            {
                string linesource linetarget;
                while (!readerSource.EndOfStream && !readerTarget.EndOfStream)
                {
                    linesource = readerSource.ReadLine().Trim();
                    while (linesource.Length <1)
                    {
                        linesource = readerSource.ReadLine().Trim();
                    }
                    linetarget = readerTarget.ReadLine().Trim();
                    while (linetarget.Length < 1)
                    {
                        linetarget = readerTarget.ReadLine().Trim();
                    }
                    if (!(linesource.ToLower().Trim() == linetarget.ToLower().Trim() || linesource.Replace(“ “ ““)==linetarget.Replace(“ “ ““)))
                    {
                        listSorce.Items.Add(linesource + “\n“);
                        listTarget.Items.Add(linetarget + “\n“);
                    }
                }
            }
            MessageBox.Show(“Compare Finished“);
        }
    }
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件      11776  2009-09-13 13:50  CompareFile\bin\Debug\CompareFile.exe

     文件      26112  2009-09-13 13:50  CompareFile\bin\Debug\CompareFile.pdb

     文件      14328  2009-09-13 13:54  CompareFile\bin\Debug\CompareFile.vshost.exe

     文件        490  2007-07-21 01:33  CompareFile\bin\Debug\CompareFile.vshost.exe.manifest

     文件       3354  2009-09-13 13:06  CompareFile\CompareFile.csproj

     文件        911  2009-09-13 12:56  CompareFile\CompareFile.sln

    ..A..H.     14848  2009-09-13 13:54  CompareFile\CompareFile.suo

     文件       2520  2009-09-13 13:50  CompareFile\Form1.cs

     文件       8948  2009-09-13 13:43  CompareFile\Form1.Designer.cs

     文件       5814  2009-09-13 13:43  CompareFile\Form1.resx

     文件        992  2009-09-13 13:54  CompareFile\obj\Debug\CompareFile.csproj.FileListAbsolute.txt

     文件        847  2009-09-13 13:43  CompareFile\obj\Debug\CompareFile.csproj.GenerateResource.Cache

     文件      11776  2009-09-13 13:50  CompareFile\obj\Debug\CompareFile.exe

     文件        180  2009-09-13 13:43  CompareFile\obj\Debug\CompareFile.Form1.resources

     文件      26112  2009-09-13 13:50  CompareFile\obj\Debug\CompareFile.pdb

     文件        180  2009-09-13 13:06  CompareFile\obj\Debug\CompareFile.Properties.Resources.resources

     文件        483  2009-09-13 12:56  CompareFile\Program.cs

     文件       1434  2009-09-13 12:56  CompareFile\Properties\AssemblyInfo.cs

     文件       2851  2009-09-13 12:56  CompareFile\Properties\Resources.Designer.cs

     文件       5612  2009-09-13 12:56  CompareFile\Properties\Resources.resx

     文件       1096  2009-09-13 12:56  CompareFile\Properties\Settings.Designer.cs

     文件        249  2009-09-13 12:56  CompareFile\Properties\Settings.settings

     目录          0  2009-09-13 13:01  CompareFile\obj\Debug\Refactor

     目录          0  2009-09-13 12:56  CompareFile\obj\Debug\TempPE

     目录          0  2009-09-13 13:06  CompareFile\bin\Debug

     目录          0  2009-09-13 13:50  CompareFile\obj\Debug

     目录          0  2009-09-13 12:56  CompareFile\bin

     目录          0  2009-09-13 12:56  CompareFile\obj

     目录          0  2009-09-13 12:56  CompareFile\Properties

     目录          0  2009-09-13 13:50  CompareFile

............此处省略3个文件信息

评论

共有 条评论

相关资源