private void OnEnable()
    {
        _path = target as CreatePath;

        //Hide the handles of the GO so we dont accidentally move it instead of moving the circle
        Tools.hidden = true;
    }
Example #2
0
        public async Task ShouldRequireUniqueTitle()
        {
            await SendAsync(new CreatePath
            {
                Title       = "ASP.NET Developer",
                Key         = "asp-net",
                Description = "Learn how to design modern web applications using ASP.NET",
                Tags        =
                    new List <string>()
                {
                    "Web", "Development", "Programming"
                }
            });

            var command = new CreatePath
            {
                Title       = "ASP.NET Developer",
                Description = "Learn how to design modern web applications using ASP.NET"
            };

            FluentActions.Invoking(() =>
                                   SendAsync(command)).Should().ThrowAsync <ValidationException>()
            .Where(ex => ex.Errors.ContainsKey("Title"))
            .Result.And.Errors["Title"].Should().Contain("The specified path already exists.");
        }
Example #3
0
        public void ShouldRequireMinimumFields()
        {
            var command = new CreatePath();

            FluentActions.Invoking(() =>
                                   SendAsync(command)).Should().ThrowAsync <ValidationException>();
        }
        private void UpdateMessage()
        {
            //message.header.Update();



            createPath     = gameObject.GetComponent <CreatePath>();
            numberOfPoints = createPath.numberOfWaypoints;
            message.poses.Clear();
            for (int i = 0; i < numberOfPoints; i++)
            {
                string     name    = "Sphere_" + i.ToString();
                GameObject spehere = GameObject.Find(name);
                message.poses.Add(new MessageTypes.Geometry.Pose());

                message.poses[i].position.x    = spehere.transform.position.z;
                message.poses[i].position.y    = -spehere.transform.position.x;
                message.poses[i].position.z    = spehere.transform.position.y;
                message.poses[i].orientation.w = spehere.transform.rotation.w;
                message.poses[i].orientation.x = spehere.transform.rotation.z;
                message.poses[i].orientation.y = -spehere.transform.rotation.x;
                message.poses[i].orientation.z = spehere.transform.rotation.y;
            }
            //Debug.Log(message.poses.Count);
        }
Example #5
0
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Space))
        {
            if (step)
            {
                step = false;
            }
            else
            {
                step = true;
            }
        }

        if (Start != null && run && !step)
        {
            SearchGrid();
            steps++;
        }

        //Abbruch des Algorithmus
        if (Start != null && !run)
        {
            Start = null;
            AlgoList.Clear();
            UnityEngine.Debug.Log("Suchalgorithmus abgebrochen");
        }

        if (step)
        {
            if (Input.GetKeyDown(KeyCode.RightArrow))
            {
                if (Ende.GetEntdeckt() == false)
                {
                    wait = false;
                    SearchGrid();
                    steps++;
                }
                else if (Ende.GetEntdeckt() == true)
                {
                    path     = new CreatePath(Ende); //erstellen des Pfades
                    pathList = path.path;
                    character.GetComponent <CharacterScript>().Init(pathList);
                }
                else
                {
                    UnityEngine.Debug.Log("Ende nicht erreichbar");
                }
            }
            if (Input.GetKeyDown(KeyCode.LeftArrow))
            {
                if (current.getPrevious() != null)
                {
                    PreviousStep();
                    steps--;
                }
            }
        }
    }
Example #6
0
    // If the path has been found, follow the path
    public void OnPathFound(Vector3[] waypoints, bool pathSuccessful)
    {
        if (pathSuccessful)
        {
            path = new CreatePath(waypoints, transform.position, turnDst, stoppingDst);

            StopCoroutine("FollowPath");
            StartCoroutine("FollowPath");
        }
    }
