private static void convertSourceFilesToWorkWithGit(string destinationPath, SourceControlOption option) { //get full file path string filePath = Path.Combine(destinationPath, option.FileName); //check if unneeded file if (option.DeleteFile) { File.Delete(filePath); return; } //if the file we working with is an archive extract that file if (option.TreatAsArchive) { string archivePath = Path.Combine(destinationPath, option.FileName); string archiveExtractDestinationPath = Path.Combine(destinationPath, option.ArchiveDestinationPath); ZipUtil.ExtractArchive(archiveExtractDestinationPath, archivePath); } if (option.IsJsonFile) { //convert json string to jsonObjects string jsonString = File.ReadAllText(filePath, Encoding.Unicode); JObject jsonObjects = JObject.Parse(jsonString); //remove useless properties var propertiesToRemove = option.PropertiesToRemove; JsonUtil.RemoveJsonProperties(jsonObjects, propertiesToRemove); //expand properties so we can see changes in them var propertiesToExpand = option.PropertiesToExpand; JsonUtil.ExpandJsonProperties(jsonObjects, propertiesToExpand); //extract all the Dax information to a flat file if (option.ExportDaxToFile) { string daxInformation = DaxUtil.GetDaxData(jsonObjects); string daxStorageLocation = Path.Combine(destinationPath, "DaxMeasures.md"); File.WriteAllText(daxStorageLocation, daxInformation); } //extract layout file if (option.FileName == "Report\\Layout") { string layoutStorageLocation = Path.Combine(destinationPath, "Report", "LayoutFiles"); LayoutUtil.ExtractLayouts(jsonObjects, layoutStorageLocation); } //sort the json files so we can check them in source control jsonObjects = JsonUtil.SortPropertiesAlphabetically(jsonObjects); //convert back to a json string jsonString = JsonConvert.SerializeObject(jsonObjects, Formatting.Indented); File.WriteAllText(filePath, jsonString, Encoding.UTF8); } //rename the file with new extension if (!string.IsNullOrWhiteSpace(option.AddFileExtension)) { var newFilePath = filePath + option.AddFileExtension; renameFile(filePath, newFilePath); } }