Ejemplo n.º 1
0
 public Pather.Graph.Path CalculatePath(Pather.Graph.Location iOrigin, Pather.Graph.Location iDestination, float sDist)
 {
     Pather.Graph.Path mypath = world.CreatePath(iOrigin, iDestination, sDist);
     /* We save the PathGraph. Stores every chunk of the map we used in the
        PPather\PathInfo\{map} folder */
     world.Save();
     return mypath;
 }
Ejemplo n.º 2
0
        public void ShouldPathToNeighbour()
        {
            var pather = new Pather <int>(_graph);
            var path   = pather.CalculateShortesPath(one, two).ToArray();

            path.Count().ShouldBe(2);

            path[0].ShouldBe(one);
            path[1].ShouldBe(two);
        }
Ejemplo n.º 3
0
        public void ShouldDetectNoPath()
        {
            var nine = new GraphNode<int>(9);
            _graph.AddNode(nine);

            var pather = new Pather<int>(_graph);
            var path = pather.CalculateShortesPath(one, nine).ToArray();

            path.Count().ShouldBe(0);
        }
Ejemplo n.º 4
0
        public void ShouldFindShortestPath3()
        {
            var pather = new Pather <int>(_graph);
            var path   = pather.CalculateShortesPath(six, seven).ToArray();

            path[0].ShouldBe(six);
            path[1].ShouldBe(three);
            path[2].ShouldBe(four);
            path[3].ShouldBe(seven);
        }
Ejemplo n.º 5
0
        public void ShouldFindShortestPath1()
        {
            var pather = new Pather <int>(_graph);
            var path   = pather.CalculateShortesPath(one, five).ToArray();

            path[0].ShouldBe(one);
            path[1].ShouldBe(two);
            path[2].ShouldBe(three);
            path[3].ShouldBe(six);
            path[4].ShouldBe(five);
        }
Ejemplo n.º 6
0
        public void ShouldDetectNoPath()
        {
            var nine = new GraphNode <int>(9);

            _graph.AddNode(nine);

            var pather = new Pather <int>(_graph);
            var path   = pather.CalculateShortesPath(one, nine).ToArray();

            path.Count().ShouldBe(0);
        }
Ejemplo n.º 7
0
        public async Task <IActionResult> PutAcompañante(int id, Pather item)
        {
            if (id != item.Id)
            {
                return(BadRequest());
            }
            _context.Entry(item).State = EntityState.Modified;
            await _context.SaveChangesAsync();

            return(NoContent());
        }
Ejemplo n.º 8
0
        public void TestMinimapImage()
        {
            float x, y;

            Pather.GetTileByLocation(new[] { -8020, 1515, -1.5f }.ToRecast(), out x, out y);

            var image = new MinimapImage("Azeroth", 256, 256, (int)x, (int)x, (int)y, (int)y);

            image.Generate();
            image.Result.Save("S:\\meshReader\\MinimapImageTest.png", ImageFormat.Png);
        }
Ejemplo n.º 9
0
        public void ShouldFindShortestPath1()
        {
            var pather = new Pather<int>(_graph);
            var path = pather.CalculateShortesPath(one, five).ToArray();

            path[0].ShouldBe(one);
            path[1].ShouldBe(two);
            path[2].ShouldBe(three);
            path[3].ShouldBe(six);
            path[4].ShouldBe(five);
        }
Ejemplo n.º 10
0
 public static Point GetClosestPointOnTile(Point position, out bool success)
 {
     if (_pather == null)
     {
         _pather = new Pather(Usefuls.ContinentNameMpq);
     }
     if (_pather.Continent != Usefuls.ContinentNameMpq)
     {
         _pather.Dispose();
         _pather = new Pather(Usefuls.ContinentNameMpq);
     }
     return(_pather.GetClosestPointOnTile(position, out success));
 }
Ejemplo n.º 11
0
        public static string GetFilePath(
            this UrlHelper urlHelper,
            PropertyValue value)
        {
            if (value.AsString.IsNullOrEmpty())
            {
                return(null);
            }

            var path = Pather.Combine("~/", value.Property.FileOptions.Path, value.AsString).Replace("\\", "/");

            return(urlHelper.Content(path));
        }
