Upload PDF or P7S file into XML

1

I have the following XML line in an XML Schema.

{**<nomeArquivoP7S><nomeArquivoP7S>**}

and I want to include a file in p7s named copia1.pdf.p7s on this line, that is I want to load this file into XML to be transmitted by doing the following:

{**<nomeArquivoP7S>copia1.pdf.p7s<nomeArquivoP7S>**}

What I understand is that it will have to read the directory where it is, locate the file and load it?

Would it be more or less like this?

string fichaconcatenada = fileName + ".pdf.p7s";

//string str = arroba + Caminhoconcatenado + fichaconcatenada;
string str = Caminhoconcatenado + "\" + fichaconcatenada;

//string[] words = { arroba,"\Imagens_SEFAZ\", fichaconcatenada };
//var res = words.Aggregate((current, next) => current + "\" + next);
FileStream stream =  new FileStream(@str, FileMode.Open);

// instanciando a variável do tipo BinaryReader
BinaryReader reader = new BinaryReader(stream);

// variáveis recebendo os valores lidos pelo arquivo binário
int lendointeiro = reader.ReadInt32();
string lendotexto = reader.ReadString();
Byte lendobool = reader.ReadByte();
//double conteudoArquivoP7S = reader.ReadDouble();
// fecha o acesso com o arquivo
reader.Close();
var bytes = Encoding.UTF8.GetBytes(fichaconcatenada);
var conteudoArquivoP7S = Convert.ToBase64String(bytes);

The detail is that in doing so, it only brings me the content in binary and not the name + content.

How to do it?

    
asked by anonymous 17.03.2015 / 20:55

0 answers