예제 #1
0
        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();
        }
예제 #2
0
        public void SUT_ComputerSystemMO(string ElementName, out uint ReturnValue, out ManagementPath Job, out ManagementPath ResultingSystem)
        {
            using (var virtualSystemSettingData = VirtualSystemSettingData.CreateInstance())
            {
                virtualSystemSettingData.LateBoundObject["ElementName"]           = ElementName;
                virtualSystemSettingData.LateBoundObject["ConfigurationDataRoot"] = VSSD_ConfigurationDataRoot;
                virtualSystemSettingData.LateBoundObject["VirtualSystemSubtype"]  = VSSD_VirtualSystemSubtype;

                ManagementPath ReferenceConfiguration = null;
                string[]       ResourceSettings       = null;
                string         SystemSettings         = virtualSystemSettingData.LateBoundObject.GetText(TextFormat.WmiDtd20);

                ReturnValue = VSMS.DefineSystem(ReferenceConfiguration, ResourceSettings, SystemSettings, out Job, out ResultingSystem);

                VSSD_ToDestroy.Add(ResultingSystem);
            }
        }