Ejemplo n.º 12
0
    /// <summary>
    /// Finds the cheapest path leading from start to the closest reachable Tile to target using Dijkstra's.
    /// </summary>
    /// <remarks>
    /// The cheapest path is selected. The most appealing path is selected.
    /// </remarks>
    /// <param name="start">Starting Tile</param>
    /// <param name="target">Target Tile</param>
    /// <param name="result">Object containing the results.</param>
    /// <param name="pather">Determines if you can move over an Edge.</param>
    /// <param name="costCalculator">Calculates the cost to move over an Edge.</param>
    /// <returns>True if target was reached.</returns>
    public static bool CheapestPath(Tile start, Tile target, out PathResult result, Pather pather = null, CostCalculator costCalculator = null)
    {
        pather ??= Pathers.Phased;
        costCalculator ??= CostCalculators.MoveCost;

        var minDist = Game.grid.Distance(start, target);
        var minCost = float.PositiveInfinity;
        var closest = start;

        var tiles = new Dictionary <Tile, FieldItem>()
        {
            { start, new FieldItem(0, 0, null) }
        };
        var frontier = new ComparisonPriorityQueue <DoublePriorityNode>(Game.grid.tiles.Count, new DoubleComparer());

        frontier.Enqueue(new DoublePriorityNode(start, 0), start.moveCost.current);

        if (start != target)
        {
            while (frontier.Count != 0)
            {
                var tile = frontier.Dequeue().tile;
                foreach (var(neighbor, edge) in tile.NeighborsWithEdges())
                {
                    var cost   = tiles[tile].cost + costCalculator(tile, edge, neighbor);
                    var appeal = tiles[tile].appeal + tile.appeal.current;
                    if (pather(tile, edge, neighbor) && (!tiles.TryGetValue(neighbor, out var other) || other.cost > cost || (other.cost == cost && other.appeal < appeal)))
                    {
                        tiles[neighbor] = new FieldItem(cost, appeal, tile);
                        if (cost < minCost || closest != target)
                        {
                            float priority = cost;
                            frontier.Enqueue(new DoublePriorityNode(neighbor, -neighbor.appeal.current), priority);
                            var dist = Game.grid.Distance(neighbor, target);
                            if (dist < minDist)
                            {
                                minDist = dist;
                                closest = neighbor;
                                if (closest == target)
                                {
                                    minCost = cost;
                                }
                            }
                        }
                    }
                }
            }
        }
        result = new PathResult(start, tiles, closest);
        return(closest == target);
    }
Ejemplo n.º 13
0
        public static string GetImageBigPath(
            this UrlHelper urlHelper,
            PropertyValue value)
        {
            if (value.AsString.IsNullOrEmpty())
            {
                return(null);
            }

            var settings = value.Property.FileOptions.Settings.FirstOrDefault();
            var path     = Pather.Combine("~/", value.Property.FileOptions.Path, settings.SubPath, value.AsString).Replace("\\", "/");

            return(urlHelper.Content(path));
        }
Ejemplo n.º 14
0
        public void TestFlightpathes()
        {
            System.Collections.Generic.List <Hop> roadHops;
            Pather.Filter.ExcludeFlags = (ushort)(PolyFlag.FlightMaster);
            TryPath(new Vector3(-9447.5f, 55.4f, 56.2f), new Vector3(-8957.4f, 517.3f, 96.3f), out roadHops, false);

            Pather = new Pather(@iMeshesPath, MockConnectionHandler);
            System.Collections.Generic.List <Hop> flightHops;
            TryPath(new Vector3(-9447.5f, 55.4f, 56.2f), new Vector3(-8957.4f, 517.3f, 96.3f), out flightHops, false);

            Console.WriteLine("Ground path: " + roadHops.Count + " hops, Flight path: " + flightHops.Count + " hops");
            Assert.Less(flightHops.Count, roadHops.Count);
            Assert.IsTrue(flightHops.Any(hop => hop.Type == HopType.Flightmaster && hop.FlightTarget != null));
        }
Ejemplo n.º 15
0
        public static void MoveTomephisto()
        {
            PC me = new PC();

            AreaMap map = new AreaMap(me.Area);

            map.Initialize();

            Pather p = me.GetSkillLevel(SkillType.Teleport) > 0 ? new Pather(map, new TeleportReducer(25)) : p = new Pather(map, new WalkingReducer(7, 13));

            p.FindPath(me.Position, new System.Drawing.Point(17564, 8069));

            Pathing.Mover m = new Pathing.Mover(p);

            m.Move(me.GetSkillLevel(SkillType.Teleport) > 0 ? Reduction.TeleportReduction : Reduction.WalkingReduction);
        }
