Esempio n. 1
0
        internal static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            /* Set up the logging framework */
            Logging.Initialize();
            logger.Info("Application started");
            logger.Info("App Version: {0}", Assembly.GetExecutingAssembly().GetName().Version.ToString());
            logger.Info("Portable Mode: {0}", AppFolders.PortableMode);
            logger.Info("Base Working Directory: {0}", AppFolders.BaseWorkingFolder);

            logger.Info("System Name: {0}", WMI.QuerySystemName());
            logger.Info("Operating System: {0}", WMI.QueryWindowsVersion());
            logger.Info("OS Service Pack: {0}", WMI.QueryWindowsServicePack());
            logger.Info("System Memory: {0}", WMI.QueryInstalledMemory());
            logger.Info("BIOS ID: {0}", WMI.QueryInstalledBIOS());
            logger.Info("System Role: {0}", WMI.QueryDomainRole());

            if (!AppFolders.WorkingFolderIsWritable())
            {
                logger.Error("Working directory was not writable. Terminating...");
                return;
            }

            logger.Info("Launching main user interface");
            Application.Run(new FormMain());
            logger.Info("Application closed cleanly");
        }
Esempio n. 2
0
        public static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            /* Set up the logging framework */
            Logging.Initialize(EdUtils.Settings.LogLevel.ENHANCED);
            logger.Info("Application started");

            /* Make sure there is write access to the working folder */
            if (!AppFolders.WorkingFolderIsWritable())
            {
                logger.Error("Working directory was not writable. Terminating...");
                return;
            }

            /* Ensure that required working folders are present */
            AppFolders.CreateWorkingFolders();

            /* Load application-level settings */
            try
            {
                settingsManager = SettingsManager.Instance;
            }
            catch (Exception ex)
            {
                logger.Error(
                    ex,
                    "Application settings couldn't be loaded from {0}.",
                    AppFolders.AppSettingsPath);

                if (File.Exists(AppFolders.AppSettingsPath))
                {
                    logger.Debug("The application settings file exists.");
                }

                return;
            }

            /* Re-initialize the logger now that the desired log level is known */
            Logging.Initialize(settingsManager.app.LoggingLevel);

            /* Log some machine info */
            logger.Info("App Version: {0}", Assembly.GetExecutingAssembly().GetName().Version.ToString());
            logger.Info("Portable Mode: {0}", AppFolders.PortableMode);
            logger.Info("Base Working Directory: {0}", AppFolders.BaseWorkingFolder);

            logger.Info("System Name: {0}", WMI.QuerySystemName());
            logger.Info("Operating System: {0}", WMI.QueryWindowsVersion());
            logger.Info("OS Service Pack: {0}", WMI.QueryWindowsServicePack());
            logger.Info("System Memory: {0}", WMI.QueryInstalledMemory());
            logger.Info("BIOS ID: {0}", WMI.QueryInstalledBIOS());
            logger.Info("System Role: {0}", WMI.QueryDomainRole());

            /* Remove outdated reports */
            if (settingsManager.app.ReportCleanupEnabled)
            {
                ReportManager.PurgeExpiredReports(settingsManager.app.MaxReportAgeDays);
            }

            Quarantine.QuarantineManager.PurgeUntrackedFiles();

            /* Remove outdated files from quarantine */
            if (settingsManager.app.QuarantineCleanupEnabled)
            {
                Quarantine.QuarantineManager.PurgeExpiredFiles(settingsManager.app.MaxQuarantineFileAgeDays);
            }

            logger.Info("Launching main user interface");
            Application.Run(new FormMain());
            logger.Info("Application closed cleanly");
        }