March 2005 - Posts

Get default web browser from registry

Microsoft.Win32.RegistryKey keyBrowser = Microsoft.Win32.Registry.ClassesRoot;
Microsoft.Win32.RegistryKey keyDefaulBrowser = keyBrowser.OpenSubKey("HTTP\\shell\\open\\ddeexec\\Application");
string defaultBrowser = (string)keyDefaulBrowser.GetValue("");

StreamReader do not reads whole file???

I just wanted to check what do I read from text file using StreamReader class and
I found that It doesn't read a whole file data. Look at this bits:

FileStream fs = new FileStream("test.txt",FileMode.Open,FileAccess.Read);
FileStream fs1 =
new FileStream("test_read.txt",FileMode.OpenOrCreate,FileAccess.Write);
StreamWriter sw =
new StreamWriter(fs1);
using (StreamReader sr = new StreamReader(fs))
{
string strTmp;
while(sr.Peek() >= 0)
{
strTmp=sr.ReadLine();
sw.WriteLine(strTmp);
}

This code must give me two identical files, right? But It doesn't. It cuts few lines at the end.
So what is the catch?

 

Ip to county solution needed

Is where any public webservices for Ip to country mapping?