コード例 #1
0
        protected override bool OnOK()
        {
            string scopeNode = this._scopeNode;
            string text      = "";
            string text2     = "";

            this.modifyPropertiesControl.GetKeyValue(out text, out text2);
            bizilante.SSO.Helper.SSO sSO = new bizilante.SSO.Helper.SSO();
            string[] keys   = sSO.GetKeys(scopeNode);
            string[] values = sSO.GetValues(scopeNode);
            string[] array  = new string[keys.Length];
            string[] array2 = new string[values.Length];
            bool     flag   = false;

            if (!(text == "") && !(text2 == ""))
            {
                for (int i = 0; i < keys.Length; i++)
                {
                    if (keys[i] == text)
                    {
                        flag = true;
                    }
                }
                for (int j = 0; j < keys.Length; j++)
                {
                    if (keys[j].ToUpper() == this._currentKeyName.ToUpper())
                    {
                        array[j]  = text;
                        array2[j] = text2;
                    }
                    else
                    {
                        array[j]  = keys[j];
                        array2[j] = values[j];
                    }
                }
                if (flag)
                {
                    if (!(text.ToUpper() == this._currentKeyName.ToUpper()))
                    {
                        this.modifyPropertiesControl.KeyExistException();
                        return(true);
                    }
                    sSO.CreateApplicationFieldsValues(scopeNode, array, array2);
                }
                else
                {
                    sSO.CreateApplicationFieldsValues(scopeNode, array, array2);
                }
            }
            return(this.OnApply());
        }
コード例 #2
0
ファイル: SSO.cs プロジェクト: dheerajbhavsar/BizTalk2016
 public void CreateApplicationFieldsValues(string name, string[] arrKeys, string[] arrValues)
 {
     try
     {
         _sso.CreateApplicationFieldsValues(name, arrKeys, arrValues);
     }
     catch (Exception exception)
     {
         _log.LogError("SSOConfigurationImportMSBuildTask - CreateApplicationFieldsValues {0} failed: {1}", name, exception.Message);
         throw;
     }
 }
コード例 #3
0
        protected override void OnSelectionAction(Microsoft.ManagementConsole.Action action, AsyncStatus status)
        {
            string a;

            if ((a = (string)action.Tag) != null)
            {
                if (a == "Properties")
                {
                    base.SelectionData.ShowPropertySheet("Key/Value Properties");
                    return;
                }
                if (!(a == "Delete"))
                {
                    return;
                }
                StringBuilder stringBuilder = new StringBuilder();
                foreach (ResultNode resultNode in ((IEnumerable)base.SelectedNodes))
                {
                    base.ResultNodes.Remove(resultNode);
                    stringBuilder.Append(resultNode.DisplayName);
                }
                bizilante.SSO.Helper.SSO sSO = new bizilante.SSO.Helper.SSO();
                string[] keys   = sSO.GetKeys(base.ScopeNode.DisplayName);
                string[] values = sSO.GetValues(base.ScopeNode.DisplayName);
                string[] array  = new string[keys.Length - 1];
                string[] array2 = new string[values.Length - 1];
                string   b      = stringBuilder.ToString();
                int      num    = 0;
                if (keys.Length == 1)
                {
                    array     = new string[1];
                    array2    = new string[1];
                    array[0]  = "";
                    array2[0] = "";
                }
                else
                {
                    for (int i = 0; i < keys.Length; i++)
                    {
                        if (!(keys[i] == b))
                        {
                            array[num]  = keys[i];
                            array2[num] = values[i];
                            num++;
                        }
                    }
                }
                sSO.CreateApplicationFieldsValues(base.ScopeNode.DisplayName, array, array2);
            }
        }
コード例 #4
0
        protected override void OnRename(string newText, SyncStatus status)
        {
            bizilante.SSO.Helper.SSO sSO = new bizilante.SSO.Helper.SSO();
            string[] applications        = sSO.GetApplications();
            bool     flag = false;

            for (int i = 0; i < applications.Length; i++)
            {
                if (applications[i].ToUpper() == newText.ToUpper())
                {
                    flag = true;
                }
            }
            if (flag)
            {
                MessageBoxParameters messageBoxParameters = new MessageBoxParameters();
                messageBoxParameters.Text    = "Application Already Exists: " + newText;
                messageBoxParameters.Caption = "Add New Application";
                messageBoxParameters.Icon    = MessageBoxIcon.Exclamation;
                base.SnapIn.Console.ShowDialog(messageBoxParameters);
            }
            else
            {
                int count = base.Parent.Children.Count;
                int index = 0;
                for (int j = 0; j < count; j++)
                {
                    if (base.Parent.Children[j].DisplayName == "_NewApplication")
                    {
                        index = j;
                    }
                }
                sSO.DeleteApplication(base.Parent.Children[index].DisplayName);
                base.Parent.Children[index].DisplayName             = newText;
                base.Parent.Children[index].LanguageIndependentName = newText;
                base.Parent.Children[index].EnabledStandardVerbs    = StandardVerbs.None;
                string[] array  = new string[1];
                string[] array2 = new string[1];
                array[0]  = "";
                array2[0] = "";
                sSO.CreateApplicationFieldsValues(newText, array, array2);
            }
            base.OnRename(newText, status);
        }
