public void InitializeExWithScratchDirectory()
        {
            FileInfo      logFile          = new FileInfo(Path.Combine(Path.GetTempPath(), $"{Guid.NewGuid():N}.log"));
            DirectoryInfo scratchDirectory = Directory.CreateDirectory(Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString("N")));

            DismApi.InitializeEx(DismLogLevel.LogErrors, logFile.FullName, scratchDirectory.FullName);

            try
            {
            }
            finally
            {
                DismApi.Shutdown();

                if (logFile.Exists)
                {
                    logFile.Delete();
                }

                if (scratchDirectory.Exists)
                {
                    scratchDirectory.Delete(recursive: true);
                }
            }
        }
Exemple #2
0
        public frmMain()
        {
            InitializeComponent();

            // Other init stuff here
            treeViewTreatments.ExpandAll();
            logger.SetTarget(txtResults);
            DismApi.InitializeEx(DismLogLevel.LogErrors);
        }
        public void InitializeExSimple(DismLogLevel logLevel)
        {
            DismApi.InitializeEx(logLevel);

            try
            {
            }
            finally
            {
                DismApi.Shutdown();
            }
        }
Exemple #4
0
        public frmMain()
        {
            InitializeComponent();

            // Other init stuff here
            DismApi.InitializeEx(DismLogLevel.LogErrors);

            // Treatments
            InitTreatments();

            // Icons
            treeViewTreatments.ImageList = StateIcons;
            treeViewTreatments.ImageKey  = "NotStarted";
            lstResults.SmallImageList    = StateIcons;
        }
        public void InitializeExWithLogFilePath()
        {
            string logFilePath = Path.Combine(Path.GetTempPath(), $"{Guid.NewGuid():N}.log");

            DismApi.InitializeEx(DismLogLevel.LogErrors, logFilePath);

            try
            {
            }
            finally
            {
                DismApi.Shutdown();

                if (File.Exists(logFilePath))
                {
                    File.Delete(logFilePath);
                }
            }
        }