private static OutputFile WriteOutputFiles(OutputFileFormat outputFileFormat, IScanTools scanTools, A11yElement element, Guid elementId)
        {
            if (scanTools == null)
            {
                throw new ArgumentNullException(nameof(scanTools));
            }
            if (scanTools.OutputFileHelper == null)
            {
                throw new ArgumentException(ErrorMessages.ScanToolsOutputFileHelperNull, nameof(scanTools));
            }

            string a11yTestOutputFile = null;

            if (outputFileFormat.HasFlag(OutputFileFormat.A11yTest))
            {
                scanTools.Actions.CaptureScreenshot(elementId);

                a11yTestOutputFile = scanTools.OutputFileHelper.GetNewA11yTestFilePath();
                if (a11yTestOutputFile == null)
                {
                    throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, ErrorMessages.VariableNull, nameof(a11yTestOutputFile)));
                }

                scanTools.Actions.SaveA11yTestFile(a11yTestOutputFile, element, elementId);
            }

            return(OutputFile.BuildFromA11yTestFile(a11yTestOutputFile));
        }
Esempio n. 2
0
        public void SaveReport(OutputFileFormat fileFormat, string htmlTemplatePath = "")
        {
            StringBuilder rb = new StringBuilder();

            switch (fileFormat)
            {
            case OutputFileFormat.Txt:
                rb.Append(this);
                break;

            case OutputFileFormat.Html:
                string path    = !string.IsNullOrEmpty(htmlTemplatePath) ? htmlTemplatePath : Config.HtmlTemplate;
                string content = GetFileContent(path);
                rb.Append(Razor.Parse(content, this));

                break;

            default:
                return;
            }
            using (StreamWriter outfile = new StreamWriter(string.Format(CultureInfo.CurrentUICulture, "{0}_{1}.{2}", StartUri.DnsSafeHost, DateTime.Now.ToString("yyy-MM-dd_hh-mm-ss", CultureInfo.CurrentUICulture), fileFormat)))
            {
                outfile.Write(rb.ToString());
            }
        }
Esempio n. 3
0
        private static OutputFile WriteOutputFiles(OutputFileFormat outputFileFormat, IScanTools scanTools, A11yElement element, Guid elementId)
        {
            if (scanTools?.OutputFileHelper == null)
            {
                throw new ArgumentNullException(nameof(scanTools.OutputFileHelper));
            }

            string a11yTestOutputFile = null;

            if (outputFileFormat.HasFlag(OutputFileFormat.A11yTest))
            {
                scanTools.Actions.CaptureScreenshot(elementId);

                a11yTestOutputFile = scanTools.OutputFileHelper.GetNewA11yTestFilePath();
                if (a11yTestOutputFile == null)
                {
                    throw new InvalidOperationException(nameof(a11yTestOutputFile));
                }

                scanTools.Actions.SaveA11yTestFile(a11yTestOutputFile, element, elementId);
            }

#if NOT_CURRENTLY_SUPPORTED
            if (locationHelper.IsSarifExtension())
            // SaveAction.SaveSarifFile(outputFileHelper.GetNewSarifFilePath(), ec2.Id, !locationHelper.IsAllOption());
#endif

            return(OutputFile.BuildFromA11yTestFile(a11yTestOutputFile));
        }
        /// <summary>
        /// 获取项目代码输出文件名
        /// </summary>
        public string GetCodeFileName(CodeModule module)
        {
            string fileName = OutputFileFormat.Replace("{Project.NamespacePrefix}", module.Project.NamespacePrefix)
                              .Replace("{Module.Name:Lower}", module.Name.ToLowerCase())
                              .Replace("{Module.Name}", module.Name);

            return(fileName);
        }
        /// <summary>
        /// 获取项目代码输出文件名
        /// </summary>
        public string GetCodeFileName(CodeProject project)
        {
            string fileName = OutputFileFormat.Replace("{Project.NamespacePrefix}", project.NamespacePrefix)
                              .Replace("{Project.Name:Lower}", project.Name.UpperToLowerAndSplit())
                              .Replace("{Project.Name}", project.Name);

            return(fileName);
        }
        /// <summary>
        /// 获取项目代码输出文件名
        /// </summary>
        public string GetCodeFileName(CodeEntity entity)
        {
            string fileName = OutputFileFormat.Replace("{Project.NamespacePrefix}", entity.Module.Project.NamespacePrefix)
                              .Replace("{Module.Name:Lower}", entity.Module.Name.UpperToLowerAndSplit())
                              .Replace("{Entity.Name:Lower}", entity.Name.UpperToLowerAndSplit())
                              .Replace("{Module.Name}", entity.Module.Name).Replace("{Entity.Name}", entity.Name);

            return(fileName);
        }
