Exemplo n.º 1
0
        public void Run(DirectoryInfo source, DirectoryInfo output, string verbosity)
        {
            SetupLogger(verbosity);
            var workspace = GitreeWorkspace.CreateFromPath(source.FullName);

            Log.Warning("This command is a Work In Progress. It may not work correctly.");
            Log.Debug("Source resolved to {RootPath}", workspace.RootPath);
            Log.Debug("Destination resolved to {Destination}", output);
            output.Create();
            Log.Information("Converting...");
            foreach (var datafile in workspace.Datafiles)
            {
                var fileDir = new FileInfo(datafile.Filepath).Directory;
                Log.Debug("Converting Gitree '{SubfolderName}' from {DirRef}", fileDir.Name, fileDir.Parent.FullName);
                Log.Verbose("- Loading Gitree...");
                var node = datafile.GetData();
                Log.Verbose("- Loading finished. Saving XML file...");
                var extension = node.GetXmlDocumentKindOrUnknown().GetXmlFileExtension();
                var filename  = Path.Combine(output.FullName, fileDir.Name + extension);
                using (var fileStream = File.Create(filename))
                {
                    node.Serialize(fileStream);
                }
                Log.Verbose("- Saved.");
            }
            Log.Information("Finished converting.");
        }
Exemplo n.º 2
0
 private static IWorkspace ReadWorkspaceFromConfig(ProjectConfigurationInfo info)
 {
     return(info.Configuration.FormatProvider switch
     {
         ProjectFormatProviderType.Gitree => GitreeWorkspace.CreateFromConfigurationInfo(info),
         ProjectFormatProviderType.BattleScribeXml => XmlWorkspace.CreateFromConfigurationInfo(info),
         _ => throw new InvalidOperationException(
             $"Unknown {nameof(ProjectConfiguration.FormatProvider)}:" +
             $" {info.Configuration.FormatProvider}"),
     });
Exemplo n.º 3
0
 public GitreeRootFindingVisitor(ProjectConfigurationInfo info, GitreeWorkspace workspace)
 {
     Info      = info;
     Workspace = workspace;
 }