{
IniHolder.WriteValue("DataWorkDir", fdOpen.getSelectedFile().getAbsolutePath().substring(0, fdOpen.getSelectedFile().getAbsolutePath().lastIndexOf((int)File.separatorChar)));
File fleOpened=fdOpen.getSelectedFile();
if(!fleOpened.exists())
{
OKMessage okm=new OKMessage(mwcMain, "File "+fleOpened.getName()+" was not found!");
okm.setVisible(true);
okm=null;
return;
}
Password pcPass=new Password(mwcMain);
pcPass.setVisible(true);
if(pcPass.getPassword()!=null)
{
mwcMain.CloseDatabase();
Profile prfMain=(new FileReader(fleOpened)).read(pcPass.getPassword());
if(prfMain!=null)
{
prfMain.resetModifyed();
mwcMain.setProfile(prfMain);
mwcMain.setOpenedFile(fleOpened);
mwcMain.setPassword(pcPass.getPassword());
}
else
{
OKMessage okm=new OKMessage(mwcMain, "Incorrect password or broken file!");
okm.setVisible(true);
okm=null;
}
}
pcPass.erasePass();
pcPass=null;