public void LoadNonExistingManifest() { // Arrange var selectedProject = VsUtils.GetSelectedProject(); PushEnvironment environment = new PushEnvironment(selectedProject); environment.ProjectDirectory = @"c:\somedirthatdoesntexist"; environment.ProfileFilePath = @"c:\foo-bar.cf.pubxml"; environment.ProjectName = "foo-bar"; // Act PublishProfile publishProfile = PublishProfile.Load(environment); // Assert Assert.AreEqual(string.Empty, publishProfile.Application.BuildpackUrl); Assert.AreEqual(null, publishProfile.Application.Command); Assert.AreEqual(null, publishProfile.Application.DiskQuota); Assert.AreEqual(0, publishProfile.Application.Domains.Count); Assert.AreEqual(0, publishProfile.Application.EnvironmentVariables.Count); Assert.AreEqual(null, publishProfile.Application.HealthCheckTimeout); Assert.AreEqual(environment.ProjectName.ToLowerInvariant(), publishProfile.Application.Hosts[0]); Assert.AreEqual(1, publishProfile.Application.InstanceCount); Assert.AreEqual(256, publishProfile.Application.Memory); Assert.AreEqual(environment.ProjectName, publishProfile.Application.Name); Assert.AreEqual(false, publishProfile.Application.NoHostName); Assert.AreEqual(false, publishProfile.Application.NoRoute); Assert.AreEqual(null, publishProfile.Application.Path); Assert.AreEqual(0, publishProfile.Application.Services.Count); Assert.AreEqual(string.Empty, publishProfile.Application.StackName); Assert.AreEqual(false, publishProfile.Application.UseRandomHostName); }
private object UpdateAzureFunctionsAsync(OperationRunner context) { AzureClient client = new AzureClient(WizardContext.TokenProvider); client.SetLogger(context.Logger); PublishData publishingProfiles = client.GetAppServicePublishingProfileAsync( DataModel.InstallationConfiguration.Azure.SelectedSubscription.Id, DataModel.InstallationConfiguration.Azure.ResourceGroupName, DataModel.InstallationConfiguration.Azure.FunctionApp.AppName).Result; PublishProfile webDeployProfile = publishingProfiles .Profiles .Where(x => x.ProfileName.Contains("Web Deploy")) .FirstOrDefault(); SecureString publishingProfilePassword = new SecureString(); foreach (char c in webDeployProfile.Password) { publishingProfilePassword.AppendChar(c); } publishingProfilePassword.MakeReadOnly(); return(client.ZipDeployAppServiceAsync( DataModel.InstallationConfiguration.Azure.FunctionApp.AppName, DataModel.InstallationConfiguration.Azure.FunctionApp.AppDeploymentSourceUrl, new NetworkCredential(webDeployProfile.UserName, publishingProfilePassword)).Result); }
public void LoadExistingProfileTest() { // Arrange var selectedProject = VsUtils.GetSelectedProject(); PushEnvironment environment = new PushEnvironment(selectedProject); environment.ProjectDirectory = Util.PublishProfileProjectDir; environment.ProfileFilePath = Util.PublishProfilePath; environment.ProjectName = "foobar-project"; // Act PublishProfile publishProfile = PublishProfile.Load(environment); // Assert Assert.AreEqual("user", publishProfile.User); Assert.AreEqual(string.Empty, publishProfile.Password); Assert.AreEqual(string.Empty, publishProfile.RefreshToken); Assert.AreEqual("https://api.1.2.3.4.xip.io/", publishProfile.ServerUri.ToString()); Assert.AreEqual(true, publishProfile.SkipSSLValidation); Assert.AreEqual("numenor", publishProfile.Organization); Assert.AreEqual("arandor", publishProfile.Space); Assert.AreEqual(string.Empty, publishProfile.DeployTargetFile); Assert.AreEqual("CloudFoundry", publishProfile.WebPublishMethod); Assert.AreEqual(@"..\..\push.yml", publishProfile.Manifest); }
public void LoadExistingManifestTest() { // Arrange var selectedProject = VsUtils.GetSelectedProject(); PushEnvironment environment = new PushEnvironment(selectedProject); environment.ProjectDirectory = Util.PublishProfileProjectDir; environment.ProfileFilePath = Util.PublishProfilePath; environment.ProjectName = "foobar-project"; // Act PublishProfile publishProfile = PublishProfile.Load(environment); // Assert Assert.AreEqual("test-bp", publishProfile.Application.BuildpackUrl); Assert.AreEqual("cmd", publishProfile.Application.Command); Assert.AreEqual(null, publishProfile.Application.DiskQuota); Assert.AreEqual("app.example.com", publishProfile.Application.Domains[0]); Assert.AreEqual("first", publishProfile.Application.EnvironmentVariables["env1"]); Assert.AreEqual("second", publishProfile.Application.EnvironmentVariables["env2"]); Assert.AreEqual(500, publishProfile.Application.HealthCheckTimeout); Assert.AreEqual("home", publishProfile.Application.Hosts[0]); Assert.AreEqual(1, publishProfile.Application.InstanceCount); Assert.AreEqual(128, publishProfile.Application.Memory); Assert.AreEqual("app-name", publishProfile.Application.Name); Assert.AreEqual(false, publishProfile.Application.NoHostName); Assert.AreEqual(false, publishProfile.Application.NoRoute); Assert.AreEqual(@"c:\path\to\app", publishProfile.Application.Path); Assert.AreEqual("mysql", publishProfile.Application.Services[0]); Assert.AreEqual("mssql", publishProfile.Application.Services[1]); Assert.AreEqual(null, publishProfile.Application.StackName); Assert.AreEqual(false, publishProfile.Application.UseRandomHostName); }
public void LoadNonExistingProfile() { // Arrange var selectedProject = VsUtils.GetSelectedProject(); PushEnvironment environment = new PushEnvironment(selectedProject); environment.ProjectDirectory = @"c:\somedirthatdoesntexist\"; environment.ProfileFilePath = @"c:\foo-bar.cf.pubxml"; environment.ProjectName = "foo-bar"; // Act PublishProfile publishProfile = PublishProfile.Load(environment); // Assert Assert.AreEqual(string.Empty, publishProfile.User); Assert.AreEqual(null, publishProfile.Password); Assert.AreEqual(null, publishProfile.RefreshToken); Assert.AreEqual(null, publishProfile.ServerUri); Assert.AreEqual(false, publishProfile.SkipSSLValidation); Assert.AreEqual(string.Empty, publishProfile.Organization); Assert.AreEqual(string.Empty, publishProfile.Space); Assert.AreEqual(null, publishProfile.DeployTargetFile); Assert.AreEqual("CloudFoundry", publishProfile.WebPublishMethod); Assert.AreEqual("foo-bar.yml", publishProfile.Manifest); }
public PushDialog(PublishProfile package) { this.cancellationToken = new CancellationToken(); this.publishProfileResources = new PublishProfileEditorResources(package, this.cancellationToken); this.DataContext = this.publishProfileResources; this.InitializeComponent(); }
public PushDialog(PublishProfile package) { this.cancellationToken = new CancellationToken(); this.publishProfileResources = new PublishProfileEditorResources(package, this.cancellationToken); this.DataContext = this.publishProfileResources; this.Owner = System.Windows.Application.Current.MainWindow; this.InitializeComponent(); }
private PublishProfile ParseAndDisplayProfileInfo(string pathToProfileFile) { var pub = new PublishProfile(pathToProfileFile); tsTargetDbValue.Text = pub.TargetDatabaseName; tsTargetConnStrValue.Text = pub.TargetConnectionString; return(pub); }
KuduSiteSettings _pub2Kudu(PublishProfile pubSetting) { return(new KuduSiteSettings { ApiUrl = pubSetting.PublishUrl, LiveUrl = pubSetting.DestinationAppUrl, Password = pubSetting.UserPWD, SiteName = pubSetting.MsdeploySite, UserName = pubSetting.UserName, ProfileName = pubSetting.ProfileName }); }
public void CreateNewDatabase_Get_Set() { // Arrange var instance = new PublishProfile { CreateNewDatabase = false }; // Act instance.CreateNewDatabase = true; // Assert Assert.IsTrue(instance.CreateNewDatabase); }
public int CreateEditorInstance(uint grfCreateDoc, string pszMkDocument, string pszPhysicalView, IVsHierarchy ppvHier, uint itemid, IntPtr punkDocDataExisting, out IntPtr ppunkDocView, out IntPtr ppunkDocData, out string pbstrEditorCaption, out Guid pguidCmdUI, out int pgrfCDW) { ppunkDocData = IntPtr.Zero; ppunkDocView = IntPtr.Zero; pguidCmdUI = new Guid("41d526d3-6281-42ff-ba9f-e5746623233f"); pgrfCDW = 0; pbstrEditorCaption = "Stackato Publish Profile"; var project = VsUtils.GetSelectedProject(); var fileInfo = new FileInfo(pszMkDocument); if (project == null) { return(VSConstants.VS_E_UNSUPPORTEDFORMAT); } if (project.Name.Contains("Miscellaneous Files")) { return(VSConstants.VS_E_UNSUPPORTEDFORMAT); } if (!fileInfo.Name.ToUpperInvariant().EndsWith(PushEnvironment.Extension, StringComparison.OrdinalIgnoreCase)) { return(VSConstants.VS_E_UNSUPPORTEDFORMAT); } PublishProfile packageFile; try { var selectedProject = VsUtils.GetSelectedProject(); PushEnvironment environment = new PushEnvironment(selectedProject); environment.ProjectName = project.Name; environment.ProfileFilePath = pszMkDocument; packageFile = PublishProfile.Load(environment); } catch (Exception ex) { MessageBoxHelper.DisplayError(string.Format(CultureInfo.InvariantCulture, "Cannot load {0}. {1}.", pszMkDocument, ex.Message)); Logger.Error("Exception loading package file", ex); return(VSConstants.VS_E_INCOMPATIBLEDOCDATA); } var dialog = new PushDialog(packageFile); dialog.ShowModal(); return(VSConstants.S_OK); }
public void ScriptDeployStateChecks_Get_Set() { // Arrange var instance = new PublishProfile { ScriptDeployStateChecks = false }; // Act instance.ScriptDeployStateChecks = true; // Assert Assert.IsTrue(instance.ScriptDeployStateChecks); }
public void PublishProfile_FeedFile_VerifyParsedData() { const string expectedDbName = "DatabaseName"; const string expectedConnStr = @"Data Source=SqlServer\Instance;Integrated Security=True;Pooling=False;Initial Catalog=DatabaseName"; var pathToProfileFile = Path.Combine(TestContext.DeploymentDirectory, "PublishProfile.publish.xml"); var target = new PublishProfile(pathToProfileFile); var dbName = target.TargetDatabaseName; var connStr = target.TargetConnectionString; Assert.AreEqual(expectedDbName, dbName); Assert.AreEqual(expectedConnStr, connStr); }
public void ScriptDatabaseOptions_Get_Set() { // Arrange var instance = new PublishProfile { ScriptDatabaseOptions = false }; // Act instance.ScriptDatabaseOptions = true; // Assert Assert.IsTrue(instance.ScriptDatabaseOptions); }
public void BackupDatabaseBeforeChanges_Get_Set() { // Arrange var instance = new PublishProfile { BackupDatabaseBeforeChanges = false }; // Act instance.BackupDatabaseBeforeChanges = true; // Assert Assert.IsTrue(instance.BackupDatabaseBeforeChanges); }
public AppsResult UpsertPublishProfile([FromBody] PublishProfile publishProfile) { var result = new AppsResult(); try { var objs = _db.GetCollection <PublishProfile>("PublishProfiles"); objs.Upsert(publishProfile); result.Success = true; } catch (System.Exception ex) { new AppFlows.Publish.Exception(ex, ref result); } return(result); }
public void Constructor_Contents_CorrectInitialization() { // Arrange const string script = "script"; const string report = "report"; const string pre = "pre"; const string post = "post"; var publishProfile = new PublishProfile(); // Act var result = new CreateDeployFilesResult(script, report, pre, post, publishProfile); // Assert Assert.AreEqual(script, result.DeployScriptContent); Assert.AreEqual(report, result.DeployReportContent); Assert.AreEqual(pre, result.PreDeploymentScript); Assert.AreEqual(post, result.PostDeploymentScript); Assert.AreSame(publishProfile, result.UsedPublishProfile); Assert.IsNull(result.Errors); }
public static PublishProfile CreatePublishProfile(string publishMethod) { PublishProfile publishProfile = null; switch (publishMethod) { case MSDeployPublishProfile.PublishMethod: publishProfile = new MSDeployPublishProfile(); break; case MSDeployPackagePublishProfile.PublishMethod: publishProfile = new MSDeployPackagePublishProfile(); break; case FileSystemPublishProfile.PublishMethod: publishProfile = new FileSystemPublishProfile(); break; } return(publishProfile); }
private async Task <bool> ValidatePublishProfileAgainstConfiguration(PublishProfile publishProfile, ConfigurationModel configuration) { if (!configuration.RemoveSqlCmdStatements) { return(true); } var valid = true; if (publishProfile.CreateNewDatabase) { await _logger.LogErrorAsync($"{nameof(PublishProfile.CreateNewDatabase)} cannot bet set to true, when {nameof(ConfigurationModel.RemoveSqlCmdStatements)} is also true."); valid = false; } if (publishProfile.BackupDatabaseBeforeChanges) { await _logger.LogErrorAsync($"{nameof(PublishProfile.BackupDatabaseBeforeChanges)} cannot bet set to true, when {nameof(ConfigurationModel.RemoveSqlCmdStatements)} is also true."); valid = false; } if (publishProfile.ScriptDatabaseOptions) { await _logger.LogErrorAsync($"{nameof(PublishProfile.ScriptDatabaseOptions)} cannot bet set to true, when {nameof(ConfigurationModel.RemoveSqlCmdStatements)} is also true."); valid = false; } if (publishProfile.ScriptDeployStateChecks) { await _logger.LogErrorAsync($"{nameof(PublishProfile.ScriptDeployStateChecks)} cannot bet set to true, when {nameof(ConfigurationModel.RemoveSqlCmdStatements)} is also true."); valid = false; } return(valid); }
private void ButtonBuildAndPushProjectExecuteHandler(object sender, EventArgs e) { try { var selectedProject = VsUtils.GetSelectedProject(); PushEnvironment environment = new PushEnvironment(selectedProject); var package = PublishProfile.Load(environment); var dialog = new PushDialog(package); dialog.ShowModal(); } catch (VisualStudioException ex) { MessageBoxHelper.DisplayError(string.Format(CultureInfo.InvariantCulture, "Error loading publish profile: {0}", ex.Message)); Logger.Error("Error loading publish profile", ex); } catch (Exception ex) { MessageBoxHelper.DisplayError(string.Format(CultureInfo.InvariantCulture, "An error occurred while trying to load a publish profile: {0}", ex.Message)); Logger.Error("Error loading default profile", ex); } }
private void SetData(PublishProfile prof = null) { if (_manager == null) { return; } try { var selectedvidprops = Manager.CurrentCapture.VideoDeviceController.GetMediaStreamProperties(MediaStreamType.VideoRecord) as VideoEncodingProperties; var boundvidprof = prof != null && prof.TargetEncodingProfile != null && prof.TargetEncodingProfile.Video != null ? prof.TargetEncodingProfile.Video : selectedvidprops; var selectedaudprops = Manager.CurrentCapture.AudioDeviceController.GetMediaStreamProperties(MediaStreamType.Audio) as AudioEncodingProperties; var boundaudprof = prof != null && prof.TargetEncodingProfile != null && prof.TargetEncodingProfile.Audio != null ? prof.TargetEncodingProfile.Audio : selectedaudprops; double framesizeratio = (double)boundvidprof.Width / (double)boundvidprof.Height; if (framesizeratio == 4.0 / 3.0) { sldrWidth.StepFrequency = 4.0; sldrHeight.StepFrequency = 3.0; } else if (framesizeratio == 16.0 / 9.0) { sldrWidth.StepFrequency = 16.0; sldrHeight.StepFrequency = 9.0; } else if (framesizeratio == 3.0 / 2.0) { sldrWidth.StepFrequency = 3.0; sldrHeight.StepFrequency = 2.0; } else { sldrWidth.StepFrequency = framesizeratio; sldrHeight.StepFrequency = 1; } sldrWidth.Value = boundvidprof.Width; sldrHeight.Value = boundvidprof.Height; sldrBitrate.Value = boundvidprof.Bitrate / 1000; sldrKFInterval.Value = ((prof != null ? prof.KeyFrameInterval : 120) / (boundvidprof.FrameRate.Numerator / boundvidprof.FrameRate.Denominator)); tbKFValue.Text = string.Format("{0:#####} frames/{1:####} secs", (prof != null ? prof.KeyFrameInterval : 120), sldrKFInterval.Value); sldrRTMPChunksize.Value = (prof != null ? prof.ClientChunkSize : 128); if (boundvidprof.ProfileId == H264ProfileIds.Baseline) { cbxH264Profile.SelectedIndex = 0; } else if (boundvidprof.ProfileId == H264ProfileIds.Main) { cbxH264Profile.SelectedIndex = 1; } else if (boundvidprof.ProfileId == H264ProfileIds.High) { cbxH264Profile.SelectedIndex = 2; } else { boundvidprof.ProfileId = H264ProfileIds.Main; cbxH264Profile.SelectedIndex = 1; } sldrAudioBitrate.Value = boundaudprof.Bitrate; cbxAudioSampling.SelectedIndex = boundaudprof.SampleRate == 48000 ? 0 : (boundaudprof.SampleRate == 44100 ? 1 : 2); tsAudioChannels.IsOn = boundaudprof.ChannelCount >= 2; tsLowLagBehavior.IsOn = (prof != null ? prof.EnableLowLatency : false); } catch { } }
public object Convert(object value, Type targetType, object parameter, string language) { PublishProfile prof = value as PublishProfile; return(string.Format("{0} kbps, {1}x{2}, {3} fps", prof.TargetEncodingProfile.Video.Bitrate / 1000, prof.TargetEncodingProfile.Video.Width, prof.TargetEncodingProfile.Video.Height, (prof.TargetEncodingProfile.Video.FrameRate.Numerator / prof.TargetEncodingProfile.Video.FrameRate.Denominator))); }
public object Convert(object value, Type targetType, object parameter, string language) { PublishProfile prof = value as PublishProfile; return(string.Format("{0} kbps, {1} kHz, {2}", prof.TargetEncodingProfile.Audio.Bitrate / 1000, prof.TargetEncodingProfile.Audio.SampleRate / 1000, prof.TargetEncodingProfile.Audio.ChannelCount >= 2 ? "Stereo" : "Mono")); }
public void SaveNonExistingProfileAndManifest() { // Arrange string testProjectDir = Path.Combine(Path.GetTempPath(), string.Format("savetest-{0}\\", Guid.NewGuid().ToString("N"))); Directory.CreateDirectory(testProjectDir); var selectedProject = VsUtils.GetSelectedProject(); PushEnvironment environment = new PushEnvironment(selectedProject); environment.ProjectDirectory = testProjectDir; string publishProfilePath = Path.Combine(testProjectDir, "Properties", "PublishProfiles", "push.cf.pubxml"); environment.ProfileFilePath = publishProfilePath; environment.ProjectName = "mypush"; string manifestPath = Path.Combine(testProjectDir, "push.yml"); PublishProfile publishProfile = PublishProfile.Load(environment); publishProfile.Organization = "doriath"; publishProfile.Space = "menegroth"; publishProfile.User = "******"; publishProfile.Password = "******"; publishProfile.RefreshToken = "012345"; publishProfile.SavedPassword = true; publishProfile.ServerUri = new Uri("https://my.server.url"); publishProfile.SkipSSLValidation = false; publishProfile.Application.BuildpackUrl = "https://my.buildpack.url"; publishProfile.Application.Command = "ls"; publishProfile.Application.DiskQuota = 1234; publishProfile.Application.Domains.Add("domain.com"); publishProfile.Application.EnvironmentVariables.Add("my", "var"); publishProfile.Application.HealthCheckTimeout = 54321; publishProfile.Application.Hosts.AddRange(new string[] { "one", "two" }); publishProfile.Application.InstanceCount = 121; publishProfile.Application.Memory = 42; publishProfile.Application.Name = "myapp"; publishProfile.Application.NoHostName = true; publishProfile.Application.NoRoute = true; publishProfile.Application.Path = "/app/path"; publishProfile.Application.Services.AddRange(new string[] { "s1", "s2" }); publishProfile.Application.StackName = "leo"; publishProfile.Application.UseRandomHostName = true; // Act publishProfile.Save(); // Assert Assert.IsTrue(File.Exists(publishProfilePath)); Assert.IsTrue(File.Exists(manifestPath)); var loadedProfile = PublishProfile.Load(environment); Assert.AreEqual(publishProfile.Manifest, loadedProfile.Manifest); Assert.AreEqual(publishProfile.Organization, loadedProfile.Organization); Assert.AreEqual(publishProfile.Password, loadedProfile.Password); Assert.AreEqual(publishProfile.RefreshToken, loadedProfile.RefreshToken); Assert.AreEqual(publishProfile.SavedPassword, loadedProfile.SavedPassword); Assert.AreEqual(publishProfile.ServerUri, loadedProfile.ServerUri); Assert.AreEqual(publishProfile.SkipSSLValidation, loadedProfile.SkipSSLValidation); Assert.AreEqual(publishProfile.Space, loadedProfile.Space); Assert.AreEqual(publishProfile.User, loadedProfile.User); Assert.AreEqual(null, loadedProfile.DeployTargetFile); Assert.AreEqual("CloudFoundry", publishProfile.WebPublishMethod); Assert.AreEqual(publishProfile.Application.BuildpackUrl, loadedProfile.Application.BuildpackUrl); Assert.AreEqual(publishProfile.Application.Command, loadedProfile.Application.Command); Assert.AreEqual(publishProfile.Application.DiskQuota, loadedProfile.Application.DiskQuota); Assert.AreEqual(publishProfile.Application.Domains[0], loadedProfile.Application.Domains[0]); Assert.AreEqual(publishProfile.Application.EnvironmentVariables["my"], loadedProfile.Application.EnvironmentVariables["my"]); Assert.AreEqual(publishProfile.Application.HealthCheckTimeout, loadedProfile.Application.HealthCheckTimeout); Assert.AreEqual(publishProfile.Application.Hosts[0], loadedProfile.Application.Hosts[0]); Assert.AreEqual(publishProfile.Application.Hosts[1], loadedProfile.Application.Hosts[1]); Assert.AreEqual(publishProfile.Application.InstanceCount, loadedProfile.Application.InstanceCount); Assert.AreEqual(publishProfile.Application.Memory, loadedProfile.Application.Memory); Assert.AreEqual(publishProfile.Application.Name, loadedProfile.Application.Name); Assert.AreEqual(publishProfile.Application.NoHostName, loadedProfile.Application.NoHostName); Assert.AreEqual(publishProfile.Application.NoRoute, loadedProfile.Application.NoRoute); Assert.AreEqual(publishProfile.Application.Path, loadedProfile.Application.Path); Assert.AreEqual(publishProfile.Application.Services[0], loadedProfile.Application.Services[0]); Assert.AreEqual(publishProfile.Application.Services[1], loadedProfile.Application.Services[1]); Assert.AreEqual(publishProfile.Application.StackName, loadedProfile.Application.StackName); Assert.AreEqual(publishProfile.Application.UseRandomHostName, loadedProfile.Application.UseRandomHostName); }
static void Main() { var mode = ModeDefiner.DefineMode(); if (!RunsDirectly()) { Logger.AppendEmptyLine(); } Logger.AppendLine($"DacDeployer is started in {mode.ToString().ToUpper()} mode!"); //Console.Title = {Console.Title} Logger.AppendEmptyLine(); if (mode == Mode.Help) { HelpInfo.Help(); PressAnyKey(mode); Environment.Exit(0); } Logger.LogConsoleArguments(); try { (var dacPacFolderPath, var dacPacFilePath) = PathResolver.GetDacPacPaths(); (var publishProfileFolderPath, var publishProfileFilePath) = PathResolver.GetPublishProfilePaths(); if (mode == Mode.Compile) { var compilationFolderPath = PathResolver.GetCompilationFolderPath(); var beforeDeploymentScriptPath = PathResolver.GetBeforeDeploymentPath(); Logger.LogResolvedPaths(dacPacFolderPath, dacPacFilePath, publishProfileFolderPath, publishProfileFilePath, beforeDeploymentScriptPath); Logger.AppendLine("DacDeployer has started compilation:"); Logger.AppendDividerLine(); CompilationSteps.CreateOrClearCompilationFolder(compilationFolderPath); CompilationSteps.CopyDacDeployer(compilationFolderPath); CompilationSteps.CopyDacPac(compilationFolderPath, dacPacFolderPath); CompilationSteps.CopyPublishProfiles(compilationFolderPath, publishProfileFolderPath); CompilationSteps.CreateBatFiles(compilationFolderPath, dacPacFilePath, beforeDeploymentScriptPath); Logger.AppendEmptyLine(); Logger.AppendLine("DacDeployer has completed compilation."); } else if (mode == Mode.Deploy) { var publishProfile = new PublishProfile(publishProfileFilePath); var beforeDeploymentScriptPath = PathResolver.GetBeforeDeploymentPath(dacPacFolderPath); Logger.LogResolvedPaths(dacPacFolderPath, dacPacFilePath, publishProfileFolderPath, publishProfileFilePath, beforeDeploymentScriptPath); Logger.AppendLine("DacDeployer has started deployment:"); Logger.AppendEmptyLine(); if (DeploymentSteps.ExecuteBeforeDeployment(beforeDeploymentScriptPath, publishProfile)) { DeploymentSteps.DeployDacPac(dacPacFilePath, publishProfile); Logger.AppendEmptyLine(); Logger.AppendLine("DacDeployer has completed deployment."); } } } catch (Exception ex) { Logger.AppendEmptyLine(); Logger.AppendLine("DacDeployer.exe exited with the following error:"); Logger.AppendLine(ex.Message); Logger.AppendEmptyLine(); } Logger.OutputLogToFile(); PressAnyKey(mode); }
public AppsResult Publish([FromBody] PublishProfile pp, string projectPath, string destinationFolder) { var result = new AppsResult(); try { //Make sure there's an folder for this app System.IO.Directory.CreateDirectory(Environment.CurrentDirectory + "\\AppFolders\\App" + pp.AppID); //Pre-build if (pp.RunPreBuildScript) { //Save to temp string preBuildScriptPath = Environment.CurrentDirectory + "\\Business\\Ops\\PreBuildScripts\\App" + pp.AppID.ToString() + "PreBuild.csx"; System.IO.File.WriteAllText(preBuildScriptPath, pp.PreBuildScript); Command.Exec("dotnet", "script", new Dictionary <string, string> { { " ", "\"" + preBuildScriptPath + "\"" } }, projectPath, ref result); new AppFlows.Publish.Success("Successfully ran pre-build script for " + pp.Name + "."); } if (System.IO.File.Exists(projectPath)) { if (System.IO.Directory.Exists(destinationFolder)) { Command.Exec("dotnet", "publish", new Dictionary <string, string> { { "-o", "\"" + destinationFolder + "\"" }, { "", "\"" + projectPath + "\"" } }, projectPath, ref result); if (!result.SuccessMessages.Any(sm => sm.Contains("error"))) { result.Success = true; new AppFlows.Publish.Success("Successfully executed publish for " + pp.Name + "."); if (pp.RunPostBuildScript) { var compileResult = Compile(pp.PostBuildScript); if (compileResult.Success) { //Save to temp string scriptPath = Environment.CurrentDirectory + "\\Business\\Ops\\PostBuildScripts\\App" + pp.AppID.ToString() + "PostPublish.csx"; System.IO.File.WriteAllText(scriptPath, pp.PostBuildScript); Command.Exec("dotnet", "script", new Dictionary <string, string> { { " ", "\"" + scriptPath + "\"" } }, projectPath, ref result); new AppFlows.Publish.Success("Successfully ran post-publish script for " + pp.Name + "."); } else { new AppFlows.Publish.Compile.Fail("Compile of post-publish script failed.", ref compileResult); } } else { new AppFlows.Publish.Compile("Post-build scripts not enabled so not run."); } } else { new AppFlows.Publish.Fail("Messages contain the work 'error'. Build and/or publish may have failed.", ref result); } } else { new AppFlows.Publish.Fail("Cannot find destination folder.", ref result); } } else { new AppFlows.Publish.Fail("Cannot find project path.", ref result); } } catch (System.Exception ex) { new AppFlows.Publish.Exception(ex, ref result); } return(result); }
public void AddPublishProfile(uint?width, uint?height, uint?kfinterval, uint?chunksize, uint?videobitrate, string profile, uint?audiobitrate, uint?audiosamplingfreqency, bool?stereo) { PublishProfile pubprof = new PublishProfile(RTMPServerType.Azure); pubprof.TargetEncodingProfile = MediaEncodingProfile.CreateMp4(VideoEncodingQuality.HD720p); pubprof.TargetEncodingProfile.Container = null; var srcvideoencodingprops = CurrentCapture.VideoDeviceController.GetMediaStreamProperties(MediaStreamType.VideoRecord) as VideoEncodingProperties; var srcaudioencodingprops = CurrentCapture.AudioDeviceController.GetMediaStreamProperties(MediaStreamType.Audio) as AudioEncodingProperties; if (width != null) { pubprof.TargetEncodingProfile.Video.Width = width.Value; } else { pubprof.TargetEncodingProfile.Video.Width = srcvideoencodingprops.Width; } if (height != null) { pubprof.TargetEncodingProfile.Video.Height = height.Value; } else { pubprof.TargetEncodingProfile.Video.Height = srcvideoencodingprops.Height; } if (videobitrate != null) { pubprof.TargetEncodingProfile.Video.Bitrate = videobitrate.Value; } else { pubprof.TargetEncodingProfile.Video.Bitrate = srcvideoencodingprops.Bitrate; } if (kfinterval != null) { pubprof.KeyFrameInterval = kfinterval.Value; } if (chunksize != null) { pubprof.ClientChunkSize = chunksize.Value; } if (profile != null) { pubprof.TargetEncodingProfile.Video.ProfileId = profile.ToLowerInvariant() == "baseline" ? H264ProfileIds.Baseline : (profile.ToLowerInvariant() == "main" ? H264ProfileIds.Main : H264ProfileIds.High); } pubprof.TargetEncodingProfile.Video.FrameRate.Numerator = srcvideoencodingprops.FrameRate.Numerator; pubprof.TargetEncodingProfile.Video.FrameRate.Denominator = srcvideoencodingprops.FrameRate.Denominator; if (audiobitrate != null) { pubprof.TargetEncodingProfile.Audio.Bitrate = audiobitrate.Value; } else { pubprof.TargetEncodingProfile.Audio.Bitrate = srcaudioencodingprops.Bitrate; } if (stereo != null) { pubprof.TargetEncodingProfile.Audio.ChannelCount = stereo.Value ? 2U : 1U; } else { pubprof.TargetEncodingProfile.Audio.Bitrate = srcaudioencodingprops.ChannelCount; } if (audiosamplingfreqency != null) { pubprof.TargetEncodingProfile.Audio.SampleRate = audiosamplingfreqency.Value; } else { pubprof.TargetEncodingProfile.Audio.SampleRate = srcaudioencodingprops.SampleRate; } _PublishProfiles.Add(pubprof); }