Example #1
0
        private void SetToolsMenuItemStates()
        {
            if (AppFolders.FileInspectorIsInstalled())
            {
                logger.Trace("File Inspector menu item enabled");
                fileInspectorToolStripMenuItem.ToolTipText = "Launches the File Inspector utility.";
                fileInspectorToolStripMenuItem.Enabled     = true;
            }
            else
            {
                logger.Trace("File Inspector menu item disabled");
                fileInspectorToolStripMenuItem.ToolTipText = "File Inspector is not installed.";
                fileInspectorToolStripMenuItem.Enabled     = false;
            }

            if (AppFolders.SigStudioIsInstalled())
            {
                logger.Trace("Signature Studio menu item enabled");
                launchSignatureStudioToolStripMenuItem.ToolTipText = "Launches the Signature Studio utility.";
                launchSignatureStudioToolStripMenuItem.Enabled     = true;
            }
            else
            {
                logger.Trace("Signature Studio menu item disabled");
                launchSignatureStudioToolStripMenuItem.ToolTipText = "Signature Studio is not installed.";
                launchSignatureStudioToolStripMenuItem.Enabled     = false;
            }
        }
Example #2
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");
        }
 public DeviceAppService(
     IRepository <User, long> userManager,
     IRepository <Device_Info> deviceInfo,
     IRepository <Device_IPEndPort> deviceIPEndPort,
     IRepository <Command_Log> commandLog)
 {
     this._userManager     = userManager;
     this._deviceInfo      = deviceInfo;
     this._deviceIPEndPort = deviceIPEndPort;
     this._commandLog      = commandLog;
     this._appFolders      = IocManager.Instance.Resolve <AppFolders>();
 }
Example #4
0
        private AppFolders GetAppPath()
        {
            var appFolders = new AppFolders();

            appFolders.SampleProfileImagesFolder = Path.Combine(_env.WebRootPath, $"Common{Path.DirectorySeparatorChar}Images{Path.DirectorySeparatorChar}SampleProfilePics");
            appFolders.TempFileDownloadFolder    = Path.Combine(_env.WebRootPath, $"Temp{Path.DirectorySeparatorChar}Downloads");
            appFolders.WebLogsFolder             = Path.Combine(_env.ContentRootPath, $"App_Data{Path.DirectorySeparatorChar}Logs");
            appFolders.UploadFilesFolder         = Path.Combine(_env.WebRootPath, $"Upload");


            return(appFolders);
        }
Example #5
0
 public GrouponRefundsWorker(AbpTimer timer,
                             IRepository <Order, long> orderRepository,
                             IRepository <OrderPay, long> orderPayRepository,
                             IRepository <GrouponOrder, long> groupOrderRepository,
                             AppFolders appFolders
                             ) : base(timer)
 {
     _orderRepository      = orderRepository;
     _orderPayRepository   = orderPayRepository;
     _groupOrderRepository = groupOrderRepository;
     _appFolders           = appFolders;
     Timer.Period          = 1000 * 60 * 10; //每1分钟执行一次
 }
Example #6
0
 public OrderRefundWorker(AbpTimer timer,
                          IRepository <Order, long> orderRepository,
                          IRepository <OrderPay, long> orderPayRepository,
                          IRepository <RefundOrder, long> refundOrderRepository,
                          AppFolders appFolders
                          ) : base(timer)
 {
     _orderRepository       = orderRepository;
     _orderPayRepository    = orderPayRepository;
     _refundOrderRepository = refundOrderRepository;
     _appFolders            = appFolders;
     Timer.Period           = 1000 * 60 * 10; //每10分钟执行一次
 }
Example #7
0
        public override void PostInitialize()
        {
            HttpServerUtility server    = HttpContext.Current.Server;
            AppFolders        appFolder = base.IocManager.Resolve <AppFolders>();

            appFolder.SampleProfileImagesFolder = server.MapPath("~/Common/Images/SampleProfilePics");
            appFolder.TempFileDownloadFolder    = server.MapPath("~/Temp/Downloads");
            try
            {
                DirectoryHelper.CreateIfNotExists(appFolder.TempFileDownloadFolder);
            }
            catch
            {
            }
        }
Example #8
0
        private static CommonParameters InitializeCommonParameters(AppFolders appFolders)
        {
            _database = new Db(appFolders.AppRootFolder);

            var eventAgg = new EventAggregator();

            var imageCacher = new ImageCacher(
                appFolders.ImageCacheFolder, new WebClient(), "https://image.tmdb.org/t/p/w500");

            return(_commonParameters = new CommonParameters(
                       eventAgg,
                       new OfflineServiceProvider(_database),
                       new OnlineServiceProvider(eventAgg),
                       new SnackbarMessageQueue(),
                       imageCacher));
        }
        private void SetButtonStates(int selectedItemCount)
        {
            logger.Debug("Updating button states");
            toolStripButtonDelete.Enabled               = false;
            toolStripButtonDetails.Enabled              = false;
            toolStripButtonRestore.Enabled              = false;
            toolStripDropDownButtonOnline.Enabled       = false;
            toolStripDropDownButtonExtensions.Enabled   = false;
            toolStripButtonOpenOriginalLocation.Enabled = false;

            if (selectedItemCount > 0)
            {
                logger.Trace("Button states initially set to single selection");
                toolStripDropDownButtonOnline.Enabled       = true;
                toolStripDropDownButtonExtensions.Enabled   = true;
                toolStripButtonOpenOriginalLocation.Enabled = true;
                toolStripButtonRestore.Enabled = true;
                toolStripButtonDelete.Enabled  = true;

                if (AppFolders.FileInspectorIsInstalled())
                {
                    logger.Trace("File Inspector button enabled");
                    toolStripButtonDetails.ToolTipText = "Opens file in the File Inspector utility.";
                    toolStripButtonDetails.Enabled     = true;
                }
                else
                {
                    logger.Trace("File Inspector button disabled");
                    toolStripButtonDetails.ToolTipText = "The File Inspector utility is not installed.";
                }

                if (selectedItemCount > 1)
                {
                    logger.Trace("Button states set to multiple selection");
                    toolStripDropDownButtonOnline.Enabled       = false;
                    toolStripDropDownButtonExtensions.Enabled   = false;
                    toolStripButtonOpenOriginalLocation.Enabled = false;
                    toolStripButtonDetails.Enabled = false;
                }
            }
            else
            {
                logger.Trace("Button states set to disabled as no item is selected");
            }
        }
Example #10
0
        public static void Main(string[] args)
        {
            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);

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

            if (args.Length >= 1)
            {
                Application.Run(new FileInspector(args[0]));
            }
            else
            {
                Application.Run(new FileInspector());
            }
        }
Example #11
0
 public GlobalConfig()
 {
     _context = SynchronizationContext.Current ?? new SynchronizationContext();
     Folders = new AppFolders(Constants.AppName);
 }
Example #12
0
 /// <summary>
 /// Create work items for XHarness test execution
 /// </summary>
 /// <returns></returns>
 private async Task ExecuteAsync()
 {
     WorkItems = (await Task.WhenAll(AppFolders.Select(PrepareWorkItem))).Where(wi => wi != null).ToArray();
 }
Example #13
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");
        }
 public FileManagerController(IRepository <Device_Info> deviceInfo)
 {
     _appFolders      = IocManager.Instance.Resolve <AppFolders>();
     this._deviceInfo = deviceInfo;
 }