//public IActionResult IndexSelect()
        //{

        //    var albuns = _albumService.BuscarTodosDoCliente(_session.Get<Cliente>("cliente"));
        //    ViewBag.FotosPreSelecionadas = _session.Get<List<Foto>>("FotosPreSelecionadas");
        //    ViewBag.FotosSelecionadas = _session.Get<List<Foto>>("FotosSelecionadas");
        //    if (ViewBag.FotosPreSelecionadas == null)
        //    {
        //        List<Foto> fotos = new List<Foto>();
        //        foreach (var album in albuns)
        //        {
        //            fotos.AddRange(_fotoService.ReadAllPreselect(album));
        //        }
        //        ViewBag.FotosPreSelecionadas = fotos;
        //    }
        //    if (ViewBag.FotosSelecionadas == null)
        //    {
        //        List<Foto> fotos = new List<Foto>();
        //        foreach (var album in albuns)
        //        {
        //            fotos.AddRange(_fotoService.ReadAllSelect(album));
        //        }
        //        ViewBag.FotosSelecionadas = fotos;
        //    }
        //    _session.Set<List<Foto>>("FotosPreSelecionadas", (List<Foto>)ViewBag.FotosPreSelecionadas);
        //    _session.Set<List<Foto>>("FotosSelecionadas", (List<Foto>)ViewBag.FotosSelecionadas);
        //    return View();
        //}
        //public IActionResult SelectFoto(Guid select)
        //{
        //    ViewBag.FotosPreSelecionadas = _session.Get<List<Foto>>("FotosPreSelecionadas");
        //    ViewBag.FotosSelecionadas = _session.Get<List<Foto>>("FotosSelecionadas");
        //    List<Foto> fotosPreSelecionadas = ViewBag.FotosPreSelecionadas;
        //    List<Foto> fotosSelecionadas = ViewBag.FotosSelecionadas;
        //    foreach (var foto in fotosPreSelecionadas)
        //    {
        //        if(foto.Id == select)
        //        {
        //            foto.Situacao = 1;
        //            fotosSelecionadas.Add(foto);
        //        }
        //    }
        //    foreach (var foto in fotosSelecionadas)
        //    {
        //        fotosPreSelecionadas.Remove(foto);
        //    }
        //    ViewBag.FotosPreSelecionadas= fotosPreSelecionadas;
        //    ViewBag.FotosSelecionadas= fotosSelecionadas;
        //    _session.Set<List<Foto>>("FotosPreSelecionadas", (List<Foto>)ViewBag.FotosPreSelecionadas);
        //    _session.Set<List<Foto>>("FotosSelecionadas", (List<Foto>)ViewBag.FotosSelecionadas);

        //    return View("IndexSelect");
        //}
        //public IActionResult UnSelectFoto(Guid select)
        //{
        //    ViewBag.FotosPreSelecionadas = _session.Get<List<Foto>>("FotosPreSelecionadas");
        //    ViewBag.FotosSelecionadas = _session.Get<List<Foto>>("FotosSelecionadas");
        //    List<Foto> fotosPreSelecionadas = ViewBag.FotosPreSelecionadas;
        //    List<Foto> fotosSelecionadas = ViewBag.FotosSelecionadas;
        //    foreach (var foto in fotosSelecionadas)
        //    {
        //        if (foto.Id == select)
        //        {
        //            foto.Situacao = 0;
        //            fotosPreSelecionadas.Add(foto);
        //        }
        //    }
        //    foreach (var foto in fotosPreSelecionadas)
        //    {
        //        fotosSelecionadas.Remove(foto);
        //    }
        //    ViewBag.FotosPreSelecionadas = fotosPreSelecionadas;
        //    ViewBag.FotosSelecionadas = fotosSelecionadas;
        //    _session.Set<List<Foto>>("FotosPreSelecionadas", (List<Foto>)ViewBag.FotosPreSelecionadas);
        //    _session.Set<List<Foto>>("FotosSelecionadas", (List<Foto>)ViewBag.FotosSelecionadas);
        //    return View("IndexSelect");
        //}

        //public IActionResult CadastrarSelecaoFotos()
        //{
        //    ViewBag.FotosPreSelecionadas = _session.Get<List<Foto>>("FotosPreSelecionadas");
        //    ViewBag.FotosSelecionadas = _session.Get<List<Foto>>("FotosSelecionadas");
        //    List<Foto> fotosPreSelecionadas = ViewBag.FotosPreSelecionadas;
        //    List<Foto> fotosSelecionadas = ViewBag.FotosSelecionadas;

        //    foreach (var foto in fotosSelecionadas)
        //    {
        //        _fotoService.AtualizarSituacao(foto);
        //    }
        //    foreach (var foto in fotosPreSelecionadas)
        //    {
        //        _fotoService.AtualizarSituacao(foto);
        //    }
        //    _session.Set<List<Foto>>("FotosPreSelecionadas", null);
        //    _session.Set<List<Foto>>("FotosSelecionadas", null);
        //    _session.SetString("Alertas", "Parabéns!!!| Você acabou de cadastrar a seleção de fotos do seu album.");

        //    return RedirectToAction("SistemaCliente","Default");
        //}

        public FotoController(IFotoService fotoService, IAlbumService albumService, IHttpContextAccessor httpContextAccessor, IFileServerService fileServerService)
        {
            _fotoService         = fotoService;
            _albumService        = albumService;
            _fileServerService   = fileServerService;
            _httpContextAccessor = httpContextAccessor;
        }
