示例#1
0
 private void RefreshCamCommands()
 {
     ScanCommand.RaiseCanExecuteChanged();
     StartCommand.RaiseCanExecuteChanged();
     StopCommand.RaiseCanExecuteChanged();
     RefreshCommand.RaiseCanExecuteChanged();
 }
示例#2
0
        public void ScanCommand_Test_Fluent_FetchColumns()
        {
            var command = new ScanCommand <MockDomainObject>(_config, _pool, _map);

            command.FetchColumns(x => x.Name);


            command.FetchColumns(x => x.RandomDictionary, "manele");
            command.FetchColumns(x => x.RandomEnumerable, "manele");

            var actual = command.List();

            var test = actual.SingleOrDefault(x => x.Name == "test");
            var foo  = actual.SingleOrDefault(x => x.Name == "Foo");

            var expectedTest = _expectedResults.SingleOrDefault(x => x.Name == "test");
            var expectedFoo  = _expectedResults.SingleOrDefault(x => x.Name == "Foo");



            Assert.Equal(expectedTest?.Name, test?.Name);
            Assert.Equal(expectedFoo?.Name, foo?.Name);


            Assert.Null(test.Address);
            Assert.Null(foo.Address);
        }
        public ACommand scanProcess(ScanCommand command, Battlefield.RobotAndBattlefield robotAndBattlefield)
        {
            double           minDistance = Battlefield.ARENA_MAX_SIZE * 10;
            BattlefieldRobot robot       = robotAndBattlefield.ROBOT;
            Battlefield      battlefield = robotAndBattlefield.BATTLEFIELD;

            BattlefieldRobot minTarget = robot;

            if (robot.HitPoints > 0)
            {
                foreach (BattlefieldRobot target in battlefield.robots)
                {
                    if (robot.ID != target.ID && target.HitPoints > 0 && battlefield.obstacleManager.CanScan(battlefield.turn, robot.X, robot.Y, target.X, target.Y))
                    {
                        double distance = EuclideanSpaceUtils.Distance(robot.X, robot.Y, target.X, target.Y);
                        if (distance < minDistance)
                        {
                            double degree = AngleUtils.NormalizeDegree(AngleUtils.AngleDegree(robot.X, robot.Y, target.X, target.Y));
                            if (Math.Abs(degree - command.ANGLE) <= command.PRECISION)
                            {
                                minDistance = distance;
                                minTarget   = target;
                            }
                        }
                    }
                }

                battlefield.battlefieldTurn.AddScan(new Scan(command.ANGLE, command.PRECISION, minDistance, robot.X, robot.Y));
            }
            return(new ScanAnswerCommand(minDistance, minTarget.ID));
        }
示例#4
0
        public void ScanCommand_Test_List()
        {
            var command = new ScanCommand <MockDomainObject>(_config, _pool, _map);

            var actual = command.List();

            Assert.True(CheckEntities(_expectedResults, actual));
        }
        public void Execute_WithNonExistingRootFolder_WillPrintError()
        {
            // Arrange
            ScanCommand command = new ScanCommand(@"c:/doesnotexist", 5, false, false);

            // Act
            command.Execute(testConsole, testFileSystem, testPathResolver);

            // Assert
            Assert.IsTrue(testConsole.GetHistory().Contains("does not exist", StringComparison.OrdinalIgnoreCase));
        }
示例#6
0
    public void Verify_path_argument_configuration()
    {
        var scanCommand = new ScanCommand();

        scanCommand.Arguments.Should().HaveCount(1);

        var arg = scanCommand.Arguments.ElementAt(0);

        arg.Name.Should().Be("path");
        arg.Arity.Should().BeEquivalentTo(ArgumentArity.ExactlyOne);
    }
        /**
         * This may seem counter-intuitive because it should work the OPPOSITE in production,
         * but since this loop is simulated it is actually a 'real' folder and should not be detected
         * as a loop with a high recursion limit
         */
        public void Execute_WithLoopAndHighRecursionLimit_WillNotFindLoop()
        {
            // Arrange
            ScanCommand command = new ScanCommand(@"c:/", 10, false, false);

            // Act
            command.Execute(testConsole, testFileSystem, testPathResolver);

            // Assert
            Assert.IsTrue(testConsole.GetHistory().Contains("no loops found", StringComparison.OrdinalIgnoreCase));
        }
        public void Execute_WithNoLoops_WillFindNoLoops()
        {
            // Arrange
            ScanCommand command = new ScanCommand(@"c:/demo", 5, false, false);

            // Act
            command.Execute(testConsole, testFileSystem, testPathResolver);

            // Assert
            Assert.IsTrue(testConsole.GetHistory().Contains("no loops found", StringComparison.OrdinalIgnoreCase));
        }
