XML string/array Comparison
I'm trying to match the indexes from "filename" and "filesize" with the ones from "xml". They contain filesize and names. I need to match them up 开发者_JS百科in an if statment. I'm stuck though, and have no idea how to proceed.
public static void APB()
{
ArrayList filename = new ArrayList();
ArrayList filesize = new ArrayList();
var directory = new DirectoryInfo(Directory.GetCurrentDirectory());
var files= directory.GetFiles("*", SearchOption.AllDirectories);
long fnd = 0;
foreach (var file in files)
{
filename.Add(file.FullName);
filesize.Add(fnd += file.Length);
}
ArrayList xml = new ArrayList();
XmlTextReader reader = new XmlTextReader(dictonary.launcher);
while (reader.Read())
{
switch (reader.NodeType)
{
case XmlNodeType.Element:
xml.Add(reader.Name);
while (reader.MoveToNextAttribute())
xml.Add(reader.Name + "=" + reader.Value);
break;
}
}
}
Create anonymous types for each with the name and size and compare them.
精彩评论