Beispiel #1
0
        public void CreateAMosaicInfoViaConstructor()
        {
            var mosaicProperties = new MosaicProperties(true, true, true, 3, 10);

            var mosaicInfo = new MosaicInfo(true,
                                            1,
                                            "5A3CD9B09CD1E8000159249B",
                                            new NamespaceId(9562080086528621131),
                                            new MosaicId(15358872602548358953),
                                            100,
                                            1,
                                            new PublicAccount("B4F12E7C9F6946091E2CB8B6D3A12B50D17CCBBF646386EA27CE2946A7423DCF", NetworkType.Types.MIJIN_TEST),
                                            mosaicProperties);

            Assert.AreEqual(true, mosaicInfo.IsActive);
            Assert.IsTrue(mosaicInfo.Index == 1);
            Assert.AreEqual("5A3CD9B09CD1E8000159249B", mosaicInfo.MetaId);
            Assert.AreEqual(9562080086528621131, mosaicInfo.NamespaceId.Id);
            Assert.AreEqual(15358872602548358953, mosaicInfo.MosaicId.Id);
            Assert.AreEqual((ulong)100, mosaicInfo.Supply);
            Assert.AreEqual((ulong)1, mosaicInfo.Height);
            Assert.AreEqual(new PublicAccount("B4F12E7C9F6946091E2CB8B6D3A12B50D17CCBBF646386EA27CE2946A7423DCF", NetworkType.Types.MIJIN_TEST).Address.Plain, mosaicInfo.Owner.Address.Plain);
            Assert.IsTrue(mosaicInfo.IsSupplyMutable);
            Assert.IsTrue(mosaicInfo.IsTransferable);
            Assert.IsTrue(mosaicInfo.IsLevyMutable);
            Assert.AreEqual(3, mosaicInfo.Divisibility);
            Assert.AreEqual((ulong)10, mosaicInfo.Duration);
        }
Beispiel #2
0
        private void AddMosaicInfoItem(MosaicInfo mosaicInfo)
        {
            if (mosaicInfo == null)
            {
                return;
            }
            string path = DataPathHelper.DataServerMosaicPath + mosaicInfo.datapath;

            if (!System.IO.File.Exists(path))
            {
                return;
            }
            MosaicInfoItem item = MosaicInfoItem.Create(mosaicInfo);

            if (item == null)
            {
                return;
            }
            foreach (MosaicInfoItem match in _lstMosaicInfo)
            {
                if (match.MosaicInfo.datapath == item.MosaicInfo.datapath)
                {
                    return;
                }
            }
            _lstMosaicInfo.Add(item);
        }
        public async Task GetNamespaceMosaics()
        {
            var        mosaicInfos = await new NamespaceMosaicHttp(host).GetNamespaceMosaics(NS);
            MosaicInfo mosaicInfo  = mosaicInfos[0];

            Assert.AreEqual(PUBKEY, mosaicInfo.CreatorPubKey);
            Assert.AreEqual("london:stock", mosaicInfo.FullName());
            Assert.IsNull(mosaicInfo.Levy);
            Assert.IsTrue(mosaicInfo.Properties.Mutable);
            Assert.IsTrue(mosaicInfo.Properties.Transferable);
        }
Beispiel #4
0
        public void ShouldReturnIsTransferableWhenItsTransferable()
        {
            var mosaicProperties = new MosaicProperties(true, true, true, 3, 10);

            var mosaicInfo = new MosaicInfo(true,
                                            1,
                                            "5A3CD9B09CD1E8000159249B",
                                            new NamespaceId(9562080086528621131),
                                            new MosaicId(15358872602548358953),
                                            100,
                                            1,
                                            new PublicAccount("B4F12E7C9F6946091E2CB8B6D3A12B50D17CCBBF646386EA27CE2946A7423DCF", NetworkType.Types.MIJIN_TEST),
                                            mosaicProperties);

            Assert.IsTrue(mosaicInfo.IsTransferable);
        }
