public override IDeepCopyable CopyTo(IDeepCopyable other) { var dest = other as Location; if (dest == null) { throw new ArgumentException("Can only copy to an object of the same type", "other"); } base.CopyTo(dest); if (Identifier != null) { dest.Identifier = new List <Hl7.Fhir.Model.Identifier>(Identifier.DeepCopy()); } if (StatusElement != null) { dest.StatusElement = (Code <Hl7.Fhir.Model.Location.LocationStatus>)StatusElement.DeepCopy(); } if (NameElement != null) { dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopy(); } if (DescriptionElement != null) { dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopy(); } if (ModeElement != null) { dest.ModeElement = (Code <Hl7.Fhir.Model.Location.LocationMode>)ModeElement.DeepCopy(); } if (Type != null) { dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopy(); } if (Telecom != null) { dest.Telecom = new List <Hl7.Fhir.Model.ContactPoint>(Telecom.DeepCopy()); } if (Address != null) { dest.Address = (Hl7.Fhir.Model.Address)Address.DeepCopy(); } if (PhysicalType != null) { dest.PhysicalType = (Hl7.Fhir.Model.CodeableConcept)PhysicalType.DeepCopy(); } if (Position != null) { dest.Position = (Hl7.Fhir.Model.Location.PositionComponent)Position.DeepCopy(); } if (ManagingOrganization != null) { dest.ManagingOrganization = (Hl7.Fhir.Model.ResourceReference)ManagingOrganization.DeepCopy(); } if (PartOf != null) { dest.PartOf = (Hl7.Fhir.Model.ResourceReference)PartOf.DeepCopy(); } return(dest); }
public override IDeepCopyable CopyTo(IDeepCopyable other) { var dest = other as List; if (dest != null) { base.CopyTo(dest); if (Identifier != null) { dest.Identifier = new List <Hl7.Fhir.Model.Identifier>(Identifier.DeepCopy()); } if (Code != null) { dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopy(); } if (Subject != null) { dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopy(); } if (Source != null) { dest.Source = (Hl7.Fhir.Model.ResourceReference)Source.DeepCopy(); } if (DateElement != null) { dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopy(); } if (OrderedElement != null) { dest.OrderedElement = (Hl7.Fhir.Model.FhirBoolean)OrderedElement.DeepCopy(); } if (ModeElement != null) { dest.ModeElement = (Code <Hl7.Fhir.Model.List.ListMode>)ModeElement.DeepCopy(); } if (Entry != null) { dest.Entry = new List <Hl7.Fhir.Model.List.ListEntryComponent>(Entry.DeepCopy()); } if (EmptyReason != null) { dest.EmptyReason = (Hl7.Fhir.Model.CodeableConcept)EmptyReason.DeepCopy(); } return(dest); } else { throw new ArgumentException("Can only copy to an object of the same type", "other"); } }
public override IDeepCopyable CopyTo(IDeepCopyable other) { var dest = other as SectionComponent; if (dest != null) { base.CopyTo(dest); if (TitleElement != null) { dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopy(); } if (Code != null) { dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopy(); } if (Text != null) { dest.Text = (Hl7.Fhir.Model.Narrative)Text.DeepCopy(); } if (ModeElement != null) { dest.ModeElement = (Hl7.Fhir.Model.Code)ModeElement.DeepCopy(); } if (OrderedBy != null) { dest.OrderedBy = (Hl7.Fhir.Model.CodeableConcept)OrderedBy.DeepCopy(); } if (Entry != null) { dest.Entry = new List <Hl7.Fhir.Model.ResourceReference>(Entry.DeepCopy()); } if (EmptyReason != null) { dest.EmptyReason = (Hl7.Fhir.Model.CodeableConcept)EmptyReason.DeepCopy(); } if (Section != null) { dest.Section = new List <Hl7.Fhir.Model.Composition.SectionComponent>(Section.DeepCopy()); } return(dest); } else { throw new ArgumentException("Can only copy to an object of the same type", "other"); } }
public override ErrorList Validate() { var result = new ErrorList(); result.AddRange(base.Validate()); if (ModeElement != null) { result.AddRange(ModeElement.Validate()); } if (TimeElement != null) { result.AddRange(TimeElement.Validate()); } if (Party != null) { result.AddRange(Party.Validate()); } return(result); }
public override ErrorList Validate() { var result = new ErrorList(); result.AddRange(base.Validate()); if (Code != null) { result.AddRange(Code.Validate()); } if (Source != null) { result.AddRange(Source.Validate()); } if (DateElement != null) { result.AddRange(DateElement.Validate()); } if (OrderedElement != null) { result.AddRange(OrderedElement.Validate()); } if (ModeElement != null) { result.AddRange(ModeElement.Validate()); } if (Entry != null) { Entry.ForEach(elem => result.AddRange(elem.Validate())); } if (EmptyReason != null) { result.AddRange(EmptyReason.Validate()); } return(result); }
public override IDeepCopyable CopyTo(IDeepCopyable other) { var dest = other as List; if (dest == null) { throw new ArgumentException("Can only copy to an object of the same type", "other"); } base.CopyTo(dest); if (Identifier != null) { dest.Identifier = new List <Hl7.Fhir.Model.Identifier>(Identifier.DeepCopy()); } if (StatusElement != null) { dest.StatusElement = (Code <Hl7.Fhir.Model.List.ListStatus>)StatusElement.DeepCopy(); } if (ModeElement != null) { dest.ModeElement = (Code <Hl7.Fhir.Model.ListMode>)ModeElement.DeepCopy(); } if (TitleElement != null) { dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopy(); } if (Code != null) { dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopy(); } if (Subject != null) { dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopy(); } if (Encounter != null) { dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopy(); } if (DateElement != null) { dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopy(); } if (Source != null) { dest.Source = (Hl7.Fhir.Model.ResourceReference)Source.DeepCopy(); } if (OrderedBy != null) { dest.OrderedBy = (Hl7.Fhir.Model.CodeableConcept)OrderedBy.DeepCopy(); } if (Note != null) { dest.Note = new List <Hl7.Fhir.Model.Annotation>(Note.DeepCopy()); } if (Entry != null) { dest.Entry = new List <Hl7.Fhir.Model.List.EntryComponent>(Entry.DeepCopy()); } if (EmptyReason != null) { dest.EmptyReason = (Hl7.Fhir.Model.CodeableConcept)EmptyReason.DeepCopy(); } return(dest); }
new public void Activate(string templateName) { lock (activationLock) { base.Activate(templateName); // validation if (String.IsNullOrEmpty(TemplateName)) { // no argument return; } // initialize templates TemplateElement templateElement = GetTemplateElement(false, TemplateName); if (templateElement == null) { return; } ModeElement modeElement = templateElement.Mode; ModificationsElement modificationsElement = templateElement.Modifications; if (!modificationsElement.ElementInformation.IsPresent) { return; } TemplateElement activeTemplateElement = GetActiveTemplateElement(true, TemplateName); ModificationsElement activeModificationsElement = activeTemplateElement.Modifications; // initialize variables string comparableName = null; string value = null; List <string> values = null; string compatibilityLayerValue = null; List <string> compatibilityLayerValues = new List <string>(); // compatibility settings try { // we need to find the compatibility layers so we can check later if the ones we want are already set compatibilityLayerValue = Environment.GetEnvironmentVariable(__COMPAT_LAYER, EnvironmentVariableTarget.Process); } catch (ArgumentException) { throw new EnvironmentVariablesFailedException("Failed to get the " + __COMPAT_LAYER + " Environment Variable."); } catch (SecurityException) { throw new TaskRequiresElevationException("Getting the " + __COMPAT_LAYER + " Environment Variable requires elevation."); } ProgressManager.CurrentGoal.Start(modificationsElement.EnvironmentVariables.Count + modificationsElement.EnvironmentVariables.Count); try { EnvironmentVariablesElement activeEnvironmentVariablesElement = null; EnvironmentVariablesElement environmentVariablesElement = null; // set active configuration for (int i = 0; i < modificationsElement.EnvironmentVariables.Count; i++) { environmentVariablesElement = modificationsElement.EnvironmentVariables.Get(i) as EnvironmentVariablesElement; if (environmentVariablesElement == null) { throw new System.Configuration.ConfigurationErrorsException("The Environment Variables Element (" + i + ") is null while creating the Active Environment Variables Element."); } comparableName = GetComparableName(environmentVariablesElement.Name); if (UnmodifiableComparableNames.Contains(comparableName)) { throw new EnvironmentVariablesFailedException("The " + environmentVariablesElement.Name + " Environment Variable cannot be modified while creating the Active Environment Variables Element."); } try { activeEnvironmentVariablesElement = new EnvironmentVariablesElement { Name = environmentVariablesElement.Name, Find = environmentVariablesElement.Find, Value = Environment.GetEnvironmentVariable(environmentVariablesElement.Name, EnvironmentVariableTarget.Process) }; } catch (ArgumentException) { throw new EnvironmentVariablesFailedException("Failed to get the " + environmentVariablesElement.Name + " Environment Variable."); } catch (SecurityException) { throw new TaskRequiresElevationException("Getting the " + environmentVariablesElement.Name + " Environment Variable requires elevation."); } activeModificationsElement.EnvironmentVariables.Set(activeEnvironmentVariablesElement); ProgressManager.CurrentGoal.Steps++; } SetFlashpointSecurePlayerSection(TemplateName); // set environment variables for (int i = 0; i < modificationsElement.EnvironmentVariables.Count; i++) { environmentVariablesElement = modificationsElement.EnvironmentVariables.Get(i) as EnvironmentVariablesElement; if (environmentVariablesElement == null) { throw new System.Configuration.ConfigurationErrorsException("The Environment Variables Element (" + i + ") is null."); } comparableName = GetComparableName(environmentVariablesElement.Name); if (UnmodifiableComparableNames.Contains(comparableName)) { throw new EnvironmentVariablesFailedException("The " + environmentVariablesElement.Name + " Environment Variable cannot be modified at this time."); } value = GetValue(environmentVariablesElement); try { Environment.SetEnvironmentVariable(environmentVariablesElement.Name, Environment.ExpandEnvironmentVariables(value), EnvironmentVariableTarget.Process); } catch (ArgumentException) { throw new EnvironmentVariablesFailedException("Failed to set the " + environmentVariablesElement.Name + " Environment Variable."); } catch (SecurityException) { throw new TaskRequiresElevationException("Setting the " + environmentVariablesElement.Name + " Environment Variable requires elevation."); } // now throw up a restart in Web Browser Mode for Compatibility Settings if (comparableName == __COMPAT_LAYER && modeElement.Name == ModeElement.NAME.WEB_BROWSER) { values = new List <string>(); // the compatibility layers may contain more values // but we're only concerned if it contains the values we want if (compatibilityLayerValue != null) { compatibilityLayerValues = compatibilityLayerValue.ToUpperInvariant().Split(' ').ToList(); } if (value != null) { values = value.ToUpperInvariant().Split(' ').ToList(); } // we have to restart in this case in server mode // because the compatibility layers only take effect // on process start if (values.Except(compatibilityLayerValues).Any()) { throw new CompatibilityLayersException("The Compatibility Layers (" + value + ") cannot be set."); } } ProgressManager.CurrentGoal.Steps++; } } finally { ProgressManager.CurrentGoal.Stop(); } } }
public void Deactivate(FlashpointSecurePlayer.MODIFICATIONS_REVERT_METHOD modificationsRevertMethod = FlashpointSecurePlayer.MODIFICATIONS_REVERT_METHOD.CRASH_RECOVERY) { lock (deactivationLock) { // do the reverse of activation because we can base.Deactivate(); TemplateElement activeTemplateElement = GetActiveTemplateElement(false); // if the activation backup doesn't exist, we don't need to do stuff if (activeTemplateElement == null) { return; } ModificationsElement activeModificationsElement = activeTemplateElement.Modifications; if (activeModificationsElement.EnvironmentVariables.Count <= 0) { return; } // if the activation backup exists, but no key is marked as active... // we assume the registry has changed, and don't revert the changes, to be safe // (it should never happen unless the user tampered with the config file) string templateElementName = activeTemplateElement.Active; // don't allow infinite recursion! if (String.IsNullOrEmpty(templateElementName)) { activeModificationsElement.EnvironmentVariables.Clear(); SetFlashpointSecurePlayerSection(TemplateName); return; } TemplateElement templateElement = GetTemplateElement(false, templateElementName); ModeElement modeElement = templateElement.Mode; ModificationsElement modificationsElement = null; // if the active element pointed to doesn't exist... same assumption // and another safeguard against recursion if (templateElement != null && templateElement != activeTemplateElement) { if (templateElement.Modifications.ElementInformation.IsPresent) { modificationsElement = templateElement.Modifications; } } if (modificationsElement == null) { activeModificationsElement.EnvironmentVariables.Clear(); SetFlashpointSecurePlayerSection(TemplateName); return; } // initialize variables string comparableName = null; string value = null; List <string> values = null; string compatibilityLayerValue = null; List <string> compatibilityLayerValues = new List <string>(); // compatibility settings try { compatibilityLayerValue = Environment.GetEnvironmentVariable(__COMPAT_LAYER, EnvironmentVariableTarget.Process); } catch (ArgumentException) { throw new EnvironmentVariablesFailedException("Failed to get the " + __COMPAT_LAYER + " Environment Variable."); } catch (SecurityException) { throw new TaskRequiresElevationException("Getting the " + __COMPAT_LAYER + " Environment Variable requires elevation."); } // we get this right away here // as opposed to after the variable has been potentially set like during activation if (compatibilityLayerValue != null) { compatibilityLayerValues = compatibilityLayerValue.ToUpperInvariant().Split(' ').ToList(); } ProgressManager.CurrentGoal.Start(activeModificationsElement.EnvironmentVariables.Count); try { EnvironmentVariablesElement environmentVariablesElement = null; EnvironmentVariablesElement activeEnvironmentVariablesElement = null; for (int i = 0; i < activeModificationsElement.EnvironmentVariables.Count; i++) { environmentVariablesElement = modificationsElement.EnvironmentVariables.Get(i) as EnvironmentVariablesElement; if (environmentVariablesElement == null) { throw new EnvironmentVariablesFailedException("The Environment Variable element (" + i + ") is null."); } activeEnvironmentVariablesElement = activeModificationsElement.EnvironmentVariables.Get(environmentVariablesElement.Name) as EnvironmentVariablesElement; if (activeEnvironmentVariablesElement != null) { comparableName = GetComparableName(activeEnvironmentVariablesElement.Name); if (UnmodifiableComparableNames.Contains(comparableName)) { throw new EnvironmentVariablesFailedException("The " + activeEnvironmentVariablesElement.Name + " Environment Variable cannot be modified at this time."); } value = environmentVariablesElement.Value; values = new List <string>(); if (value != null) { values = value.ToUpperInvariant().Split(' ').ToList(); } if (modificationsRevertMethod == FlashpointSecurePlayer.MODIFICATIONS_REVERT_METHOD.DELETE_ALL) { try { Environment.SetEnvironmentVariable(activeEnvironmentVariablesElement.Name, null, EnvironmentVariableTarget.Process); } catch (ArgumentException) { throw new EnvironmentVariablesFailedException("Failed to delete the " + environmentVariablesElement.Name + " Environment Variable."); } catch (SecurityException) { throw new TaskRequiresElevationException("Deleting the " + environmentVariablesElement.Name + " Environment Variable requires elevation."); } } else { // don't reset Compatibility Settings if we're restarting for Web Browser Mode if (comparableName != __COMPAT_LAYER || values.Except(compatibilityLayerValues).Any() || modeElement.Name != ModeElement.NAME.WEB_BROWSER) { try { Environment.SetEnvironmentVariable(activeEnvironmentVariablesElement.Name, activeEnvironmentVariablesElement.Value, EnvironmentVariableTarget.Process); } catch (ArgumentException) { throw new EnvironmentVariablesFailedException("Failed to set the " + environmentVariablesElement.Name + " Environment Variable."); } catch (SecurityException) { throw new TaskRequiresElevationException("Setting the " + environmentVariablesElement.Name + " Environment Variable requires elevation."); } } } ProgressManager.CurrentGoal.Steps++; } } activeModificationsElement.EnvironmentVariables.Clear(); SetFlashpointSecurePlayerSection(TemplateName); } finally { ProgressManager.CurrentGoal.Stop(); } } }
public override IDeepCopyable CopyTo(IDeepCopyable other) { var dest = other as CompositionAttesterComponent; if (dest != null) { base.CopyTo(dest); if (ModeElement != null) { dest.ModeElement = new List <Code <Hl7.Fhir.Model.Composition.CompositionAttestationMode> >(ModeElement.DeepCopy()); } if (TimeElement != null) { dest.TimeElement = (Hl7.Fhir.Model.FhirDateTime)TimeElement.DeepCopy(); } if (Party != null) { dest.Party = (Hl7.Fhir.Model.ResourceReference)Party.DeepCopy(); } return(dest); } else { throw new ArgumentException("Can only copy to an object of the same type", "other"); } }
public void Activate(string templateName, ref ProcessStartInfo softwareProcessStartInfo, out bool softwareIsOldCPUSimulator) { OldCPUSimulatorElement oldCPUSimulatorElement = null; softwareIsOldCPUSimulator = false; base.Activate(templateName); if (String.IsNullOrEmpty(TemplateName)) { // no argument return; } TemplateElement templateElement = GetTemplateElement(false, TemplateName); if (templateElement == null) { return; } ModeElement modeElement = templateElement.Mode; ModificationsElement modificationsElement = templateElement.Modifications; if (!modificationsElement.ElementInformation.IsPresent) { return; } oldCPUSimulatorElement = modificationsElement.OldCPUSimulator; if (!oldCPUSimulatorElement.ElementInformation.IsPresent) { return; } // sigh... okay // first, we check the target rate if (oldCPUSimulatorElement.TargetRate == null) { throw new OldCPUSimulatorFailedException("The target rate is required."); } if (TestRunningWithOldCPUSimulator()) { // aaand we're done return; } // next... we need to check if the CPU speed is actually faster than // what we want to underclock to long mhzLimit = 0; ProcessStartInfo oldCPUSimulatorProcessStartInfo = new ProcessStartInfo(OLD_CPU_SIMULATOR_PATH, "--dev-get-mhz-limit") { UseShellExecute = false, RedirectStandardError = false, RedirectStandardOutput = true, RedirectStandardInput = false, WindowStyle = ProcessWindowStyle.Hidden, CreateNoWindow = true, ErrorDialog = false }; try { Process oldCPUSimulatorProcess = Process.Start(oldCPUSimulatorProcessStartInfo); if (!oldCPUSimulatorProcess.HasExited) { oldCPUSimulatorProcess.WaitForExit(); } string oldCPUSimulatorProcessStandardError = null; string oldCPUSimulatorProcessStandardOutput = null; if (oldCPUSimulatorProcessStartInfo.RedirectStandardError) { oldCPUSimulatorProcessStandardError = oldCPUSimulatorProcess.StandardError.ReadToEnd(); } if (oldCPUSimulatorProcessStartInfo.RedirectStandardOutput) { oldCPUSimulatorProcessStandardOutput = oldCPUSimulatorProcess.StandardOutput.ReadToEnd(); } if (oldCPUSimulatorProcess.ExitCode != 0 || !long.TryParse(oldCPUSimulatorProcessStandardOutput.Split('\n').Last(), out mhzLimit)) { throw new OldCPUSimulatorFailedException("Failed to get rate limit."); } } catch { throw new OldCPUSimulatorFailedException("Failed to get rate limit."); } // if our CPU is too slow, just ignore the modification if (mhzLimit <= oldCPUSimulatorElement.TargetRate) { return; } switch (modeElement.Name) { case ModeElement.NAME.WEB_BROWSER: // server mode, need to restart the whole app // handled in the GUI side of things throw new OldCPUSimulatorRequiresApplicationRestartException("The Old CPU Simulator in Web Browser Mode requires a restart."); case ModeElement.NAME.SOFTWARE: // USB the HDMI to .exe the database string commandLineExpanded = Environment.ExpandEnvironmentVariables(modeElement.CommandLine); StringBuilder oldCPUSimulatorSoftware = new StringBuilder("\""); // the problem we're dealing with here // is that we need to get the full path to // the executable we want to launch // because we want to change the working directory // but still launch the executable from a path // potentially relative to this executable try { string[] argv = CommandLineToArgv(commandLineExpanded, out int argc); if (argc <= 0) { throw new IndexOutOfRangeException("The command line argument is out of range."); } // TODO: deal with paths with quotes... someday oldCPUSimulatorSoftware.Append(Path.GetFullPath(argv[0])); } catch { throw new OldCPUSimulatorFailedException("The command line is invalid."); } oldCPUSimulatorSoftware.Append("\" "); oldCPUSimulatorSoftware.Append(GetCommandLineArgumentRange(commandLineExpanded, 1, -1)); // this becomes effectively the new thing passed as --software // the shared function is used both here and GUI side for restarts //modeElement.CommandLine = OLD_CPU_SIMULATOR_PATH + " " + GetOldCPUSimulatorProcessStartInfoArguments(oldCPUSimulatorElement, oldCPUSimulatorSoftware.ToString()); softwareIsOldCPUSimulator = true; if (softwareProcessStartInfo == null) { softwareProcessStartInfo = new ProcessStartInfo(); } softwareProcessStartInfo.FileName = OLD_CPU_SIMULATOR_PATH; softwareProcessStartInfo.Arguments = GetOldCPUSimulatorProcessStartInfoArguments(oldCPUSimulatorElement, oldCPUSimulatorSoftware.ToString()); softwareProcessStartInfo.RedirectStandardError = true; softwareProcessStartInfo.RedirectStandardOutput = false; softwareProcessStartInfo.RedirectStandardInput = false; // hide the Old CPU Simulator window... we always do this HideWindow(ref softwareProcessStartInfo); // default the working directory to here // (otherwise it'd get set to Old CPU Simulator's directory, not desirable) if (String.IsNullOrEmpty(modeElement.WorkingDirectory)) { softwareProcessStartInfo.WorkingDirectory = Environment.CurrentDirectory; } return; } throw new OldCPUSimulatorFailedException("No Mode was used which Old CPU Simulator supports."); }
new public void Activate(string templateName) { base.Activate(templateName); if (String.IsNullOrEmpty(TemplateName)) { // no argument return; } TemplateElement templateElement = GetTemplateElement(false, TemplateName); if (templateElement == null) { return; } ModeElement modeElement = templateElement.Mode; ModificationsElement modificationsElement = templateElement.Modifications; if (!modificationsElement.ElementInformation.IsPresent) { return; } SingleInstanceElement singleInstanceElement = modificationsElement.SingleInstance; if (!singleInstanceElement.ElementInformation.IsPresent) { return; } string executable = singleInstanceElement.Executable; if (String.IsNullOrEmpty(executable)) { string[] argv = CommandLineToArgv(Environment.ExpandEnvironmentVariables(modeElement.CommandLine), out int argc); if (argc > 0) { executable = argv[0]; } } if (String.IsNullOrEmpty(executable)) { return; } //string[] argv = CommandLineToArgv(executablePath, out int argc); List <Process> processesByName; List <Process> processesByNameStrict; string processName = null; // GetProcessesByName can't have extension (stupidly) string activeProcessName = Path.GetFileNameWithoutExtension(executable); do { // the strict list is the one which will be checked against for real processesByName = Process.GetProcessesByName(activeProcessName).ToList(); processesByNameStrict = new List <Process>(); if (singleInstanceElement.Strict) { for (int i = 0; i < processesByName.Count; i++) { processName = GetProcessName(processesByName[i]); try { if (ComparePaths(executable, processName)) { processesByNameStrict.Add(processesByName[i]); } } catch { // Fail silently. } } } else { processesByNameStrict = processesByName; } // don't allow preceding further until // all processes with the same name have been killed if (processesByNameStrict.Any()) { DialogResult?dialogResult = ShowClosableMessageBox(Task.Run(delegate() { while (processesByNameStrict.Any()) { if (!processesByNameStrict[0].HasExited) { processesByNameStrict[0].WaitForExit(); } processesByNameStrict.RemoveAt(0); } }), String.Format(Properties.Resources.ProcessCompatibilityConflict, activeProcessName), Properties.Resources.FlashpointSecurePlayer, MessageBoxButtons.OKCancel, MessageBoxIcon.Warning); if (dialogResult == DialogResult.Cancel) { Application.Exit(); throw new InvalidModificationException("The operation was aborted by the user."); } } // continue this process until the problem is resolved } while (processesByNameStrict.Any()); }