Example #7
0
 // Start is called before the first frame update
 void Start()
 {
     createPath       = GameObject.FindGameObjectWithTag("shovel").GetComponent <CreatePath>();
     rb               = gameObject.GetComponent <Rigidbody>();
     transform.parent = GameObject.FindGameObjectWithTag("rescuedCars").transform;
     transform.name   = multiplier.ToString();
     firstIndex       = createPath.index - 2;
     targetIndex      = firstIndex;
     gotFirstIndex    = true;
 }
Example #8
0
    void Awake()
    {
        //Find camera object
        GameObject cam = GameObject.FindGameObjectWithTag("MainCamera");

        //Get NodeControl class
        control = (NodeControl)cam.GetComponent(typeof(NodeControl));

        currNode    = firstNode;
        pathCreater = FindObjectOfType <CreatePath>();
    }
Example #9
0
 //Suchfunktion
 private void SearchGrid()
 {
     if (Ende.GetEntdeckt() == false && AlgoList.Count > 0)
     {
         if (wait == false)
         {
             current = AlgoList[0]; //aktuelles Hex aktualisieren
             current.ChangeColor(0);
             StepList.Add(current);
             UnityEngine.Debug.Log("current Hex: " + current.xCoordinate + ", " + current.yCoordinate);
             AlgoList.RemoveAt(0); //letztes Element aus liste holen
             AddNeighborsToList(); // Nachbarn in Liste einfügen
             wait = true;
             steps++;
         }
         else //wartefunktiion
         {
             if (counter <= 0) //warten beenden
             {
                 wait    = false;
                 counter = setTimer;
             }
             else //warte zähler um eins veringern
             {
                 counter--;
             }
         }
     }
     else // Anschluss des Algortihmus
     {
         if (Ende.GetEntdeckt() == true)
         {
             path     = new CreatePath(Ende); //erstellen des Pfades
             pathList = path.path;
             character.GetComponent <CharacterScript>().Init(pathList);
         }
         else
         {
             UnityEngine.Debug.Log("Ende nicht erreichbar");
         }
         foreach (Hex g in GetComponent <Grid>().HexList)
         {
             if (g.GetEntdeckt())
             {
                 entdeckt++;
             }
         }
         UnityEngine.Debug.Log("Endeckte Felder " + entdeckt);
         AlgoList.Clear(); //Liste leeren
         Start = null;     // Start und Ende nullen
         run   = false;    //Updatefunktion auf false setzen
         steps = 0;
     }
 }
Example #10
0
 protected void SaveToCSV(bool start, string name, string column1, string column2)
 {
     //MessageBox.Show(start.ToString() + " ; " + dataTable.Rows.Count.ToString());
     if (start && dataTable.Rows.Count > 2)
     {
         ReadWriteCSV readWriteCSV = new ReadWriteCSV(CreatePath.CreateReportPath(name, fileEnding));
         readWriteCSV.WriteToCSV(column1, column2);
         for (int i = 0; i < dataTable.Rows.Count; i++)
         {
             readWriteCSV.WriteToCSV(dataTable.Rows[i][0].ToString(), dataTable.Rows[i][1].ToString());
         }
     }
 }
Example #11
0
        public void ShouldRequireKey()
        {
            var command = new CreatePath
            {
                Title       = "ASP.NET Developer",
                Description = "Learn how to design modern web applications using ASP.NET"
            };

            FluentActions.Invoking(() =>
                                   SendAsync(command)).Should().ThrowAsync <ValidationException>()
            .Where(ex => ex.Errors.ContainsKey("Key"))
            .Result.And.Errors["Key"].Should().Contain("URI key is required.");
        }
Example #12
0
        public void ShouldRequireDescription()
        {
            var command = new CreatePath
            {
                Title = "ASP.NET Developer",
                Key   = "key"
            };

            FluentActions.Invoking(() =>
                                   SendAsync(command)).Should().ThrowAsync <ValidationException>()
            .Where(ex => ex.Errors.ContainsKey("Description"))
            .Result.And.Errors["Description"].Should().Contain("Description is required.");
        }