Beispiel #5
0
        private void ShowBlocksInfo(BlockInfo[] infos)
        {
            lv.Items.Clear();
            lv.Columns.Clear();
            ListViewDetailColumn col1 = new ListViewDetailColumn("文件名");

            col1.Width = 320;
            lv.Columns.Add(col1);
            lv.Columns.Add("创建时间");
            lv.Columns.Add("大小(MB)");
            lv.Columns.Add("快视图");
            lv.Columns.Add("轨道时间");
            lv.Columns.Add("白天/晚上");
            lv.Columns.Add("卫星");
            lv.Columns.Add("传感器");
            if (infos == null || infos.Length == 0)
            {
                SendMessage("查询到满足条件的结果共0条。");
                return;
            }
            else
            {
                SendMessage("查询到满足条件的结果共" + infos.Length + "条。");
            }
            for (int i = 0; i < infos.Length; i++)
            {
                BlockInfo info = infos[i];
                if (info == null)
                {
                    continue;
                }
                MosaicInfo o = info.mosaicInfo == null ? null : info.mosaicInfo;
                lv.Items.Add(
                    Path.GetFileName(info.datapath),
                    info.createTime,
                    (info.fileSize / 1024.0 / 1024).ToString("f2"),
                    info.thumbnail,
                    o == null ? "" : o.observationdate,
                    o == null ? "" : o.dayOrNight,
                    o == null ? "" : o.satellite,
                    o == null ? "" : o.sensor);
                lv.Items[i].Tag = info.datapath;
            }
        }
Beispiel #6
0
            public static MosaicInfoItem Create(MosaicInfo info)
            {
                if (info == null)
                {
                    return(null);
                }
                if (string.IsNullOrWhiteSpace(info.datapath))
                {
                    return(null);
                }
                string fullfilename = DataPathHelper.DataServerMosaicPath + info.datapath;

                if (!System.IO.File.Exists(fullfilename))
                {
                    return(null);
                }
                MosaicInfoItem item = new MosaicInfoItem();

                item.MosaicInfo = info;
                item.Name       = info.envname;
                item.Envelope   = new CoordEnvelope(info.minx.GetValueOrDefault(), info.maxx.GetValueOrDefault(), info.miny.GetValueOrDefault(), info.maxy.GetValueOrDefault());
                return(item);
            }
