public static bool ExportSSOApplication(string appName, string encryptionKey, ApplicationScopeNode currentNode) { bizilante.SSO.Helper.SSO sSO = new bizilante.SSO.Helper.SSO(); string[] keys = sSO.GetKeys(appName); string[] values = sSO.GetValues(appName); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append("<?xml version=\"1.0\" encoding=\"utf-8\" ?><SSOApplicationExport><applicationData>"); for (int i = 0; i < keys.Length; i++) { if (keys[i] != null && !(keys[i] == "")) { stringBuilder.Append(string.Concat(new string[] { "<add key=\"", keys[i], "\" value=\"", HttpUtility.HtmlEncode(values[i]), "\" />" })); } } stringBuilder.Append("</applicationData></SSOApplicationExport>"); bool result; using (SaveFileDialog saveFileDialog = new SaveFileDialog()) { saveFileDialog.CheckPathExists = true; saveFileDialog.Filter = "SSO Extract files (*.sso)|*.sso|All files (*.*)|*.*"; saveFileDialog.DefaultExt = "*.sso"; saveFileDialog.FileName = appName + ".sso"; saveFileDialog.Title = "Export SSO Application"; DialogResult dialogResult = currentNode.SnapIn.Console.ShowDialog(saveFileDialog); if (dialogResult != DialogResult.Cancel) { StreamWriter streamWriter = new StreamWriter(saveFileDialog.FileName, false); try { streamWriter.Write(bizilante.SSO.Helper.SSO.Encrypt(stringBuilder.ToString(), encryptionKey)); streamWriter.Flush(); } catch (Exception ex) { EventLog.WriteEntry("SSO MMC SnapIn - ExportSSOApplication \r\n", ex.ToString()); result = false; return(result); } finally { streamWriter.Close(); streamWriter.Dispose(); } } result = true; } return(result); }
public string[] GetValues(string appName) { try { return(_sso.GetValues(appName)); } catch (Exception exception) { _log.LogError("SSOConfigurationImportMSBuildTask - GetValues {0} failed: {1}", appName, exception.Message); throw; } }
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()); }
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); } }
public void Refresh() { bizilante.SSO.Helper.SSO sSO = new bizilante.SSO.Helper.SSO(); string displayName = base.ScopeNode.DisplayName; string[] keys = sSO.GetKeys(displayName); string[] values = sSO.GetValues(displayName); base.ResultNodes.Clear(); for (int i = 0; i < keys.Length; i++) { if (keys[i] != null && !(keys[i] == "")) { ResultNode resultNode = new ResultNode(); resultNode.DisplayName = keys[i]; resultNode.SubItemDisplayNames.Add(values[i]); base.ResultNodes.Add(resultNode); } } }
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()); }