예제 #1
0
        private static Byt3Serializer CreateLoader(FLInstructionSet iset)
        {
            SerializableBufferArgumentSerializer           bbuf           = new SerializableBufferArgumentSerializer();
            SerializableDecimalArgumentSerializer          debuf          = new SerializableDecimalArgumentSerializer();
            SerializableFunctionArgumentSerializer         fabuf          = new SerializableFunctionArgumentSerializer();
            SerializableExternalFunctionArgumentSerializer exbuf          = new SerializableExternalFunctionArgumentSerializer();
            Dictionary <Type, FLBaseSerializer>            argumentParser = new Dictionary <Type, FLBaseSerializer>
            {
                { typeof(SerializeBufferArgument), bbuf },
                { typeof(SerializeDecimalArgument), debuf },
                { typeof(SerializeFunctionArgument), fabuf },
                { typeof(SerializeExternalFunctionArgument), exbuf }
            };

            SerializableFLFunctionSerializer         efunc  = new SerializableFLFunctionSerializer(argumentParser);
            SerializableExternalFLFunctionSerializer exfunc = new SerializableExternalFLFunctionSerializer(iset);
            EmptyFLBufferSerializer         ebuf            = new EmptyFLBufferSerializer();
            RandomFLBufferSerializer        rbuf            = new RandomFLBufferSerializer();
            UnifiedRandomFLBufferSerializer urbuf           = new UnifiedRandomFLBufferSerializer();
            FromImageFLBufferSerializer     fibuf           = new FromImageFLBufferSerializer(true);
            WFCFLBufferSerializer           wfcbuf          = new WFCFLBufferSerializer();
            Dictionary <Type, Serializers.Internal.FLBaseSerializer> bufferParser = new Dictionary <Type, Serializers.Internal.FLBaseSerializer>
            {
                { typeof(SerializableExternalFLFunction), exfunc },
                { typeof(SerializableFLFunction), efunc },
                { typeof(SerializableEmptyFLBuffer), ebuf },
                { typeof(SerializableRandomFLBuffer), rbuf },
                { typeof(SerializableUnifiedRandomFLBuffer), urbuf },
                { typeof(SerializableFromFileFLBuffer), fibuf },
                { typeof(SerializableWaveFunctionCollapseFLBuffer), wfcbuf },
            };

            SerializableFLProgramSerializer prog = new SerializableFLProgramSerializer(bufferParser, iset);
            Byt3Serializer main = Byt3Serializer.GetDefaultSerializer();

            main.AddSerializer(typeof(SerializableFLProgram), prog);
            main.AddSerializer(typeof(FLFileFormat), new FLFileFormatSerializer());
            return(main);
        }
예제 #2
0
        private static Byt3Serializer CreateLoader(FLInstructionSet iset)
        {
            SerializableBufferArgumentSerializer           bbuf  = new SerializableBufferArgumentSerializer();
            SerializableArrayArgumentSerializer            abuf  = new SerializableArrayArgumentSerializer();
            SerializableDecimalArgumentSerializer          debuf = new SerializableDecimalArgumentSerializer();
            SerializableFunctionArgumentSerializer         fabuf = new SerializableFunctionArgumentSerializer();
            SerializableExternalFunctionArgumentSerializer exbuf = new SerializableExternalFunctionArgumentSerializer();
            SerializableArrayLengthSerializer  arLen             = new SerializableArrayLengthSerializer();
            SerializableNameArgumentSerializer nArg = new SerializableNameArgumentSerializer();
            SerializableArrayElementArgumentVariableIndexSerializer arEVI =
                new SerializableArrayElementArgumentVariableIndexSerializer();
            SerializableArrayElementArgumentValueIndexSerializer arEVaI =
                new SerializableArrayElementArgumentValueIndexSerializer();
            SerializableArrayElementArgumentEnclosedIndexSerializer arEI =
                new SerializableArrayElementArgumentEnclosedIndexSerializer();
            Dictionary <Type, FLBaseSerializer> argumentParser = new Dictionary <Type, FLBaseSerializer>
            {
                { typeof(SerializeBufferArgument), bbuf },
                { typeof(SerializeArrayBufferArgument), abuf },
                { typeof(SerializeDecimalArgument), debuf },
                { typeof(SerializeFunctionArgument), fabuf },
                {
                    typeof(SerializeExternalFunctionArgument), exbuf
                },
                { typeof(SerializeArrayLengthArgument), arLen },
                { typeof(SerializeNameArgument), nArg },
                {
                    typeof(
                        SerializeArrayElementArgumentVariableIndex),
                    arEVI
                },
                {
                    typeof(SerializeArrayElementArgumentValueIndex),
                    arEVaI
                },
                {
                    typeof(
                        SerializeArrayElementArgumentEnclosedIndex),
                    arEI
                }
            };

            SerializableFLFunctionSerializer         efunc   = new SerializableFLFunctionSerializer(argumentParser);
            SerializableExternalFLFunctionSerializer exfunc  = new SerializableExternalFLFunctionSerializer(iset);
            EmptyFLBufferSerializer             ebuf         = new EmptyFLBufferSerializer();
            FromImageFLBufferSerializer         fibuf        = new FromImageFLBufferSerializer(true);
            Dictionary <Type, FLBaseSerializer> bufferParser =
                new Dictionary <Type, FLBaseSerializer>
            {
                { typeof(SerializableExternalFLFunction), exfunc },
                { typeof(SerializableFLFunction), efunc },
                { typeof(SerializableEmptyFLBuffer), ebuf },
                { typeof(SerializableFromFileFLBuffer), fibuf }
            };

            SerializableFLProgramSerializer prog = new SerializableFLProgramSerializer(bufferParser, iset);

            PluginManager.LoadPlugins(prog);
            Byt3Serializer main = Byt3Serializer.GetDefaultSerializer();

            main.AddSerializer(typeof(SerializableFLProgram), prog);
            main.AddSerializer(typeof(FLFileFormat), new FLFileFormatSerializer());
            return(main);
        }