Beispiel #7
0
        public ViewModel(ScreenView screen, MosaicInfo mosaicInfo, MainWindow mainWindow)
        {
            //if (Helpers.IsDevComputer)
            //{
            //    _configFilename = @"C:\Temp\PanoBeam.config";
            //}
            _screenView                      = screen;
            _mainWindow                      = mainWindow;
            CameraUserControl                = new CameraUserControl();
            CalibrationUserControl           = new CalibrationUserControl();
            BlendingUserControl              = new BlendingUserControl();
            TestImagesUserControl            = new TestImagesUserControl();
            CalibrationUserControl.Start    += CalibrationUserControlOnStart;
            TestImagesUserControl.ShowImage += TestImagesUserControlOnShowImage;

            _screen = new PanoScreen
            {
                Resolution            = _screenView.Resolution,
                Overlap               = _screenView.Overlap,
                SaveCursorPosition    = () => { _mousePosition = Win32.GetMousePosition(); },
                RestoreCursorPosition = () =>
                {
                    if (_mousePosition != null)
                    {
                        Win32.SetCursorPos(_mousePosition.X, _mousePosition.Y);
                    }
                }
            };
            _screen.AddProjectors(mosaicInfo.DisplayId0, mosaicInfo.DisplayId1);
            //_screen.LoadDefaults();
            CalibrationUserControl.Initialize();
            BlendingUserControl.Initialize(_screen.Projectors);
            _screen.CalculationProgress += ScreenOnCalculationProgress;

            //_screen.SetPattern(50, new Size(8, 9));
        }
        public void AssertOnMosaicDefinition(Address addr, MosaicInfo mosaicInfo)
        {
            const string M1 = "myspace:subspace";
            const string M2 = "myspace:subspacewithlevy";
            const string M3 = "nis1porttest:test";


            Debug.WriteLine(string.Format("AssertOnMosaicDefinition: MosaicDefinition received for mosaic '{0}', owned by {1}", mosaicInfo.FullName(), addr.Pretty));
            //AssertOnMosaicDefinition: MosaicDefinition received for mosaic '{"mosaicDefinition":{"creator":"7b1a93132b8c5b8001a07f973307bee2b37bcd6dc279a59ea98179b238d44e2d","description":"new mosaic test","id":{"namespaceId":"myspace","name":"subspace"},"properties":[{"name":"divisibility","value":"4"},{"name":"initialSupply","value":"1000000000"},{"name":"supplyMutable","value":"true"},{"name":"transferable","value":"true"}],"levy":{}},"supply":1000100000}', owned by TCTUIF - 557ZCQ - OQPW2M - 6GH4TC - DPM2ZY - BBL54K - GNHR
            //AssertOnMosaicDefinition: MosaicDefinition received for mosaic '{"mosaicDefinition":{"creator":"7b1a93132b8c5b8001a07f973307bee2b37bcd6dc279a59ea98179b238d44e2d","description":"test","id":{"namespaceId":"nis1porttest","name":"test"},"properties":[{"name":"divisibility","value":"6"},{"name":"initialSupply","value":"100000"},{"name":"supplyMutable","value":"true"},{"name":"transferable","value":"true"}],"levy":{}},"supply":100000}', owned by TCTUIF - 557ZCQ - OQPW2M - 6GH4TC - DPM2ZY - BBL54K - GNHR
            //AssertOnMosaicDefinition: MosaicDefinition received for mosaic '{"mosaicDefinition":{"creator":"3e82e1c1e4a75adaa3cba8c101c3cd31d9817a2eb966eb3b511fb2ed45b8e262","description":"reserved xem mosaic","id":{"namespaceId":"nem","name":"xem"},"properties":[{"name":"divisibility","value":"6"},{"name":"initialSupply","value":"8999999999"},{"name":"supplyMutable","value":"false"},{"name":"transferable","value":"true"}],"levy":{}},"supply":8999999999}', owned by TCTUIF - 557ZCQ - OQPW2M - 6GH4TC - DPM2ZY - BBL54K - GNHR
            //AssertOnMosaicDefinition: MosaicDefinition received for mosaic '{"mosaicDefinition":{"creator":"7b1a93132b8c5b8001a07f973307bee2b37bcd6dc279a59ea98179b238d44e2d","description":"new mosaic test","id":{"namespaceId":"myspace","name":"subspacewithlevy"},"properties":[{"name":"divisibility","value":"4"},{"name":"initialSupply","value":"1000000000"},{"name":"supplyMutable","value":"true"},{"name":"transferable","value":"true"}],"levy":{"fee":100,"recipient":"TCTUIF557ZCQOQPW2M6GH4TCDPM2ZYBBL54KGNHR","type":1,"mosaicId":{"namespaceId":"myspace","name":"subspace"}}},"supply":1000000000}', owned by TCTUIF - 557ZCQ - OQPW2M - 6GH4TC - DPM2ZY - BBL54K - GNHR

            switch (mosaicInfo.FullName())
            {
            case MosaicId.XEMfullName:
                Assert.AreEqual("3e82e1c1e4a75adaa3cba8c101c3cd31d9817a2eb966eb3b511fb2ed45b8e262", mosaicInfo.CreatorPubKey);
                Assert.AreEqual("reserved xem mosaic", mosaicInfo.Description);
                Assert.AreEqual(MosaicInfo.Xem.Properties.Divisibility, mosaicInfo.Properties.Divisibility);
                Assert.AreEqual(MosaicInfo.Xem.Properties.InitialSupply, mosaicInfo.Properties.InitialSupply);
                Assert.AreEqual(MosaicInfo.Xem.Properties.Mutable, mosaicInfo.Properties.Mutable);
                Assert.AreEqual(MosaicInfo.Xem.Properties.Transferable, mosaicInfo.Properties.Transferable);
                Assert.IsNull(mosaicInfo.Levy);
                break;

            case M1:
                Assert.AreEqual(Config.TACCOUNT_TO_WATCH2_PUBKEY, mosaicInfo.CreatorPubKey);
                Assert.AreEqual("new mosaic test", mosaicInfo.Description);
                Assert.AreEqual(4, mosaicInfo.Properties.Divisibility);
                Assert.AreEqual((ulong)1000000000, mosaicInfo.Properties.InitialSupply);
                Assert.AreEqual(true, mosaicInfo.Properties.Mutable);
                Assert.AreEqual(true, mosaicInfo.Properties.Transferable);
                Assert.IsNull(mosaicInfo.Levy);
                break;

            case M2:
                Assert.AreEqual(Config.TACCOUNT_TO_WATCH2_PUBKEY, mosaicInfo.CreatorPubKey);
                Assert.AreEqual("new mosaic test", mosaicInfo.Description);
                Assert.AreEqual(4, mosaicInfo.Properties.Divisibility);
                Assert.AreEqual((ulong)1000000000, mosaicInfo.Properties.InitialSupply);
                Assert.AreEqual(true, mosaicInfo.Properties.Mutable);
                Assert.AreEqual(true, mosaicInfo.Properties.Transferable);
                Assert.IsNotNull(mosaicInfo.Levy);
                // Assert The Levy
                Assert.AreEqual(Config.TACCOUNT_TO_WATCH2, mosaicInfo.Levy.Recipient.Pretty);
                Assert.AreEqual(M1, mosaicInfo.Levy.FullName());
                Assert.AreEqual((ulong)100, mosaicInfo.Levy.Fee);
                Assert.AreEqual(1, mosaicInfo.Levy.FeeType);
                break;

            case M3:
                Assert.AreEqual(Config.TACCOUNT_TO_WATCH2_PUBKEY, mosaicInfo.CreatorPubKey);
                Assert.AreEqual("test", mosaicInfo.Description);
                Assert.AreEqual(6, mosaicInfo.Properties.Divisibility);
                Assert.AreEqual((ulong)100000, mosaicInfo.Properties.InitialSupply);
                Assert.AreEqual(true, mosaicInfo.Properties.Mutable);
                Assert.AreEqual(true, mosaicInfo.Properties.Transferable);
                Assert.IsNull(mosaicInfo.Levy);
                break;

            default:
                throw new Exception("AssertOnMosaicDefinition: Unsupported MosaicInfo " + mosaicInfo.FullName());
            }
        }