示例#2
0
        /// <summary>
        /// Constructs a new instance of the <see cref="GroupFileController"/>.
        /// </summary>
        /// <param name="fileService"></param>
        /// <param name="membershipService"></param>
        /// <param name="folderService"></param>
        /// <param name="localizationService"></param>
        public GroupFileController(IFileService fileService, IMembershipService membershipService, IFolderService folderService, ILocalizationService localizationService, IFileServerService fileServerService, IConfigurationProvider configurationProvider)
        {
            if (fileService is null)
            {
                throw new ArgumentNullException(nameof(fileService));
            }
            if (membershipService is null)
            {
                throw new ArgumentNullException(nameof(membershipService));
            }
            if (folderService is null)
            {
                throw new ArgumentNullException(nameof(folderService));
            }
            if (localizationService is null)
            {
                throw new ArgumentNullException(nameof(localizationService));
            }
            if (fileServerService is null)
            {
                throw new ArgumentNullException(nameof(fileServerService));
            }
            if (configurationProvider is null)
            {
                throw new ArgumentNullException(nameof(configurationProvider));
            }

            _fileService           = fileService;
            _membershipService     = membershipService;
            _folderService         = folderService;
            _localizationService   = localizationService;
            _fileServerService     = fileServerService;
            _configurationProvider = configurationProvider;
        }
示例#3
0
 public AlbumController(IAlbumService albumService, IClienteService clienteService, IFotoService fotoService, IHttpContextAccessor httpContextAccessor, IFileServerService fileServerService)
 {
     _albumService        = albumService;
     _clienteService      = clienteService;
     _fotoService         = fotoService;
     _httpContextAccessor = httpContextAccessor;
     _fileServerService   = fileServerService;
 }
 public FileServerControler(IHostingEnvironment env,
                            IStatusCodeFactory <IActionResult> codeFactory,
                            IFileServerService service)
 {
     _env         = env ?? throw new ArgumentNullException("Hosting environment is null");
     _codeFactory = codeFactory ?? throw new ArgumentNullException("Status code factory is null");
     _service     = service ?? throw new ArgumentNullException("File server service is null");
 }
示例#5
0
 public NoteController(IFileService fileService, IFileServerService uploadService, IUserService userService, IGroupService groupService, IUnitOfWork unitOfWork)
 {
     _fileService = fileService;
     _uploadService = uploadService;
     _userService = userService;
     _groupService = groupService;
     _unitOfWork = unitOfWork;
 }
