Esempio n. 1
0
        protected override async Task OnInitializedAsync()
        {
            Addons = await AddonService.LoadAllCatalogAddons();

            NavigationManager.LocationChanged += NavigationManager_LocationChanged !;
            ParseQueryString();
        }
Esempio n. 2
0
        private async void BtnSearch_Click(object sender, EventArgs e)
        {
            btnSearch.Enabled = false;
            addonsContainer.Controls.Clear();

            var result = await AddonService.GetAddonsAsync(filter : txtSearch.Text);//.ConfigureAwait(false);

            foreach (var item in result)
            {
                var control = item.GetControl();
                addonsContainer.Controls.Add(control);

                if (item != result.LastOrDefault())
                {
                    addonsContainer.Controls.Add(new Panel
                    {
                        Height       = 1,
                        BorderStyle  = BorderStyle.Fixed3D,
                        Width        = control.Width,
                        AutoSizeMode = AutoSizeMode.GrowAndShrink,
                        MinimumSize  = new Size(1, 1),
                        MaximumSize  = new Size(int.MaxValue, 1),
                        BackColor    = Color.DarkGray
                    });
                }
            }

            btnSearch.Enabled = true;
        }
Esempio n. 3
0
 public DataService(IHostingEnvironment hostingEnvironment, DiscordSocketClient client, MessageReceiver receiver, ICommandService commandService,
                    AddonService addons)
 {
     _hostingEnvironment = hostingEnvironment;
     _messageReceiver    = receiver;
     _commandService     = commandService;
     _discord            = client;
     _addons             = addons;
 }
Esempio n. 4
0
        public void Initialize()
        {
            //Set title and print version
            Console.Title = string.Format("RockSniffer {0}", version);
            Logger.Log("RockSniffer {0} ({1}bits)", version, Is64Bits ? "64" : "32");

            //Initialize and load configuration
            config = new Config();
            try
            {
                config.Load();
            }
            catch (Exception e)
            {
                Logger.LogError("Could not load configuration: {0}\r\n{1}", e.Message, e.StackTrace);
                throw e;
            }

            //Run version check
            if (!config.debugSettings.disableVersionCheck)
            {
                VersionCheck();
            }

            //Transfer logging options
            Logger.logStateMachine      = config.debugSettings.debugStateMachine;
            Logger.logCache             = config.debugSettings.debugCache;
            Logger.logFileDetailQuery   = config.debugSettings.debugFileDetailQuery;
            Logger.logMemoryReadout     = config.debugSettings.debugMemoryReadout;
            Logger.logSongDetails       = config.debugSettings.debugSongDetails;
            Logger.logSystemHandleQuery = config.debugSettings.debugSystemHandleQuery;

            //Initialize cache
            cache = new SQLiteCache();

            //Create directories
            Directory.CreateDirectory("output");

            //Enable addon service if configured
            if (config.addonSettings.enableAddons)
            {
                try
                {
                    addonService = new AddonService(config.addonSettings, new SQLiteStorage());
                }
                catch (SocketException e)
                {
                    Logger.LogError("Please verify that the IP address is valid and the port is not already in use");
                    Logger.LogError("Could not start addon service: {0}\r\n{1}", e.Message, e.StackTrace);
                }
                catch (Exception e)
                {
                    Logger.LogError("Could not start addon service: {0}\r\n{1}", e.Message, e.StackTrace);
                }
            }
        }
Esempio n. 5
0
 public Worker(ILogger <Worker> logger,
               CpuStressService cpuStressService,
               AddonService addonService,
               IOptions <GeneralConfig> generalConfig,
               IHostApplicationLifetime hostApplicationLifetime)
 {
     this._logger                  = logger;
     _cpuStressService             = cpuStressService;
     _addonService                 = addonService;
     _generalConfig                = generalConfig.Value;
     this._hostApplicationLifetime = hostApplicationLifetime;
     Debug.WriteLine(typeof(TestWebAddon.LeakyAddon).Name);
 }
Esempio n. 6
0
        public void Initialize()
        {
            //Set title and print version
            Console.Title = string.Format("RockSniffer {0}", version);
            Console.WriteLine("RockSniffer {0} ({1}bits)", version, CustomAPI.Is64Bits() ? "64" : "32");

            //Initialize and load configuration
            config = new Config();
            config.Load();

            //Transfer logging options
            Logger.logStateMachine      = config.debugSettings.debugStateMachine;
            Logger.logCache             = config.debugSettings.debugCache;
            Logger.logFileDetailQuery   = config.debugSettings.debugFileDetailQuery;
            Logger.logHIRCScan          = config.debugSettings.debugHIRCScan;
            Logger.logMemoryReadout     = config.debugSettings.debugMemoryReadout;
            Logger.logSongDetails       = config.debugSettings.debugSongDetails;
            Logger.logSystemHandleQuery = config.debugSettings.debugSystemHandleQuery;

            //Initialize cache
            cache = new FileCache(cachedir);

            //Create directories
            Directory.CreateDirectory("output");

            //Enable addon service if configured
            if (config.addonSettings.enableAddons)
            {
                try
                {
                    addonService = new AddonService(config.addonSettings.ipAddress, config.addonSettings.port);
                }
                catch (SocketException e)
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine("Please verify that the IP address is valid and the port is not already in use");
                    Console.WriteLine("Could not start addon service: {0}", e.Message);
                    Console.WriteLine(e.StackTrace);
                    Console.ResetColor();
                }
                catch (Exception e)
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine("Could not start addon service: {0}", e.Message);
                    Console.WriteLine(e.StackTrace);
                    Console.ResetColor();
                }
            }
        }
Esempio n. 7
0
        private async Task DeleteAddon(string id)
        {
            var addon = AllAddons!.SingleOrDefault(x => x.Manifest!.Id!.Equals(id));

            bool? result = await DialogService.ShowMessageBox(
                "Warning",
                $"Delete addon {addon!.Manifest!.Name}?",
                yesText: "Delete",
                cancelText: "Cancel");

            if (result.HasValue && result.Value)
            {
                await AddonService.DeleteAddon(id);
            }


            await LoadAddons();
        }
Esempio n. 8
0
 public BotService(
     IServiceProvider services, ILogger <BotService> logger, AbyssConfig config, DiscordSocketClient socketClient, MessageReceiver messageReceiver, AddonService addonService,
     NotificationsService notifications, DataService dataService, ILoggerFactory factory,
     MarketingService marketing)
 {
     _logger                     = logger;
     _discordClient              = socketClient;
     _config                     = config;
     _serviceProvider            = services;
     _discordClient.Log         += DiscordClient_Log;
     _discordClient.Ready       += DiscordClient_Ready;
     _discordClient.JoinedGuild += DiscordClient_JoinedGuild;
     _discordClient.LeftGuild   += DiscordClient_LeftGuild;
     _messageReceiver            = messageReceiver;
     _addonService               = addonService;
     _notifications              = notifications;
     _dataService                = dataService;
     _discordLogger              = factory.CreateLogger("Discord");
     _marketing                  = marketing;
 }
Esempio n. 9
0
        protected override async Task OnInitializedAsync()
        {
            Addons = await AddonService.LoadAllCatalogAddons();

            StateHasChanged();
        }
Esempio n. 10
0
 private async Task SaveAddon(string url, string manifestString)
 {
     await AddonService.SaveAddon(url, manifestString);
     await LoadAddons();
 }
Esempio n. 11
0
 private async Task LoadAddons()
 {
     AllAddons = await AddonService.LoadAllAddons();
     StateHasChanged();
 }