/** -------------------------------------------------------------------- **/

        private void CallbackSaveGeneratorSitemapXmlPerHost(object sender, EventArgs e)
        {
            SaveFileDialog Dialog = new SaveFileDialog();

            Dialog.Filter           = "Sitemap XML files (*.xml)|*.xml|All files (*.*)|*.*";
            Dialog.FilterIndex      = 2;
            Dialog.RestoreDirectory = true;
            Dialog.DefaultExt       = "xml";
            Dialog.AddExtension     = true;
            Dialog.FileName         = "Macroscope-Sitemap.xml";

            MacroscopeSitemapGenerator SitemapGenerator;

            if (Dialog.ShowDialog() == DialogResult.OK)
            {
                string Pathname = Dialog.FileName;

                Cursor.Current = Cursors.WaitCursor;

                SitemapGenerator = new MacroscopeSitemapGenerator(
                    NewDocCollection: this.JobMaster.GetDocCollection()
                    );

                try
                {
                    SitemapGenerator.WriteSitemapXmlPerHost(NewPath: Pathname);
                }
                catch (XmlException ex)
                {
                    this.DialogueBoxError("Error saving Sitemap XML for one or more hosts", ex.Message);
                }
                catch (MacroscopeSitemapException ex)
                {
                    this.DialogueBoxError("Error saving Sitemap XML", ex.Message);
                }
                catch (Exception ex)
                {
                    this.DialogueBoxError("Error saving Sitemap XML for one or more hosts", ex.Message);
                }
                finally
                {
                    Cursor.Current = Cursors.Default;
                }
            }
            else
            {
                this.DialogueBoxError("Error saving Sitemap XML", "Could not open file.");
            }

            if (Dialog != null)
            {
                Dialog.Dispose();
            }
        }
Пример #2
0
        /** -------------------------------------------------------------------- **/

        private void CallbackSaveGeneratorSitemapXmlPerHost(object sender, EventArgs e)
        {
            SaveFileDialog Dialog = new SaveFileDialog();

            Dialog.Filter           = "Sitemap XML files (*.xml)|*.xml|All files (*.*)|*.*";
            Dialog.FilterIndex      = 2;
            Dialog.RestoreDirectory = true;
            Dialog.DefaultExt       = "xml";
            Dialog.AddExtension     = true;
            Dialog.FileName         = "Macroscope-Sitemap.xml";

            MacroscopeSitemapGenerator SitemapGenerator;

            if (Dialog.ShowDialog() == DialogResult.OK)
            {
                string Pathname = Dialog.FileName;

                SitemapGenerator = new MacroscopeSitemapGenerator(
                    NewDocCollection: this.JobMaster.GetDocCollection()
                    );

                try
                {
                    if (Macroscope.MemoryGuard(RequiredMegabytes: 256))
                    {
                        Cursor.Current = Cursors.WaitCursor;
                        SitemapGenerator.WriteSitemapXmlPerHost(NewPath: Pathname);
                        Cursor.Current = Cursors.Default;
                    }
                }
                catch (MacroscopeInsufficientMemoryException ex)
                {
                    this.DialogueBoxError("Error saving Sitemap XML", ex.Message);
                    GC.Collect();
                }
                catch (XmlException ex)
                {
                    this.DialogueBoxError("Error saving Sitemap XML", ex.Message);
                    GC.Collect();
                }
                catch (Exception ex)
                {
                    this.DialogueBoxError("Error saving Sitemap XML", ex.Message);
                    GC.Collect();
                }
            }

            GC.Collect();

            Dialog.Dispose();
        }