示例#6
0
 public FileController(IHttpContextAccessor httpContextAccessor, ILogger <FileController> logger, IFileAndFolderDataProvider fileAndFolderDataProvider, IPermissionsService permissionsService, IFileService fileService, IFileServerService fileServerService, IOptionsSnapshot <ApplicationGateway> gatewayConfig)
 {
     _logger = logger;
     _fileAndFolderDataProvider = fileAndFolderDataProvider;
     _fileService         = fileService;
     _permissionsService  = permissionsService;
     _fileServerService   = fileServerService;
     _httpContextAccessor = httpContextAccessor;
     _fqdn = gatewayConfig.Value.FQDN;
 }
示例#7
0
        private static bool OnClientRequestError__(ByteArray byteArray, IFileServerService serverService)
        {
            int errorCode = byteArray.readDynamicsInt();

            if (ClientRequestErrorHandler__ != null)
            {
                ClientRequestErrorHandler__(errorCode);
            }
            return(true);
        }
示例#8
0
 public ProdutoService(IProdutoRepository produtoRepository,
                       IGeekStoreDbContextService geekStoreDbContextService,
                       IFileServerService fileServerService,
                       INotificationService notificador,
                       IImagemRepository imagemRepository) : base(notificador, produtoRepository)
 {
     _produtoRepository         = produtoRepository;
     _geekStoreDbContextService = geekStoreDbContextService;
     _fileServerService         = fileServerService;
     _imagemRepository          = imagemRepository;
 }
示例#9
0
        private static bool OnSendDirectoryFailed(ByteArray byteArray, IFileServerService serverService)
        {
            int crc = byteArray.readIntNCRC();

            if (crc == byteArray.CRC)
            {
                serverService.OnSendDirectoryFailed();
            }
            byteArray.Recycle();
            return(true);
        }
示例#10
0
 /// <summary>
 /// Initializes a new instance of the WindowViewModel class.
 /// </summary>
 /// <param name="applicationService">Instance of Application state</param>
 /// <param name="userService">Instance of movie history service</param>
 /// <param name="fileServerService">Instance of file server service</param>
 /// <param name="subtitlesService">Instance of subtitles service</param>
 public WindowViewModel(IApplicationService applicationService, IUserService userService, IFileServerService fileServerService, ISubtitlesService subtitlesService)
 {
     _subtitlesService   = subtitlesService;
     _fileServerService  = fileServerService;
     _userService        = userService;
     _dialogCoordinator  = DialogCoordinator.Instance;
     _applicationService = applicationService;
     RegisterMessages();
     RegisterCommands();
     AppDomain.CurrentDomain.UnhandledException += OnUnhandledException;
     ClearFolders();
 }
示例#11
0
        private static bool OnSetWorkingDirectory(ByteArray byteArray, IFileServerService serverService)
        {
            String name = byteArray.readUTF();

            int crc = byteArray.readIntNCRC();

            if (crc == byteArray.CRC)
            {
                serverService.OnSetWorkingDirectory(name);
            }
            byteArray.Recycle();
            return(true);
        }
示例#12
0
        private static bool OnSendFileFailed(ByteArray byteArray, IFileServerService serverService)
        {
            String name   = byteArray.readUTF();
            String reason = byteArray.readUTF();

            int crc = byteArray.readIntNCRC();

            if (crc == byteArray.CRC)
            {
                serverService.OnSendFileFailed(name, reason);
            }
            byteArray.Recycle();
            return(true);
        }
示例#13
0
        private static bool OnBatchComplete(ByteArray byteArray, IFileServerService serverService)
        {
            bool   success = byteArray.readBoolean();
            String name    = byteArray.readUTF();

            int crc = byteArray.readIntNCRC();

            if (crc == byteArray.CRC)
            {
                serverService.OnBatchComplete(success, name);
            }
            byteArray.Recycle();
            return(true);
        }
