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 override void LoadFromFile(string aFileName, TSynchronicity aSynchronicity) { if (SymbolFileEngine.IsSymbolFile(aFileName)) { iEngineSymbol.LoadFromFile(aFileName, aSynchronicity); } else if (MapFileEngine.IsMapFile(aFileName)) { iEngineMap.LoadFromFile(aFileName, aSynchronicity); } else { throw new NotSupportedException(); } }
private void SymbolEngine_Observer(SymbianUtils.AsyncReaderBase.TEvent aEvent, SymbianUtils.AsyncReaderBase aSender) { System.Diagnostics.Debug.Assert(aSender.Tag is SymbolFileEngine); SymbolFileEngine engine = (SymbolFileEngine)aSender.Tag; // switch (aEvent) { case SymbianUtils.AsyncReaderBase.TEvent.EReadingStarted: OnParsingStarted(engine.SymbolFileName); break; case SymbianUtils.AsyncReaderBase.TEvent.EReadingProgress: OnParsingProgress(engine.SymbolFileName, aSender.Progress); break; case SymbianUtils.AsyncReaderBase.TEvent.EReadingComplete: OnParsingCompleted(engine.SymbolFileName); break; } }
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); }
internal ROMEngine(ITracer aTracer) : base(aTracer) { iEngineSymbol = new SymbolFileEngine(this, SymbolFileEngine.TActivationType.EImmediate, false); iEngineSymbol.Observer += new SymbianUtils.AsyncReaderBase.Observer(SymbolEngine_Observer); }