76 lines
2.8 KiB
C#
76 lines
2.8 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace CompareDef
|
|
{
|
|
class Program
|
|
{
|
|
|
|
const string def1 = @"D:\l\src\cs\eDosStation\TestMK3Dll\reader31\reader3.def";
|
|
const string def2 = @"D:\l\src\cs\eDosStation\TestMK3Dll\reader32\reader32.def";
|
|
|
|
static System.Collections.Generic.Dictionary<string, int> def1List, def2List;
|
|
static System.Collections.Generic.Dictionary<string, int> ImportDef(string defPath)
|
|
{
|
|
char[] sep = new char[] { ' ', '\t' };
|
|
|
|
System.Collections.Generic.Dictionary<string, int> list = new Dictionary<string, int>();
|
|
using (var s = new System.IO.StreamReader(defPath))
|
|
{
|
|
s.ReadLine();
|
|
s.ReadLine();
|
|
#pragma warning disable CS0168 // The variable 'l' is declared but never used
|
|
string l;
|
|
#pragma warning restore CS0168 // The variable 'l' is declared but never used
|
|
while (!s.EndOfStream)
|
|
{
|
|
var a = s.ReadLine().Split(sep, StringSplitOptions.RemoveEmptyEntries);
|
|
if (a.Length==2)
|
|
{
|
|
int i = a[0].IndexOf('=');
|
|
if (i >= 0)
|
|
a[0] = a[0].Substring(0, i );
|
|
i = a[0].LastIndexOf('@');
|
|
if (i >= 0) a[0] = a[0].Substring(0, i);
|
|
|
|
if (a[0].StartsWith("Begin", StringComparison.CurrentCultureIgnoreCase)) a[0] = a[0].Substring(5);
|
|
else if (a[0].StartsWith("End", StringComparison.CurrentCultureIgnoreCase)) a[0] = a[0].Substring(3);
|
|
|
|
if (!list.ContainsKey(a[0])) list.Add(a[0], int.Parse(a[1].Substring(1)));
|
|
}
|
|
|
|
|
|
}
|
|
|
|
};
|
|
return list;
|
|
}
|
|
|
|
static void CompareLists()
|
|
{
|
|
foreach (var x in def2List)
|
|
{
|
|
if (def1List.ContainsKey(x.Key))
|
|
{
|
|
//if (def1List[x.Key] != x.Value)
|
|
//{
|
|
// System.Diagnostics.Debug.WriteLine($"Ordinal changed function {x.Key} ordinal1 = {def1List[x.Key]} now at {x.Value}");
|
|
//}
|
|
} else
|
|
{
|
|
System.Diagnostics.Debug.WriteLine($"New function {x.Key} at {x.Value}");
|
|
}
|
|
}
|
|
}
|
|
|
|
static void Main(string[] args)
|
|
{
|
|
def1List = ImportDef(def1);
|
|
def2List = ImportDef(def2);
|
|
CompareLists();
|
|
}
|
|
}
|
|
}
|