Exemplo n.º 1
0
        public FrontEnd()
        {
            InitializeComponent();
            ServerService.Logging.LogMessage += Logging_LogMessage;
            Helper.Logging.LogMessage += Logging_LogMessage;

            Stats = new Statistics(1000, false);

            if (!ServerService.Helper.UacHelper.IsProcessElevated && ServerService.Helper.UacHelper.IsUacEnabled)
            {
                Helper.Logging.OnLogMessage("The application is not running as administrator. Features like banning might not work.", Logging.MessageType.Warning);
            }
            else
            {
                Helper.Logging.OnLogMessage("The application is running as administrator. Keep in mind, that everything that is launched from here, will run as administrator as well.", Logging.MessageType.Info);
            }
        }
Exemplo n.º 2
0
        public FrontEnd()
        {
            InitializeComponent();
            ServerService.Logging.LogMessage += Logging_LogMessage;
            Helper.Logging.LogMessage += Logging_LogMessage;

            Stats = new Statistics(false);

            ServerService.Helper.Settings.Instance.ConfigureStatistics(ref stats);
            notifyPropertyChanged("Stats");

            Infrastructure.Server.Instance.Statistics = Stats;

            Infrastructure.Server.Instance.GetLog = () =>
            {
                return LogControl.Messages.ToList();
            };

            Infrastructure.Server.Instance.ClearLog = () =>
            {
                Dispatcher.Invoke(() =>
                {
                    LogControl.ClearLog();
                });
            };

            if (File.Exists(Dialogs.IPFilter.ListLocation))
                AccessControl.Instance.RestoreList(Dialogs.IPFilter.ListLocation);

            if (File.Exists(ServerService.Helper.Settings.Instance.AdditionalProcessesLocation))
                ServerService.Helper.Settings.Instance.RestoreAdditionalProcceses(ServerService.Helper.Settings.Instance.AdditionalProcessesLocation);

            if (!ServerService.Helper.UacHelper.IsProcessElevated && ServerService.Helper.UacHelper.IsUacEnabled)
            {
                Helper.Logging.OnLogMessage("The application is not running as administrator. Features like banning might not work.", MessageType.Warning);
            }
            else
            {
                Helper.Logging.OnLogMessage("The application is running as administrator. Keep in mind, that everything that is launched from here, will run as administrator as well.", MessageType.Info);
            }
#if DEBUG
            ToggleInterProcessCommunication_Click(null, null);
#endif

            if (Helper.Settings.Instance.AutostartCWSProtocol)
            {
                ToggleInterProcessCommunication_Click(null, null);
            }

            if (Helper.Settings.Instance.AutostartStatistics)
            {
                ToggleStatisticsButton_Click(null, null);
            }

            if (Helper.Settings.Instance.AutostartWatcher)
            {
                if (ServerService.Helper.Settings.Instance.Validates)
                    ToggleWatcher_Click(null, null);
                else
                    Helper.Logging.OnLogMessage("Not all settings are set. Watcher not started.", MessageType.Warning);
            }
        }