public static TFileType IsSupported(string aFileName) { TFileType ret = TFileType.EFileNotSupported; // try { string extension = Path.GetExtension(aFileName).ToLower(); if (extension == ".symbol") { SymbolFileEngine tempEngine = new SymbolFileEngine(null, SymbolFileEngine.TActivationType.EOnDemand, false); SymbolsForBinary symbols = tempEngine.ReadFirstCollection(aFileName); // For a valid ROFS symbol file, the first symbol should have an address of zero. bool containedNonZeroFirstSymbolCollection = (symbols != null && symbols.Count > 0 && symbols[0].Address != 0); if (containedNonZeroFirstSymbolCollection) { ret = TFileType.EFileRomSymbol; } } } catch (Exception) { } // return(ret); }
public static TFileType IsSupported(string aFileName) { TFileType ret = TFileType.EFileNotSupported; // try { string extension = Path.GetExtension(aFileName).ToLower(); if (extension == ".symbol") { bool sawSomeValidContent = false; // SymbolFileEngine tempEngine = new SymbolFileEngine(null, SymbolFileEngine.TActivationType.EOnDemand, true); SymbolsForBinary symbols = tempEngine.ReadFirstCollection(aFileName, out sawSomeValidContent); // For a valid ROFS symbol file, the first symbol should have an address of zero. bool valid = (symbols != null && symbols.Count > 0 && symbols[0].Address == 0); if (valid) { ret = TFileType.EFileRofsSymbol; } else if (sawSomeValidContent) { // Probably just a file containing data files rather than code, but that's okay. ret = TFileType.EFileRofsSymbol; } } else if (extension == ".map") { ret = MapFileEngineCollection.IsSupported(aFileName); } } catch (Exception) { } // return(ret); }