Example #13
0
        public void ShouldDisallowLongTitle()
        {
            var command = new CreatePath
            {
                Title       = "This path title is too long and exceeds one hundred characters allowed for path titles by CreatePathCommandValidator",
                Key         = "key",
                Description = "Learn how to design modern web applications using ASP.NET"
            };

            FluentActions.Invoking(() =>
                                   SendAsync(command)).Should().ThrowAsync <ValidationException>()
            .Where(ex => ex.Errors.ContainsKey("Title"))
            .Result.And.Errors["Title"].Should().Contain("Title must not exceed 100 characters.");
        }
Example #14
0
        public async Task Create_ReturnsCreatedAtRoute()
        {
            var createCommand = new CreatePath {
                Title = "Create title", Description = "Create Description"
            };
            var controller = new PathsController(moqMediator.Object);

            var result = await controller.Create(createCommand);

            var content = GetObjectResultContent <Path>(result.Result);

            Assert.IsInstanceOf(typeof(CreatedAtRouteResult), result.Result);
            Assert.AreEqual("GetPath", ((CreatedAtRouteResult)result.Result).RouteName);
            Assert.IsNotNull(content);
            Assert.AreEqual(1, content.Id);
        }
Example #15
0
 private void Start()
 {
     if (!path)
     {
         path = FindObjectOfType <CreatePath>();
     }
     _pathLength = path.Length;
     if (!isReversed)
     {
         _curPathIndex = 0;
     }
     else
     {
         _curPathIndex = _pathLength - 1;
     }
     _velocity = transform.forward;
 }
Example #16
0
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();
        CreatePath pathEditor = (CreatePath)target;

        if (GUILayout.Button("Create Path"))
        {
            pathEditor.CreateWaypoints(pathEditor.numberOfWaypoints);
            // Debug.Log("Button Pressed");
        }

        if (GUILayout.Button("Delete all waypoints"))
        {
            pathEditor.DestroyWaypoints();
            //Debug.Log("Button 2 Pressed");
        }
    }
Example #17
0
 protected void SaveToCSV(bool start, string name, string column1, string column2, string column3, string column4)
 {
     if (start && ValuesAfter1.Count > 2)
     {
         ReadWriteCSV readWriteCSV = new ReadWriteCSV(CreatePath.CreateReportPath(name, fileEnding));
         readWriteCSV.WriteToCSV("Height", column1, column2, column3, column4);
         for (int i = 0; i < ValuesBefore1.Count; i++)
         {
             if ((i < ValuesAfter1.Count))
             {
                 readWriteCSV.WriteToCSV(i.ToString(), ValuesBefore1[i].ToString(), ValuesBefore2[i].ToString(), ValuesAfter1[i].ToString(), ValuesAfter2[i].ToString());
             }
             else
             {
                 readWriteCSV.WriteToCSV(i.ToString(), ValuesBefore1[i].ToString(), ValuesBefore2[i].ToString());
             }
         }
     }
 }
Example #18
0
        public async Task ShouldCreatePath()
        {
            //var userId = await RunAsDefaultUserAsync();

            var command = new CreatePath
            {
                Title       = "Some title",
                Key         = "some-key",
                Description = "Some description"
            };

            var createdPath = await SendAsync(command);

            var path = await FindAsync <Path>(createdPath.Id);

            path.Should().NotBeNull();
            path.Title.Should().Be(command.Title);
            path.Description.Should().Be(command.Description);
            //path.CreatedBy.Should().Be(userId);
            path.Created.Should().BeCloseTo(DateTime.Now, TimeSpan.FromMilliseconds(1000));
        }
