private string UnpackDic(string filename) { bool ignoreInvalidHeader = false; string dictionaryPath = String.Empty; MLifter.DAL.Interfaces.IDictionary dictionary = null; string fileNameWithoutExtension = String.Empty; if (!MLifter.DAL.Pack.Packer.IsValidArchive(filename)) { throw new Exception("Invalid Archiv"); } fileNameWithoutExtension = Path.GetFileNameWithoutExtension(filename); dictionaryPath = GenerateDictionaryPath(filename); try { if (!Directory.Exists(dictionaryPath)) { Directory.CreateDirectory(dictionaryPath); } } catch { throw new Exception("Cannot Create Dictionary Folder for Unpacking"); } bool pathExists = false; do { if (File.Exists(Path.Combine(dictionaryPath, fileNameWithoutExtension + MLifter.DAL.Helper.OdxExtension))) { pathExists = true; } else if (Directory.GetFiles(dictionaryPath, "*" + MLifter.DAL.Helper.OdxExtension).Length > 0) { pathExists = true; } else { pathExists = false; } }while (pathExists); ShowStatusMessage("Unpacking"); try { BackgroundWorker backgroundWorker = new BackgroundWorker(); backgroundWorker.WorkerReportsProgress = true; backgroundWorker.WorkerSupportsCancellation = true; backgroundWorker.ProgressChanged += new ProgressChangedEventHandler(Unzip_ProgressChanged); MLifter.DAL.Pack.Packer packer = new MLifter.DAL.Pack.Packer(backgroundWorker); packer.TemporaryFolder = dictionaryPath; packer.LoginCallback = (MLifter.DAL.GetLoginInformation)LoginForm.OpenLoginForm; dictionary = packer.Unpack(filename, ignoreInvalidHeader); // dictionaryPath = Path.Combine(dictionaryPath, fileNameWithoutExtension + DAL.DictionaryFactory.OdxExtension); dictionaryPath = dictionary.Connection; } catch (MLifter.DAL.NoValidArchiveHeaderException ex) { Debug.WriteLine("Pack.Unpack() - " + filename + " - " + ex.Message); return(String.Empty); } catch (MLifter.DAL.NoValidArchiveException ex) { Debug.WriteLine("Pack.Unpack() - " + filename + " - " + ex.Message); return(String.Empty); } catch (System.Xml.XmlException ex) { Debug.WriteLine("Pack.Unpack() - " + filename + " - " + ex.Message); return(String.Empty); } catch (IOException ex) { Debug.WriteLine("Pack.Unpack() - " + filename + " - " + ex.Message); return(String.Empty); } catch (MLifter.DAL.DictionaryFormatNotSupported ex) { Debug.WriteLine("Pack.Unpack() - " + filename + " - " + ex.Message); return(String.Empty); } catch (MLifter.DAL.DictionaryNotDecryptedException ex) { Debug.WriteLine("Pack.Unpack() - " + filename + " - " + ex.Message); return(String.Empty); } catch { if (dictionary != null) { dictionary.Dispose(); } return(String.Empty); } finally { if (dictionary != null) { dictionary.Dispose(); } Cursor.Current = Cursors.Default; m_LoadMsg.Hide(); } return(dictionaryPath); }
private string UnpackDic(string filename) { bool ignoreInvalidHeader = false; string dictionaryPath = String.Empty; MLifter.DAL.Interfaces.IDictionary dictionary = null; string fileNameWithoutExtension = String.Empty; if (!MLifter.DAL.Pack.Packer.IsValidArchive(filename)) { throw new Exception("Invalid Archiv"); } fileNameWithoutExtension = Path.GetFileNameWithoutExtension(filename); dictionaryPath = GenerateDictionaryPath(filename); try { if (!Directory.Exists(dictionaryPath)) { Directory.CreateDirectory(dictionaryPath); } } catch { throw new Exception("Cannot Create Dictionary Folder for Unpacking"); } bool pathExists = false; do { if (File.Exists(Path.Combine(dictionaryPath, fileNameWithoutExtension + MLifter.DAL.Helper.OdxExtension))) { pathExists = true; } else if (Directory.GetFiles(dictionaryPath, "*" + MLifter.DAL.Helper.OdxExtension).Length > 0) { pathExists = true; } else { pathExists = false; } } while (pathExists); ShowStatusMessage("Unpacking"); try { BackgroundWorker backgroundWorker = new BackgroundWorker(); backgroundWorker.WorkerReportsProgress = true; backgroundWorker.WorkerSupportsCancellation = true; backgroundWorker.ProgressChanged += new ProgressChangedEventHandler(Unzip_ProgressChanged); MLifter.DAL.Pack.Packer packer = new MLifter.DAL.Pack.Packer(backgroundWorker); packer.TemporaryFolder = dictionaryPath; packer.LoginCallback = (MLifter.DAL.GetLoginInformation)LoginForm.OpenLoginForm; dictionary = packer.Unpack(filename, ignoreInvalidHeader); // dictionaryPath = Path.Combine(dictionaryPath, fileNameWithoutExtension + DAL.DictionaryFactory.OdxExtension); dictionaryPath = dictionary.Connection; } catch (MLifter.DAL.NoValidArchiveHeaderException ex) { Debug.WriteLine("Pack.Unpack() - " + filename + " - " + ex.Message); return String.Empty; } catch (MLifter.DAL.NoValidArchiveException ex) { Debug.WriteLine("Pack.Unpack() - " + filename + " - " + ex.Message); return String.Empty; } catch (System.Xml.XmlException ex) { Debug.WriteLine("Pack.Unpack() - " + filename + " - " + ex.Message); return String.Empty; } catch (IOException ex) { Debug.WriteLine("Pack.Unpack() - " + filename + " - " + ex.Message); return String.Empty; } catch (MLifter.DAL.DictionaryFormatNotSupported ex) { Debug.WriteLine("Pack.Unpack() - " + filename + " - " + ex.Message); return String.Empty; } catch (MLifter.DAL.DictionaryNotDecryptedException ex) { Debug.WriteLine("Pack.Unpack() - " + filename + " - " + ex.Message); return String.Empty; } catch { if (dictionary != null) dictionary.Dispose(); return String.Empty; } finally { if (dictionary != null) dictionary.Dispose(); Cursor.Current = Cursors.Default; m_LoadMsg.Hide(); } return dictionaryPath; }
/// <summary> /// This method unpacks arrayList dictionary in arrayList dzp file (ZIP). /// Unit Test necessary /// </summary> /// <param name="filename">name of file to extract</param> /// <returns>The dictionary path.</returns> /// <remarks>Documented by Dev04, 2007-07-19</remarks> internal string UnpackDic(string filename) { DialogResult dialogResult; bool ignoreInvalidHeader = false; string dictionaryPath = String.Empty; DAL.Interfaces.IDictionary dictionary = null; string fileNameWithoutExtension = String.Empty; if (!DAL.Pack.Packer.IsValidArchive(filename)) { TaskDialog.ShowTaskDialogBox(Resources.UNPACK_NOT_ORIGINAL_CAPTION, Resources.UNPACK_NOT_ORIGINAL_TEXT, Resources.UNPACK_NOT_ORIGINAL_CONTENT, string.Empty, string.Empty, string.Empty, string.Empty, Resources.UNPACK_NOT_ORIGINAL_OPTION_YES + "|" + Resources.UNPACK_NOT_ORIGINAL_OPTION_NO, TaskDialogButtons.None, TaskDialogIcons.Question, TaskDialogIcons.Information); switch (TaskDialog.CommandButtonResult) { case 1: default: return(String.Empty); case 0: ignoreInvalidHeader = true; break; } } fileNameWithoutExtension = Path.GetFileNameWithoutExtension(filename); dictionaryPath = GenerateDictionaryPath(filename); dialogResult = MLifter.Controls.TaskDialog.ShowTaskDialogBox(Resources.UNPACK_DEFAULT_MBX_CAPTION, Resources.UNPACK_DEFAULT_MBX_TEXT, String.Format(Resources.UNPACK_DEFAULT_MBX_CONTENT, dictionaryPath), String.Empty, String.Empty, String.Empty, String.Empty, String.Format("{0}|{1}|{2}", Resources.UNPACK_DEFAULT_OPTION_YES, Resources.UNPACK_DEFAULT_MBX_OPTION_NO, Resources.UNPACK_DEFAULT_MBX_OPTION_CANCEL), MLifter.Controls.TaskDialogButtons.None, MLifter.Controls.TaskDialogIcons.Question, MLifter.Controls.TaskDialogIcons.Warning); switch (MLifter.Controls.TaskDialog.CommandButtonResult) { case 0: break; case 1: if (Directory.Exists(dictionaryPath)) { DirDialog.SelectedPath = dictionaryPath; } else { DirDialog.SelectedPath = Settings.Default.DicDir; } if (DirDialog.ShowDialog(m_LoadMsg) == DialogResult.OK) { dictionaryPath = DirDialog.SelectedPath; } else { return(String.Empty); } break; case 2: default: return(String.Empty); } try { if (!Directory.Exists(dictionaryPath)) { Directory.CreateDirectory(dictionaryPath); } } catch { dictionaryPath = Settings.Default.DicDir; } bool ignore = false; bool pathExists = false; do { if (File.Exists(Path.Combine(dictionaryPath, fileNameWithoutExtension + DAL.Helper.OdxExtension))) { pathExists = true; dialogResult = MLifter.Controls.TaskDialog.ShowTaskDialogBox(Resources.UNPACK_DICTIONARY_EXISTS_MBX_CAPTION, Resources.UNPACK_REPLACE_FILES_MBX_TEXT, Resources.UNPACK_DICTIONARY_EXISTS_MBX_CONTENT, String.Empty, String.Empty, String.Empty, String.Empty, String.Format("{0}|{1}|{2}", Resources.UNPACK_DICTIONARY_EXISTS_MBX_OPTION_YES, Resources.UNPACK_DICTIONARY_EXISTS_MBX_OPTION_NO, Resources.UNPACK_DICTIONARY_EXISTS_MBX_OPTION_CANCEL), MLifter.Controls.TaskDialogButtons.None, MLifter.Controls.TaskDialogIcons.Question, MLifter.Controls.TaskDialogIcons.Warning); switch (MLifter.Controls.TaskDialog.CommandButtonResult) { case 0: ignore = true; break; case 2: DirDialog.SelectedPath = dictionaryPath; if (DirDialog.ShowDialog(m_LoadMsg) == DialogResult.OK) { dictionaryPath = DirDialog.SelectedPath; } else { return(String.Empty); } continue; case 1: default: return(String.Empty); } } else if (Directory.GetFiles(dictionaryPath, "*" + DAL.Helper.OdxExtension).Length > 0) { pathExists = true; dialogResult = MLifter.Controls.TaskDialog.ShowTaskDialogBox(Resources.UNPACK_DICTIONARY_FOLDER_EXISTS_MBX_CAPTION, Resources.UNPACK_DICTIONARY_FOLDER_EXISTS_MBX_TEXT, Resources.UNPACK_DICTIONARY_FOLDER_EXISTS_MBX_CONTENT, String.Empty, String.Empty, String.Empty, String.Empty, String.Format("{0}|{1}|{2}", Resources.UNPACK_DICTIONARY_FOLDER_EXISTS_MBX_OPTION_YES, Resources.UNPACK_DICTIONARY_FOLDER_EXISTS_MBX_OPTION_NO, Resources.UNPACK_DICTIONARY_FOLDER_EXISTS_MBX_OPTION_CANCEL), MLifter.Controls.TaskDialogButtons.None, MLifter.Controls.TaskDialogIcons.Warning, MLifter.Controls.TaskDialogIcons.Warning); switch (MLifter.Controls.TaskDialog.CommandButtonResult) { case 0: ignore = true; break; case 2: DirDialog.SelectedPath = dictionaryPath; if (DirDialog.ShowDialog(m_LoadMsg) == DialogResult.OK) { dictionaryPath = DirDialog.SelectedPath; } else { return(String.Empty); } break; case 1: default: return(String.Empty); } } else { pathExists = false; } }while (pathExists && !ignore); m_LoadMsg.InfoMessage = Resources.UNPACK_TLOADMSG; m_LoadMsg.SetProgress(0); Cursor.Current = Cursors.WaitCursor; m_LoadMsg.Show(); try { BackgroundWorker backgroundWorker = new BackgroundWorker(); backgroundWorker.WorkerReportsProgress = true; backgroundWorker.WorkerSupportsCancellation = true; backgroundWorker.ProgressChanged += new ProgressChangedEventHandler(Unzip_ProgressChanged); MLifter.DAL.Pack.Packer packer = new MLifter.DAL.Pack.Packer(backgroundWorker); packer.TemporaryFolder = dictionaryPath; packer.LoginCallback = (MLifter.DAL.GetLoginInformation)LoginForm.OpenLoginForm; dictionary = packer.Unpack(filename, ignoreInvalidHeader); //dictionaryPath = Path.Combine(dictionaryPath, fileNameWithoutExtension + DAL.DictionaryFactory.OdxExtension); dictionaryPath = dictionary.Connection; } catch (DAL.NoValidArchiveHeaderException ex) { Debug.WriteLine("Pack.Unpack() - " + filename + " - " + ex.Message); if (dictionary != null) { dictionary.Dispose(); } MessageBox.Show(String.Format(Properties.Resources.DIC_ERROR_LOADING_TEXT, filename), Properties.Resources.DIC_ERROR_LOADING_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error); return(String.Empty); } catch (DAL.NoValidArchiveException ex) { Debug.WriteLine("Pack.Unpack() - " + filename + " - " + ex.Message); if (dictionary != null) { dictionary.Dispose(); } MessageBox.Show(String.Format(Properties.Resources.DIC_ERROR_LOADING_TEXT, filename), Properties.Resources.DIC_ERROR_LOADING_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error); return(String.Empty); } catch (System.Xml.XmlException ex) { Debug.WriteLine("Pack.Unpack() - " + filename + " - " + ex.Message); if (dictionary != null) { dictionary.Dispose(); } MessageBox.Show(String.Format(Properties.Resources.DIC_ERROR_LOADING_TEXT, filename), Properties.Resources.DIC_ERROR_LOADING_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error); return(String.Empty); } catch (IOException ex) { Debug.WriteLine("Pack.Unpack() - " + filename + " - " + ex.Message); if (dictionary != null) { dictionary.Dispose(); } MessageBox.Show(String.Format(Properties.Resources.DIC_ERROR_LOADING_TEXT, filename), Properties.Resources.DIC_ERROR_LOADING_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error); return(String.Empty); } catch (ICSharpCode.SharpZipLib.Zip.ZipException ex) { Debug.WriteLine("Pack.Unpack() - " + filename + " - " + ex.Message); if (dictionary != null) { dictionary.Dispose(); } MessageBox.Show(String.Format(Properties.Resources.DIC_ERROR_LOADING_TEXT, filename), Properties.Resources.DIC_ERROR_LOADING_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error); return(String.Empty); } catch (MLifter.DAL.DictionaryFormatNotSupported ex) { Debug.WriteLine("Pack.Unpack() - " + filename + " - " + ex.Message); if (dictionary != null) { dictionary.Dispose(); } MessageBox.Show(Properties.Resources.DIC_ERROR_NEWERVERSION_TEXT, Properties.Resources.DIC_ERROR_NEWERVERSION_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Information); return(String.Empty); } catch (MLifter.DAL.DictionaryNotDecryptedException ex) { Debug.WriteLine("Pack.Unpack() - " + filename + " - " + ex.Message); if (dictionary != null) { dictionary.Dispose(); } MessageBox.Show(Properties.Resources.DIC_ERROR_NOT_DECRYPTED_TEXT, Properties.Resources.DIC_ERROR_NOT_DECRYPTED_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Information); return(String.Empty); } finally { if (dictionary != null) { dictionary.Dispose(); } Cursor.Current = Cursors.Default; m_LoadMsg.Hide(); } return(dictionaryPath); }
/// <summary> /// This method unpacks arrayList dictionary in arrayList dzp file (ZIP). /// Unit Test necessary /// </summary> /// <param name="filename">name of file to extract</param> /// <returns>The dictionary path.</returns> /// <remarks>Documented by Dev04, 2007-07-19</remarks> internal string UnpackDic(string filename) { DialogResult dialogResult; bool ignoreInvalidHeader = false; string dictionaryPath = String.Empty; DAL.Interfaces.IDictionary dictionary = null; string fileNameWithoutExtension = String.Empty; if (!DAL.Pack.Packer.IsValidArchive(filename)) { TaskDialog.ShowTaskDialogBox(Resources.UNPACK_NOT_ORIGINAL_CAPTION, Resources.UNPACK_NOT_ORIGINAL_TEXT, Resources.UNPACK_NOT_ORIGINAL_CONTENT, string.Empty, string.Empty, string.Empty, string.Empty, Resources.UNPACK_NOT_ORIGINAL_OPTION_YES + "|" + Resources.UNPACK_NOT_ORIGINAL_OPTION_NO, TaskDialogButtons.None, TaskDialogIcons.Question, TaskDialogIcons.Information); switch (TaskDialog.CommandButtonResult) { case 1: default: return String.Empty; case 0: ignoreInvalidHeader = true; break; } } fileNameWithoutExtension = Path.GetFileNameWithoutExtension(filename); dictionaryPath = GenerateDictionaryPath(filename); dialogResult = MLifter.Controls.TaskDialog.ShowTaskDialogBox(Resources.UNPACK_DEFAULT_MBX_CAPTION, Resources.UNPACK_DEFAULT_MBX_TEXT, String.Format(Resources.UNPACK_DEFAULT_MBX_CONTENT, dictionaryPath), String.Empty, String.Empty, String.Empty, String.Empty, String.Format("{0}|{1}|{2}", Resources.UNPACK_DEFAULT_OPTION_YES, Resources.UNPACK_DEFAULT_MBX_OPTION_NO, Resources.UNPACK_DEFAULT_MBX_OPTION_CANCEL), MLifter.Controls.TaskDialogButtons.None, MLifter.Controls.TaskDialogIcons.Question, MLifter.Controls.TaskDialogIcons.Warning); switch (MLifter.Controls.TaskDialog.CommandButtonResult) { case 0: break; case 1: if (Directory.Exists(dictionaryPath)) DirDialog.SelectedPath = dictionaryPath; else DirDialog.SelectedPath = Settings.Default.DicDir; if (DirDialog.ShowDialog(m_LoadMsg) == DialogResult.OK) dictionaryPath = DirDialog.SelectedPath; else return String.Empty; break; case 2: default: return String.Empty; } try { if (!Directory.Exists(dictionaryPath)) { Directory.CreateDirectory(dictionaryPath); } } catch { dictionaryPath = Settings.Default.DicDir; } bool ignore = false; bool pathExists = false; do { if (File.Exists(Path.Combine(dictionaryPath, fileNameWithoutExtension + DAL.Helper.OdxExtension))) { pathExists = true; dialogResult = MLifter.Controls.TaskDialog.ShowTaskDialogBox(Resources.UNPACK_DICTIONARY_EXISTS_MBX_CAPTION, Resources.UNPACK_REPLACE_FILES_MBX_TEXT, Resources.UNPACK_DICTIONARY_EXISTS_MBX_CONTENT, String.Empty, String.Empty, String.Empty, String.Empty, String.Format("{0}|{1}|{2}", Resources.UNPACK_DICTIONARY_EXISTS_MBX_OPTION_YES, Resources.UNPACK_DICTIONARY_EXISTS_MBX_OPTION_NO, Resources.UNPACK_DICTIONARY_EXISTS_MBX_OPTION_CANCEL), MLifter.Controls.TaskDialogButtons.None, MLifter.Controls.TaskDialogIcons.Question, MLifter.Controls.TaskDialogIcons.Warning); switch (MLifter.Controls.TaskDialog.CommandButtonResult) { case 0: ignore = true; break; case 2: DirDialog.SelectedPath = dictionaryPath; if (DirDialog.ShowDialog(m_LoadMsg) == DialogResult.OK) dictionaryPath = DirDialog.SelectedPath; else return String.Empty; continue; case 1: default: return String.Empty; } } else if (Directory.GetFiles(dictionaryPath, "*" + DAL.Helper.OdxExtension).Length > 0) { pathExists = true; dialogResult = MLifter.Controls.TaskDialog.ShowTaskDialogBox(Resources.UNPACK_DICTIONARY_FOLDER_EXISTS_MBX_CAPTION, Resources.UNPACK_DICTIONARY_FOLDER_EXISTS_MBX_TEXT, Resources.UNPACK_DICTIONARY_FOLDER_EXISTS_MBX_CONTENT, String.Empty, String.Empty, String.Empty, String.Empty, String.Format("{0}|{1}|{2}", Resources.UNPACK_DICTIONARY_FOLDER_EXISTS_MBX_OPTION_YES, Resources.UNPACK_DICTIONARY_FOLDER_EXISTS_MBX_OPTION_NO, Resources.UNPACK_DICTIONARY_FOLDER_EXISTS_MBX_OPTION_CANCEL), MLifter.Controls.TaskDialogButtons.None, MLifter.Controls.TaskDialogIcons.Warning, MLifter.Controls.TaskDialogIcons.Warning); switch (MLifter.Controls.TaskDialog.CommandButtonResult) { case 0: ignore = true; break; case 2: DirDialog.SelectedPath = dictionaryPath; if (DirDialog.ShowDialog(m_LoadMsg) == DialogResult.OK) dictionaryPath = DirDialog.SelectedPath; else return String.Empty; break; case 1: default: return String.Empty; } } else { pathExists = false; } } while (pathExists && !ignore); m_LoadMsg.InfoMessage = Resources.UNPACK_TLOADMSG; m_LoadMsg.SetProgress(0); Cursor.Current = Cursors.WaitCursor; m_LoadMsg.Show(); try { BackgroundWorker backgroundWorker = new BackgroundWorker(); backgroundWorker.WorkerReportsProgress = true; backgroundWorker.WorkerSupportsCancellation = true; backgroundWorker.ProgressChanged += new ProgressChangedEventHandler(Unzip_ProgressChanged); MLifter.DAL.Pack.Packer packer = new MLifter.DAL.Pack.Packer(backgroundWorker); packer.TemporaryFolder = dictionaryPath; packer.LoginCallback = (MLifter.DAL.GetLoginInformation)LoginForm.OpenLoginForm; dictionary = packer.Unpack(filename, ignoreInvalidHeader); //dictionaryPath = Path.Combine(dictionaryPath, fileNameWithoutExtension + DAL.DictionaryFactory.OdxExtension); dictionaryPath = dictionary.Connection; } catch (DAL.NoValidArchiveHeaderException ex) { Debug.WriteLine("Pack.Unpack() - " + filename + " - " + ex.Message); if (dictionary != null) dictionary.Dispose(); MessageBox.Show(String.Format(Properties.Resources.DIC_ERROR_LOADING_TEXT, filename), Properties.Resources.DIC_ERROR_LOADING_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error); return String.Empty; } catch (DAL.NoValidArchiveException ex) { Debug.WriteLine("Pack.Unpack() - " + filename + " - " + ex.Message); if (dictionary != null) dictionary.Dispose(); MessageBox.Show(String.Format(Properties.Resources.DIC_ERROR_LOADING_TEXT, filename), Properties.Resources.DIC_ERROR_LOADING_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error); return String.Empty; } catch (System.Xml.XmlException ex) { Debug.WriteLine("Pack.Unpack() - " + filename + " - " + ex.Message); if (dictionary != null) dictionary.Dispose(); MessageBox.Show(String.Format(Properties.Resources.DIC_ERROR_LOADING_TEXT, filename), Properties.Resources.DIC_ERROR_LOADING_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error); return String.Empty; } catch (IOException ex) { Debug.WriteLine("Pack.Unpack() - " + filename + " - " + ex.Message); if (dictionary != null) dictionary.Dispose(); MessageBox.Show(String.Format(Properties.Resources.DIC_ERROR_LOADING_TEXT, filename), Properties.Resources.DIC_ERROR_LOADING_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error); return String.Empty; } catch (ICSharpCode.SharpZipLib.Zip.ZipException ex) { Debug.WriteLine("Pack.Unpack() - " + filename + " - " + ex.Message); if (dictionary != null) dictionary.Dispose(); MessageBox.Show(String.Format(Properties.Resources.DIC_ERROR_LOADING_TEXT, filename), Properties.Resources.DIC_ERROR_LOADING_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error); return String.Empty; } catch (MLifter.DAL.DictionaryFormatNotSupported ex) { Debug.WriteLine("Pack.Unpack() - " + filename + " - " + ex.Message); if (dictionary != null) dictionary.Dispose(); MessageBox.Show(Properties.Resources.DIC_ERROR_NEWERVERSION_TEXT, Properties.Resources.DIC_ERROR_NEWERVERSION_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Information); return String.Empty; } catch (MLifter.DAL.DictionaryNotDecryptedException ex) { Debug.WriteLine("Pack.Unpack() - " + filename + " - " + ex.Message); if (dictionary != null) dictionary.Dispose(); MessageBox.Show(Properties.Resources.DIC_ERROR_NOT_DECRYPTED_TEXT, Properties.Resources.DIC_ERROR_NOT_DECRYPTED_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Information); return String.Empty; } finally { if (dictionary != null) dictionary.Dispose(); Cursor.Current = Cursors.Default; m_LoadMsg.Hide(); } return dictionaryPath; }