Matching Text with Image name
Sir I want to match or compare text which is in registry with the image name stored in local app data directory.How can i do that?
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Former memberPosted Jul 30, 2014, 4:44 AM EDT
You can use Exist function of File class to know whether the file is is exist or not
string filename;
string KeyName="your registry key name where your text exist";
// Opening the registry key
RegistryKey rk = baseRegistryKey ;
// Open a subKey as read-only
RegistryKey sk1 = rk.OpenSubKey(subKey);
// If the RegistrySubKey doesn't exist -> (null)
if ( sk1 == null )
{
filename=null;
}
else
{
try
{
// If the RegistryKey exists I get its value // or null is returned.
filename= (string)sk1.GetValue(KeyName.ToUpper());
}
catch (Exception e)
{
// AAAAAAAAAAARGH, an error!
MessageBox.Show(e, "Reading registry " + KeyName.ToUpper());
}
}
if(File.Exists("full path")==true)
{
MessageBox.Show("File Exists");
}
else
{
MessageBox.Show("File not Exists");
}
Kindly mark as answer, if above helps you
Thanks,
Kailash