示例#9
0
        public void ScanCommand_Test_Start_End_row()
        {
            var command = new ScanCommand <MockDomainObject>(_config, _pool, _map);

            command.StartFrom("test");
            command.EndTo("Foo");

            //intercept TSCAN


            var actual = command.List();

            Assert.True(CheckEntities(_expectedResults, actual));
        }
示例#10
0
        public ActionResult Scan(ScanForm command, IScannerManager scannerManager)
        {
            var scanResult = new ScanCommand(command, scannerManager).Execute(_markerAsync);

            if (scanResult.Validate())
            {
                return new ActionResult {
                           Content = scanResult.Content, ContentType = "text/json"
                }
            }
            ;

            throw new Exception(scanResult.Error);
        }
        /// <summary>
        /// Initialization of the package; this method is called right after the package is sited, so this is the place
        /// where you can put all the initialization code that rely on services provided by VisualStudio.
        /// </summary>
        protected override void Initialize()
        {
            base.Initialize();
            ScanCommand.Initialize(this);
            BindCommand.Initialize(this);
            ShowStoredResultsCommand.Initialize(this);
            RetrieveResultsCommand.Initialize(this);
            IncrementalScanCommand.Initialize(this);

            Connect connect = new Connect();

            connect.OnConnection(GetDTE());


            CommonActions ca = CommonActionsInstance.getInstance();

            ca.ApplicationObject = GetDTE();
        }
示例#12
0
        /// <summary>
        /// Initialize the object.
        /// </summary>
        public WpMagDirOutputViewModel()
            : base("Water Profile Direction and Magnitude Data Output")
        {
            base.DisplayName = "Data Output";

            // Subscribe to receive ensembles
            _eventAggregator = IoC.Get <IEventAggregator>();
            _eventAggregator.Subscribe(this);

            // Get PulseManager
            _pm = IoC.Get <PulseManager>();

            _fileSizeMonitor = 0;

            // Get the options from the database
            GetOptionsFromDatabase();

            FormatList = new List <string>();
            FormatList.Add(WpMagDirOutputViewOptions.TRANSFORM_SHIP);
            FormatList.Add(WpMagDirOutputViewOptions.TRANSFORM_EARTH);
            FormatList.Add(WpMagDirOutputViewOptions.TRANSFORM_INSTRUMENT);

            HeadingSourceList = Enum.GetValues(typeof(Transform.HeadingSource)).Cast <Transform.HeadingSource>().ToList();

            _serialOptions = new SerialOptions();
            CommPortList   = SerialOptions.PortOptions;
            BaudRateList   = SerialOptions.BaudRateOptions;

            DataOutput = "";

            // Scan for ADCP command
            ScanCommand = ReactiveUI.ReactiveCommand.Create();
            ScanCommand.Subscribe(_ => ScanForSerialPorts());

            // Disconnect Serial
            ConnectCommand = ReactiveUI.ReactiveCommand.Create();
            ConnectCommand.Subscribe(_ => ConnectAdcpSerial());

            // Disconnect Serial
            DisconnectCommand = ReactiveUI.ReactiveCommand.Create();
            DisconnectCommand.Subscribe(_ => DisconnectSerial());
        }
示例#13
0
        private void Scan(Coordinate planetCoord)
        {
            SystemCoordinate _from, _to;

            // Start scanner
            _from        = planetCoord;
            _from.System = (short)Math.Max(_from.System - Range, 1);

            _to        = planetCoord;
            _to.System = (short)Math.Min(_to.System + Range, 499);

            var scanner = new ScanCommand()
            {
                PlanetId = PlanetId,
                From     = _from,
                To       = _to
            };

            scanner.Run();
        }