Ejemplo n.º 16
0
    public static int[,,] GetDistanceMap(Unit unit, Vector2 destination)
    {
        int[,,] distanceMap = new int[GridManager.Width(), GridManager.Height(), 2];
        for (int x = 0; x < distanceMap.GetLength(0); x++)
        {
            for (int y = 0; y < distanceMap.GetLength(1); y++)
            {
                distanceMap[x, y, 0] = 1000;
                distanceMap[x, y, 1] = 1000;
            }
        }
        distanceMap[(int)destination.x, (int)destination.y, 0] = 0;
        distanceMap[(int)destination.x, (int)destination.y, 1] = 0;
        List <Vector2> positionsToCheck = new List <Vector2>();

        positionsToCheck.Add(destination);
        int turnsAway = 1;

        while (positionsToCheck.Count > 0)
        {
            List <Vector2> addList = new List <Vector2>();
            foreach (Vector2 positionToCheck in positionsToCheck)
            {
                Pather.SetUpNodes(positionToCheck, unit.owner, unit.grouping, true);
                List <Vector2> movePositions = Pather.GetMoveCoordsForFloodFill(positionToCheck, unit.movePoints);
                foreach (Vector2 movePosition in movePositions)
                {
                    int pathCost = nodes[(int)movePosition.x, (int)movePosition.y].pathCost;
                    if (turnsAway < distanceMap[(int)movePosition.x, (int)movePosition.y, 0] ||
                        (turnsAway == distanceMap[(int)movePosition.x, (int)movePosition.y, 0] &&
                         pathCost < distanceMap[(int)movePosition.x, (int)movePosition.y, 1]))
                    {
                        distanceMap[(int)movePosition.x, (int)movePosition.y, 0] = turnsAway;
                        distanceMap[(int)movePosition.x, (int)movePosition.y, 1] = pathCost;
                        addList.Add(movePosition);
                    }
                }
            }
            positionsToCheck.Clear();
            foreach (Vector2 addVector in addList)
            {
                positionsToCheck.Add(addVector);
            }
            turnsAway++;
        }
        return(distanceMap);
    }
Ejemplo n.º 17
0
 public static void GetTileByPosition(Point position, out float x, out float y, string continentId = "")
 {
     if (string.IsNullOrEmpty(continentId))
     {
         continentId = Usefuls.ContinentNameMpq;
     }
     if (_pather == null)
     {
         _pather = new Pather(continentId);
     }
     if (_pather.Continent != continentId)
     {
         _pather.Dispose();
         _pather = new Pather(continentId);
     }
     _pather.GetTileByLocation(position, out x, out y);
 }
Ejemplo n.º 18
0
    public static List <Vector2> GetAIMovePositions(Unit unit, bool forAttack)
    {
        List <Vector2> movePositions = new List <Vector2>();

        if (unit.behaviour == Behaviour.hold ||
            (unit.behaviour == Behaviour.defend && !forAttack) ||
            (unit.grouping == UnitGroup.artillery && forAttack))
        {
            GetCoordsToMoveHighlight(unit);
            movePositions.Add(unit.xy);
        }
        else
        {
            movePositions = Pather.GetCoordsToMoveHighlight(unit);
        }
        return(movePositions);
    }
Ejemplo n.º 19
0
        /// <summary>
        /// Cleans the paths.
        /// </summary>
        /// <returns>Returns a set of Paths where all points that are closer than tolerance are merged.</returns>
        /// <param name="paths">Paths.</param>


        public static Paths cleanPaths(Paths paths, int tolerance = 10)
        {
            return(Pather.cleanPaths(paths, tolerance));

            //return AXClipperLib.Clipper.CleanPolygons(paths, tolerance);
            //return paths;
//
//			// check the distance for between conscecutive IntPoints and if closer than tolerance replace the two points witha  median point.
//			Paths retPaths = new Paths();
//			foreach (Path path in paths)
//			{
//
//
//
//			}
//			return retPaths;
        }
Ejemplo n.º 20
0
    /// <summary>
    /// Finds the first path leading from start to the closest reachable Tile to target using optimism. Computationally less intensive.
    /// </summary>
    /// <remarks>
    /// Tiles closer to the target are favored.
    /// </remarks>
    /// <param name="start">Starting Tile</param>
    /// <param name="target">Target Tile</param>
    /// <param name="result">Object containing the results.</param>
    /// <param name="pather">Determines if you can move over an Edge.</param>
    /// <returns>True if target was reached</returns>
    public static bool FirstPath(Tile start, Tile target, out PathResult result, Pather pather = null)
    {
        pather ??= Pathers.Phased;

        var minDist = Game.grid.Distance(start, target);
        var closest = start;

        var tiles = new Dictionary <Tile, FieldItem>()
        {
            { start, new FieldItem(0, 0, null) }
        };
        var frontier = new FastPriorityQueue <SinglePriorityNode>(Game.grid.tiles.Count);

        frontier.Enqueue(new SinglePriorityNode(start), 1);

        if (start != target)
        {
            while (frontier.Count != 0)
            {
                var tile = frontier.Dequeue().tile;
                foreach (var(neighbor, edge) in tile.NeighborsWithEdges())
                {
                    var cost = tiles[tile].cost + 1;
                    if (pather(tile, edge, neighbor) && (!tiles.TryGetValue(neighbor, out var other)))
                    {
                        tiles[neighbor] = new FieldItem(cost, 0, tile);
                        var dist     = Game.grid.Distance(neighbor, target);
                        var priority = dist;
                        frontier.Enqueue(new SinglePriorityNode(neighbor), priority);
                        if (dist < minDist)
                        {
                            minDist = dist;
                            closest = neighbor;
                            if (closest == target)
                            {
                                result = new PathResult(start, tiles, closest);
                                return(true);
                            }
                        }
                    }
                }
            }
        }
        result = new PathResult(start, tiles, closest);
        return(closest == target);
    }
Ejemplo n.º 21
0
        /// <summary>
        /// check that settings exist for the appl.
        /// </summary>
        /// <returns></returns>
        public static bool SettingsExist()
        {
            ClientSettings settings    = new ClientSettings();
            string         applDataDir = ClientSettings.BuildApplDataDir();

            Pather.AssureDirectoryExists(applDataDir);
            string applStateFileName = "ClientSettings.xml";
            string applStatePath     = Path.Combine(applDataDir, applStateFileName);

            if (System.IO.File.Exists(applStatePath) == true)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 22
0
        /// <summary>
        /// return the directory info of a file or folder.
        /// </summary>
        /// <param name="InFileName"></param>
        /// <returns></returns>
        public FtpDirEntry GetFileInfo(string InFileName)
        {
            FtpDirEntry info     = null;
            AcFileType  fileType = AcFileType.None;

            if (Pather.IsDirectoryName(InFileName) == true)
            {
                fileType = AcFileType.Folder;
            }
            else
            {
                fileType = AcFileType.File;
            }

            info = GetFileInfo(InFileName, fileType);

            return(info);
        }
Ejemplo n.º 23
0
    public void Reset()
    {
        Pather pather = mesh.GetComponent <Pather>();

        if (pather != null)
        {
            path            = pather.getPath(gameObject, end);
            currentWaypoint = 0;
            distance        = 0;
            time            = 0;

            if (path != null && path.Length > 1)
            {
                distance = Vector3.Distance(path[currentWaypoint], path[currentWaypoint + 1]);
                transform.LookAt(path[currentWaypoint + 1]);
            }
        }
    }
Ejemplo n.º 24
0
        /// <summary>
        /// check that settings exist for the appl.
        /// </summary>
        /// <returns></returns>
        public static bool SettingsExist()
        {
            TextDemoSettings settings    = new TextDemoSettings();
            string           applDataDir = TextDemoSettings.BuildApplDataDir();

            Pather.AssureDirectoryExists(applDataDir);
            string applStateFileName = "TextDemoSettings.xml";
            string applStatePath     = Path.Combine(applDataDir, applStateFileName);

            if (File.Exists(applStatePath) == true)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 25
0
 public IEnumerator CheckAttacks()
 {
     attackFound = false;
     for (int i = 0; i < units.Count; i++)
     {
         Unit unit = units[i];
         if (unit.Equals(null))
         {
             break;
         }
         // try capture
         if (GridManager.CanUnitCapture(unit))
         {
             Building building = (Building)GridManager.GetTile(unit.xy);
             if (building.controlPoints <= unit.HealthInt())
             {
                 CaptureBuilding(unit);
                 unitsToRemove.Add(unit);
                 unit.Deactivate();
                 break;
             }
         }
         Vector2 attackPosition = new Vector2();
         Unit    target         = ChooseTarget(unit, ref attackPosition);
         if (target)
         {
             moving = true;
             Pather.GetCoordsToMoveHighlight(unit);
             GridManager.MoveUnitAlongPath(unit, attackPosition, Pather.GetPathToPoint(attackPosition), () => {
                 moving = false;
             });
             while (moving)
             {
                 yield return(new WaitForSeconds(.1f));
             }
             CompleteAttack(unit, target);
             attackFound = true;
         }
     }
     RemoveUsedUnits();
     inSubCoroutine = false;
 }
Ejemplo n.º 26
0
 /// <summary>
 /// </summary>
 /// <param name="point"></param>
 /// <param name="strict"></param>
 /// <returns></returns>
 public static float GetZPosition(Point point, bool strict = false)
 {
     try
     {
         if (_pather == null)
         {
             _pather = new Pather(Usefuls.ContinentNameMpq);
         }
         if (_pather.Continent != Usefuls.ContinentNameMpq)
         {
             _pather.Dispose();
             _pather = new Pather(Usefuls.ContinentNameMpq);
         }
         return(_pather.GetZ(point, strict));
     }
     catch (Exception exception)
     {
         Logging.WriteError("GetZPosition(Point point): " + exception);
     }
     return(0);
 }
Ejemplo n.º 27
0
        /// <summary>
        /// make sure the current working directory is the ScopePath from
        /// the CompleteHomePath.
        /// This method assumes that the CurrentPath is accurate with respect
        /// to the working directory of the FTP client.
        /// </summary>
        /// <param name="InPath"></param>
        /// <returns></returns>
        public FtpResponse AssureCurrentDirectory(ScopePath InPath)
        {
            FtpResponse resp     = null;
            string      comPath  = null;
            int         comDepth = 0;

            // build the desired full path.
            FullPath rqsFull  = CompleteHomePath + InPath;
            int      rqsDepth = rqsFull.Depth;

            // step back the CurrentPath to a subset of requested path.
            while (true)
            {
                Pather.GetCommonPath(
                    out comPath, out comDepth,
                    rqsFull.ToString(), CurrentPath.ToString());
                if (comDepth < CurrentPath.Depth)
                {
                    resp = ChangeDirectory("..");
                }
                else
                {
                    break;
                }
            }

            string filePath = Pather.GetFilePath(rqsFull.ToString(), CurrentPath.ToString());

            if (filePath.Length > 0)
            {
                if (mCurrentPath.IsEmpty == true)
                {
                    filePath = Pather.AssureRootSlash(filePath, '\\');
                }
                ChangeDirectory(filePath);
            }

            return(resp);
        }
Ejemplo n.º 28
0
        //[Route("CreatePadreHijos")]
        public ActionResult CreatePadreHijos(string json)
        {
            /* foreach (var itempadreshijos in listpadreshijos)
             * {
             *
             *   var recordpadreshijos = new Padreshijos()
             *   {
             *       Padreid = itempadreshijos.listapatherson.Padreid
             *       Childid = itempadreshijos.Childid
             *   };
             *
             *   dbSchoolSunday.Padreshijos.Add(recordpadreshijos);
             *   dbSchoolSunday.SaveChanges();
             * }*/
            Pather pathersons = JsonConvert.DeserializeObject <Pather>(json);

            foreach (var itempadreshijos in pathersons.listapatherson)
            {
                // Console.WriteLine("Padreid: {0}, Childid: {1}", item.Padreid, item.Childid);
                var recordpadreshijos = new Padreshijos()
                {
                    Padreid = itempadreshijos.Padreid,
                    Childid = itempadreshijos.Childid
                };
                dbSchoolSunday.Padreshijos.Add(recordpadreshijos);
            }
            try
            {
                if (dbSchoolSunday.SaveChanges() > 0)
                {
                    return(Json(new { error = false, message = "Order saved successfully" }));
                }
            }
            catch (Exception ex)
            {
                return(Json(new { error = true, message = ex.Message }));
            }
            return(RedirectToAction(nameof(IndexPather)));
        }
Ejemplo n.º 29
0
        public void TestNeo()
        {
            System.Collections.Generic.List <Hop> walkHops;

            var Place01 = new Vector3(1044.314f, -1238.926f, 179.1343f); // Triger the load of tile 34_30
            var Place02 = new Vector3(1044.677f, -1049.89f, 210.6527f);  // Trigger the load of tile 33_30

            Pather = new Pather(@iMeshesPath, MockConnectionHandler);
            // costs settings
            Pather.Filter.SetAreaCost((int)PolyArea.Water, 4);
            Pather.Filter.SetAreaCost((int)PolyArea.Terrain, 1);
            Pather.Filter.SetAreaCost((int)PolyArea.Road, 1);
            Pather.Filter.SetAreaCost((int)PolyArea.Danger, 20);
            Console.WriteLine("Place01 -> Place02");
            TryPath(Place01, Place02, out walkHops, true);
            WriteFile("Place01-Place02.xml", walkHops, Place02);

            //meshDatabase.MpqManager.Initialize();
            Stream OutFileStream = System.IO.File.OpenWrite("AreaTable.dbc");
            Stream input         = meshDatabase.MpqManager.GetFile("DBFilesClient\\AreaTable.dbc");

            CopyStream(input, OutFileStream);
        }
Ejemplo n.º 30
0
        private void ButtonStart_Click(object sender, EventArgs e)
        {
            Pather Pathfinder = new Pather();
            Robot  Rover      = new Robot(0, 3);
            string text       = "";

            Pathfinder.GenerateMap(0, 3);
            richPathCost.Text += "Map Done" + Environment.NewLine;
            Pathfinder.GenerateCostMap(Rover, 250, 250);
            richPathCost.Text += "Cost Map Done" + Environment.NewLine;
            Pathfinder.FindClosedPath();
            richPathCost.Text += "Pathing Done" + Environment.NewLine;
            foreach (var tile in Pathfinder.ShortestPath)
            {
                text += $"{tile.X }, {tile.Y}\r\n";
            }
            text += "Blocked coords";
            foreach (var tile in Pathfinder.BlockedList)
            {
                text += $"{tile.X }, {tile.Y}\r\n";
            }
            richPathCost.Text += text;
        }
Ejemplo n.º 31
0
        public void CrossingTest()
        {
            //MpqManager.Initialize("I:\\WoW");
            byte[] dataA, dataB;

            // Build tile A
            {
                var builder = new TileBuilder("Azeroth", 31, 49);
                builder.PrepareData(new ConsoleLog());
                dataA = builder.Build();
                Assert.IsNotNull(dataA);
            }

            // Build tile B
            {
                var builder = new TileBuilder("Azeroth", 32, 49);
                builder.PrepareData(new ConsoleLog());
                dataB = builder.Build();
                Assert.IsNotNull(dataB);
            }

            // Load into mesh
            var pather = new Pather("X:\\Meshes\\Azeroth");

            Assert.IsTrue(pather.LoadTile(dataA));
            Assert.IsTrue(pather.LoadTile(dataB));

            // and try pathing, coords from AzerothMeshTest -> TileCrossing which is a non-building version of this
            var start = new Vector3(-9467.8f, 64.2f, 55.9f);
            var end   = new Vector3(-9248.9f, -93.35f, 70.3f);
            var path  = pather.FindPath(start, end);

            // check result
            Assert.IsNotNull(path);
            Assert.Greater(path.Count, 0);
            Assert.Less((end - path[path.Count - 1].Location).Length(), 3f);
        }
Ejemplo n.º 32
0
        /// <summary>
        /// returns the last change date of file or folder.
        /// </summary>
        /// <param name="InFileName"></param>
        /// <returns></returns>
        public DateTime GetChangeDateTime(string InFileName)
        {
            DateTime chgDttm = new DateTime(1, 1, 1);

            string fileName = InFileName;

            if (Pather.IsDirectoryName(fileName) == true)
            {
                fileName = fileName + "*";
            }

            FtpResponse_DirList dl = this.GetDirList(fileName);

            foreach (FtpDirEntry de in dl.RcvdDirList)
            {
                if (de.EntryName.ToLower( ) == InFileName.ToLower( ))
                {
                    chgDttm = de.ChgDateTime;
                    break;
                }
            }

            return(chgDttm);
        }
Ejemplo n.º 33
0
        public void ShouldPathToNeighbour()
        {
            var pather = new Pather<int>(_graph);
            var path = pather.CalculateShortesPath(one, two).ToArray();

            path.Count().ShouldBe(2);

            path[0].ShouldBe(one);
            path[1].ShouldBe(two);
        }
Ejemplo n.º 34
0
        public void TestNeo()
        {
            System.Collections.Generic.List <Hop> walkHops;

            var NorthShire = new Vector3(-8913.293f, -137.431f, 80.78545f);  // redone
            var Goldshire  = new Vector3(-9465.505f, 73.8429f, 56.57315f);   // redone
            var Westfall   = new Vector3(-10507.8f, 1044.024f, 60.51819f);   // redone
            var LakeShire  = new Vector3(-9245.273f, -2211.097f, 66.18014f); // redone

            var IronForgeFly    = new Vector3(-4821.13f, -1152.4f, 502.295f);
            var LocModanCityFly = new Vector3(-5424.85f, -2929.87f, 347.645f);

            var Dustwood        = new Vector3(-10557.85f, -1147.258f, 28.03498f); // redone
            var BootyBay        = new Vector3(-14449.93f, 472.5713f, 15.21084f);  // redone
            var inBootyBay      = new Vector3(-14420.53f, 479.2f, 15.21084f);     // computed !!
            var PassPointStrong = new Vector3(-13050.81f, -363.3668f, 34.68807f); // redone
            var BootyTunnel     = new Vector3(-14247.34f, 328.0565f, 24.18314f);

            var StormwindDwarf   = new Vector3(-8373.929f, 622.0675f, 95.19361f);
            var etage            = new Vector3(-9456.81f, 29.361f, 63.9038f);
            var Stormgriffon     = new Vector3(-8835.36f, 490.4935f, 109.9794f);
            var HarrisonJonesSTW = new Vector3(-8295.137f, 232.502f, 155.3478f);

            var AzoraDown = new Vector3(-9517.778f, -680.7117f, 63.0045f);
            var AzoraTop  = new Vector3(-9551.597f, -721.6193f, 99.12933f);

            Pather = new Pather(@iMeshesPath, MockConnectionHandler);
            // costs settings
            Pather.Filter.SetAreaCost((int)PolyArea.Water, 4);
            Pather.Filter.SetAreaCost((int)PolyArea.Terrain, 1);
            Pather.Filter.SetAreaCost((int)PolyArea.Road, 1);
            Pather.Filter.SetAreaCost((int)PolyArea.Danger, 20);
            //Pather.LoadAllTiles();

            Console.WriteLine("Northshire -> Goldshire");
            TryPath(NorthShire, Goldshire, out walkHops, true);
            WriteFile("Northshire-Goldshire.xml", walkHops, Goldshire);

            // works

            /*
             * Console.WriteLine("Northshire -> Westfall");
             * TryPath(NorthShire, Westfall, out walkHops, true);
             * WriteFile("Northshire-Westfall.xml", walkHops, Westfall);
             */
            // works

            /*
             * Console.WriteLine("Goldshire -> Stormwind Dwarf");
             * TryPath(Goldshire, StormwindDwarf, out walkHops, true);
             * WriteFile("Goldshire-StormwindDwarf.xml", walkHops, StormwindDwarf);
             */
            // very small to test height & radius

            /*
             * Console.WriteLine("Goldshire -> Lion Pride upstair");
             * TryPath(Goldshire, etage, out walkHops, true);
             * WriteFile("Goldshire-LionPride.xml", walkHops, etage);
             */
            // very small to test height & radius

            /*
             * Console.WriteLine("Goldshire -> Stormgriffon");
             * TryPath(Goldshire, Stormgriffon, out walkHops, true);
             * WriteFile("Goldshire-Stormgriffon.xml", walkHops, Stormgriffon);
             */
            // another stormwind test

            /*
             * Console.WriteLine("Goldshire -> Harrison Jones STW");
             * TryPath(Goldshire, HarrisonJonesSTW, out walkHops, true);
             * WriteFile("Goldshire-HarrisonJonesSTW.xml", walkHops, HarrisonJonesSTW);
             */
            // Azora tower pb on tile 33/50 it does not go to the last stair (missing 7.5 in height)

            /*
             * Console.WriteLine("AzoraDown -> Azora tower top");
             * TryPath(AzoraDown, AzoraTop, out walkHops, true);
             * WriteFile("AzoraDown-AzoraTop.xml", walkHops, AzoraTop);
             */
            // works

            /*
             * Console.WriteLine("Goldshire -> Lakeshire");
             * TryPath(Goldshire, LakeShire, out walkHops, true);
             * WriteFile("Goldshire-Lakeshire.xml", walkHops, LakeShire);
             */
            // works

            /*
             * Console.WriteLine("Northshire -> Lakeshire");
             * TryPath(NorthShire, LakeShire, out walkHops, true);
             * WriteFile("Northshire-Lakeshire.xml", walkHops, LakeShire);
             */
            // works

            /*
             * Console.WriteLine("Goldshire -> Sombre Conté");
             * TryPath(Goldshire, Dustwood, out walkHops, true);
             * WriteFile("Goldshire-Dustwood.xml", walkHops, Dustwood);
             */
            // ??

            /*
             * Console.WriteLine("Sombre Conté -> Booty Bay");
             * TryPath(Dustwood, BootyBay, out walkHops, true);
             * WriteFile("Dustwood-BootyBay.xml", walkHops, BootyBay);
             */
            // works

            /*
             * Console.WriteLine("Sombre Conté -> Passage 2 strong");
             * TryPath(Dustwood, PassPointStrong, out walkHops, true);
             * WriteFile("Dustwood-PassPointStrong.xml", walkHops, PassPointStrong);
             */
            //

            /*
             * Console.WriteLine("Passage 2 strong -> Booty Tunnel");
             * TryPath(PassPointStrong, BootyTunnel, out walkHops, true);
             * WriteFile("PassPointStrong-BootyTunnel.xml", walkHops, BootyTunnel);
             */
            // fails because cannot enter the tunnel

            /*
             * // pb tile not 31,59
             * Console.WriteLine("Booty Tunnel -> Booty bay");
             * TryPath(BootyTunnel, BootyBay, out walkHops, true);
             * WriteFile("Booty Tunnel-BootyBay.xml", walkHops, BootyBay);
             */
            // works

            /*
             * Console.WriteLine("Goldshire -> Booty Tunnel");
             * TryPath(Goldshire, BootyTunnel, out walkHops, true);
             * WriteFile("Goldshire-BootyTunnel.xml", walkHops, BootyTunnel);
             */
            // works

            /*
             * Console.WriteLine("Goldshire -> PassPointStrong");
             * TryPath(Goldshire, PassPointStrong, out walkHops, true);
             * WriteFile("Goldshire-PassPointStrong.xml", walkHops, PassPointStrong);
             */
            // unsure coords

            Console.WriteLine("Ironforge (Fly-Master) -> Loc Modan City (Fly-Master Thorgrum Borrelson)");
            TryPath(IronForgeFly, LocModanCityFly, out walkHops, true);
            WriteFile("Ironforge-Loc Modan City.xml", walkHops, LocModanCityFly);

            Console.WriteLine("Goldshire -> Ironforge");
            TryPath(Goldshire, IronForgeFly, out walkHops, true);
            if ((IronForgeFly - walkHops[walkHops.Count - 1].Location).Length() > 5f)
            {
                int limit = (int)(walkHops.Count * 0.75f);
                Console.WriteLine("Incomplete result of {0} node, restarting at node {1}", walkHops.Count, limit);
                WriteFile("Goldshire-Ironforge.xml", walkHops, IronForgeFly); //, limit);
                TryPath(walkHops[limit].Location, IronForgeFly, out walkHops, true);
                WriteFile("Goldshire-Ironforge.xml", walkHops, IronForgeFly, 0, true);
            }

            //Pather.Filter.ExcludeFlags = (ushort)(PolyFlag.FlightMaster);

            /*Pather = new Pather("X:\\Meshes\\Azeroth", MockConnectionHandler); // accept alliance fly
             * Console.WriteLine("Goldshire -> Ironforge by fly");
             * TryPath(Goldshire, IronForgeFly, out walkHops, true);
             * WriteFile("Goldshire-Ironforge_byFly.xml", walkHops, IronForgeFly);*/
        }
Ejemplo n.º 35
0
        public void ShouldFindShortestPath2()
        {
            var pather = new Pather<int>(_graph);
            var path = pather.CalculateShortesPath(one, seven).ToArray();

            path[0].ShouldBe(one);
            path[1].ShouldBe(two);
            path[2].ShouldBe(four);
            path[3].ShouldBe(seven);
        }
Ejemplo n.º 36
0
 public Pather.Graph.Path CalculatePath(Pather.Graph.Location iOrigin, Pather.Graph.Location iDestination)
 {
     return CalculatePath(iOrigin, iDestination, 5F);
 }
Ejemplo n.º 37
0
 public Pather.Graph.Path CalculatePath(Pather.Graph.Location iOrigin, Pather.Graph.Location iDestination, float charHight, float charRadius)
 {
     return CalculatePath(iOrigin, iDestination, 5f, charHight, charRadius);
 }
Ejemplo n.º 38
0
 public Pather.Graph.Path CalculatePath(Pather.Graph.Location iOrigin, Pather.Graph.Location iDestination, float sDist, float charHight, float charRadius)
 {
     Pather.Graph.Path mypath = world.CreatePath(iOrigin, iDestination, sDist, charHight, charRadius);
     world.Save();
     return mypath;
 }