Beispiel #1
0
        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);
        }
Beispiel #2
0
 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();
     }
 }
Beispiel #3
0
        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;
            }
        }
Beispiel #4
0
        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);
        }
Beispiel #5
0
 internal ROMEngine(ITracer aTracer)
     : base(aTracer)
 {
     iEngineSymbol           = new SymbolFileEngine(this, SymbolFileEngine.TActivationType.EImmediate, false);
     iEngineSymbol.Observer += new SymbianUtils.AsyncReaderBase.Observer(SymbolEngine_Observer);
 }