Esempio n. 7
0
        static void Execute(string basePath, SearchQueryFilter filter, string?setVersion, string outputFile,
                            string outputFileFormatStr)
        {
            var tools           = new ProjectNugetVersionUpdater(new DotNetPackageReferenceUpdater());
            var projFileService = new ProjectFileService();

            OutputFileFormat outputFormat = !string.IsNullOrEmpty(outputFileFormatStr) ?
                                            Enum.Parse <OutputFileFormat>(outputFileFormatStr, true)
                : OutputFileFormat.Default;

            IProjectFileResultsRenderer projectFileRenderer;

            basePath = Path.GetFullPath(basePath);
            var projFiles = projFileService.GetProjectFilesByFilter(basePath, filter);

            if (!string.IsNullOrEmpty(outputFile))
            {
                var outputFilePath = Path.GetFullPath(outputFile);

                Console.Write($"Writing output to {outputFilePath}");
                if (!string.IsNullOrEmpty(outputFileFormatStr))
                {
                    Console.Write($" format: {outputFileFormatStr}");
                }
                Console.WriteLine();

                // no format so just redirect
                FileOutput.RedirectConsoleToFile(outputFilePath);
            }

            switch (outputFormat)
            {
            case OutputFileFormat.Json:
                projectFileRenderer = new ProjectFileJsonRenderer();
                break;

            default:
                projectFileRenderer = new ProjectFileConsoleRenderer();
                break;
            }

            projectFileRenderer.RenderResults(basePath, filter, projFiles);

            if (!string.IsNullOrEmpty(setVersion))
            {
                var startTabPad = 10;
                var strPad      = new string(' ', startTabPad);
                if (projFileService.SetNugetPackageVersions(filter, setVersion, projFiles, strPad, tools))
                {
                    return;
                }
            }
        }
Esempio n. 8
0
        private void Compress_Button_Click(object sender, RoutedEventArgs e)
        {
            OutputFileFormat = ChoisePickUp(FileFormatPanel);

            var outputFileDialog = new System.Windows.Forms.SaveFileDialog()
            {
                InitialDirectory = @"D:\",
                Filter           = OutputFileFormat + "文件(*." + OutputFileFormat + ")" + "|*." + OutputFileFormat,
                RestoreDirectory = true
            };

            if (outputFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                OutputFile = outputFileDialog.FileName;

                var cmdEncodingExe = new StringBuilder(Environment.CurrentDirectory);
                cmdEncodingExe.Append(@".\JPEG2000_MI_Encoding.exe ");
                var cmd = new StringBuilder("-i ");
                cmd.Append(InputFile);
                cmd.Append(" -o ");
                cmd.Append(OutputFile);
                cmd.Append(" -OutFor ");
                cmd.Append(OutputFileFormat.ToUpper());
                cmd.Append(" -r ");
                cmd.Append(CompressionValueLabel.Content.ToString());
                //cmd.Append( " -q " );
                //cmd.Append( QualityValuetextBox.Text );
                cmd.Append(" -n ");
                cmd.Append(ResolutionLabel.Content.ToString());
                cmd.Append(" -b ");
                var size = ChoisePickUp(CodeblockSizePanel).Split('*');
                cmd.Append(size[0]);
                cmd.Append(",");
                cmd.Append(size[1]);
                if (ChoisePickUp(CompressionProfilePanel) == "有损压缩")
                {
                    cmd.Append(" -I ");
                }
                cmd.Append(" -p ");
                cmd.Append(ChoisePickUp(ProgressionOrderPanel));

                System.Diagnostics.Process.Start(cmdEncodingExe.ToString(), cmd.ToString());

                ShowCompress_Button.IsEnabled = true;
            }
        }
Esempio n. 9
0
 /// <summary>
 /// Needed to reset the values after each compile/decopmile
 /// </summary>
 static void ResetValues()
 {
     //library = null;
     InputFilePath    = null;
     OutputFilePath   = null;
     LibraryName      = null;
     IsActionAssigned = false;
     DoCompile        = false;
     DoDecompile      = false;
     DoDisassemble    = false;
     InputFileFormat  = InputFileFormat.None;
     OutputFileFormat = OutputFileFormat.None;
     MessageScriptTextEncodingName = null;
     MessageScriptEncoding         = Encoding.Default;
     //LibraryName = null;
     LogTrace = false;
     FlowScriptEnableProcedureTracing     = false;
     FlowScriptEnableProcedureCallTracing = false;
     FlowScriptEnableFunctionCallTracing  = false;
     FlowScriptEnableStackCookie          = false;
     FlowScriptEnableProcedureHook        = false;
 }
