예제 #1
0
        public void Setup(IDependencyContainer container)
        {
            container.Bind <TypeAnalyzerConfiguration>(x => x.AsSingleton());

            container.Bind <IPrimitiveChecker, BasicPrimitiveChecker>();

            container.Bind <IPrimitiveRegistry>(builder =>
                                                builder
                                                .ToMethod(x =>
            {
                var primitiveCheckers = x.ResolveAll <IPrimitiveChecker>();
                var primitiveRegistry = new PrimitiveRegistry();
                primitiveCheckers.ForEachRun(primitiveRegistry.AddPrimitiveCheck);
                return(primitiveRegistry);
            })
                                                .AsSingleton());

            container.Bind <ITypeCreator, TypeCreator>();
            container.Bind <ITypeAnalyzer, TypeAnalyzer>();
            container.Bind <MappingConfiguration>(x => x.ToInstance(MappingConfiguration.Default));
            container.Bind <EverythingTypeMapper>();
            container.Bind <DefaultTypeMapper>();
            container.Bind <ITypeMapper>(x => x.ToBoundType <DefaultTypeMapper>());
            container.Bind <IMappingRegistry, MappingRegistry>();

            container.Bind <IBinaryPrimitiveHandler, BasicBinaryPrimitiveHandler>();
            container.Bind <IBinarySerializer, BinarySerializer>();
            container.Bind <IBinaryDeserializer, BinaryDeserializer>();
        }
        public NumericsModelSerializationTests(ITestOutputHelper outputHelper)
        {
            _outputHelper = outputHelper;
            _typeCreator  = new TypeCreator();

            var primitiveRegistry = new PrimitiveRegistry();

            primitiveRegistry.AddPrimitiveCheck(new BasicPrimitiveChecker());
            primitiveRegistry.AddPrimitiveCheck(new NumericsPrimitiveChecker());
            var analyzer = new TypeAnalyzer(primitiveRegistry);

            var mapper = new EverythingTypeMapper(analyzer);

            _mappingRegistry = new MappingRegistry(mapper);
        }
예제 #3
0
        public void PreparePrimitive()
        {
            Descriptor = PrimitiveRegistry.GetDescriptor(Instruction.Opcode);
            Operand    = (VMPrimitiveOperand)Activator.CreateInstance(Descriptor.OperandType);
            Operand.Read(Instruction.Operand);

            Nodes         = new PrimitiveNode[2];
            Nodes[0]      = new PrimitiveNode();
            Nodes[0].Type = NodeType.False;
            Nodes[1]      = new PrimitiveNode();
            Nodes[1].Type = NodeType.True;

            Title           = new UILabel();
            Title.Alignment = TextAlignment.Middle | TextAlignment.Center;
            Title.Y         = 0;
            Title.X         = 0;
            this.Add(Title);
            Title.CaptionStyle       = TextStyle.DefaultLabel.Clone();
            Title.CaptionStyle.Font  = FSO.Client.GameFacade.EdithFont;
            Title.CaptionStyle.VFont = FSO.Client.GameFacade.EdithVectorFont;
            Title.CaptionStyle.Size  = 14;

            Index           = new UILabel();
            Index.Alignment = TextAlignment.Right | TextAlignment.Center;
            Index.Y         = 0;
            Index.X         = 0;
            this.Add(Index);
            Index.CaptionStyle       = TextStyle.DefaultLabel.Clone();
            Index.CaptionStyle.Font  = FSO.Client.GameFacade.EdithFont;
            Index.CaptionStyle.VFont = FSO.Client.GameFacade.EdithVectorFont;
            Index.CaptionStyle.Size  = 10;
            Index.Visible            = false;

            BodyTextStyle       = TextStyle.DefaultLabel.Clone();
            BodyTextStyle.Font  = FSO.Client.GameFacade.EdithFont;
            BodyTextStyle.VFont = FSO.Client.GameFacade.EdithVectorFont;
            BodyTextStyle.Size  = 12;

            CommentNode = new CommentContainer(TreeBox.Comment);
            CommentNode.OnCommentChanged += CommentNode_OnCommentChanged;
            CommentNode.Y = -3;
            Add(CommentNode);

            this.Add(Nodes[0]);
            this.Add(Nodes[1]);

            UpdateDisplay();
        }
예제 #4
0
        public PrimitiveBox(BHAVInstruction inst, byte ptr, BHAVContainer master)
        {
            Type        = PrimBoxType.Primitive;
            Instruction = inst;
            Descriptor  = PrimitiveRegistry.GetDescriptor(inst.Opcode);
            Operand     = (VMPrimitiveOperand)Activator.CreateInstance(Descriptor.OperandType);
            Operand.Read(inst.Operand);
            InstPtr = ptr;

            Nodes    = new PrimitiveNode[2];
            Nodes[0] = new PrimitiveNode
            {
                Type = NodeType.False
            };
            Nodes[1] = new PrimitiveNode
            {
                Type = NodeType.True
            };

            Title = new UILabel
            {
                Alignment = TextAlignment.Middle | TextAlignment.Center,
                Y         = 0,
                X         = 0
            };
            this.Add(Title);
            Title.CaptionStyle      = TextStyle.DefaultLabel.Clone();
            Title.CaptionStyle.Font = Client.GameFacade.EdithFont;
            Title.CaptionStyle.Size = 14;

            BodyTextStyle      = TextStyle.DefaultLabel.Clone();
            BodyTextStyle.Font = Client.GameFacade.EdithFont;
            BodyTextStyle.Size = 12;

            this.Add(Nodes[0]);
            this.Add(Nodes[1]);

            HitTest = ListenForMouse(new Rectangle(0, 0, Width, Height), new UIMouseEvent(MouseEvents));

            Master = master;
            UpdateDisplay();
        }