Example #1
0
        public ModDescription CreateModReference(int i, BinaryRead reader, bool isBefore01414)
        {
            if (isBefore01414)
            {
                return(CreateModReferenceBefore014(i, reader));
            }

            var name = reader.GetNextString <byte>();
            // ReSharper disable once UnusedVariable
            var lookAhead = reader.LookAhead();
            var version   = new Version
                                (reader.GetNext <byte>(), reader.GetNext <byte>(), reader.GetNext <byte>());

            return(ModDictionary[name][version]);
        }
Example #2
0
    void BinaryRead.IContext.Got
        (BinaryRead reader, MemberInfo member, object captureIdentifier, object result)
    {
        if (captureIdentifier as string == "Version")
        {
            Version = (Version)result;
            return;
        }

        if (captureIdentifier as string == "Lookahead")
        {
            // ReSharper disable once UnusedVariable
            var value = reader.LookAhead();
            Tracer.TraceBreak();
            return;
        }

        NotImplementedMethod(member.Name, captureIdentifier, result.ToString());
    }
Example #3
0
        object BinaryRead.IReaderProvider.ReadAndAdvance
            (BinaryRead reader, Type type, MemberInfo member)
        {
            // ReSharper disable once UnusedVariable
            var x             = reader.LookAhead();
            var isBefore01414 = ((UserContext)reader.UserContext).IsBefore01414;

            var result = isBefore01414
                ? new
            {
                name = reader.GetNextString <int>(), version = new Version
                                                               (
                    reader.GetNext <short>(),
                    reader.GetNext <short>(),
                    reader.GetNext <short>()
                                                               )
            }
                : new
            {
                name = reader.GetNextString <byte>(), version = new Version
                                                                (
                    reader.GetNext <byte>(),
                    reader.GetNext <byte>(),
                    reader.GetNext <byte>()
                                                                )
            };

            if (result.name == "")
            {
                throw new("Mod not recognized in stream");
            }

            var mod = MmasfContext.Instance.ModDictionary[result.name];

            return(mod[result.version]);
        }