public static GetFormRegistery ( string key ) : string | ||
key | string | |
return | string |
private async Task <bool> RunScript(string path) { PowerShellInstance = PowerShell.Create(); PowerShellInstance.AddScript(LoadScript(path)); PowerShellInstance.AddArgument(CredentialHelper.GetFormRegistery(CredentialHelper.SourceRepoUserName)); PowerShellInstance.AddArgument(CredentialHelper.GetFormRegistery(CredentialHelper.SourceRepoPassword)); PowerShellInstance.AddArgument(CredentialHelper.GetFormRegistery(CredentialHelper.TargetRepoUserName)); PowerShellInstance.AddArgument(CredentialHelper.GetFormRegistery(CredentialHelper.TargetRepoPassword)); PSDataCollection <PSObject> outputCollection = new PSDataCollection <PSObject>(); outputCollection.DataAdded += outputCollection_DataAdded; PowerShellInstance.Streams.Error.DataAdded += Error_DataAdded; IAsyncResult result = PowerShellInstance.BeginInvoke <PSObject, PSObject>(null, outputCollection); while (result.IsCompleted == false) { await Task.Delay(100); } return(PowerShellInstance.HadErrors); }
private void CredentialForm_Load(object sender, EventArgs e) { SourceRepoUserName.Text = CredentialHelper.GetFormRegistery(CredentialHelper.SourceRepoUserName); SourceRepoPassword.Text = CredentialHelper.GetFormRegistery(CredentialHelper.SourceRepoPassword); TargetRepoUserName.Text = CredentialHelper.GetFormRegistery(CredentialHelper.TargetRepoUserName); TargetRepoPassword.Text = CredentialHelper.GetFormRegistery(CredentialHelper.TargetRepoPassword); }
private static string GetScriptName() { string script; SHA1 sha = new SHA1CryptoServiceProvider(); using (var stream = File.OpenRead(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile)) { var hash = BitConverter.ToString(sha.ComputeHash(stream)); if (hash == CredentialHelper.GetFormRegistery("ConfigHash")) { script = "UpdateSource.ps1"; } else { CredentialHelper.SaveInRegistery("ConfigHash", hash); script = "CheckoutSource.ps1"; } } return(script); }