Beispiel #9
0
 private void AddMosaicInfo(MosaicInfo mosaicInfo)
 {
     _lstMosaicInfo.Add(mosaicInfo);
 }
Beispiel #10
0
 void _hdDataMonitor_DataChanged(MonitorTask.ChangedType arg1, dynamic[] arg2)
 {
     try
     {
         if (arg2 == null || arg2.Length == 0)
         {
             return;
         }
         if (arg1 == MonitorTask.ChangedType.Add)
         {
             if (arg2[0] is HdDataServer.ProjectionInfo)
             {
                 Progress(0);
                 for (int i = 0; i < arg2.Length; i++)
                 {
                     Progress((i + 1) * 100 / arg2.Length);
                     ProjectionInfo pInfo = arg2[i];
                     if (pInfo.orbitInfo.dayOrNight != "D")
                     {
                         continue;
                     }
                     AddDataOverView(pInfo);
                 }
                 if (this.InvokeRequired)
                 {
                     this.Invoke(new Action(UpdateProjectionInfo));
                 }
                 else
                 {
                     UpdateProjectionInfo();
                 }
             }
             else if (arg2[0] is HdDataServer.MosaicInfo)
             {
                 for (int i = 0; i < arg2.Length; i++)
                 {
                     Progress((i + 1) * 100 / arg2.Length);
                     MosaicInfo pInfo = arg2[i];
                     if (pInfo.dayOrNight != "D")
                     {
                         continue;
                     }
                     AddMosaicInfo(pInfo);
                 }
                 if (this.InvokeRequired)
                 {
                     this.Invoke(new Action(UpdateMosaicInfo));
                 }
                 else
                 {
                     UpdateMosaicInfo();
                 }
             }
             else if (arg2[0] is HdDataServer.BlockInfo)
             {
                 for (int i = 0; i < arg2.Length; i++)
                 {
                     BlockInfo info = arg2[i];
                     if (info.mosaicInfo.dayOrNight != "D")
                     {
                         continue;
                     }
                     AddBlockInfo(info);
                 }
                 if (this.InvokeRequired)
                 {
                     this.Invoke(new Action(UpdateBlockInfo));
                 }
                 else
                 {
                     UpdateBlockInfo();
                 }
             }
         }
     }
     finally
     {
         Progress(0);
     }
 }