//ModConfiguration GetModConfigFile(string FileToProcess)
        //{
        //    if (_log.IsDebugEnabled) { _log.DebugFormat("Starting {0}", MethodBase.GetCurrentMethod().ToString()); }
        //    ModConfiguration config = null;
        //    string target = null;
        //    using (Stream stream = File.OpenRead(FileToProcess))
        //    {
        //        IReader reader = ReaderFactory.Open(stream);
        //        while (reader.MoveToNextEntry())
        //        {
        //            if (!reader.Entry.IsDirectory)
        //            {
        //                if (reader.Entry.FilePath.EndsWith(".aml", StringComparison.OrdinalIgnoreCase))
        //                {
        //                    target = System.IO.Path.Combine(System.IO.Path.GetTempPath(), reader.Entry.FilePath);

        //                    reader.WriteEntryToDirectory(System.IO.Path.GetTempPath(),
        //                        SharpCompress.Common.ExtractOptions.ExtractFullPath | SharpCompress.Common.ExtractOptions.Overwrite);
        //                    break;
        //                }
        //            }
        //        }
        //    }
        //    if (!string.IsNullOrEmpty(target))
        //    {
        //        config = new ModConfiguration(target);
        //    }
        //    if (_log.IsDebugEnabled) { _log.DebugFormat("Ending {0}", MethodBase.GetCurrentMethod().ToString()); }
        //    return config;
        //}
        //void ProcessNoAML(string FileToProcess)
        //{
        //    if (_log.IsDebugEnabled) { _log.DebugFormat("Starting {0}", MethodBase.GetCurrentMethod().ToString()); }
        //    ModDefinitionSetup win = new ModDefinitionSetup();
        //    win.Configuration.PackagePath = FileToProcess;
        //    win.Configuration.ID = new FileInfo(FileToProcess).Name.Replace('.', '~');
        //    if (win.ShowDialog() == true)
        //    {
        //        ModManagement.BeginInstall(win.Configuration, FileToProcess);
        //    }
        //    if (_log.IsDebugEnabled) { _log.DebugFormat("Ending {0}", MethodBase.GetCurrentMethod().ToString()); }
        //}
        //bool ProcessAML(string fileToProcess)
        //{
        //    if (_log.IsDebugEnabled) { _log.DebugFormat("Starting {0}", MethodBase.GetCurrentMethod().ToString()); }
        //    bool retVal = false;
        //    ModConfiguration config = new ModConfiguration(fileToProcess);
        //    if (!string.IsNullOrEmpty(config.Download.Source) || ! string.IsNullOrEmpty(config.Download.Webpage))
        //    {
        //        MessageBoxResult result = Locations.MessageBoxShow("Do you wish to download the package from the web?", MessageBoxButton.YesNoCancel, MessageBoxImage.Question);
        //        if (result == MessageBoxResult.Cancel)
        //        {
        //            retVal = false;
        //        }
        //        else if (result == MessageBoxResult.Yes)
        //        {
        //            if (string.IsNullOrEmpty(config.Download.Source))
        //            {
        //                System.Diagnostics.Process.Start(config.Download.Webpage);
        //                retVal = ModManagement.BrowseForPackage(config);
        //            }
        //            else
        //            {
        //                StartDownload(config);
        //                retVal = true;
        //            }
        //        }
        //    }
        //    else
        //    {
        //        retVal = ModManagement.BrowseForPackage(config);
        //    }
        //    if (_log.IsDebugEnabled) { _log.DebugFormat("Ending {0}", MethodBase.GetCurrentMethod().ToString()); }
        //    return retVal;
        //}
        //void StartDownload(ModConfiguration config)
        //{
        //    if (_log.IsDebugEnabled) { _log.DebugFormat("Starting {0}", MethodBase.GetCurrentMethod().ToString()); }
        //    ModManagement.Downloaded += new EventHandler<System.ComponentModel.AsyncCompletedEventArgs>(ModManagement_Downloaded);
        //    ModManagement.DownloadFailed += new EventHandler<System.ComponentModel.AsyncCompletedEventArgs>(ModManagement_DownloadFailed);

        //    ModManagement.StartDownload(config);
        //    if (_log.IsDebugEnabled) { _log.DebugFormat("Ending {0}", MethodBase.GetCurrentMethod().ToString()); }
        //}
        //////void CleanupDownload()
        //////{
        //////    if (_log.IsDebugEnabled) { _log.DebugFormat("Starting {0}", MethodBase.GetCurrentMethod().ToString()); }
        //////    ModManagement.Downloaded -= new EventHandler<System.ComponentModel.AsyncCompletedEventArgs>(ModManagement_Downloaded);
        //////    ModManagement.DownloadFailed -= new EventHandler<System.ComponentModel.AsyncCompletedEventArgs>(ModManagement_DownloadFailed);
        //////    if (_log.IsDebugEnabled) { _log.DebugFormat("Ending {0}", MethodBase.GetCurrentMethod().ToString()); }
        //////}
        //////void ModManagement_DownloadFailed(object sender, System.ComponentModel.AsyncCompletedEventArgs e)
        //////{
        //////    if (_log.IsDebugEnabled) { _log.DebugFormat("Starting {0}", MethodBase.GetCurrentMethod().ToString()); }
        //////    CleanupDownload();
        //////    MessageBox.Show("Download Failed:\r\n\r\n" + e.Error.ToString() + "\r\n\r\nPlease manually download the file and select it.", "Aretmis Mod Loader", MessageBoxButton.OK, MessageBoxImage.Error);
        //////    ModConfiguration mod = e.UserState as ModConfiguration;
        //////    if (string.IsNullOrEmpty(mod.Download.Source))
        //////    {
        //////        System.Diagnostics.Process.Start(mod.Download.Source);
        //////    }
        //////    else
        //////    {
        //////        System.Diagnostics.Process.Start(mod.Download.Webpage);
        //////    }
        //////    ModManagement.BrowseForPackage(mod);
        //////    if (_log.IsDebugEnabled) { _log.DebugFormat("Ending {0}", MethodBase.GetCurrentMethod().ToString()); }
        //////}

        //////void ModManagement_Downloaded(object sender, System.ComponentModel.AsyncCompletedEventArgs e)
        //////{
        //////    if (_log.IsDebugEnabled) { _log.DebugFormat("Starting {0}", MethodBase.GetCurrentMethod().ToString()); }
        //////    CleanupDownload();
        //////    if (e != null)
        //////    {
        //////        ModConfiguration mod = e.UserState as ModConfiguration;

        //////        ModManagement.BeginInstall(mod, mod.PackagePath);

        //////    }
        //////    if (_log.IsDebugEnabled) { _log.DebugFormat("Ending {0}", MethodBase.GetCurrentMethod().ToString()); }
        //////}

        void BrowseForFile()
        {
            if (_log.IsDebugEnabled)
            {
                _log.DebugFormat("Starting {0}", MethodBase.GetCurrentMethod().ToString());
            }
            string         retVal = string.Empty;
            OpenFileDialog diag   = new OpenFileDialog();

            diag.Filter = AMLResources.Properties.Resources.SupportedCompressedFiles + DataStrings.SupportedCompressedFilesFilter
                          + "|" + AMLResources.Properties.Resources.AML + DataStrings.AMLFilter
                          + "|" + AMLResources.Properties.Resources.AllFiles + DataStrings.AllFilesFilter;
            diag.Title       = Locations.AssemblyTitle;
            diag.Multiselect = true;

            if (diag.ShowDialog() == true)
            {
                if (diag.FileNames != null)
                {
                    ModManagement.ProcessFiles(diag.FileNames);
                }
            }
            if (_log.IsDebugEnabled)
            {
                _log.DebugFormat("Ending {0}", MethodBase.GetCurrentMethod().ToString());
            }
        }
        private void uc_Drop(object sender, DragEventArgs e)
        {
            //if (_log.IsDebugEnabled) { _log.DebugFormat("Starting {0}", MethodBase.GetCurrentMethod().ToString()); }


            if (e.Data.GetDataPresent(DataFormats.FileDrop))
            {
                string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
                if (files != null)
                {
                    ModManagement.ProcessFiles(files);
                }
            }

            //if (_log.IsDebugEnabled) { _log.DebugFormat("Ending {0}", MethodBase.GetCurrentMethod().ToString()); }
        }