コード例 #1
0
        protected override ExitCode ExecuteFileTask()
        {
            string target     = Arguments.GetOption <string>("target", "t");
            int    redirector = Array.IndexOf(Arguments.Targets, ">");

            if (target == null && redirector == -1)
            {
                ResultLog.WriteLine(string.Join(" ", Arguments.Targets));
                return(ExitCode.Success);
            }

            if (target == null)
            {
                if (redirector == Arguments.Targets.Length - 1)
                {
                    StatusLog.WriteLine(WriteStyle.Error, XFileStrings.ErrorNoTargetSpecified);
                    return(ExitCode.InvalidArgument);
                }

                target = Arguments.Targets[redirector + 1];
            }

            target = GetFullPath(target);
            FileService.WriteAllText(target, string.Join(" ", redirector == -1 ? Arguments.Targets : Arguments.Targets.Take(redirector)));

            return(ExitCode.Success);
        }
コード例 #2
0
        protected override ExitCode ExecuteFileTask()
        {
            foreach (var stream in ExtendedFileService.GetAlternateStreamInformation(GetFullTargetPath()))
            {
                ResultLog.WriteLine($"Stream '{stream.Name}', Size {stream.Size}");
            }

            return(ExitCode.Success);
        }
コード例 #3
0
        protected override ExitCode ExecuteFileTask()
        {
            foreach (string pathName in ExtendedFileService.GetVolumeMountPoints(Arguments.Target))
            {
                ResultLog.WriteLine(pathName);
            }

            return(ExitCode.Success);
        }
コード例 #4
0
        protected override ExitCode ExecuteFileTask()
        {
            foreach (string drive in ExtendedFileService.GetLogicalDriveStrings())
            {
                ResultLog.WriteLine(drive);
            }

            return(ExitCode.Success);
        }
コード例 #5
0
ファイル: TypeTask.cs プロジェクト: JeremyKuhne/XTask
        protected override ExitCode ExecuteFileTask()
        {
            using (var reader = FileService.CreateReader(GetFullTargetPath()))
            {
                string nextLine = null;
                while ((nextLine = reader.ReadLine()) != null)
                {
                    ResultLog.WriteLine(nextLine);
                }
            }

            return(ExitCode.Success);
        }
コード例 #6
0
        protected override ExitCode ExecuteFileTask()
        {
            string target = Arguments.Target;

            if (target == null)
            {
                target = ".";
            }

            string fullPath = ExtendedFileService.GetFinalPath(GetFullPath(target));

            FileService.CurrentDirectory = fullPath;
            ResultLog.WriteLine(FileService.CurrentDirectory);

            return(ExitCode.Success);
        }
コード例 #7
0
        protected override ExitCode ExecuteFileTask()
        {
            string target = Arguments.Target;

            target = string.IsNullOrWhiteSpace(target) ? null : target;

            var targetPaths =
                from path in ExtendedFileService.QueryDosDeviceNames(target)
                orderby path
                select path;

            int count = 0;

            foreach (string path in targetPaths)
            {
                count++;
                ResultLog.WriteLine(path);
            }

            StatusLog.WriteLine("\nFound {0} paths", count);

            return(ExitCode.Success);
        }
コード例 #8
0
ファイル: VolumeNameTask.cs プロジェクト: JeremyKuhne/XTask
        protected override ExitCode ExecuteFileTask()
        {
            ResultLog.WriteLine(ExtendedFileService.GetVolumeName(Arguments.Target));

            return(ExitCode.Success);
        }
コード例 #9
0
 protected override ExitCode ExecuteFileTask()
 {
     ResultLog.WriteLine(ExtendedFileService.GetMountPoint(GetFullTargetPath()));
     return(ExitCode.Success);
 }
コード例 #10
0
ファイル: FullPathTask.cs プロジェクト: JeremyKuhne/XTask
 protected override ExitCode ExecuteFileTask()
 {
     ResultLog.WriteLine(GetFullTargetPath());
     return(ExitCode.Success);
 }
コード例 #11
0
 protected override ExitCode ExecuteFileTask()
 {
     ResultLog.WriteLine(FileService.CurrentDirectory);
     return(ExitCode.Success);
 }
コード例 #12
0
ファイル: TestTask.cs プロジェクト: JeremyKuhne/XTask
        protected override ExitCode ExecuteFileTask()
        {
            ResultLog.WriteLine(ExtendedFileService.GetDriveLetter(FileService, GetFullTargetPath()));

            return(ExitCode.Success);
        }