private void CreateTableFile(string path) { InfoTable infotable = new InfoTable(); infotable.Items = new List <TableItem>(); //Far = new FAR1Archive(path, 0); DirectoryInfo dir = new DirectoryInfo(path); foreach (FileInfo file in dir.GetFiles()) { if (file.Extension == ".iff") { var iff = new IffFile(path + "/" + file.Name); ulong FileID = 0; foreach (OBJD obj in iff.List <OBJD>()) { if (obj.IsMultiTile) { FileID = obj.GUID; string name = Path.GetFileNameWithoutExtension(file.Name); infotable.Items.Add(new TableItem() { GUID = FileID.ToString("X"), FileName = name, Name = iff.Filename.Substring(0, iff.Filename.Length - 4), Group = obj.MasterID.ToString(), SubIndex = obj.SubIndex.ToString() }); listBox2.Items.Add(file.Name + " " + FileID); InfoTable.Save("table.xml", infotable); } else if (!obj.IsMultiTile) { FileID = obj.GUID; string name = Path.GetFileNameWithoutExtension(file.Name); infotable.Items.Add(new TableItem() { GUID = FileID.ToString("X"), FileName = name, Name = iff.Filename.Substring(0, iff.Filename.Length - 4), Group = obj.MasterID.ToString(), SubIndex = obj.SubIndex.ToString() }); listBox2.Items.Add(file.Name + " " + FileID); InfoTable.Save("table.xml", infotable); } } } } }
public static void Save(string xmlFilePath, InfoTable table) { XmlSerializer serialize = new XmlSerializer(typeof(InfoTable)); using (var writer = new StreamWriter(xmlFilePath)) { serialize.Serialize(writer, table); } }