Esempio n. 1
0
        TaskResult BackupFiles(TaskResult result)
        {
            try
            {
                var backupDir = @"c:\Backups\DbVersionHelper\";

                if (!Directory.Exists(backupDir))
                {
                    Directory.CreateDirectory(backupDir);
                }

                var backupVersionDir = Path.Combine(backupDir, DateTime.Now.ToString("mmDDyyyy") + "-" + NewDbVersion.ToString());
                if (_isDebug)
                {
                    Console.WriteLine("Backing up directory {0}\r\n--------------- to ---------------\r\n{1}", PendingVersionBuildFolder, backupVersionDir);
                }
                DirectoryCopy(PendingVersionBuildFolder, backupVersionDir, true);
            }
            catch (Exception ex)
            {
                result.AddException(ex);
            }
            return(result);
        }
Esempio n. 2
0
 /// <summary>
 /// Updates the Minor version vb file.
 /// </summary>
 /// <param name="result"></param>
 /// <returns></returns>
 TaskResult UpdateMinorVersionFile(TaskResult result)
 {
     try
     {
         var fileContent = File.ReadAllText(MinorVersionVbFile);
         // update the class name.
         //Public Class Upgrade16_4_100
         if (fileContent.Contains(PendingUpgradeClassName))
         {
             fileContent = fileContent.Replace(PendingUpgradeClassName, NewUpgradeClassName);
         }
         else
         {
             // need to add the new class to the end of the list.
             fileContent = BuildMinorVersionVbFile();
         }
         File.WriteAllText(MinorVersionVbFile, fileContent);
     }
     catch (Exception ex)
     {
         result.AddException(ex);
     }
     return(result);
 }