Esempio n. 1
0
            public static GlobalBinaryOverlay GlobalFactory(
                OverlayStream stream,
                BinaryOverlayFactoryPackage package,
                RecordTypeConverter recordTypeConverter)
            {
                var majorFrame = package.MetaData.Constants.MajorRecordFrame(stream.RemainingMemory);
                var globalChar = GlobalCustomParsing.GetGlobalChar(majorFrame);

                switch (globalChar)
                {
                case GlobalInt.TRIGGER_CHAR:
                    return(GlobalIntBinaryOverlay.GlobalIntFactory(
                               stream,
                               package));

                case GlobalShort.TRIGGER_CHAR:
                    return(GlobalShortBinaryOverlay.GlobalShortFactory(
                               stream,
                               package));

                case GlobalFloat.TRIGGER_CHAR:
                    return(GlobalFloatBinaryOverlay.GlobalFloatFactory(
                               stream,
                               package));

                default:
                    throw new ArgumentException($"Unknown trigger char: {globalChar}");
                }
            }
Esempio n. 2
0
        public static Global CreateFromBinary(
            MutagenFrame frame,
            RecordTypeConverter recordTypeConverter)
        {
            return(GlobalCustomParsing.Create <Global>(
                       frame,
                       getter: (f, triggerChar) =>
            {
                switch (triggerChar)
                {
                case GlobalInt.TRIGGER_CHAR:
                    return GlobalInt.CreateFromBinary(f);

                case GlobalShort.TRIGGER_CHAR:
                    return GlobalShort.CreateFromBinary(f);

                case GlobalFloat.TRIGGER_CHAR:
                    return GlobalFloat.CreateFromBinary(f);

                case null:
                    var ret = GlobalFloat.CreateFromBinary(f);
                    ret.NoTypeDeclaration = true;
                    return ret;

                default:
                    throw new ArgumentException($"Unknown trigger char: {triggerChar}");
                }
            }));
        }
Esempio n. 3
0
        public static Global CreateFromBinary(
            MutagenFrame frame,
            TypedParseParams?translationParams)
        {
            return(GlobalCustomParsing.Create <Global>(
                       frame,
                       getter: (f, triggerChar) =>
            {
                switch (triggerChar)
                {
                case GlobalInt.TRIGGER_CHAR:
                    return GlobalInt.CreateFromBinary(f);

                case GlobalShort.TRIGGER_CHAR:
                    return GlobalShort.CreateFromBinary(f);

                case GlobalFloat.TRIGGER_CHAR:
                    return GlobalFloat.CreateFromBinary(f);

                default:
                    throw new ArgumentException($"Unknown trigger char: {triggerChar}");
                }
            }));
        }