Esempio n. 10
0
        public static string GetExtention(OutputFileFormat fileFormat)
        {
            switch (fileFormat)
            {
            case OutputFileFormat.DOC:
                return("doc");

            case OutputFileFormat.DOCX:
                return("docx");

            case OutputFileFormat.PDF:
                return("pdf");

            case OutputFileFormat.XLS:
                return("xls");

            case OutputFileFormat.XLSX:
                return("xlsx");

            case OutputFileFormat.TIFF:
                return("tiff");

            case OutputFileFormat.JPG:
                return("jpg");

            case OutputFileFormat.EMF:
                return("emf");

            case OutputFileFormat.MSP:
                return("MPP");

            case OutputFileFormat.PRIMAVERA:
                return("XER");

            default:
                return("");
            }
        }
Esempio n. 11
0
        public static string GetMime(OutputFileFormat fileFormat)
        {
            switch (fileFormat)
            {
            case OutputFileFormat.DOC:
                return("application/doc");

            case OutputFileFormat.DOCX:
                return("application/msword");

            case OutputFileFormat.PDF:
                return("application/pdf");

            case OutputFileFormat.XLS:
                return("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");    //TODO

            case OutputFileFormat.XLSX:
                return("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");

            case OutputFileFormat.TIFF:
                return("image/tiff");

            case OutputFileFormat.JPG:
                return("image/jpeg");

            case OutputFileFormat.EMF:
                return("application/emf");

            case OutputFileFormat.MSP:
                return("application/vnd.ms-project");

            case OutputFileFormat.PRIMAVERA:
                return("application/octet-stream");

            default:
                return(null);
            }
        }
Esempio n. 12
0
        private void Decompress_Button_Click(object sender, RoutedEventArgs e)
        {
            //OutputFileFormat = ChoisePickUp(FileFormatPanel);
            OutputFileFormat = "bmp";

            var outputFileDialog = new System.Windows.Forms.SaveFileDialog()
            {
                InitialDirectory = @"D:\",
                Filter           = OutputFileFormat + "文件(*." + OutputFileFormat + ")" + "|*." + OutputFileFormat,
                RestoreDirectory = true
            };

            if (outputFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                OutputFile_JP2 = outputFileDialog.FileName;

                var cmdEncodingExe = new StringBuilder(Environment.CurrentDirectory);
                cmdEncodingExe.Append(@".\JPEG2000_MI_Decoding.exe ");
                var cmd = new StringBuilder("-i ");
                cmd.Append(InputFile_JP2);
                cmd.Append(" -o ");
                cmd.Append(OutputFile_JP2);
                cmd.Append(" -OutFor ");
                cmd.Append(OutputFileFormat.ToUpper());
                cmd.Append(" -r ");
                cmd.Append(ResolutionLabel_Decode.Content.ToString());
                cmd.Append(" -b ");
                if (ChoisePickUp(DecompressionProfile_RGBPanel) == "强行RGB转换")
                {
                    cmd.Append(" -force-rgb ");
                }
                System.Diagnostics.Process.Start(cmdEncodingExe.ToString(), cmd.ToString());

                ShowDecompress_Button.IsEnabled = true;
            }
        }
Esempio n. 13
0
 /// <summary>
 /// Specify the type(s) of output files you wish AxeWindows to create
 /// </summary>
 /// <param name="format"></param>
 /// <returns></returns>
 public Builder WithOutputFileFormat(OutputFileFormat format)
 {
     _config.OutputFileFormat = format;
     return(this);
 }