示例#14
0
        /// <summary>
        /// Initialize the view model.
        /// </summary>
        public OutputDataViewModel(string name)
        {
            base.DisplayName = name;

            NumBinsSelected = 4;
            MinBin          = 1;
            MaxBin          = 200;
            SelectedFormat  = ENCODING_PD6_PD13;
            FormatList      = new List <string>();
            FormatList.Add(ENCODING_Binary_ENS);
            FormatList.Add(ENCODING_PD0);
            FormatList.Add(ENCODING_PD6_PD13);
            FormatList.Add(ENCODING_VMDAS);
            //FormatList.Add(ENCODING_PD0);
            //FormatList.Add(ENCODING_RETRANSFORM_PD6);

            SelectedCoordTransform  = PD0.CoordinateTransforms.Coord_Earth;
            CoordinateTransformList = new List <PD0.CoordinateTransforms>();
            CoordinateTransformList.Add(PD0.CoordinateTransforms.Coord_Beam);
            CoordinateTransformList.Add(PD0.CoordinateTransforms.Coord_Instrument);
            CoordinateTransformList.Add(PD0.CoordinateTransforms.Coord_Ship);
            CoordinateTransformList.Add(PD0.CoordinateTransforms.Coord_Earth);

            _serialOptions = new SerialOptions();
            CommPortList   = SerialOptions.PortOptions;
            BaudRateList   = SerialOptions.BaudRateOptions;
            _SelectedBaud  = 115200;

            IsRetransformData = true;

            IsRecording = false;

            IsUseGpsHeading = true;
            HeadingOffset   = 0.0f;

            ShipXdcrOffset = 0.0f;

            DataOutput = "";

            _codecVmDas  = new VmDasAsciiCodec();
            _codecPd6_13 = new EnsToPd6_13Codec();

            // Bin List
            BinList = new List <int>();
            for (int x = 1; x <= 200; x++)
            {
                BinList.Add(x);
            }

            // Scan for ADCP command
            ScanCommand = ReactiveUI.Legacy.ReactiveCommand.Create();
            ScanCommand.Subscribe(_ => ScanForSerialPorts());

            // Disconnect Serial
            ConnectCommand = ReactiveUI.Legacy.ReactiveCommand.Create();
            ConnectCommand.Subscribe(_ => ConnectAdcpSerial());

            // Disconnect Serial
            DisconnectCommand = ReactiveUI.Legacy.ReactiveCommand.Create();
            DisconnectCommand.Subscribe(_ => DisconnectSerial());
        }
示例#15
0
        /// <summary>
        /// Initialize the object.
        /// </summary>
        public DataOutputViewModel()
            : base("Data Output")
        {
            base.DisplayName = "Data Output";

            // Subscribe to receive ensembles
            _eventAggregator = IoC.Get <IEventAggregator>();
            _eventAggregator.Subscribe(this);

            // Get PulseManager
            _pm = IoC.Get <PulseManager>();

            // Get the options from the database
            GetOptionsFromDatabase();

            NumBinsSelected = 4;
            FormatList      = new List <string>();
            FormatList.Add(DataOutputViewOptions.ENCODING_Binary_ENS);
            FormatList.Add(DataOutputViewOptions.ENCODING_PD0);
            FormatList.Add(DataOutputViewOptions.ENCODING_PD6_PD13);
            FormatList.Add(DataOutputViewOptions.ENCODING_VMDAS);
            //FormatList.Add(ENCODING_PD0);
            //FormatList.Add(ENCODING_RETRANSFORM_PD6);

            CoordinateTransformList = new List <PD0.CoordinateTransforms>();
            CoordinateTransformList.Add(PD0.CoordinateTransforms.Coord_Beam);
            CoordinateTransformList.Add(PD0.CoordinateTransforms.Coord_Instrument);
            CoordinateTransformList.Add(PD0.CoordinateTransforms.Coord_Ship);
            CoordinateTransformList.Add(PD0.CoordinateTransforms.Coord_Earth);

            HeadingSourceList = Enum.GetValues(typeof(Transform.HeadingSource)).Cast <Transform.HeadingSource>().ToList();

            _serialOptions = new SerialOptions();
            CommPortList   = SerialOptions.PortOptions;
            BaudRateList   = SerialOptions.BaudRateOptions;

            _manualWT = new VesselMount.VmManualWaterTrack();
            NumBins   = 200;

            DataOutput = "";

            _codecVmDas  = new VmDasAsciiCodec();
            _codecPd6_13 = new EnsToPd6_13Codec();

            // Bin List
            BinList = new List <int>();
            for (int x = 1; x <= 200; x++)
            {
                BinList.Add(x);
            }

            // Scan for ADCP command
            ScanCommand = ReactiveUI.ReactiveCommand.Create();
            ScanCommand.Subscribe(_ => ScanForSerialPorts());

            // Disconnect Serial
            ConnectCommand = ReactiveUI.ReactiveCommand.Create();
            ConnectCommand.Subscribe(_ => ConnectAdcpSerial());

            // Disconnect Serial
            DisconnectCommand = ReactiveUI.ReactiveCommand.Create();
            DisconnectCommand.Subscribe(_ => DisconnectSerial());
        }
示例#16
0
 private string CreateResponse( ScanCommand command )
 {
     return _responseMap [command.CommandString].ToString();
 }
示例#17
0
 private static ScanCommand EnsureExists(ScanCommand scan)
 {
     return(scan ?? new ScanCommand());
 }