public VideoV01 AbrirVideo01(string arquivoNome) { //if (!VerificarIntegridade(arquivoNome)) // throw new NotImplementedException("O arquivo está corrompido!!!"); video = (VideoV01)video.Abrir(arquivoNome); return(video); }
private void CarregarListaVideos() { listaVideos.Clear(); foreach (string caminho in listaPaths) { if (caminho.EndsWith(".v01")) { VideoV01 video = new VideoV01(); if (caminho.Contains(":")) { video.Abrir(caminho); } else { video.Abrir(DiretorioRaiz + Util.Util.TrataDiretorioFWParaWindows(Util.Util.ARQUIVO_SEPARADOR_DIRETORIO + caminho)); } listaVideos.Add(video); } else if (caminho.EndsWith(".v02")) { VideoV02 video = new VideoV02(); if (caminho.Contains(":")) { //se for mais de um video video.Abrir(caminho); } else { // se for apenas um video video.Abrir(DiretorioRaiz + Util.Util.TrataDiretorioFWParaWindows(Util.Util.ARQUIVO_SEPARADOR_DIRETORIO + caminho)); } listaVideos.Add(video); } else if (caminho.EndsWith(".v04")) { VideoV04 video = new VideoV04(); if (caminho.Contains(":")) { video.Abrir(caminho); } else { video.Abrir(DiretorioRaiz + Util.Util.TrataDiretorioFWParaWindows(Util.Util.ARQUIVO_SEPARADOR_DIRETORIO + caminho)); } listaVideos.Add(video); } } }
public VideoV01(VideoV01 oldValue) { this.Indice = oldValue.Indice; this.versao = oldValue.versao; this.Formato = oldValue.Formato; this.animacao = oldValue.animacao; this.alinhamento = oldValue.alinhamento; this.otimizacao = oldValue.otimizacao; this.inverteLeds = oldValue.inverteLeds; this.tempoRolagem = oldValue.tempoRolagem; this.tempoApresentacao = oldValue.tempoApresentacao; this.tamanhoString = oldValue.tamanhoString; this.fontPath = oldValue.fontPath; this.crc = oldValue.crc; this.tamanho = oldValue.tamanho; this._texto = oldValue._texto; }
public VideoTexto() { this.video = new VideoV01(); }
/* * /// <summary> * /// Método Salvar - Responsável por salvar o arquivo * /// </summary> * /// <param name="nomeArquivo">arquivoNome - Este parametro é o caminho do arquivo mais o nome do arquivo.</param> * /// <remarks> Lembrar de preencher o video antes de mandar salvar</remarks> * public override void Salvar(string arquivoNome, object controlador) * { * VideoV01 videoLocal = this.video; * * if (null != controlador) * { * videoLocal = (VideoV01)controlador; * } * * FileStream fs = File.Create(arquivoNome); * fs.Write(videoLocal.ToArrayBytes(), 0, videoLocal.ToArrayBytes().Length); * fs.Close(); * video.AtualizarCRC(arquivoNome); * } */ public IVideo Abrir(String arquivoNome) { this.video = this.AbrirVideo01(arquivoNome); return(this); }
public void LoadFromBytes(byte[] dados) { unsafe { fixed(byte *pSrc = dados) { FormatoPlaylist *listaArquivos = (FormatoPlaylist *)pSrc; Byte[] temporario = new byte[listaArquivos->qtdArquivos]; listaArquivos->Tamanho = (UInt32)dados.Length; this.versao = listaArquivos->versao; this.qtdArquivos = listaArquivos->qtdArquivos; // Limpa a lista this.listaVideos.Clear(); int indice = sizeof(FormatoPlaylist) - sizeof(UInt32); for (int i = 0; i < this.qtdArquivos; i++) { int indiceInicial = indice; // Pegar o tamanho do Arquivo uint tamanhoArquivo = BitConverter.ToUInt32(dados, indice); byte[] dadosVideo = new byte[tamanhoArquivo]; // Atualiza o indice com o tamanho do arquivo indice += sizeof(uint); // Pular a versão indice++; Array.Copy(dados, indiceInicial, dadosVideo, 0, tamanhoArquivo); // Pegar o formato do Arquivo Ex.: V02 if (Encoding.ASCII.GetString(dados, indice, 3).ToUpper().Equals("V01")) { // Instancia o video a partir do formato VideoV01 video = new VideoV01(); // Carrega através do ARRAY video.LoadFromBytes(dadosVideo); // Adiciona o video listaVideos.Add(video); } else if (Encoding.ASCII.GetString(dados, indice, 3).ToUpper().Equals("V02")) { // Instancia o video a partir do formato VideoV02 video = new VideoV02(); // Carrega através do ARRAY video.LoadFromBytes(dadosVideo); // Adiciona o video listaVideos.Add(video); } else if (Encoding.ASCII.GetString(dados, indice, 3).ToUpper().Equals("V04")) { // Instancia o video a partir do formato VideoV04 video = new VideoV04(); // Carrega através do ARRAY video.LoadFromBytes(dadosVideo); // Adiciona o video listaVideos.Add(video); } indice = indice + dadosVideo.Length; indice = indice - sizeof(uint); indice = indice - 1; } } } }
public void LoadFromBytes(byte[] dados) { if (null == this.listaVideos) { this.listaVideos = new List <IVideo>(); } unsafe { fixed(byte *pSrc = dados) { FormatoVideo04 *listaArquivos = (FormatoVideo04 *)pSrc; Byte[] temporario = new byte[listaArquivos->qntFrames]; listaArquivos->Tamanho = (UInt32)dados.Length; this.versao = listaArquivos->versao; uint qtdFrames = listaArquivos->qntFrames; // Limpa a lista this.listaVideos.Clear(); int indice = sizeof(FormatoVideo04) - sizeof(UInt32); for (int i = 0; i < qtdFrames; i++) { FormatoFrame temporaria = new FormatoFrame(); temporaria.x = BitConverter.ToUInt32(dados, indice); indice += sizeof(uint); temporaria.y = BitConverter.ToUInt32(dados, indice); indice += sizeof(uint); temporaria.height = BitConverter.ToUInt32(dados, indice); indice += sizeof(uint); temporaria.width = BitConverter.ToUInt32(dados, indice); indice += sizeof(uint); listaFrames.Add(temporaria); // Pegar o tamanho do Arquivo uint tamanhoArquivo = BitConverter.ToUInt32(dados, indice); byte[] dadosVideo = new byte[tamanhoArquivo]; Array.Copy(dados, indice, dadosVideo, 0, tamanhoArquivo); // índice do tamanho indice += sizeof(uint); // índice da versão indice++; // Pegar o formato do Arquivo Ex.: V02 if (Encoding.ASCII.GetString(dados, indice, 3).ToUpper().Equals("V01")) { // Instancia o video a partir do formato VideoV01 video = new VideoV01(); // Carrega através do ARRAY video.LoadFromBytes(dadosVideo); // Adiciona o video listaVideos.Add(video); } else if (Encoding.ASCII.GetString(dados, indice, 3).ToUpper().Equals("V02")) { // Instancia o video a partir do formato VideoV02 video = new VideoV02(); // Carrega através do ARRAY video.LoadFromBytes(dadosVideo); // Adiciona o video listaVideos.Add(video); } else if (Encoding.ASCII.GetString(dados, indice, 3).ToUpper().Equals("PLS")) { // Instancia o video a partir do formato Arquivo_PLS video = new Arquivo_PLS(); // Carrega através do ARRAY video.LoadFromBytes(dadosVideo); // Adiciona o video listaVideos.Add(video); } indice = indice + dadosVideo.Length - (sizeof(uint) + 1 /*tamanho da versão*/); } } } }