コード例 #1
0
        private async Task Validate(List <string> errors)
        {
            if (SourceFile != null && !MarkdownProjectRoot.FileExists(SourceFile))
            {
                errors.Add($"File not found: {SourceFile.Value}");
            }

            if (string.IsNullOrEmpty(Package) && Project == null)
            {
                errors.Add("No project file or package specified");
            }

            if (Package != null)
            {
                try
                {
                    var package = await PackageRegistry.Find <IPackage>(Package);
                }
                catch (PackageNotFoundException e)
                {
                    errors.Add(e.Message);
                    return;
                }
            }

            if (Project != null)
            {
                var packageName = GetPackageNameFromProjectFile(Project);

                if (packageName == null)
                {
                    errors.Add($"No project file could be found at path {MarkdownProjectRoot.GetFullyQualifiedPath(new RelativeDirectoryPath("."))}");
                }
            }
        }
コード例 #2
0
        private string GetDestinationFileAbsolutePath()
        {
            var file = DestinationFile ?? SourceFile;

            return(file == null
                       ? string.Empty
                       : MarkdownProjectRoot
                   .GetFullyQualifiedPath(file)
                   .FullName);
        }
コード例 #3
0
 private string GetSourceFileAbsolutePath()
 {
     return(MarkdownProjectRoot.GetFullyQualifiedPath(SourceFile).FullName);
 }