I found the problem, I was forgetting to create a registry key at LOCAL_MACHINE, I was only creating keys in CLASSES_ROOT, now both the static void Main (string [] args) and Environment.GetCommandLineArgs() method return the name of the file that I clicked. Below I put all the keys that I used in case someone need.
private void ClassesRoot()
{
Registry.ClassesRoot.CreateSubKey(extensao);
Registry.SetValue(@"HKEY_CLASSES_ROOT\" + extensao, "", "ArquivoPersonalizado",
RegistryValueKind.String);
Registry.ClassesRoot.CreateSubKey("ArquivoPersonalizado");
Registry.SetValue(@"HKEY_CLASSES_ROOT\ArquivoPersonalizado", "", "ArquivoPersonalizado",
RegistryValueKind.String);
Registry.ClassesRoot.CreateSubKey(@"ArquivoPersonalizado\CLSID");
Registry.SetValue(@"HKEY_CLASSES_ROOT\ArquivoPersonalizado\CLSID", "",
"{EDSON" + extensao.Substring(1) + "-0000-0000-0000-000000000001}", RegistryValueKind.String);
Registry.ClassesRoot.CreateSubKey(@"ArquivoPersonalizado\DefaultIcon");
Registry.SetValue(@"HKEY_CLASSES_ROOT\ArquivoPersonalizado\DefaultIcon", "",
Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) +
@"\Meus Documentos\Icones\Icones de Programas\AAS.ico", RegistryValueKind.String);
Registry.ClassesRoot.CreateSubKey(@"ArquivoPersonalizado\Shell\Open\Command");
Registry.SetValue(@"HKEY_CLASSES_ROOT\ArquivoPersonalizado\Shell\Open\Command", "",
Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) +
@"\C#\Arquivo.Personalizado\Arquivo.Personalizado\bin\Release\Arquivo.Personalizado.exe ""%1""",
RegistryValueKind.String);
}
private void CurrentUser()
{
Registry.CurrentUser.CreateSubKey(@"Software\Industrias Ederson");
Registry.CurrentUser.CreateSubKey(@"Software\Industrias Ederson\ArquivoPersonalizado");
Registry.CurrentUser.CreateSubKey(@"Software\Industrias Ederson\ArquivoPersonalizado\1.0.0.0");
Registry.SetValue(@"HKEY_CURRENT_USER\Software\Industrias Ederson\ArquivoPersonalizado\1.0.0.0", "",
"{EDSON" + extensao.Substring(1) + "-0000-0000-0000-000000000001}", RegistryValueKind.String);
}
private void LocalMachine()
{
Registry.LocalMachine.CreateSubKey(@"Software\Classes\" + extensao);
Registry.LocalMachine.SetValue(@"HKEY_LOCAL_MACHINE\Software\Classes\" + extensao,
"ArquivoPersonalizado", RegistryValueKind.String);
Registry.LocalMachine.CreateSubKey(@"Software\Classes\ArquivoPersonalizado");
Registry.SetValue(@"HKEY_LOCAL_MACHINE\Software\Classes\ArquivoPersonalizado", "",
"ArquivoPersonalizado", RegistryValueKind.String);
Registry.LocalMachine.CreateSubKey(@"Software\Classes\ArquivoPersonalizado\CLSID");
Registry.SetValue(@"HKEY_LOCAL_MACHINE\Software\Classes\ArquivoPersonalizado\CLSID", "",
"{EDSON" + extensao.Substring(1) + "-0000-0000-0000-000000000001}", RegistryValueKind.String);
Registry.LocalMachine.CreateSubKey(@"Software\Classes\ArquivoPersonalizado\DefaultIcon");
Registry.SetValue(@"HKEY_LOCAL_MACHINE\Software\Classes\ArquivoPersonalizado\DefaultIcon", "",
Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) +
@"\Meus Documentos\Icones\Icones de Programas\AAS.ico", RegistryValueKind.String);
Registry.LocalMachine.CreateSubKey(@"Software\Classes\ArquivoPersonalizado\Shell\Open\Command");
Registry.SetValue(@"HKEY_LOCAL_MACHINE\Software\Classes\ArquivoPersonalizado\Shell\Open\Command", "",
Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) +
@"\C#\Arquivo.Personalizado\Arquivo.Personalizado\bin\Release\Arquivo.Personalizado.exe ""%1""",
RegistryValueKind.String);
Registry.LocalMachine.CreateSubKey(@"Software\Industrias Ederson");
Registry.LocalMachine.CreateSubKey(@"Software\Industrias Ederson\ArquivoPersonalizado");
Registry.LocalMachine.CreateSubKey(@"Software\Industrias Ederson\ArquivoPersonalizado\1.0.0.0");
Registry.SetValue(@"HKEY_LOCAL_MACHINE\Software\Industrias Ederson\ArquivoPersonalizado\1.0.0.0", "",
"{EDSON" + extensao.Substring(1) + "-0000-0000-0000-000000000001}", RegistryValueKind.String);
}