Esempio n. 14
0
        /// <summary>
        /// Builds the sorter.
        /// </summary>
        /// <returns>a <see cref="Sorter{T}"/></returns>
        public SplitSorter<byte[]> BuildSorter()
        {
            Logger.Debug("Building sorter for ExtendedSort");
            var sorter = new SplitSorter<byte[]>();

            if (RecordLength > 0 || Separator == null)
            {
                sorter.RecordAccessorFactory = new BlockAccessorFactory { RecordLength = RecordLength };
            }
            else
            {
                sorter.RecordAccessorFactory = new SeparatorAccessorFactory { Separator = Encoding.GetBytes(Separator) };
            }

            if (!string.IsNullOrWhiteSpace(SortCard))
            {
                var comparerParser = new ComparerParser { Encoding = Encoding, SortEncoding = SortEncoding };
                sorter.Comparer = comparerParser.GetComparer(SortCard);
            }
           
            if (SkipDuplicates)
            {
                sorter.Sum = new SkipSum<byte[]>();
            }
            if (!string.IsNullOrWhiteSpace(Sum))
            {
                var sumParser = new SumParser { Encoding = Encoding };
                sorter.Sum = sumParser.GetSum(Sum);
            }
            var formatterParser = new FormatterParser { Encoding = Encoding };
            if (!string.IsNullOrWhiteSpace(Inrec))
            {
                sorter.InputFormatter = formatterParser.GetFormatter(Inrec);
            }
            if (!string.IsNullOrWhiteSpace(Outrec))
            {
                sorter.OutputFormatter = formatterParser.GetFormatter(Outrec);
            }
            if (!string.IsNullOrWhiteSpace(Include) || !string.IsNullOrWhiteSpace(Omit))
            {
                var filterParser = new FilterParser { Encoding = Encoding, SortEncoding = SortEncoding };
                sorter.Filter = filterParser.GetFilter(Include, Omit);
            }

            sorter._outputWriters = new List<OutputFileFormat<byte[]>>();
            int count = 0;
            foreach (var file in OutputFiles)
            {
                Logger.Debug("Building sorter - fileformat " + ++count);
                OutputFileFormat<byte[]> writer = new OutputFileFormat<byte[]>();
                if (!string.IsNullOrWhiteSpace(file.Outrec))
                {
                    Logger.Debug("Building sorter - fileformat outrec = " + file.Outrec);
                    writer.OutputFormatter = formatterParser.GetFormatter(file.Outrec);
                }
                if (!string.IsNullOrWhiteSpace(file.Include) || !string.IsNullOrWhiteSpace(file.Omit))
                {
                    Logger.Debug("Building sorter - fileformat Include = " + file.Include);
                    var filterParser = new FilterParser { Encoding = Encoding, SortEncoding = SortEncoding };
                    writer.Filter = filterParser.GetFilter(file.Include, file.Omit);
                }
                SectionFormatter<string> format = new SectionFormatter<string> { Encoding = Encoding };
                if (!string.IsNullOrWhiteSpace(file.Section))
                {
                    Logger.Debug("Building sorter - fileformat Section = " + file.Section);
                    writer.Section = format.ParseSection(file.Section, Encoding, file.OutputFileRecordLength);
                }
                if (!string.IsNullOrWhiteSpace(file.Header1))
                {
                    Logger.Debug("Building sorter - fileformat header1 = " + file.Header1);
                    writer.Header1 = format.ParseElement(file.Header1, Encoding, file.OutputFileRecordLength);
                }
                if (!string.IsNullOrWhiteSpace(file.Header2))
                {
                    Logger.Debug("Building sorter - fileformat header2 = " + file.Header1);
                    writer.Header2 = format.ParseElement(file.Header2, Encoding, file.OutputFileRecordLength);
                }
                if (!string.IsNullOrWhiteSpace(file.Trailer1))
                {
                    Logger.Debug("Building sorter - fileformat header1 = " + file.Header1);
                    writer.Trailer1 = format.ParseElement(file.Trailer1, Encoding, file.OutputFileRecordLength);
                }
                if (!string.IsNullOrWhiteSpace(file.Trailer2))
                {
                    Logger.Debug("Building sorter - fileformat header2 = " + file.Header1);
                    writer.Trailer2 = format.ParseElement(file.Trailer2, Encoding, file.OutputFileRecordLength);
                }
                writer.MaxPageLines = (file.Lines == 0) ? 60 : file.Lines;
                sorter._outputWriters.Add(writer);
            }

            if (MaxInMemorySize > 0)
            {
                sorter.MaxInMemorySize = MaxInMemorySize;
            }

            sorter.HeaderSize = HeaderSize;

            return sorter;
        }
Esempio n. 15
0
        public void SaveReport(OutputFileFormat fileFormat, string htmlTemplatePath = "")
        {
            StringBuilder rb = new StringBuilder();
            switch (fileFormat)
            {
                case OutputFileFormat.Txt:
                    rb.Append(this);
                    break;
                case OutputFileFormat.Html:
                    string path = !string.IsNullOrEmpty(htmlTemplatePath) ? htmlTemplatePath : Config.HtmlTemplate;
                    string content = GetFileContent(path);
                    rb.Append(Razor.Parse(content, this));

                    break;
                default:
                    return;
            }
            using (StreamWriter outfile = new StreamWriter(string.Format(CultureInfo.CurrentUICulture, "{0}_{1}.{2}", StartUri.DnsSafeHost, DateTime.Now.ToString("yyy-MM-dd_hh-mm-ss", CultureInfo.CurrentUICulture), fileFormat)))
            {
                outfile.Write(rb.ToString());
            }
        }