Example #19
0
        static void Main(string[] args)
        {
            var createPath = new CreatePath();
            var clearPath  = new ClearPath();
            var dt         = DateTime.Now;
            var logger     = new Logger();

            var databaseDump = new DatabaseDump()
            {
                BackupPath      = Config.Default.BackupPath,
                DbPassword      = Config.Default.DbPassword,
                DbUser          = Config.Default.DbUser,
                DumpFileStamp   = DateTime.Now,
                MySqlServerPath = Config.Default.MySqlServerPath
            };
            var zipAndMove = new ZipAndMove()
            {
                BackupPath = Config.Default.BackupPath,
                TempPath   = Config.Default.BackupPathTemp
            };
            var purgeLocal = new PurgeLocal()
            {
                LocalRetention = Config.Default.LocalRetention,
                LocalPath      = Config.Default.BackupPath
            };

            var ftpMakeDirectory = new FtpMakeDirectory(
                Config.Default.RemoteFtpServer,
                Config.Default.RemoteFtpUsr,
                Config.Default.RemoteFtpPwd,
                logger);

            var ftpCreateRemotePath = new FtpCreateRemotePath()
            {
                FtpMakeDirectory = ftpMakeDirectory,
                Month            = dt.ToString("MM"),
                RemoteBasePath   = Config.Default.RemoteBasePath,
                RemoteFtpPwd     = Config.Default.RemoteFtpPwd,
                RemoteFtpServer  = Config.Default.RemoteFtpServer,
                RemoteFtpUsr     = Config.Default.RemoteFtpUsr,
                Year             = dt.Year.ToString()
            };

            var ftpSendFile = new FtpSendFile(
                Config.Default.RemoteFtpUsr,
                Config.Default.RemoteFtpPwd,
                logger);

            var ftpSendFileToRemote = new FtpSendFileToRemote()
            {
                FtpSendFile     = ftpSendFile,
                Month           = dt.ToString("MM"),
                RemoteBasePath  = Config.Default.RemoteBasePath,
                RemoteFtpPwd    = Config.Default.RemoteFtpPwd,
                RemoteFtpServer = Config.Default.RemoteFtpServer,
                RemoteFtpUsr    = Config.Default.RemoteFtpUsr,
                Year            = dt.Year.ToString(),
                BackupPath      = Config.Default.BackupPath
            };

            var ftpListDirectory = new FtpListDirectory(
                Config.Default.RemoteFtpServer,
                Config.Default.RemoteFtpUsr,
                Config.Default.RemoteFtpPwd
                );

            var ftpDeleteFile = new FtpDeleteFile(
                Config.Default.RemoteFtpServer,
                Config.Default.RemoteFtpUsr,
                Config.Default.RemoteFtpPwd,
                logger
                );

            var ftpListDirectoryOnRemote = new FtpListDirectoryOnRemote()
            {
                FtpListDirectory = ftpListDirectory,
                FtpDeleteFile    = ftpDeleteFile
            };

            var ftpRemoveDirectory = new FtpRemoveDirectory(
                Config.Default.RemoteFtpServer,
                Config.Default.RemoteFtpUsr,
                Config.Default.RemoteFtpPwd,
                logger
                );

            var ftpPurgeRemoteData = new FtpPurgeRemoteData(
                ftpListDirectoryOnRemote,
                ftpRemoveDirectory,
                Config.Default.RemoteRetention,
                Config.Default.RemoteBasePath);

            new EntryPoint(
                createPath,
                clearPath,
                databaseDump,
                zipAndMove,
                purgeLocal,
                ftpCreateRemotePath,
                ftpSendFileToRemote,
                ftpListDirectoryOnRemote,
                ftpPurgeRemoteData,
                Config.Default.BackupPath,
                Config.Default.BackupPathTemp,
                Config.Default.RemoteBasePath,
                Config.Default.DbList)
            .Go();

            Console.WriteLine("DONE");
        }
Example #20
0
        public async Task <ActionResult <Path> > Create([FromBody] CreatePath command)
        {
            Path model = await Mediator.Send(command);

            return(CreatedAtRoute("GetPath", new { pathId = model.Id }, model));
        }