C#.net identify zip file

This is a base class for a component that needs to handle data that is either uncompressed, PKZIP compressed (sharpziplib) or GZip compressed (built in .net). Perhaps a bit more than you need but should get you going. This is an example of using @PhonicUK’s suggestion to parse the header of the data stream. The … Read more

Using a proxy with .NET 4.5 HttpClient

This code worked for me: using System.Net; using System.Net.Http; var httpClientHandler = new HttpClientHandler { Proxy = new WebProxy(Address: “http://localhost:8888”, BypassOnLocal: false), UseProxy = true } Note that I am not using the WebProxy constructor overload that accepts string\[\] bypassList, but your code does – perhaps that’s the problem?

What’s the difference between InvokeAsync and BeginInvoke for WPF Dispatcher

The exception handling is different. You may want to check the following: private async void OnClick(object sender, RoutedEventArgs e) { Dispatcher.UnhandledException += OnUnhandledException; try { await Dispatcher.BeginInvoke((Action)(Throw)); } catch { // The exception is not handled here but in the unhandled exception handler. MessageBox.Show(“Catched BeginInvoke.”); } try { await Dispatcher.InvokeAsync((Action)Throw); } catch { MessageBox.Show(“Catched InvokeAsync.”); … Read more

GetSystemMetrics() returns different results for .NET 4.5 & .NET 4.0

So, it’s actually a by-design behavior, and if someone has similar issues, here is the code which always outputs the same result: const int CXFRAME = 0x20; const int CYFRAME = 0x21; const int CXPADDEDBORDER = 92; var dx = GetSystemMetrics(CXFRAME); var dy = GetSystemMetrics(CYFRAME); var d = GetSystemMetrics(CXPADDEDBORDER); dx += d; dy += d; … Read more