private void saveListToRespectiveFilesToolStripMenuItem_Click(object sender, EventArgs e)
{
Dictionary<String, List<ItemProto>> FileProtoList = new Dictionary<string, List<ItemProto>>();
List<ItemProto> Prots = new List<ItemProto>();
foreach (ItemProto Prot in lstProtos.FilteredObjects) Prots.Add(Prot);
if (Prots.Count > 0)
{
foreach (ItemProto Prot in lstProtos.FilteredObjects)
{
if (String.IsNullOrEmpty(Prot.FileName))
{
Message.Show("Item " + Prot.Name + " [" + Prot.ProtoId + "] has no filename assigned, and therefore can't be saved.", MessageBoxButtons.OK, MessageBoxIcon.Error);
continue;
}
if (FileProtoList.ContainsKey(Prot.FileName))
FileProtoList[Prot.FileName].Add(Prot);
else
{
FileProtoList[Prot.FileName] = new List<ItemProto>();
FileProtoList[Prot.FileName].Add(Prot);
}
}
foreach(KeyValuePair<String, List<ItemProto>> kvp in FileProtoList)
{
ItemProtoParser ProtoParser = new ItemProtoParser();
if (CurrentProto != null)
SetProtoGUI(CurrentProto, false);
ProtoParser.SaveProtosToFile(kvp.Key, Utils.GetVersion(), FOObj, kvp.Value, CustomInterface.CustomFields, Config.FormatWithSpace);
}
}
else
Message.Show("No items in filtered list.", MessageBoxButtons.OK, MessageBoxIcon.Error);
}