private void SerializeCollection(FileNamePairCollection aFilesToSave, string aProposedFileName, SymbolCollection aCollection) { SymbolCollectionList list = new SymbolCollectionList(); list.Add(aCollection); SerializeCollection(aFilesToSave, aProposedFileName, list); }
public override bool SerializeTaggedCollections(FileNamePairCollection aFilesToSave) { int initialFileCount = aFilesToSave.Count; // Will contain tagged fixed collections SymbolCollectionList symColFixed = new SymbolCollectionList(); // Will contain dynamically relocated collections SymbolCollectionList symColDynamicRelocations = new SymbolCollectionList(); // Find tagged collections string fixedSymbolCollectionFileName = string.Empty; SymSourceManager sourceManager = iQueryAPI.SourceManager; foreach (SymSource source in sourceManager) { int count = source.Count; for (int i = 0; i < count; i++) { SymbolCollection col = source[i]; if (col.Tagged) { if (col.IsFixed) { symColFixed.Add(col); // Save the ROM symbol file name (if present) if (string.IsNullOrEmpty(fixedSymbolCollectionFileName)) { fixedSymbolCollectionFileName = source.FileName; } } else { symColDynamicRelocations.Add(col); } } } } // Now save them to needed files. We create one file for all the fixed // collections and then individual files for all the dynamically relocated // collections. // // In all cases, we create temporary files which are to be deleted by // the client. if (symColFixed.Count > 0) { SerializeCollection(aFilesToSave, Path.GetFileNameWithoutExtension(fixedSymbolCollectionFileName) + ".symbol", symColFixed); } if (symColDynamicRelocations.Count > 0) { foreach (SymbolCollection col in symColDynamicRelocations) { // For the dynamically relocated collections, we must generate a file name based // upon the collection details. string fileName = Path.GetFileNameWithoutExtension(col.FileName.EitherFullNameButDevicePreferred) + ".symbol"; SerializeCollection(aFilesToSave, fileName, col); } } return(aFilesToSave.Count != initialFileCount); }