示例#14
0
        private static bool OnRequestFileSend(ByteArray byteArray, IFileServerService serverService)
        {
            String file        = byteArray.readUTF();
            int    uploadToken = byteArray.readDynamicsInt();
            int    size        = byteArray.readDynamicsInt();

            int crc = byteArray.readIntNCRC();

            if (crc == byteArray.CRC)
            {
                serverService.OnRequestFileSend(file, uploadToken, size);
            }
            byteArray.Recycle();
            return(true);
        }
示例#15
0
        private static bool OnRequestFileBlock(ByteArray byteArray, IFileServerService serverService)
        {
            String    file    = byteArray.readUTF();
            int       blockId = byteArray.readDynamicsInt();
            int       size    = byteArray.readDynamicsInt();
            ByteArray stream  = ByteArray.SReadFromByteArray(byteArray);
            int       special = byteArray.readDynamicsInt();

            int crc = byteArray.readIntNCRC();

            if (crc == byteArray.CRC)
            {
                serverService.OnRequestFileBlock(file, blockId, size, ref stream, special);
            }
            byteArray.Recycle();
            return(true);
        }
        public ChromecastDialogViewModel(string title, string mediaPath, string subtitleFilePath,
                                         IFileServerService fileServerService)
        {
            _subtitleFilePath  = subtitleFilePath;
            _fileServerService = fileServerService;
            _mediaPath         = mediaPath;
            Title       = title;
            Chromecasts = new ObservableCollection <Chromecast>();
            _chromecastService.ChromeCastClient.ApplicationStarted += ApplicationStarted;
            _chromecastService.ChromeCastClient.VolumeChanged      += VolumeChanged;
            _chromecastService.ChromeCastClient.MediaStatusChanged += MediaStatusChanged;
            _chromecastService.ChromeCastClient.ConnectedChanged   += ConnectedChanged;
            _secondsTimer = new DispatcherTimer {
                Interval = TimeSpan.FromSeconds(1)
            };
            _secondsTimer.Tick += SecondsTimer_Tick;
            DispatcherHelper.CheckBeginInvokeOnUI(async() =>
            {
                await LoadChromecasts();
            });

            CloseCommand = new RelayCommand(() =>
            {
                OnCloseAction.Invoke();
            });

            CancelCommand = new RelayCommand(async() =>
            {
                await StopApplication();
                if (_mediaServer != null)
                {
                    await _mediaServer(null);
                }

                if (_subtitleServer != null)
                {
                    await _subtitleServer(null);
                }
            });
        }
示例#17
0
 public FileController(IFileServerService uploadService, IFileService fileService)
 {
     _uploadService = uploadService;
     _fileService = fileService;
 }
