コード例 #1
0
 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);
 }
コード例 #2
0
        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);
        }
コード例 #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            CredentialHelper.SaveInRegistery(CredentialHelper.SourceRepoUserName, SourceRepoUserName.Text);
            CredentialHelper.SaveInRegistery(CredentialHelper.SourceRepoPassword, SourceRepoPassword.Text);
            CredentialHelper.SaveInRegistery(CredentialHelper.TargetRepoUserName, TargetRepoUserName.Text);
            CredentialHelper.SaveInRegistery(CredentialHelper.TargetRepoPassword, TargetRepoPassword.Text);

            this.Close();
        }
コード例 #4
0
        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);
        }