private void StartIEByProcess(string url, IUIService uiService) { bool flag = false; try { this.helpProcess = new Process { StartInfo = new ProcessStartInfo("iexplore.exe", this.IsIE8OrNewer() ? " -new -nomerge " : " -new ") }; if (this.helpProcess.Start()) { this.helpProcess.WaitForInputIdle(2000); flag = true; } } catch (InvalidOperationException) { } catch (Win32Exception) { } if (!flag) { try { WinformsHelper.OpenUrl(new Uri(url)); } catch (UrlHandlerNotFoundException ex) { uiService.ShowError(ex.Message); } } }
private MonadConnectionInfo DiscoverOrganizationConnectionInfo() { if (!WinformsHelper.IsRemoteEnabled()) { return(null); } if (this.Type == OrganizationType.RemoteOnPremise || this.Type == OrganizationType.Cloud) { this.ReportConnectToSpecifiedServerProgress(0); return(this.DiscoverConnectionInfo()); } if (this.Uri != null) { try { this.ReportConnectToSpecifiedServerProgress(0); return(this.DiscoverConnectionInfo()); } catch (PSRemotingDataStructureException) { } catch (PSRemotingTransportException) { } } this.ReportDiscoverServerProgress(15); this.Uri = PSConnectionInfoSingleton.GetRemotePowerShellUri(PSConnectionInfoSingleton.DiscoverExchangeServer()); this.ReportConnectToServerProgress(40); return(this.DiscoverConnectionInfo()); }
public string GetConnectionStringForScript() { if (!WinformsHelper.IsRemoteEnabled()) { return("pooled=false"); } return("timeout=30"); }
internal static byte[] ConvertExpressionStringToByteArray(string expression, ObjectSchema schema) { QueryParser.ConvertValueFromStringDelegate convertDelegate = new QueryParser.ConvertValueFromStringDelegate(MonadFilter.ConvertValueFromString); QueryParser.EvaluateVariableDelegate evalDelegate = new QueryParser.EvaluateVariableDelegate(FilterNode.VarConverter); QueryParser queryParser = new QueryParser(expression, schema, QueryParser.Capabilities.All, evalDelegate, convertDelegate); return(WinformsHelper.Serialize(queryParser.ParseTree)); }
private Icon GetDisplayIcon(DataRow row) { if (string.IsNullOrEmpty(base.WorkUnitIconColumn)) { return(null); } return(WinformsHelper.GetIconFromIconLibrary(row[base.WorkUnitIconColumn].ToString())); }
public override List <string> Validate(object target, Service profile) { List <string> list = new List <string>(); if (WinformsHelper.IsEmptyValue(target)) { list.Add("cannot be null or empty"); } return(list); }
public override void ExtensionExecute(IExchangeExtensionSnapIn snapIn) { try { snapIn.SharedDataItem.RequestDataUpdate(WinformsHelper.Serialize(this)); } catch (PrimarySnapInDataException) { } }
public void Load() { try { using (RegistryKey registryKey = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\ExchangeServer\\v15\\AdminTools", false)) { if (registryKey != null) { this.serializedSettings = (registryKey.GetValue(NodeStructureSettingsStore.NodeStructureSettings) as byte[]); if (this.serializedSettings != null) { NodeStructureSettingsStore nodeStructureSettingsStore = WinformsHelper.DeSerialize(this.serializedSettings) as NodeStructureSettingsStore; if (nodeStructureSettingsStore.settings != null) { if ((from c in nodeStructureSettingsStore.settings where c.State == NodeStructureSettingState.Used select c).Count <NodeStructureSetting>() <= (from c in this.slots where c.Version == NodeStructureSettingsStore.DominantVersion select c).Count <Slot>()) { using (IEnumerator <NodeStructureSetting> enumerator = nodeStructureSettingsStore.settings.GetEnumerator()) { while (enumerator.MoveNext()) { NodeStructureSetting nodeStructureSetting = enumerator.Current; if (nodeStructureSetting.State == NodeStructureSettingState.Used) { this.organizationSettings.Add(new OrganizationSetting { CredentialKey = nodeStructureSetting.CredentialKey, DisplayName = nodeStructureSetting.DisplayName, LogonWithDefaultCredential = nodeStructureSetting.LogonWithDefaultCredential, Type = nodeStructureSetting.Type, Uri = nodeStructureSetting.Uri, SupportedVersionList = new SupportedVersionList(NodeStructureSettingsStore.DominantVersion) }); } } goto IL_172; } } } this.organizationSettings = (nodeStructureSettingsStore.organizationSettings ?? new List <OrganizationSetting>()); this.recentServerUris = (nodeStructureSettingsStore.recentServerUris ?? new List <Uri>()); IL_172: this.LocalOnPremiseRemotePSServer = nodeStructureSettingsStore.LocalOnPremiseRemotePSServer; } } } } catch (Exception) { } }
private void OpenURL(string url) { try { WinformsHelper.OpenUrl(new Uri(url)); } catch (UrlHandlerNotFoundException ex) { base.ShowError(ex.Message); } }
public DetailsTemplatesRootNode() { base.DisplayName = Strings.RootNodeDisplayName; base.Icon = Icons.DetailsTemplate; base.ViewDescriptions.Add(ExchangeFormView.CreateViewDescription(typeof(DetailsTemplatesResultPane))); base.HelpTopic = HelpId.DetailsTemplateRootNode.ToString(); if (WinformsHelper.IsRemoteEnabled()) { base.RegisterConnectionToPSServerAction(); } }
private static void CheckInstalledTopology() { if (EnvironmentAnalyzer.installedTopology == EnvironmentAnalyzer.Topology.Unchecked) { string path = "SOFTWARE\\Microsoft\\ExchangeServer\\v15\\EdgeTransportRole\\AdamSettings\\MSExchange"; if (WinformsHelper.IsValidRegKey(path)) { EnvironmentAnalyzer.installedTopology = EnvironmentAnalyzer.Topology.WorkGroup; return; } EnvironmentAnalyzer.installedTopology = EnvironmentAnalyzer.Topology.ServerForest; } }
public sealed override void ExtensionExecute(IExchangeExtensionSnapIn snapIn) { this.Execute(snapIn); try { snapIn.SharedDataItem.RequestDataUpdate(WinformsHelper.Serialize(new AcKnowledgeCommand { AcknowledgedId = this.Id })); } catch (PrimarySnapInDataException) { } }
public override void UpdateWorkUnits(DataRow row) { this.dataHandler.UpdateWorkUnits(); if (!string.IsNullOrEmpty(base.WorkUnitTextColumn)) { this.dataHandler.WorkUnit.Text = row[base.WorkUnitTextColumn].ToString(); } this.dataHandler.WorkUnit.Description = this.ModifiedParametersDescription; if (!string.IsNullOrEmpty(base.WorkUnitIconColumn)) { this.dataHandler.WorkUnit.Icon = WinformsHelper.GetIconFromIconLibrary(row[base.WorkUnitIconColumn].ToString()); } this.dataHandler.ResetCancel(); }
public QueueViewerNode() { base.DisplayName = Strings.QueueViewer; base.Icon = Icons.QueueViewerTool; base.ViewDescriptions.Add(ExchangeFormView.CreateViewDescription(typeof(QueueViewerResultPane))); base.EnabledStandardVerbs |= 64; base.HelpTopic = HelpId.QueueViewerNode.ToString(); if (WinformsHelper.IsRemoteEnabled()) { base.RegisterConnectionToPSServerAction(); return; } Globals.InitializeMultiPerfCounterInstance("EMC"); }
public static List <FilterNode> GetNodesFromSerializedQueryFilter(byte[] serializedQueryFilter, IList <FilterablePropertyDescription> filterableProperties, ObjectSchema schema) { List <FilterNode> list = new List <FilterNode>(); if (serializedQueryFilter != null) { Hashtable hashtable = new Hashtable(filterableProperties.Count); foreach (FilterablePropertyDescription filterablePropertyDescription in filterableProperties) { hashtable.Add(filterablePropertyDescription.PropertyDefinition.Name, filterablePropertyDescription); } FilterNode.GetNodesFromExpressionTree((QueryFilter)WinformsHelper.DeSerialize(serializedQueryFilter), hashtable, list); } return(list); }
protected override void OnExecute() { base.OnExecute(); DetailsTemplatesResultPane detailsTemplatesResultPane = base.ResultPane as DetailsTemplatesResultPane; string templateIdentity = detailsTemplatesResultPane.SelectedIdentity.ToString(); string text = WinformsHelper.GenerateFormName <DetailsTemplatesEditor>((ADObjectId)detailsTemplatesResultPane.SelectedIdentity); if (!ExchangeForm.ActivateSingleInstanceForm(text)) { DetailsTemplatesEditor detailsTemplatesEditor = new DetailsTemplatesEditor(templateIdentity); detailsTemplatesEditor.Icon = Icons.DetailsTemplate; detailsTemplatesEditor.Name = text; detailsTemplatesEditor.RefreshOnFinish = detailsTemplatesResultPane.GetSelectionRefreshObjects(); detailsTemplatesEditor.PrivateSettings = (detailsTemplatesResultPane.PrivateSettings as DetailsTemplatesEditorSettings); detailsTemplatesEditor.ShowModeless(detailsTemplatesResultPane); detailsTemplatesEditor.HelpTopic = detailsTemplatesResultPane.SelectionHelpTopic; } }
private void contentLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { string text = e.Link.LinkData as string; if (!string.IsNullOrEmpty(text)) { try { WinformsHelper.OpenUrl(new Uri(text)); } catch (UrlHandlerNotFoundException ex) { base.ShowError(ex.Message); } catch (UriFormatException) { } } }
public void Save() { try { byte[] array = WinformsHelper.Serialize(this); if (this.serializedSettings == null || !WinformsHelper.ByteArrayEquals(array, this.serializedSettings)) { using (RegistryKey registryKey = Registry.CurrentUser.CreateSubKey("SOFTWARE\\Microsoft\\ExchangeServer\\v15\\AdminTools")) { registryKey.SetValue(NodeStructureSettingsStore.NodeStructureSettings, array, RegistryValueKind.Binary); } } } catch (SecurityException) { } catch (UnauthorizedAccessException) { } }
public static PSCredential PromptForCredentials(IntPtr parentWindow, string displayName, Uri targetUri, string errorMessage, ref bool pfSave) { string text = errorMessage; NativeMethods.CREDUI_INFO credUiInfo; credUiInfo..ctor(parentWindow); credUiInfo.pszCaptionText = Strings.CredentialInputDialogTitle(displayName); NativeMethods.CredUIReturnCodes credUIReturnCodes; for (;;) { credUiInfo.pszMessageText = (text ?? string.Empty); string userName; SecureString password; credUIReturnCodes = (WinformsHelper.IsWin7OrLater() ? CredentialHelper.SspiPromptForCredentials(credUiInfo, targetUri, ref pfSave, out userName, out password) : CredentialHelper.CredUIPromptForCredentials(credUiInfo, ref pfSave, out userName, out password)); if (credUIReturnCodes == null) { try { return(new PSCredential(userName, password)); } catch (PSArgumentException) { text = Strings.InvalidUserNameOrPassword; continue; } } if (credUIReturnCodes == 1223) { break; } if (credUIReturnCodes != 1315) { goto IL_8F; } text = Strings.InvalidUserNameOrPassword; } return(null); IL_8F: throw new InvalidOperationException(string.Format("PromptForCredentials failed with error {0}.", credUIReturnCodes.ToString())); }
private MonadConnectionInfo RetryCredentialsFromLoadOrInput(Func <PSCredential, MonadConnectionInfo> tryConnectWithCredential) { PSCredential cred = this.proposedCredential; if (cred == null && !string.IsNullOrEmpty(this.credentialKey)) { cred = CredentialHelper.ReadCredential(this.credentialKey); } MonadConnectionInfo monadConnectionInfo = null; while (monadConnectionInfo == null) { if (cred == null && this.uiInteractionHandler != null) { if (WinformsHelper.IsWin7OrLater() && this.orgType == OrganizationType.Cloud) { CredentialHelper.ForceConnection(this.uri); } this.uiInteractionHandler.DoActionSynchronizely(delegate(IWin32Window window) { cred = CredentialHelper.PromptForCredentials((window == null) ? IntPtr.Zero : window.Handle, this.displayName, this.uri, this.GetErrorMessage(), ref this.rememberCredentialChecked); }); if (cred != null && !string.IsNullOrEmpty(this.credentialKey)) { CredentialHelper.RemoveCredential(this.credentialKey); } } if (cred == null) { throw new OperationCanceledException(Strings.UnableToConnectExchangeForest(this.displayName)); } monadConnectionInfo = tryConnectWithCredential(cred); cred = null; } return(monadConnectionInfo); }
public void ReplaceAnchorValues(object dataSource, string listSeparator) { if (dataSource != null) { PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(dataSource); foreach (object obj in this.xml.SelectNodes("a")) { XmlNode xmlNode = (XmlNode)obj; if (!string.IsNullOrEmpty(xmlNode.InnerText)) { string value = xmlNode.Attributes["id"].Value; PropertyDescriptor propertyDescriptor = properties[value]; if (propertyDescriptor != null) { object value2 = propertyDescriptor.GetValue(dataSource); if (!WinformsHelper.IsEmptyValue(value2)) { xmlNode.InnerText = MarkupParser.ValueToString(value2, listSeparator); } } } } } }
public static ExchangeSharedDataCommand Parse(byte[] bytes) { return((ExchangeSharedDataCommand)WinformsHelper.DeSerialize(bytes)); }
private static bool IsExchangeInstalled() { string path = "SOFTWARE\\Microsoft\\ExchangeServer\\v15\\"; return(WinformsHelper.IsValidRegKey(path)); }
protected override void OnExecute() { base.OnExecute(); QueueViewerQueuesResultPane queueViewerQueuesResultPane = base.ResultPane as QueueViewerQueuesResultPane; QueueViewerResultPane queueViewerResultPane = base.ResultPane.ContainerResultPane as QueueViewerResultPane; QueryFilter data = new ComparisonFilter(ComparisonOperator.Equal, ExtensibleMessageInfoSchema.Queue, queueViewerQueuesResultPane.SelectedIdentity); queueViewerResultPane.MessageListResultPane.Text = queueViewerQueuesResultPane.SelectedName; queueViewerResultPane.CommandMessagesView.Text = new LocalizedString(queueViewerResultPane.MessageListResultPane.Text); if (!queueViewerResultPane.ResultPaneTabs.Contains(queueViewerResultPane.MessageListResultPane)) { queueViewerResultPane.ResultPaneTabs.Add(queueViewerResultPane.MessageListResultPane); queueViewerResultPane.CommandMessagesView.Visible = true; QueueViewerResultPaneBase messageListResultPane = queueViewerResultPane.MessageListResultPane; messageListResultPane.SettingsKey = messageListResultPane.Name; messageListResultPane.LoadComponentSettings(); } queueViewerResultPane.MessageListResultPane.Datasource.BeginInit(); queueViewerResultPane.SelectedResultPane = queueViewerResultPane.MessageListResultPane; queueViewerResultPane.MessageListResultPane.ObjectList.FilterControl.PersistedExpression = WinformsHelper.Serialize(data); queueViewerResultPane.MessageListResultPane.Datasource.GoToFirstPage(); queueViewerResultPane.MessageListResultPane.Datasource.EndInit(); queueViewerResultPane.MessageListResultPane.Datasource.Refresh(); }
public sealed override void PrimaryExecute(string key, CommunicationChannelCollection channels, NodeStructureSettingsStore store, SyncQueue syncQueue) { channels[key].Channel.SetData(WinformsHelper.Serialize(this)); }