AzurePoolCrossDbGenerator/Generators.cs
/// <summary>
/// Write out the file and log the result to console
/// </summary>
/// <param name="outputContents"></param>
/// <param name="outputFileName"></param>
/// <param name="i"></param>
Write out the file and log the result to console
Write out the file and log the result to console
static void SaveGeneratedScript(string outputContents, string outputFileName, int i)
        {
            outputFileName = Path.Combine(Program.FileNames.OutputFolder, outputFileName);
            string path = Path.Combine(Directory.GetCurrentDirectory(), outputFileName);
            string scriptsFolder = Path.Combine(Directory.GetCurrentDirectory(), Program.FileNames.OutputFolder);
            if (!Directory.Exists(scriptsFolder)) Directory.CreateDirectory(scriptsFolder);
            if (File.Exists(path))
            {
                Program.WriteLine($"#{(i + 1).ToString()} - {outputFileName} already exists.", ConsoleColor.Yellow);
                return;
            }
            Program.WriteLine($"#{(i + 1).ToString()} - saving to {outputFileName}");
            try
            {
                File.WriteAllText(path, outputContents, System.Text.Encoding.UTF8);
            }
            catch (Exception ex)
            {
                Program.WriteLine(ex.Message);
            }
        }
static void SaveGeneratedScript ( string outputContents , string outputFileName , int i ) { outputFileName = Path . Combine ( Program . FileNames . OutputFolder , outputFileName ) ; string path = Path . Combine ( Directory . GetCurrentDirectory ( ) , outputFileName ) ; string scriptsFolder = Path . Combine ( Directory . GetCurrentDirectory ( ) , Program . FileNames . OutputFolder ) ; if ( ! Directory . Exists ( scriptsFolder ) ) Directory . CreateDirectory ( scriptsFolder ) ; if ( File . Exists ( path ) ) { Program . WriteLine ( $" # { ( i + 1 ) . ToString ( ) }  -  { outputFileName }  already exists. " , ConsoleColor . Yellow ) ; return ; } Program . WriteLine ( $" # { ( i + 1 ) . ToString ( ) }  - saving to  { outputFileName } " ) ; try { File . WriteAllText ( path , outputContents , System . Text . Encoding . UTF8 ) ; } catch ( Exception ex ) { Program . WriteLine ( ex . Message ) ; } }
Write out the file and log the result to console
Write out the file and log the result to console
// create the destination folder if it doesn't exist // do not overwrite files for consistency
outputContents
string
None
outputFileName
string
None
i
int
None