示例#18
0
        public static bool IntepretMessage(ByteArray byteArray, IFileServerService serverService)
        {
            byteArray.BypassHeader();
            int  methodID = byteArray.readInt();
            bool mtdrst__ = false;

            switch (methodID)
            {
            case EnumFileMethods.SERVER_REQUESTFILESEND_HASH:
            {
                byteArray.EncryptKey = EnumFileMethods.SERVER_REQUESTFILESEND_HASH;
                byteArray.CRC        = 0;
                byteArray.readDynamicsInt();

                mtdrst__             = OnRequestFileSend(byteArray, serverService);
                byteArray.EncryptKey = 0;
                return(mtdrst__);
            }

            case EnumFileMethods.SERVER_REQUESTFILEBLOCK_HASH:
            {
                byteArray.EncryptKey = EnumFileMethods.SERVER_REQUESTFILEBLOCK_HASH;
                byteArray.CRC        = 0;
                byteArray.readDynamicsInt();

                mtdrst__             = OnRequestFileBlock(byteArray, serverService);
                byteArray.EncryptKey = 0;
                return(mtdrst__);
            }

            case EnumFileMethods.SERVER_STARTBATCH_HASH:
            {
                byteArray.EncryptKey = EnumFileMethods.SERVER_STARTBATCH_HASH;
                byteArray.CRC        = 0;
                byteArray.readDynamicsInt();

                mtdrst__             = OnStartBatch(byteArray, serverService);
                byteArray.EncryptKey = 0;
                return(mtdrst__);
            }

            case EnumFileMethods.SERVER_BATCHCOMPLETE_HASH:
            {
                byteArray.EncryptKey = EnumFileMethods.SERVER_BATCHCOMPLETE_HASH;
                byteArray.CRC        = 0;
                byteArray.readDynamicsInt();

                mtdrst__             = OnBatchComplete(byteArray, serverService);
                byteArray.EncryptKey = 0;
                return(mtdrst__);
            }

            case EnumFileMethods.SERVER_CREATEDIRECTORY_HASH:
            {
                byteArray.EncryptKey = EnumFileMethods.SERVER_CREATEDIRECTORY_HASH;
                byteArray.CRC        = 0;
                byteArray.readDynamicsInt();

                mtdrst__             = OnCreateDirectory(byteArray, serverService);
                byteArray.EncryptKey = 0;
                return(mtdrst__);
            }

            case EnumFileMethods.SERVER_LISTDIRECTORYS_HASH:
            {
                byteArray.EncryptKey = EnumFileMethods.SERVER_LISTDIRECTORYS_HASH;
                byteArray.CRC        = 0;
                byteArray.readDynamicsInt();

                mtdrst__             = OnListDirectorys(byteArray, serverService);
                byteArray.EncryptKey = 0;
                return(mtdrst__);
            }

            case EnumFileMethods.SERVER_DELETEDIRECTORY_HASH:
            {
                byteArray.EncryptKey = EnumFileMethods.SERVER_DELETEDIRECTORY_HASH;
                byteArray.CRC        = 0;
                byteArray.readDynamicsInt();

                mtdrst__             = OnDeleteDirectory(byteArray, serverService);
                byteArray.EncryptKey = 0;
                return(mtdrst__);
            }

            case EnumFileMethods.SERVER_DELETEFILE_HASH:
            {
                byteArray.EncryptKey = EnumFileMethods.SERVER_DELETEFILE_HASH;
                byteArray.CRC        = 0;
                byteArray.readDynamicsInt();

                mtdrst__             = OnDeleteFile(byteArray, serverService);
                byteArray.EncryptKey = 0;
                return(mtdrst__);
            }

            case EnumFileMethods.SERVER_SETWORKINGDIRECTORY_HASH:
            {
                byteArray.EncryptKey = EnumFileMethods.SERVER_SETWORKINGDIRECTORY_HASH;
                byteArray.CRC        = 0;
                byteArray.readDynamicsInt();

                mtdrst__             = OnSetWorkingDirectory(byteArray, serverService);
                byteArray.EncryptKey = 0;
                return(mtdrst__);
            }

            case EnumFileMethods.SERVER_SENDDIRECTORYFAILED_HASH:
            {
                byteArray.EncryptKey = EnumFileMethods.SERVER_SENDDIRECTORYFAILED_HASH;
                byteArray.CRC        = 0;
                byteArray.readDynamicsInt();

                mtdrst__             = OnSendDirectoryFailed(byteArray, serverService);
                byteArray.EncryptKey = 0;
                return(mtdrst__);
            }

            case EnumFileMethods.SERVER_SENDFILEFAILED_HASH:
            {
                byteArray.EncryptKey = EnumFileMethods.SERVER_SENDFILEFAILED_HASH;
                byteArray.CRC        = 0;
                byteArray.readDynamicsInt();

                mtdrst__             = OnSendFileFailed(byteArray, serverService);
                byteArray.EncryptKey = 0;
                return(mtdrst__);
            }

            case EnumFileMethods.CLIENT_REQUESTERROR_HASH:
                byteArray.EncryptKey = EnumFileMethods.CLIENT_REQUESTERROR_HASH;
                byteArray.readDynamicsInt();
                OnClientRequestError__(byteArray, serverService);
                byteArray.EncryptKey = 0;
                return(true);
            }

            // recover the header
            byteArray.Rewind();
            return(false);
        }