protected virtual void Dispose(bool disposing) { try { VSSD_ToDestroy?.ForEach((vssd) => VSMS?.DestroySystem(vssd, out ManagementPath Job)); } catch (ManagementException e) { Trace.WriteLine($"[{DateTime.Now}] [{e.Message}]"); } try { VESSD_ToDestroy?.ForEach((vessd) => VESMS?.DestroySystem(vessd, out ManagementPath Job)); } catch (ManagementException e) { Trace.WriteLine($"[{DateTime.Now}] [{e.Message}]"); } if (disposing) { VSMS?.Dispose(); IMS?.Dispose(); } VSSD_ToDestroy.Clear(); VESSD_ToDestroy.Clear(); }
public void SUT_VirtualEthernetSwitchSettingDataMO(string ElementName, string Notes, out uint ReturnValue, out ManagementPath Job, out ManagementPath ResultingSystem) { using (var virtualEthernetSwitchSettingData = VirtualEthernetSwitchSettingData.CreateInstance()) { virtualEthernetSwitchSettingData.LateBoundObject["ElementName"] = ElementName; virtualEthernetSwitchSettingData.LateBoundObject["Notes"] = new string[] { Notes }; ManagementPath ReferenceConfiguration = null; var SystemSettings = virtualEthernetSwitchSettingData.LateBoundObject.GetText(TextFormat.WmiDtd20); var ResourceSettings = Array.Empty <string>(); ReturnValue = VESMS.DefineSystem(ReferenceConfiguration, ResourceSettings, SystemSettings, out Job, out ResultingSystem); VESSD_ToDestroy.Add(ResultingSystem); } }