Skip to content

Enhancement of the directory structure #2

@alexanderwendt

Description

@alexanderwendt

In order to prevent to put 100 dfq-files in the execution folder and get the json results in the same folder, it might be an idea to use a separate source and result folder. If you would like to do that, you might want to look at the method below. The files are put in the [execution folder]/dfq_source and the results are written into [execution folder]/json_result.

static void Main(string[] args)
{
var converter = new DfqConverter();

		var location = System.Reflection.Assembly.GetEntryAssembly().Location;
		var directory = Path.GetDirectoryName(location);

        var directorySource = directory + "\\dfq_source";
        var directoryResult = directory + "\\json_result";

		var files = Directory.EnumerateFiles(directorySource, "*.dfq");

		foreach (var file in files)
		{
            
            converter.Convert(file);
            
            string newPath = directoryResult + "\\" + Path.GetFileNameWithoutExtension(file) + ".json";
            

            File.WriteAllText(newPath, converter.GetJson());
		}
	}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions