|
Are you absolutely sure your .zip file is in gzip format? The gzip format has a header and the GZipStream class accounts for this. But, if your .zip file is not in gzip format, the gzip decompression will not work.
Your .zip file may have been created with the DEFLATE compression method in which case you need to use the DeflateStream class.
Simply substitute GZipStream with DeflateStream and see what happens...
|
|
|
|
|
I am trying to unzip an container .zip file (it contains many files & folder within that). My app. downloads this .zip file from an http URL of an web site & then tries to unzip it.
After implementing DeflateStream class, it shows me following error:
"Block length does not match with its complement"
Regards,
Vipul Mehta
|
|
|
|
|
ZIP is not GZip. They are different formats. GZip compresses a single stream of bytes, ZIP is a container for multiple files each of which can be compressed a different way (although conventionally the Deflate algorithm is used, unless that gives no compression in which case the original file is simply stored instead).
The ZIP format is documented[^]. Parsing it is actually pretty easy.
SharpZipLib does work but I've found it pretty slow.
The GZipStream and DeflateStream classes are primarily intended for the web support e.g. HttpWebRequest, because the HTTP protocol allows responses to be compressed. Java has ZIP classes because its class library format, JAR, is simply a renamed ZIP file. (An individual class's bytecode is stored in a .class file, early versions of Java did not allow you to bundle these up into a package, later versions added the Java ARchive, JAR, format.)
DoEvents : Generating unexpected recursion since 1991
|
|
|
|
|
Hello,
I have code in VC++ with MFC.Can I develop the same code in .NET framework.
What major changes will be required in the VC++ code.
Prithaa
|
|
|
|
|
Well - if you're dealing entirely with the .NET framework, then pretty much every bit of your MFC code is going to change. If it works as MFC, why change it?
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
If you are developing new code, why waste time with a 15 year old API like MFC.
If you are trying to use existing MFC code, you can host your MFC code in WPF through the interop mechanisms.
Only you can weigh the cost between salvaging MFC code or re-writing it in Windows Forms or WPF.
|
|
|
|
|
Hello,
Thanks for your support.
Where will I find the details of hosting MFC code in WPF ?
Can you give me the link.
Prithaa
|
|
|
|
|
I'm a book worm, myself...
Windows Presentation Foundation Unleashed - Adam Nathan
Essential Windows Presentation Foundation - Chris Anderson
|
|
|
|
|
Is there some utility that can scan an assembly and spit out any methods that are being used that are not .netcf compliant?
Cum catapultae proscriptae erunt tum soli proscripti catapultas habebunt
|
|
|
|
|
netcf means .NET Compact Framework? And by compliant you mean API's being used?
Could you use the decompiler utilities to produce code, then put it in a CF project and compile it?
|
|
|
|
|
Sorry yes, it's the .net compact framework for windows mobile devices.
I have the code, it's my own code however it was never written with .net cf in mind and a customer of ours wants to use our developers api to write some kind of net cf utility or add-on.
I just wanted something that could quickly scan through it and show all the uses of methods etc that were not .netcf compliant. I already know it isn't even fundamental things like Decimal.TryParse are not supported so no question about it working or not, I just wanted details I could provide to the guy (and out of my own curiosity) without having to install all that windows mobile mumbo jumbo for visual studio.
Cum catapultae proscriptae erunt tum soli proscripti catapultas habebunt
|
|
|
|
|
Oh, I was way off track, sorry.
|
|
|
|
|
Fastest way to do it.. honestly.. very low tech.
Create a Smart Device project, drop all your files in, and try to compile. You'll immediately get a nice long list of all the things the CF compiler doesn't recognize
I've done this a couple of times. Will this serve your purpose?
Edit:
Oh, I missed this part:
without having to install all that windows mobile mumbo jumbo for visual studio.
Hmmm.. yes this should still work. I don't think you need to install the Windows Mobile SDK to get smart device projects. I could be wrong, it's been so long since I installed it..
"If you think of yourselves as helpless and ineffectual, it is certain that you will create a despotic government to be your master. The wise despot, therefore, maintains among his subjects a popular sense that they are helpless and ineffectual."
- Frank Herbert
|
|
|
|
|
I have a specialized legacy application that was written for XP using VS2003 and .NET 2.0. There are only 2 users of this app, and it's worked great up until they got a new laptop with Vista (and sometime in the past year they've moved out of state, so I'm having to troubleshoot this via email).
What the program does is creates an RTF document (report) and saves it in a subdirectory of where the program currently is, and then prompts whether or not they want to view it. If they do, I use: Process::Start(filename); which has previously opened the document in the default viewer (MS Word). There is no user interaction in creating the filename, and the program checks that it's a valid string.
Here's the exception text I get:
System.ComponentModel.Win32Exception: The system cannot find the file specified
at System.Diagnostics.Process.StartWithShellExecuteEx(ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start()
at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start(String fileName)
at LoanServicing.edit_payment.b_reconciliation_Click(Object sender, EventArgs e)
I had the user check to make sure the file was getting created and named correctly, and it is; they can open it by doubleclicking the file icon.
The MSDN documentation seems to indicate that this use should work:
(from the C# example at: http://msdn2.microsoft.com/en-us/library/sxf2saat.aspx)
// The following call to Start succeeds.
Process.Start(path + "Text.txt");
Running the program as Administrator gives the same exception. Any idea what might be the problem here? I've tried everything I can think of...
Thanks!
|
|
|
|
|
You should be keeping track of the full path of the file your writing. If it's in the Program Files folder you can get the path to that with Application.StartupPath . It's always good practice to use fully qualified path names whenever you're working with files. Never assume you know what the "current directory" is going to be at any time.
|
|
|
|
|
This whole mess started out with a conversion from PHP to C#. In the PHP code, PHP's internal OpenSSL module works fine when verifying the signature. However, when using external OpenSSL binaries to perform the same function, neither the PHP code nor the C# code verifies the signature.
Due to that particular problem, I started looking around to see if I could verify an SSL signature via .Net. I have the data to verify with (as a string), the public key (in a file), and the signature (in a file). I've looked for more than a week on Google trying to find something less vague than "look up the signature formatter" (something someone here said). None of the stuff I've found to date makes any sense and assumes I'm already familiar with the crypto stuff in .Net.
All I need is to know if the signature is valid.
I assume that the signatures generated by openSSL code are the same as would be generated by SSL, and SHA1 is the same everywhere, so I should be able to verify this signature with what the three items I have, and I should be able to do it in .Net 2.0.
Can someone PLEASE give me a solid direction to follow so that I don't have to start converting openssl to C#?
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
John Simmons / outlaw programmer wrote: Can someone PLEASE give me a solid direction to follow
John SSL in IIS is very simple. Perhaps you can separate the SSL from the Authentication aspect of your system, is that possible?
|
|
|
|
|
You have to:
- Hash the data you have using the appropriate hash algorithm (SHA1 and MD5 are supported);
- Decrypt the signature using the public key;
- Compare the hashes.
If they are identical you have proved that the message can only have been signed by the corresponding private key, and therefore (presumably) by the owner of the certificate, and that the message has not changed in transit.
Any transformations whatsoever to the data will change the hash value, so you must ensure that only the part of the data that was used to generate the signature is hashed, and you must ensure that you treat it as a simple, opaque array of bytes. You mustn't convert it to a string as .NET's strings are Unicode (UTF-16 little-endian) - if the data was originally UTF-8 or another byte-oriented character set.
DoEvents : Generating unexpected recursion since 1991
|
|
|
|
|
Well, I finally got the openssl.exe utility to respond with something ("Verification Failure"), but I'll give what you said a shot.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Hi,
Everytime I've integrate an external DLL in my application, the default config settings of this DLL are used then.
Now I got the problem, that I don't want to compile the whole file when I have to change the database connection.
After hours of google search I found an example how to overwrite the default settings (see below).
It works great, but not for connection strings, it's only good for normal application settings.
I've experimented a little bit with this sample trying to get it work with connection strings, but with no result.
Does anybody know how I could get this work with connection string?
Thank in advance
regards pdluke
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="WindowsApplication1.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<section name="ClassLibrary1.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
</configSections>
<applicationSettings>
<WindowsApplication1.Properties.Settings>
<setting name="Setting" serializeAs="String">
<value>abc</value>
</setting>
</WindowsApplication1.Properties.Settings>
<ClassLibrary1.Properties.Settings>
<setting name="Setting" serializeAs="String">
<value>zzzz</value>
</setting>
</ClassLibrary1.Properties.Settings>
</applicationSettings>
</configuration>
|
|
|
|
|
Yesterday i've received an interesting "feature"(or bug?).
My form has context menu (ContextMenuStrip) with two levels:
menuItem_1
-> menuItem_1_1
-> menuItem_1_2
menuItem_2
every menu item has Click event handler:
<br />
void MenuItem_Click(object sender, EventArgs e)<br />
{<br />
ToolStripMenuItem item = (ToolStripMenuItem)sender;<br />
ContextMenuStrip menu = item.Owner as ContextMenuStrip;<br />
MessageBox.Show(menu == null ? "false" : "true");<br />
}<br />
I've got:
menuItem_1 click => true
menuItem_1_1 click => false
menuItem_1_2 click => false
menuItem_2 click => true
So, ToolStripMenuItem's Owner on 2+ level is not a ContextMenuStrip!!! Is it normal? I bet - not...
And how I can receive the reference to the ContextMenuStrip to which the 2+ level menu item belongs?
|
|
|
|
|
First you should check (in the debugger or by calling GetType()) what type the item.Owner actually is. I have a feeling for the submenus it would probably be ToolStripDropDown, not ContextMenuStrip. If you're looking to get a ref to the parent ContextMenuStrip, you might have to do something like ToolStripDropDown.OwnerItem.Owner.
Logan
{o,o}.oO( Did somebody say “mouse”? )
|)””’)
-”-”-
|
|
|
|
|
Yes... item.Owner isn't ContextMenuStrip - it's type is ToolStripDropDownMenu.
Construction like item.OwnerItem.Owner is not comprehensible, because:
1) It works for 2 level menu only, not for 3+
2) For first level it throws exception
Certainly, it is possible to use construction like:
<br />
ToolStripItem parent = item;<br />
while(parent.OwnerItem != null)<br />
parent = parent.OwnerItem;<br />
ContextMenuStrip menu = (ContextMenuStrip)parent.Owner;<br />
... but it looks not as it would be desirable.
P.S. What for the reference to object which property item.Owner (on 2+ level) refers is necessary to me?
|
|
|
|
|
I used nant to build ASP .NET application my VS 2005 .sln file
is being compiled using nant builder ..I heard that nant is used to compile and deploy the ASP .NET application ......
Can anyone plese tell me how to deploy ASP .NET application using nant. I have compiled file ready i want to know how to deploy it...
I m using VS 2005 and Nant-0.85
aaa
|
|
|
|
|
Have you resolved this?
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|