Example #1
0
        private ImmutableDictionary <ImmutableArray <byte>, InstructionStub> ReadInstructionStubs()
        {
            var commonStubs = _commonInstrStubs.Value;
            var stream      = GetResourceFileStream(InstructionStubsFileName);
            ImmutableDictionary <ImmutableArray <byte>, InstructionStub> gameSpecificStubs;

            if (stream != null)
            {
                using (stream)
                {
                    gameSpecificStubs = InstructionStubsParser.Parse(stream);
                }
            }
            else
            {
                gameSpecificStubs = ImmutableDictionary <ImmutableArray <byte>, InstructionStub> .Empty;
            }

            var bldStubs = commonStubs.ToBuilder();

            foreach (var stub in gameSpecificStubs)
            {
                bldStubs[stub.Key] = stub.Value;
            }

            return(bldStubs.ToImmutable());
        }
Example #2
0
 private ImmutableDictionary <ImmutableArray <byte>, InstructionStub> ReadCommonInstructionStubs()
 {
     using (var stream = GetResourceFileStream(CommonInstructionStubsFileName, gameSpecific: false))
     {
         return(InstructionStubsParser.Parse(stream));
     }
 }