Exemplo n.º 1
0
        /// <summary>
        /// Launches an inspection job for this workbook.
        /// </summary>
        public void Inspect(InspectionMode inspectionMode, InspectionType inspectionType)
        {
            // Save a copy of this workbook temporarily
            string workbookFile = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + System.IO.Path.DirectorySeparatorChar + Guid.NewGuid().ToString() + ".xls";
            this.Workbook.SaveCopyAs(workbookFile);

            // Create the rules
            var xmlDoc = new XDocument();
            switch (inspectionMode)
            {
                case InspectionMode.All:
                    xmlDoc.Add(this.Accept(new Sprudel1_5XMLVisitor(inspectionType)) as XElement);
                    //TODO add static
                    break;
                case InspectionMode.Dynamic:
                    xmlDoc.Add(this.Accept(new Sprudel1_5XMLVisitor(inspectionType)) as XElement);
                    break;
                case InspectionMode.Static:
                    //TODO change to static
                    xmlDoc.Add(this.Accept(new Sprudel1_5XMLVisitor(inspectionType)) as XElement);
                    break;
            };

            Debug.WriteLine(xmlDoc.ToString());
            var x = xmlDoc.Element(XName.Get("policyList"));
            var a = x.Element(XName.Get("dynamicPolicy"));
            var b = a.Element(XName.Get("spreadsheetFilePath"));
            b.Value = workbookFile;

            xmlDoc.Validate(XMLPartManager.Instance.GetRequestSchema(), null);

            // Enqueue this inspectio
            InspectionEngine.Instance.InspectionQueue.Add(new InspectionJob(this, workbookFile, xmlDoc));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Launches an inspection job for this workbook.
        /// </summary>
        public void Inspect(InspectionMode inspectionMode)
        {
            // Save a copy of this workbook temporarily
            var workbookFile = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + System.IO.Path.DirectorySeparatorChar + Guid.NewGuid().ToString() + ".xls";
            this.Workbook.SaveCopyAs(workbookFile);

            // Create the rules
            var xmlDoc = new XDocument();
            switch (inspectionMode)
            {
                case InspectionMode.All:
                    xmlDoc.Add(this.Accept(new Sprudel1_2XMLVisitor()) as XElement);
                    //TODO add static
                    break;
                case InspectionMode.Dynamic:
                    xmlDoc.Add(this.Accept(new Sprudel1_2XMLVisitor()) as XElement);
                    break;
                case InspectionMode.Static:
                    //TODO change to static
                    xmlDoc.Add(this.Accept(new Sprudel1_2XMLVisitor()) as XElement);
                    break;
            };

            Debug.WriteLine(xmlDoc.ToString());

            // Enqueue this inspectio
            InspectionEngine.Instance.InspectionQueue.Add(new InspectionJob(this, workbookFile, xmlDoc));
        }
Exemplo n.º 3
0
        /// <summary>
        /// Launches an inspection job for this workbook.
        /// </summary>
        public void Inspect(InspectionMode inspectionMode, InspectionType inspectionType)
        {
            Globals.ThisAddIn.Application.StatusBar = Resources.tl_ProcessingScan;
            Globals.Ribbons.Ribbon.scanButton.Enabled = false;
            Globals.Ribbons.Ribbon.scanButton.Label = Resources.tl_NoScanPossible;

            // Save a copy of this workbook temporarily
            string workbookFile = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) +
                                  System.IO.Path.DirectorySeparatorChar + Guid.NewGuid().ToString() + ".xls";
            Workbook.SaveCopyAs(workbookFile);

            var xmlDoc = new XDocument();

            // Create the rules
            switch (inspectionMode)
            {
                case InspectionMode.All:
                    xmlDoc.Add(Accept(new Sprudel1_5XMLVisitor(inspectionType)) as XElement);
                    //TODO add static
                    break;
                case InspectionMode.Dynamic:
                    xmlDoc.Add(Accept(new Sprudel1_5XMLVisitor(inspectionType)) as XElement);
                    break;
                case InspectionMode.Static:
                    //TODO change to static
                    xmlDoc.Add(Accept(new Sprudel1_5XMLVisitor(inspectionType)) as XElement);
                    break;
            }

            var x = xmlDoc.Element(XName.Get("policyList"));
            var a = x.Element(XName.Get("dynamicPolicy"));
            var b = a.Element(XName.Get("spreadsheetFilePath"));
            b.Value = workbookFile;

            xmlDoc.Validate(XMLPartManager.Instance.GetRequestSchema(), null);

            // Enqueue this inspection
            InspectionEngine.Instance.InspectionQueue.Add(new InspectionJob(this, workbookFile, xmlDoc));
        }