Пример #1
0
        public CustomCommandListPageViewModel(ISshService sshService, IMessageBoxService messageBoxService)
        {
            _sshService = sshService;


            _messageBoxService = messageBoxService;
            RunCommand         = new Command(Run);
            ClearCommand       = new Command(Clear);
            ExecuteCommand     = new Command(o => Execute(o));
        }
Пример #2
0
        public AptUpdatesPageViewModel(ISshService sshService, IMessageBoxService messageBoxService,
                                       IRewardService rewardService)
        {
            Title                     = Resource.Apt;
            _sshService               = sshService;
            _messageBoxService        = messageBoxService;
            UpdatesCmd                = new Command(Updates);
            UpdateSelectedItemsCmd    = new Command(UpdateSelectedItems);
            SelectUnselectAllItemsCmd = new Command(SelectUnselectAllItems);

            _rewardService             = rewardService;
            _rewardService.OnRewarded += Current_OnRewarded;
            _rewardService.OnRewardedVideoAdClosed          += Current_OnRewardedVideoAdClosed;
            _rewardService.OnRewardedVideoAdLeftApplication += Current_OnRewardedVideoAdLeftApplication;
        }
Пример #3
0
 public SystemService(
     ILogger <SystemService> logger,
     IConfiguration configuration,
     IServiceProvider serviceProvider,
     IWebHostEnvironment hostingEnvironment,
     ISshService sshService,
     ISettingsService settingsService
     )
 {
     this.Logger             = logger;
     this.Configuration      = configuration;
     this.ServiceProvider    = serviceProvider;
     this.HostingEnvironment = hostingEnvironment;
     this.SSHService         = sshService;
     this.SettingsService    = settingsService;
 }
        public void Start()
        {
            try
            {
                logger.Debug("SSHServerDaemon starting...");

                NSshServiceConfiguration configuration = NSshServiceConfiguration.LoadFromFile(m_nsshConfigurationFilePath);
                SetupDependencies(configuration);

                m_sshService = Dependency.Resolve <ISshService>();
                ((NSshService)m_sshService).Start();
            }
            catch (Exception excp)
            {
                logger.Error("Exception SSHServerDaemon Start. " + excp.Message);
            }
        }
        public MainPageViewModel(ISshService sshService, IConfiguration configuration)
        {
            Title       = Resource.Home;
            _sshService = sshService;

            CmdState    = RefreshCmd;
            _addHostCmd = new Command(
                AddHost);
            SetCommandForStateView(_addHostCmd);

            ManageHostsCmd   = new Command(ManageHosts);
            ChangeHostCmd    = new Command(async() => await ChangeHost());
            UpdatesCmd       = new Command(Updates);
            ShowProcessesCmd = new Command(ShowProcesses);
            ShowTestsPageCmd = new Command(() => NavigationService.NavigateAsync(nameof(TestPage)));
            BannerId         = configuration.AdsKey;
        }
Пример #6
0
        public SoundService(
            IServiceProvider serviceProvider,
            ILogger <ISoundService> logger,
            IConfiguration configuration,
            ISshService sshService,
            IHubContext <SoundHub> soundHub,
            IWebHostEnvironment environment
            )
        {
            this.serviceProvider = serviceProvider;
            this.Logger          = logger;
            this.Configuration   = configuration;
            this.SshService      = sshService;
            this.SoundHub        = soundHub;
            this.Environment     = environment;

            LoggingThread = new Thread(() =>
            {
                while (keepRunning)
                {
                    if (!Usages.IsEmpty)
                    {
                        List <SoundUsage> tempsForSave = new List <SoundUsage>();
                        while (!Usages.IsEmpty)
                        {
                            if (Usages.TryDequeue(out SoundUsage item))
                            {
                                tempsForSave.Add(item);
                            }
                        }

                        using (var scope = serviceProvider.CreateScope())
                        {
                            var db = scope.ServiceProvider.GetRequiredService <NervboxDBContext>();
                            db.SoundUsages.AddRange(tempsForSave);
                            db.SaveChanges();
                        }
                    }

                    Thread.Sleep(10000);
                }
            });

            LoggingThread.Start();
        }
Пример #7
0
        public CamService(
            IServiceProvider serviceProvider,
            ILogger <ICamService> logger,
            IConfiguration configuration,
            ISshService sshService,
            IHubContext <CamHub> camHub,
            IWebHostEnvironment environment
            )
        {
            this.serviceProvider = serviceProvider;
            this.Logger          = logger;
            this.Configuration   = configuration;
            this.SshService      = sshService;
            this.CamHub          = camHub;
            this.Environment     = environment;

            this.AppSettings = Configuration.GetSection("AppSettings").Get <AppSettings>();
        }
        /// <summary>
        /// Contains the middleware logic that handles HTTP requests.
        /// </summary>
        /// <param name="context">Encapsulates all HTTP-specific information about an individual HTTP request.</param>
        /// <param name="sshService">The injected instance of SshService.</param>
        /// <param name="operatingSystemService">The injected instance of OsService.</param>
        /// <returns>A <see cref="Task"/> representing the result of the asynchronous operation.</returns>
        public async Task InvokeAsync(HttpContext context, ISshService sshService, IOsService operatingSystemService)
        {
            if ("/shell".Equals(context.Request.Path))
            {
                if (context.WebSockets.IsWebSocketRequest)
                {
                    WebSocket webSocket = await context.WebSockets.AcceptWebSocketAsync();

                    var os = await operatingSystemService.GetAsync();

                    await sshService.BindAsync(webSocket, os.SshPort);
                }
                else
                {
                    context.Response.StatusCode = (int)HttpStatusCode.BadRequest;
                }
            }
            else
            {
                // Call the next delegate/middleware in the pipeline
                await this.next(context);
            }
        }
Пример #9
0
 public SshController(ISshService SshService, IHostingEnvironment environment)
 {
     this.SshService  = SshService;
     this.Environment = environment;
 }
Пример #10
0
 public MainController(ISshService isshService, ISftpService isftpService, CertificateService certificateService)
 {
     this._isshService        = isshService;
     this._isftpService       = isftpService;
     this._certificateService = certificateService;
 }
 public ProcessesPageViewModel(ISshService sshService)
 {
     Title              = Resource.Processes;
     _sshService        = sshService;
     StopProcessCommand = new Command(async o => await StopProcess(o));
 }
Пример #12
0
 public DisksUsageViewmodel(ISshService sshService)
 {
     _sshService = sshService;
 }
        public void Start()
        {
            try
            {
                logger.Debug("SSHServerDaemon starting...");

                NSshServiceConfiguration configuration = NSshServiceConfiguration.LoadFromFile(m_nsshConfigurationFilePath);
                SetupDependencies(configuration);

                m_sshService = Dependency.Resolve<ISshService>();
                ((NSshService)m_sshService).Start();
            }
            catch (Exception excp)
            {
                logger.Error("Exception SSHServerDaemon Start. " + excp.Message);
            }
        }
 public LogsViewmodel(ISshService sshService)
 {
     _sshService = sshService;
 }
Пример #15
0
 public CertificateService(DataContext dataCtx, ISshService sshService)
 {
     this._dataCtx    = dataCtx;
     this._sshService = sshService;
 }
Пример #16
0
 public ExecSubCommand(ISshService sshService)
 {
     _sshService = sshService;
 }
Пример #17
0
 public DockerSubCommand(ISshService sshService)
 {
     _sshService = sshService;
 }
Пример #18
0
 public CopySubCommand(ISshService sshService)
 {
     _sshService = sshService;
 }