Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement of the directory structure #2

Open
alexanderwendt opened this issue Sep 3, 2018 · 0 comments
Open

Enhancement of the directory structure #2

alexanderwendt opened this issue Sep 3, 2018 · 0 comments

Comments

@alexanderwendt
Copy link

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());
		}
	}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant