示例#1
0
 /// <summary>
 /// Save settings into the SCOPE section of the Report Definition file
 /// </summary>
 /// <param name="writer"></param>
 protected void SaveScope(XmlTextWriterEx writer)
 {
     writer.StartSection(S_SCOPE);
     //
     writer.WriteSetting(V_SCOPE_LOCATIONS, _selectedGroups);
     writer.WriteSetting(V_SCOPE_ASSETS, _selectedAssets);
     writer.WriteSetting(V_SCOPE_IGNORECHILDASSETS, _selectedAssets);
     //
     writer.EndSection();
 }
示例#2
0
        public int SaveToXml(XmlTextWriterEx writer)
        {
            writer.WriteSetting(V_SECTION_TYPE, ((int)_sectionType).ToString());

            // Save the formatted text object in its own section
            writer.StartSection(S_REPORT_SECTION_FORMAT);
            _formattedText.SaveToXml(writer);
            writer.EndSection();

            return(0);
        }
示例#3
0
 /// <summary>
 /// Save settings into the FILTERS section of the Report Definition file
 /// </summary>
 /// <param name="writer"></param>
 private void SaveFilters(XmlTextWriterEx writer)
 {
     writer.StartSection(S_FILTERS);
     //
     writer.WriteSetting(V_FILTERS_APPLICATIONS, _selectedApplications);
     writer.WriteSetting(V_FILTERS_PUBLISHERS, _selectedPublishers);
     writer.WriteSetting(V_FILTERS_SHOWINSTANCES, _showInstanceDetails);
     writer.WriteSetting(V_FILTERS_SHOWKEYSONLY, _showWithKeysOnly);
     writer.WriteSetting(V_FILTERS_SHOWLICENSES, _showLicenses);
     //
     writer.EndSection();
 }
示例#4
0
        /// <summary>
        /// Save settings into the FILTERS section of the Report Definition file
        /// </summary>
        /// <param name="writer"></param>
        private void SaveFilters(XmlTextWriterEx writer)
        {
            writer.StartSection(S_FILTERS);
            //
            writer.WriteSetting(V_FILTERS_SHOWBASIC, _showBasicInformation.ToString());
            writer.WriteSetting(V_FILTERS_SHOWDATE, _showDateInformation.ToString());
            writer.WriteSetting(V_FILTERS_SHOWVERSION, _showVersionInformation.ToString());

            if (_filterFile != "")
            {
                writer.WriteSetting(V_FILTERS_FILE, _filterFile);
            }
            //
            writer.EndSection();
        }
示例#5
0
        /// <summary>
        /// Called to save the attributes for this object to an XML file
        /// </summary>
        /// <param name="writer"></param>
        /// <returns></returns>
        public int SaveToXml(XmlTextWriterEx writer)
        {
            writer.WriteSetting(V_SECTION_TEXT, _rawText);
            writer.WriteSetting(V_SECTION_HALIGN, ((int)_hAlignment).ToString());
            writer.WriteSetting(V_SECTION_VALIGN, ((int)_vAlignment).ToString());
            writer.WriteSetting(V_SECTION_FORECOLOR, _foreColor.Name);
            //writer.WriteSetting(V_SECTION_BACKCOLOR, _backColor.ToString());
            //
            writer.WriteSetting(V_SECTION_FONTDATA_NAME, _fontData.Name);
            writer.WriteSetting(V_SECTION_FONTDATA_SIZE, _fontData.SizeInPoints.ToString());
            writer.WriteSetting(V_SECTION_FONTDATA_UNDERLINE, (_fontData.Underline == DefaultableBoolean.True) ? "Y" : "N");
            writer.WriteSetting(V_SECTION_FONTDATA_BOLD, (_fontData.Bold == DefaultableBoolean.True) ? "Y" : "N");

            return(0);
        }
示例#6
0
        //
        //    SaveReportLabels
        //    =================
        //
        //    Create the 'Labels' section
        //
        protected void SaveReportLabels(XmlTextWriterEx writer)
        {
            // We will also save the report sections
            writer.StartSection(S_REPORT_LABELS);

            // Iterate through each section but get them to save themselves
            foreach (KeyValuePair <string, string> kvp in _dictionaryLabels)
            {
                writer.StartSection(S_REPORT_LABEL);
                writer.WriteSetting(V_LABEL_MAPPING, kvp.Key + "###" + kvp.Value);
                writer.EndSection();
            }

            writer.EndSection();
        }
示例#7
0
        //
        //    SaveReportSections
        //    ===================
        //
        //    Create the 'ReportSections' section
        //
        protected void SaveReportSections(XmlTextWriterEx writer)
        {
            // We will also save the report sections
            writer.StartSection(S_REPORT_SECTIONS);                     // ...add a 'General' section

            // Iterate through each section but get them to save themselves
            foreach (ExportSection reportSection in _listReportSections)
            {
                writer.StartSection(S_REPORT_SECTION);
                reportSection.SaveToXml(writer);
                writer.EndSection();
            }

            writer.EndSection();
        }
 /// <summary>
 /// Save settings into the FILTERS section of the Report Definition file
 /// </summary>
 /// <param name="writer"></param>
 private void SaveFilters(XmlTextWriterEx writer)
 {
     writer.StartSection(S_FILTERS);
     //
     if (_startDate.Ticks != 0)
     {
         writer.WriteSetting(V_FILTERS_STARTDATE, _startDate.ToString());
     }
     if (_endDate.Ticks != 0)
     {
         writer.WriteSetting(V_FILTERS_ENDDATE, _endDate.ToString());
     }
     if (_filterURL != "")
     {
         writer.WriteSetting(V_FILTERS_URL, _filterURL);
     }
     //
     writer.EndSection();
 }
        /// <summary>
        /// Save settings into the FILTERS section of the Report Definition file
        /// </summary>
        /// <param name="writer"></param>
        private void SaveFilters(XmlTextWriterEx writer)
        {
            writer.StartSection(S_FILTERS);

            // Write the 'Show as Asset Register' first
            writer.WriteSetting(V_FILTERS_SHOWASSETREGISTER, _showAssetRegister);

            // We write the fields into a SelectedFields section each within their own SelectedField section
            writer.StartSection(V_FILTERS_SELECTEDFIELDS);

            foreach (string item in _listSelectedFields)
            {
                writer.WriteSetting(V_FILTERS_SELECTEDFIELD, item);
            }

            // End of SelectedFields Section
            writer.EndSection();

            // End of 'Filters' section
            writer.EndSection();
        }
        /// <summary>
        /// write the XML Report Definition file using the supplied data.
        /// This over-rides the abstract implementation in the base class as the write is always specific
        /// to the report
        /// </summary>
        /// <returns></returns>
        public override int WriteReport()
        {
            try
            {
                // First of all create the object
                XmlWriterSettings settings = new XmlWriterSettings();
                settings.Indent             = true;
                settings.OmitXmlDeclaration = false;

                using (XmlTextWriterEx writer = new XmlTextWriterEx(_filename, null))
                {
                    // Add the header
                    writer.Formatting = Formatting.Indented;
                    writer.WriteComment("AuditWizard Report Definition File");

                    // Now the Scanner Configuration Section
                    writer.StartSection(S_REPORT_DEFINITION);

                    // Add the 'General' section (in the base class)
                    SaveGeneral(writer);

                    // Add the 'Scope' section (in the base class)
                    SaveScope(writer);

                    // Now write our sections specific to this report
                    SaveFilters(writer);

                    // Tidy up
                    writer.Flush();
                    writer.Close();
                }
            }
            catch (Exception ex)
            {
                String error = ex.Message;
                return(-1);
            }

            return(0);
        }
 /// <summary>
 /// Save settings into the FILTERS section of the Report Definition file
 /// </summary>
 /// <param name="writer"></param>
 private void SaveFilters(XmlTextWriterEx writer)
 {
     writer.StartSection(S_FILTERS);
     //
     writer.WriteSetting(V_FILTER_TYPE, ((int)_subtype).ToString());
     //
     if (_startDate.Ticks != 0)
     {
         writer.WriteSetting(V_FILTERS_STARTDATE, _startDate.ToString());
     }
     //
     if (_endDate.Ticks != 0)
     {
         writer.WriteSetting(V_FILTERS_ENDDATE, _endDate.ToString());
     }
     //
     if (_days != 0)
     {
         writer.WriteSetting(V_FILTERS_DAYS, _days.ToString());
     }
     //
     writer.EndSection();
 }
示例#12
0
        //
        //    SaveGeneral
        //    ===========
        //
        //    Create the 'General' section
        //
        protected void SaveGeneral(XmlTextWriterEx writer)
        {
            writer.StartSection(S_GENERAL);                     // ...add a 'General' section
            //
            writer.WriteSetting(V_GENERAL_AUTHOR, "AuditWizard");
            writer.WriteSetting(V_GENERAL_TYPE, ((int)_reportType).ToString());
            writer.WriteSetting(V_GENERAL_NAME, _name);
            writer.WriteSetting(V_GENERAL_DESCRIPTION, _description);
            writer.WriteSetting(V_GENERAL_VERSION, _currentVersion);
            //
            writer.EndSection();                                        // ...out of 'General' section

            // Write the report sections
            SaveReportSections(writer);

            // Write the column mappings (if any)
            if (_dictionaryLabels.Count != 0)
            {
                SaveReportLabels(writer);
            }

            // Flag as no changes anymore
            _hasChanged = false;
        }