コード例 #5
0
        protected override bool OnOK()
        {
            bizilante.SSO.Helper.SSO sSO = new bizilante.SSO.Helper.SSO();
            string[] keys   = sSO.GetKeys(this._scopenode);
            string[] values = sSO.GetValues(this._scopenode);
            string[] array  = new string[keys.Length + 1];
            string[] array2 = new string[values.Length + 1];
            string   text;
            string   text2;

            this._add_KeyValue_PropertiesControl.GetKeyValue(out text, out text2);
            if (!this._add_KeyValue_PropertiesControl.CheckText())
            {
                bool flag = false;
                for (int i = 0; i < values.Length; i++)
                {
                    if (keys[i].ToUpper() == text.ToUpper())
                    {
                        flag = true;
                    }
                }
                for (int j = 0; j < values.Length; j++)
                {
                    array[j]  = keys[j];
                    array2[j] = values[j];
                }
                array[keys.Length]    = text;
                array2[values.Length] = text2;
                if (flag)
                {
                    this._add_KeyValue_PropertiesControl.KeyExist(text);
                }
                else
                {
                    sSO.CreateApplicationFieldsValues(this._scopenode, array, array2);
                }
            }
            return(this.OnApply());
        }
コード例 #6
0
        protected override void OnAction(Microsoft.ManagementConsole.Action action, AsyncStatus status)
        {
            string a;

            if ((a = (string)action.Tag) != null)
            {
                if (a == "Delete")
                {
                    ScopeNode scopeNode = new ScopeNode();
                    scopeNode.DisplayName = base.DisplayName;
                    bizilante.SSO.Helper.SSO sSO = new bizilante.SSO.Helper.SSO();
                    sSO.GetApplications();
                    int index = 0;
                    for (int i = 0; i < base.Parent.Children.Count; i++)
                    {
                        if (Parent.Children[i].DisplayName.ToUpper() == DisplayName.ToUpper())
                        {
                            index = i;
                        }
                    }
                    sSO.DeleteApplication(base.DisplayName);
                    Parent.Children.RemoveAt(index);
                    return;
                }
                if (a == "Add_KeyValue")
                {
                    if (DisplayName.ToUpper() == "_NewApplication".ToUpper())
                    {
                        EnabledStandardVerbs = StandardVerbs.None;
                    }
                    _hasKeyValuePropertyPage = true;
                    ShowPropertySheet("Add Key/Value Pair");
                    OnRefresh(status);
                    base.OnRefresh(status);
                    return;
                }
                if (a == "Add_Application")
                {
                    string[] array  = new string[1];
                    string[] array2 = new string[1];
                    array[0]  = "";
                    array2[0] = "";
                    string text = "_NewApplication";
                    bool   flag = false;
                    bizilante.SSO.Helper.SSO sSO = new bizilante.SSO.Helper.SSO();
                    string[] applications        = sSO.GetApplications();
                    for (int j = 0; j < applications.Length; j++)
                    {
                        if (applications[j].ToUpper() == text.ToUpper())
                        {
                            flag = true;
                        }
                    }
                    if (flag)
                    {
                        MessageBoxParameters messageBoxParameters = new MessageBoxParameters();
                        messageBoxParameters.Text    = "This application already exists";
                        messageBoxParameters.Caption = "Add New Application";
                        messageBoxParameters.Icon    = MessageBoxIcon.Exclamation;
                        SnapIn.Console.ShowDialog(messageBoxParameters);
                    }
                    else
                    {
                        ScopeNode scopeNode2 = new ScopeNode();
                        scopeNode2.DisplayName = "_NewApplication";
                        ScopeNode scopeNode3 = new ScopeNode();
                        Children.Add(scopeNode2);
                        int count = Children.Count;
                        sSO.CreateApplicationFieldsValues("_NewApplication", array, array2);
                        Children[count - 1] = new ApplicationScopeNode("_NewApplication");
                    }
                    base.OnRefresh(status);
                    return;
                }
                if (!(a == "Export"))
                {
                    if (!(a == "Import"))
                    {
                        return;
                    }
                    DialogResult dialogResult = SSOHelper.OpenSSOImportFile(
                        out _applicationFileName,
                        out _encryptedText,
                        this);
                    if (dialogResult != DialogResult.Cancel)
                    {
                        EncryptionKey_PropertyPage encryptionKey_PropertyPage =
                            new EncryptionKey_PropertyPage("Import", _applicationFileName, _encryptedText);
                        encryptionKey_PropertyPage.EncryptionKeyEnteredForImport +=
                            new EventHandler <EventArgs <bool, string> >(propertyPage_EncryptionKeyEnteredForImport);
                        AcceptKeyForImportForm form =
                            new AcceptKeyForImportForm(encryptionKey_PropertyPage);
                        base.SnapIn.Console.ShowDialog(form);
                    }
                    base.OnRefresh(status);
                }
                else
                {
                    EncryptionKey_PropertyPage encryptionKey_PropertyPage2 =
                        new EncryptionKey_PropertyPage("Export", base.DisplayName);
                    AcceptKeyForImportForm form2 = new AcceptKeyForImportForm(encryptionKey_PropertyPage2);
                    base.SnapIn.Console.ShowDialog(form2);
                    if (encryptionKey_PropertyPage2.EncryptionKey != null && encryptionKey_PropertyPage2.EncryptionKey.Length != 0)
                    {
                        if (!SSOHelper.ExportSSOApplication(base.DisplayName, encryptionKey_PropertyPage2.EncryptionKey, this))
                        {
                            MessageBoxParameters messageBoxParameters2 = new MessageBoxParameters();
                            messageBoxParameters2.Text    = "Error exporting the application.  Please check the event log for further information";
                            messageBoxParameters2.Caption = "Export Application Error";
                            messageBoxParameters2.Icon    = MessageBoxIcon.Hand;
                            base.SnapIn.Console.ShowDialog(messageBoxParameters2);
                            return;
                        }
                    }
                }
            }
        }