コード例 #1
0
ファイル: TLVDecoderTest.cs プロジェクト: Lucasvo1/FHVGame
        public void Decode_ListOfPrimitives_Test()
        {
            // Create input
            int i = -1;
            int n = 13;
            byte[] input = new byte[n];
            input[++i] = Convert.ToByte("01101000", 2);// (T) 01 (Application) 1 (Constructed) 01000 (Type >= 32)
            input[++i] = 11; // (L)

            input[++i] = 0x02; // (T) int
            input[++i] = 0x01; // (L)
            input[++i] = 150; // (V)

            input[++i] = 0x02; // (T) int
            input[++i] = 0x01; // (L)
            input[++i] = 100; // (V)

            input[++i] = 0x30; // (T) for list
            input[++i] = 0x03; // (L)
            input[++i] = 0x02; // (T) int
            input[++i] = 0x01; // (L)
            input[++i] = 0x02; // (V)

            // Expected
            ImgParseSetup setup = new ImgParseSetup();
            setup.Height = 100;
            setup.Width = 150;
            setup.ListOfObjectIds.Add(2);

            ImgParseSetup result = (ImgParseSetup)TLVDec.Decode(input);

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(1, result.ListOfObjectIds.Count);
            Assert.AreEqual(2, result.ListOfObjectIds[0]);
            Assert.AreEqual(100, result.Height);
            Assert.AreEqual(150, result.Width);
        }
コード例 #2
0
ファイル: DataProvider.cs プロジェクト: Lucasvo1/FHVGame
 public void OnImgSetupChanged(ImgParseSetup setup)
 {
     Action<int, object> act = new Action<int, object>((int idx, object o) => clients[idx].Svc.OnImgSetupChanged(setup));
     NetworkSvc.NotifyClients(clients, setup, act);
 }
コード例 #3
0
ファイル: TLVEncoder.Test.cs プロジェクト: Lucasvo1/FHVGame
        public void ListOfPrimitives_Test()
        {
            ImgParseSetup setup = new ImgParseSetup();
            setup.Height = 100;
            setup.Width = 150;
            setup.ListOfObjectIds.Add(2);

            byte[] result = TlvConv.Encode(setup);

            // Create expected
            int i = -1;
            int n = 13;
            byte[] expResult = new byte[n];
            expResult[++i] = Convert.ToByte("01101000", 2);// (T) 01 (Application) 1 (Constructed) 01000 (Type >= 32)
            expResult[++i] = 11; // (L)

            expResult[++i] = 0x02; // (T) int
            expResult[++i] = 0x01; // (L)
            expResult[++i] = 150; // (V)

            expResult[++i] = 0x02; // (T) int
            expResult[++i] = 0x01; // (L)
            expResult[++i] = 100; // (V)

            expResult[++i] = 0x30; // (T) for list T [7:6]=00, [5]=1, [4:0]=10000
            expResult[++i] = 0x03; // (L)
            expResult[++i] = 0x02; // (T) int
            expResult[++i] = 0x01; // (L)
            expResult[++i] = 0x02; // (V)

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(n, result.Length);

            for (i = 0; i < n; i++)
            {
                Assert.AreEqual(expResult[i], result[i]);
            }
        }
コード例 #4
0
ファイル: VMService.cs プロジェクト: Lucasvo1/FHVGame
        public void RegisterImageObjects(ImgParseSetup setup)
        {
            ImgSetup = setup;

            WcfHandler.OnImgSetupChanged(setup);
        }
コード例 #5
0
ファイル: VMService.cs プロジェクト: Lucasvo1/FHVGame
 public VMService()
 {
     // Empty before ImageParser has not connected
     ImgSetup = new ImgParseSetup();
 }
コード例 #6
0
ファイル: VMClientReceiver.cs プロジェクト: Lucasvo1/FHVGame
 public void OnImgSetupChanged(ImgParseSetup setup)
 {
     ImgSetup = setup;
     OnDataChanged(VMChangedType.IMG_SETUP);
 }