using Microsoft.Win32;
static void Main(string[] args)
{
if (args.Length == 0)
{
string FileExt = ".test";
string FileType = "Test File";
string MIMEType = "text/plain";
string ExeApp = Application.ExecutablePath + " %1";
RegistryKey RegKey;
RegKey = Registry.ClassesRoot;
RegKey = RegKey.CreateSubKey(FileExt);
RegKey.SetValue("", FileType);
RegKey.SetValue("Content Type", MIMEType);
RegKey = RegKey.CreateSubKey("shell\\open\\command");
RegKey.SetValue("", ExeApp);
RegKey.Close();
return;
}
strFile = args[0];
Application.Run(new Form1());
}
private void Form1_Load(object sender, System.EventArgs e)
{
this.richTextBox1.LoadFile(strFile, RichTextBoxStreamType.PlainText);
}