public bool userSearchFile(ref string fullFileName,
bool ifNotExistsIsOk,
string description,
bool saving,
bool canOpenOther)
{
string userFile = "";
bool extValid = false;
bool nameValid = false;
bool exists = false;
do
{
if (showOpenFileDlg(out userFile,
getFileExt(fullFileName),
getFileName(fullFileName),
getPath(fullFileName),
description,
saving))
{
exists = fileExists(userFile);
if (exists || ifNotExistsIsOk)
{
if (fullFileName == " " || getFileWithoutExt(fullFileName) == "*")
{
nameValid = true;
}
else if (ifNotExistsIsOk
|| canOpenOther
|| getFileWithoutExt(fullFileName) == getFileWithoutExt(userFile))
{
nameValid = true;
}
if (nameValid)
{
if (fullFileName == " " || getFileExt(fullFileName) == "*")
{
extValid = true;
}
else if (ifNotExistsIsOk || getFileExt(fullFileName) == getFileExt(userFile))
{
extValid = true;
}
if (extValid && nameValid && (exists || ifNotExistsIsOk))
{
break;
}
else
{
nameValid = false;
extValid = false;
}
}
}
}
else
{
return false;
}
} while (true);
m_curPath = getPath(userFile);
fullFileName = userFile;
m_name = getFileName(userFile);
m_path = getPath(userFile);
return true;
}