private void SerializeCollection(FileNamePairCollection aFilesToSave, string aProposedFileName, SymbolCollection aCollection) { SymbolCollectionList list = new SymbolCollectionList(); list.Add(aCollection); SerializeCollection(aFilesToSave, aProposedFileName, list); }
public bool SerializeTaggedCollections(FileNamePairCollection aFilesToSave) { bool savedSyms = Symbols.SerializeTaggedCollections(aFilesToSave); bool savedCode = Code.SerializeTaggedCollections(aFilesToSave); // return(savedCode || savedSyms); }
private void SerializeCollection(FileNamePairCollection aFilesToSave, string aProposedFileName, SymbolCollectionList aList) { string tempFileName = Path.GetTempFileName(); // FileNamePair fileNamePair = new FileNamePair(tempFileName); fileNamePair.Destination = string.Format("/Symbols/{0}", Path.GetFileName(aProposedFileName)); fileNamePair.DeleteFile = true; // Make sure the collections are sorted in order aList.SortByCollectionAddress(); using (FileStream stream = new FileStream(tempFileName, FileMode.Create)) { aList.Serialize(stream); } // aFilesToSave.Add(fileNamePair); }
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); }
public virtual bool SerializeTaggedCollections(FileNamePairCollection aFilesToSave) { return(false); }