0% found this document useful (0 votes)
20 views3 pages

Comparison Code

It is C# script note explaining how to code

Uploaded by

copy.ai2003
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views3 pages

Comparison Code

It is C# script note explaining how to code

Uploaded by

copy.ai2003
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

using System;

using [Link];

class Program

static void Main()

string file1Path = @"C:\Users\aawotidebe\Documents\db\Database


Compare Files\DB Cut 1\analog.l";

string file2Path = @"C:\Users\aawotidebe\Documents\db\Database


Compare Files\DB Cut \analog.l";

if (![Link](file1Path) || ![Link](file2Path))

[Link]("One or both files do not exist.");

return;

string[] file1Lines = [Link](file1Path);

string[] file2Lines = [Link](file2Path);

int maxLines = [Link]([Link], [Link]);

for (int i = 0; i < maxLines; i++)

string line1 = i < [Link] ? file1Lines[i] : "";

string line2 = i < [Link] ? file2Lines[i] : "";


string name1 = ExtractNameValue(line1);

string name2 = ExtractNameValue(line2);

if (![Link](name1, name2,
[Link]))

[Link]($"Line {i + 1}: Name differs: '{name1}' vs


'{name2}'");

static string ExtractNameValue(string line)

// Assuming line contains "name <value>" somewhere

// Let's parse it by splitting and look for key "name"

if ([Link](line))

return "";

var parts = [Link](new char[] { ' ', '\t' },


[Link]);

for (int i = 0; i < [Link] - 1; i++)

if (parts[i].Equals("name", [Link]))

return parts[i + 1];

}
// If no name key found, return empty string

return "";

You might also like