Re: Assembly conversion to Pocket Pc format



It should also work with binary files, show us the PDA code now you've
amended it.
--
Simon Hart
Visual Developer - Device Application Development MVP
http://simonrhart.blogspot.com


"Harsha" wrote:

Thank you very much Mr. Hart for your time and response.

In MSDN I found out an article which is close to this. That says how to
upload and download files in compact framework.

Link of that document is
http://msdn2.microsoft.com/en-us/library/aa446517.aspx

I replicated the steps given ( please click on the above link ) and could
successfully download files to device. But I couldn't download any dll's. But
I can download text files,xml files,images.
I want to with this application can I download dll files ? If not what
changes I have to make do so ?

Thanks in advance.

Harsha.



"Simon Hart [MVP]" wrote:

On the client end you are using StreamReader and StreamWriter. These classes
are usally used for text files not binary plus you could have encoding
issues. Calling ReadLine and WriteLine will append \r\n carriage return and
line feed characters to each buffer read/write. This is probebly why it is
not working for you. Try using BinaryReader/BinaryWriter classes, and the
Read and Write methods.
--
Simon Hart
Visual Developer - Device Application Development MVP
http://simonrhart.blogspot.com


"Harsha" wrote:

Thanks for below information. I tried a sample code. I am sharing same with
you.

sample code -> web application runnin on IIS


{
string strfilename =
"c:\\inetpub\\wwwroot\\DownloadCABForMypaq\\mypaq\\mypaq.exe";
System.IO.BinaryReader BR = new
System.IO.BinaryReader(File.Open(strfilename , FileMode.Open,
FileAccess.Read));
BR.BaseStream.Position = 0;
byte[] binFile = BR.ReadBytes(Convert.ToInt32(BR.BaseStream.Length));
Response.BinaryWrite(binFile);

BR.Close();
Response.End();
Response.Flush();
}


Client application - running in PDA (windows mobile 4x)

{
string FileName = "mypaq.exe";
string downloadUrl =
"http://16.138.51.97/DownloadCABForMypaq/DownloadCAB.aspx?file="; + FileName;
HttpWebRequest req =
(HttpWebRequest)WebRequest.Create(downloadUrl);
req.Method = "GET";

HttpWebResponse resp = (HttpWebResponse)req.GetResponse();

Stream respStream = resp.GetResponseStream();
StreamReader rdr = new StreamReader(respStream);
localFile = strAppExecPath1 + FileName;

// Create the local file
StreamWriter wrtr = new StreamWriter(localFile);

// loop through response stream reading each line
// and writing to the local file
string inLine = rdr.ReadLine();
int iSize = 0;
while (inLine != null)
{
wrtr.WriteLine(inLine);
iSize = iSize + inLine.Length;
inLine = rdr.ReadLine();
}

rdr.Close();
wrtr.Close();
}

Problem -> after download of the data from server it is stored in a file in
PDA.
when i try to run, the application does not run on PDA
the mypaq.exe is a device application compiled in .NET
can you check if i have done any mistake in coding.


Thanks for your patience.

Harsha.



"Christopher Fairbairn" wrote:

Hi,

"Harsha" <Harsha@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:D6B67244-6E28-4998-8846-E2FC0A008155@xxxxxxxxxxxxxxxx
My scenario is I have set of Compact framework DLL's (Not winodws
assembly).
Till date I used to manually paste those into my device. While doing that
it
used to copy and convert those assemblies into device format.

Are you talking about the dialog that appears while transfering files to an
ActiveSync connected via Windows Explorer?

If so the conversion process mentioned in the dialog isn't doing anything
for .NET assemblies, i.e. it is simply passing them through unmodified.

Only files of certain file types are passed through a convertor when
transfered via ActiveSync and to my knowledge .NET assemblies are not one of
those file types. It's mainly wordprocessor and spread*** type formats
that are converted by ActiveSync for use with Pocket Word or Excel.

Now I want to automate that process and I don't want to manually copy them
rather I want to download from HTTP or HTTPS. So while downloading text
file
downloads properly. But for assembly's,images,videos format needs to be
changed as it was happening when we manually copy to device.

As long as the files are being treated as binary data and not text data by
any code related to the HTTP transfer the assemblies should transfer over
HTTP or HTTPS just fine without any modification or conversion required.

Hope this helps,
Christopher Fairbairn



.


Loading