AzurePoolCrossDbGenerator/GenerateBlankConfigs.cs
/// <summary>
/// Write out blank config files for all known structures in class Configs.
/// </summary>
Write out blank config files for all known structures in class Configs.
Write out blank config files for all known structures in class Configs .
public static void GenerateBlankConfigs()
        {
            string currentDirectory = Directory.GetCurrentDirectory();
            string configFolder = Path.Combine(currentDirectory, Program.FileNames.ConfigFolder);
            if (!Directory.Exists(configFolder)) Directory.CreateDirectory(configFolder);
            Program.WriteLine($"Writing config files to {configFolder}");
            var config = new Configs.InitialConfig();
            Configs.GenericConfigEntry.SaveConfigFile(Program.FileNames.InitialConfig, JsonConvert.SerializeObject(config));
            string templatesFolderDest = Path.Combine(currentDirectory, Program.FileNames.TemplatesFolder);
            string templatesFolderSrc = Path.Combine(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location), Program.FileNames.TemplatesFolder);
            if (!Directory.Exists(templatesFolderDest)) Directory.CreateDirectory(templatesFolderDest);
            Program.WriteLine($"Writing template files to {templatesFolderDest}");
            foreach (string templateFile in Directory.GetFiles(templatesFolderSrc))
            {
                string templateFileNoPath = Path.GetFileName(templateFile);
                string fileNameDest = Path.Combine(templatesFolderDest, templateFileNoPath);
                if (File.Exists(fileNameDest))
                {
                    Program.WriteLine($"{templateFileNoPath} already exists.", ConsoleColor.Yellow);
                }
                else
                {
                    File.Copy(templateFile, fileNameDest, false);
                    Program.WriteLine($"{templateFileNoPath} written.");
                }
            }
        }
public static void GenerateBlankConfigs ( ) { string currentDirectory = Directory . GetCurrentDirectory ( ) ; string configFolder = Path . Combine ( currentDirectory , Program . FileNames . ConfigFolder ) ; if ( ! Directory . Exists ( configFolder ) ) Directory . CreateDirectory ( configFolder ) ; Program . WriteLine ( $" Writing config files to  { configFolder } " ) ; var config = new Configs . InitialConfig ( ) ; Configs . GenericConfigEntry . SaveConfigFile ( Program . FileNames . InitialConfig , JsonConvert . SerializeObject ( config ) ) ; string templatesFolderDest = Path . Combine ( currentDirectory , Program . FileNames . TemplatesFolder ) ; string templatesFolderSrc = Path . Combine ( Path . GetDirectoryName ( System . Reflection . Assembly . GetExecutingAssembly ( ) . Location ) , Program . FileNames . TemplatesFolder ) ; if ( ! Directory . Exists ( templatesFolderDest ) ) Directory . CreateDirectory ( templatesFolderDest ) ; Program . WriteLine ( $" Writing template files to  { templatesFolderDest } " ) ; foreach ( string templateFile in Directory . GetFiles ( templatesFolderSrc ) ) { string templateFileNoPath = Path . GetFileName ( templateFile ) ; string fileNameDest = Path . Combine ( templatesFolderDest , templateFileNoPath ) ; if ( File . Exists ( fileNameDest ) ) { Program . WriteLine ( $" { templateFileNoPath }  already exists. " , ConsoleColor . Yellow ) ; } else { File . Copy ( templateFile , fileNameDest , false ) ; Program . WriteLine ( $" { templateFileNoPath }  written. " ) ; } } }
Write out blank config files for all known structures in class Configs.
Write out blank config files for all known structures in class Configs .
// create the folder if it doesn't exist // create the initial config file // copy all templates to the local templates folder // Copy the files and overwrite destination files if they already exist.