public static void ImportPowerBIModelFromSourceFiles(SourceControlOptionsRoot options) { string fileName = options.PowerBITemplatePath; string sourcePath = options.PowerBISourceControlPath; if (!Directory.Exists(sourcePath)) { Console.WriteLine($"PowerBI Template Source folder '{sourcePath}' does not exist"); return; } //make a clone of the folder we working with as we want to change the encodings of a couple of files string clonePath = new DirectoryInfo(sourcePath).Parent.FullName + "\\clone"; deleteDirectory(clonePath); copyFilesRecursively(sourcePath, clonePath); foreach (var option in options.SourceControlOptions) { convertSourceFilesToWorkWithPowerBI(clonePath, option); } //generate the powerbi file File.Delete(fileName); ZipUtil.CreateArchive(clonePath, fileName); //delete the clone folder as we done with it deleteDirectory(clonePath); }
public static void ExportPowerBIModelToSourceFiles(SourceControlOptionsRoot options) { string fileName = options.PowerBITemplatePath; string destinationPath = options.PowerBISourceControlPath; if (!File.Exists(fileName)) { Console.WriteLine($"PowerBI Template '{fileName}' does not exist"); return; } //export to folder ZipUtil.ExtractArchive(destinationPath, fileName); //adjust the json files to work better with source control foreach (var option in options.SourceControlOptions) { convertSourceFilesToWorkWithGit(destinationPath, option); } }