void OnDrawGizmos()
    {
        if (!this.gameObject.activeSelf || !this.enabled)
        {
            return;
        }
        if (!showGizmos)
        {
            return;
        }
        Gizmos.color = gizmoColor;
        for (int i = 0; i < pathPoints.Count; i++)
        {
            if (i != pathPoints.Count - 1)
            {
                Gizmos.DrawLine(pathPoints[i].position, pathPoints[i + 1].position);
            }
            else if (pathType.Equals(PathType.loop))
            {
                Gizmos.DrawLine(pathPoints[i].position, pathPoints[0].position);
            }
        }

        var targetPosition = pathPoints[_targetPathPointIndex].position;

        Gizmos.DrawLine(targetPosition, targetPosition + new Vector3(1, 1));
        Gizmos.DrawLine(targetPosition, targetPosition + new Vector3(-1, 1));
        Gizmos.DrawLine(targetPosition, targetPosition + new Vector3(-1, -1));
        Gizmos.DrawLine(targetPosition, targetPosition + new Vector3(1, -1));
    }
示例#2
0
        public Dictionary <string, TfsFileData> GetTFSProjectInfo(string Path, PathType PathType, int RecursionLevel = 2)
        {
            Dictionary <string, TfsFileData> result = null;

            if (PathType.Equals(PathType.File) && File.Exists(Path))
            {
                result = GetTFSProjectInfo(Path, RecursionType.None);
            }
            else if (PathType.Equals(PathType.Directory) && Directory.Exists(Path))
            {
                result = GetTFSProjectInfo(Path, (RecursionType)RecursionLevel);
            }
            else
            {
                throw new Exception(string.Format("{0} {1} does not exist.", (PathType)PathType, Path));
            }

            return(result);
        }
示例#3
0
        public bool UndoPendingChange(string Path, PathType PathType, int RecursionLevel = 2)
        {
            bool result = false;


            //CommonHelper.WriteMessage(string.Format("Check that {0} {1} exists.", (PathType)PathType, Path));

            if (PathType.Equals(PathType.File) && File.Exists(Path))
            {
                result = UndoPendingChange(Path, RecursionType.None);
            }
            else if (PathType.Equals(PathType.Directory) && Directory.Exists(Path))
            {
                result = UndoPendingChange(Path, (RecursionType)RecursionLevel);
            }
            else
            {
                throw new Exception(string.Format("{0} {1} does not exist.", (PathType)PathType, Path));
            }

            return(result);
        }
示例#4
0
        public bool CheckIn(string Path, PathType PathType, int RecursionLevel = 2, string Comment = "I'm too lazy to write my own comment")
        {
            bool result = false;


            //CommonHelper.WriteMessage(string.Format("Check that {0} {1} exists.", (PathType)PathType, Path));

            if (PathType.Equals(PathType.File) && File.Exists(Path))
            {
                result = CheckIn(Path, RecursionType.None, Comment);
            }
            else if (PathType.Equals(PathType.Directory) && Directory.Exists(Path))
            {
                result = CheckIn(Path, (RecursionType)RecursionLevel, Comment);
            }
            else
            {
                throw new Exception(string.Format("{0} {1} does not exist.", (PathType)PathType, Path));
            }


            return(result);
        }
示例#5
0
        // TODO: support for DynamicParameters (calling the providers appropriate method)

        protected override void ProcessRecord()
        {
            var runtime = ProviderRuntime;

            foreach (var curPath in InternalPaths)
            {
                // check if only syntactical check
                if (IsValid.IsPresent)
                {
                    WriteObject(SessionState.Path.IsValid(curPath, runtime));
                    continue;
                }

                // otherwise we might check if it's a container
                if (PathType.Equals(TestPathType.Container))
                {
                    WriteObject(InvokeProvider.Item.IsContainer(curPath, ProviderRuntime));
                    continue;
                }

                // alrgiht, either any item or leaf, so check if it exists
                if (!InvokeProvider.Item.Exists(curPath, ProviderRuntime))
                {
                    WriteObject(false);
                    continue;
                }

                // if we check against leaf, make sure it's not a container
                if (PathType.Equals(TestPathType.Leaf))
                {
                    WriteObject(!InvokeProvider.Item.IsContainer(curPath));
                    continue;
                }

                // otherwise we check against any object. As it exists, we can just write true
                WriteObject(true);
            }
        }