From 681ffefb5898c7324d8511d06dcfaf2f6f747965 Mon Sep 17 00:00:00 2001 From: Mike Phares Date: Tue, 24 May 2022 11:19:34 -0700 Subject: [PATCH] Initial Commit --- .editorconfig | 242 +++++++++++++++++++ .groovy | 89 +++++++ Jenkinsfile | 89 +++++++ PDF-Text-Stripper.sln | 25 ++ PDF-Text-Stripper/App.config | 6 + PDF-Text-Stripper/PDF-Text-Stripper.csproj | 62 +++++ PDF-Text-Stripper/Program.cs | 55 +++++ PDF-Text-Stripper/Properties/AssemblyInfo.cs | 36 +++ PDF-Text-Stripper/package.json | 14 ++ README.md | 2 +- 10 files changed, 619 insertions(+), 1 deletion(-) create mode 100644 .editorconfig create mode 100644 .groovy create mode 100644 Jenkinsfile create mode 100644 PDF-Text-Stripper.sln create mode 100644 PDF-Text-Stripper/App.config create mode 100644 PDF-Text-Stripper/PDF-Text-Stripper.csproj create mode 100644 PDF-Text-Stripper/Program.cs create mode 100644 PDF-Text-Stripper/Properties/AssemblyInfo.cs create mode 100644 PDF-Text-Stripper/package.json diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..930a1dd --- /dev/null +++ b/.editorconfig @@ -0,0 +1,242 @@ +[*.cs] +csharp_indent_block_contents = true +csharp_indent_braces = false +csharp_indent_case_contents = true +csharp_indent_case_contents_when_block = true +csharp_indent_labels = one_less_than_current +csharp_indent_switch_labels = true +csharp_new_line_before_catch = true +csharp_new_line_before_else = true +csharp_new_line_before_finally = true +csharp_new_line_before_members_in_anonymous_types = true +csharp_new_line_before_members_in_object_initializers = true +csharp_new_line_before_open_brace = all +csharp_new_line_between_query_expression_clauses = true +csharp_prefer_braces = false +csharp_prefer_simple_default_expression = true:warning +csharp_prefer_simple_using_statement = true:warning +csharp_prefer_static_local_function = true:warning +csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async +csharp_preserve_single_line_blocks = true +csharp_preserve_single_line_statements = false +csharp_space_after_cast = false +csharp_space_after_colon_in_inheritance_clause = true +csharp_space_after_comma = true +csharp_space_after_dot = false +csharp_space_after_keywords_in_control_flow_statements = true +csharp_space_after_semicolon_in_for_statement = true +csharp_space_around_binary_operators = before_and_after +csharp_space_around_declaration_statements = false +csharp_space_before_colon_in_inheritance_clause = true +csharp_space_before_comma = false +csharp_space_before_dot = false +csharp_space_before_open_square_brackets = false +csharp_space_before_semicolon_in_for_statement = false +csharp_space_between_empty_square_brackets = false +csharp_space_between_method_call_empty_parameter_list_parentheses = false +csharp_space_between_method_call_name_and_opening_parenthesis = false +csharp_space_between_method_call_parameter_list_parentheses = false +csharp_space_between_method_declaration_empty_parameter_list_parentheses = false +csharp_space_between_method_declaration_name_and_open_parenthesis = false +csharp_space_between_method_declaration_parameter_list_parentheses = false +csharp_space_between_parentheses = false +csharp_space_between_square_brackets = false +csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = true +csharp_style_allow_blank_lines_between_consecutive_braces_experimental = true +csharp_style_allow_embedded_statements_on_same_line_experimental = true +csharp_style_conditional_delegate_call = true +csharp_style_deconstructed_variable_declaration = false +csharp_style_expression_bodied_accessors = when_on_single_line:warning +csharp_style_expression_bodied_constructors = when_on_single_line:warning +csharp_style_expression_bodied_indexers = when_on_single_line:warning +csharp_style_expression_bodied_lambdas = when_on_single_line:warning +csharp_style_expression_bodied_local_functions = when_on_single_line:warning +csharp_style_expression_bodied_methods = when_on_single_line:warning +csharp_style_expression_bodied_operators = when_on_single_line:warning +csharp_style_expression_bodied_properties = when_on_single_line:warning +csharp_style_implicit_object_creation_when_type_is_apparent = true:warning +csharp_style_inlined_variable_declaration = false +csharp_style_namespace_declarations = file_scoped:warning +csharp_style_pattern_local_over_anonymous_function = true:warning +csharp_style_pattern_matching_over_as_with_null_check = true:warning +csharp_style_pattern_matching_over_is_with_cast_check = true:warning +csharp_style_prefer_index_operator = true:warning +csharp_style_prefer_not_pattern = true:warning +csharp_style_prefer_null_check_over_type_check = true +csharp_style_prefer_pattern_matching = true:warning +csharp_style_prefer_range_operator = true:warning +csharp_style_prefer_switch_expression = true:warning +csharp_style_throw_expression = true +csharp_style_unused_value_assignment_preference = discard_variable:warning +csharp_style_unused_value_expression_statement_preference = discard_variable:warning +csharp_style_var_elsewhere = false:warning +csharp_style_var_for_built_in_types = false:warning +csharp_style_var_when_type_is_apparent = false:warning +csharp_using_directive_placement = outside_namespace +dotnet_code_quality_unused_parameters = all +dotnet_code_quality_unused_parameters = non_public # IDE0060: Remove unused parameter +dotnet_code_quality.CAXXXX.api_surface = private, internal +dotnet_diagnostic.CA1825.severity = warning # CA1823: Avoid zero-length array allocations +dotnet_diagnostic.CA1829.severity = warning # CA1829: Use Length/Count property instead of Count() when available +dotnet_diagnostic.CA1834.severity = warning # CA1834: Consider using 'StringBuilder.Append(char)' when applicable +dotnet_diagnostic.IDE0001.severity = warning # IDE0001: Simplify name +dotnet_diagnostic.IDE0002.severity = warning # Simplify (member access) - System.Version.Equals("1", "2"); Version.Equals("1", "2"); +dotnet_diagnostic.IDE0005.severity = warning # Using directive is unnecessary +dotnet_diagnostic.IDE0060.severity = warning # IDE0060: Remove unused parameter +dotnet_naming_rule.abstract_method_should_be_pascal_case.severity = warning +dotnet_naming_rule.abstract_method_should_be_pascal_case.style = pascal_case +dotnet_naming_rule.abstract_method_should_be_pascal_case.symbols = abstract_method +dotnet_naming_rule.class_should_be_pascal_case.severity = warning +dotnet_naming_rule.class_should_be_pascal_case.style = pascal_case +dotnet_naming_rule.class_should_be_pascal_case.symbols = class +dotnet_naming_rule.delegate_should_be_pascal_case.severity = warning +dotnet_naming_rule.delegate_should_be_pascal_case.style = pascal_case +dotnet_naming_rule.delegate_should_be_pascal_case.symbols = delegate +dotnet_naming_rule.enum_should_be_pascal_case.severity = warning +dotnet_naming_rule.enum_should_be_pascal_case.style = pascal_case +dotnet_naming_rule.enum_should_be_pascal_case.symbols = enum +dotnet_naming_rule.event_should_be_pascal_case.severity = warning +dotnet_naming_rule.event_should_be_pascal_case.style = pascal_case +dotnet_naming_rule.event_should_be_pascal_case.symbols = event +dotnet_naming_rule.interface_should_be_begins_with_i.severity = warning +dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i +dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface +dotnet_naming_rule.method_should_be_pascal_case.severity = warning +dotnet_naming_rule.method_should_be_pascal_case.style = pascal_case +dotnet_naming_rule.method_should_be_pascal_case.symbols = method +dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = warning +dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case +dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members +dotnet_naming_rule.private_method_should_be_pascal_case.severity = warning +dotnet_naming_rule.private_method_should_be_pascal_case.style = pascal_case +dotnet_naming_rule.private_method_should_be_pascal_case.symbols = private_method +dotnet_naming_rule.private_or_internal_field_should_be_private_of_internal_field.severity = warning +dotnet_naming_rule.private_or_internal_field_should_be_private_of_internal_field.style = private_of_internal_field +dotnet_naming_rule.private_or_internal_field_should_be_private_of_internal_field.symbols = private_or_internal_field +dotnet_naming_rule.private_or_internal_static_field_should_be_private_of_internal_field.severity = warning +dotnet_naming_rule.private_or_internal_static_field_should_be_private_of_internal_field.style = private_of_internal_field +dotnet_naming_rule.private_or_internal_static_field_should_be_private_of_internal_field.symbols = private_or_internal_static_field +dotnet_naming_rule.property_should_be_pascal_case.severity = warning +dotnet_naming_rule.property_should_be_pascal_case.style = pascal_case +dotnet_naming_rule.property_should_be_pascal_case.symbols = property +dotnet_naming_rule.public_or_protected_field_should_be_private_of_internal_field.severity = warning +dotnet_naming_rule.public_or_protected_field_should_be_private_of_internal_field.style = private_of_internal_field +dotnet_naming_rule.public_or_protected_field_should_be_private_of_internal_field.symbols = public_or_protected_field +dotnet_naming_rule.static_field_should_be_pascal_case.severity = warning +dotnet_naming_rule.static_field_should_be_pascal_case.style = pascal_case +dotnet_naming_rule.static_field_should_be_pascal_case.symbols = static_field +dotnet_naming_rule.static_method_should_be_pascal_case.severity = warning +dotnet_naming_rule.static_method_should_be_pascal_case.style = pascal_case +dotnet_naming_rule.static_method_should_be_pascal_case.symbols = static_method +dotnet_naming_rule.struct_should_be_pascal_case.severity = warning +dotnet_naming_rule.struct_should_be_pascal_case.style = pascal_case +dotnet_naming_rule.struct_should_be_pascal_case.symbols = struct +dotnet_naming_rule.types_should_be_pascal_case.severity = warning +dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case +dotnet_naming_rule.types_should_be_pascal_case.symbols = types +dotnet_naming_style.begins_with_i.capitalization = pascal_case +dotnet_naming_style.begins_with_i.required_prefix = I +dotnet_naming_style.begins_with_i.required_suffix = +dotnet_naming_style.begins_with_i.word_separator = +dotnet_naming_style.pascal_case.capitalization = pascal_case +dotnet_naming_style.pascal_case.required_prefix = +dotnet_naming_style.pascal_case.required_suffix = +dotnet_naming_style.pascal_case.word_separator = +dotnet_naming_style.private_of_internal_field.capitalization = pascal_case +dotnet_naming_style.private_of_internal_field.required_prefix = _ +dotnet_naming_style.private_of_internal_field.required_suffix = +dotnet_naming_style.private_of_internal_field.word_separator = +dotnet_naming_symbols.abstract_method.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.abstract_method.applicable_kinds = method +dotnet_naming_symbols.abstract_method.required_modifiers = abstract +dotnet_naming_symbols.class.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.class.applicable_kinds = class +dotnet_naming_symbols.class.required_modifiers = +dotnet_naming_symbols.delegate.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.delegate.applicable_kinds = delegate +dotnet_naming_symbols.delegate.required_modifiers = +dotnet_naming_symbols.enum.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.enum.applicable_kinds = enum +dotnet_naming_symbols.enum.required_modifiers = +dotnet_naming_symbols.event.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.event.applicable_kinds = event +dotnet_naming_symbols.event.required_modifiers = +dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.interface.applicable_kinds = interface +dotnet_naming_symbols.interface.required_modifiers = +dotnet_naming_symbols.method.applicable_accessibilities = public +dotnet_naming_symbols.method.applicable_kinds = method +dotnet_naming_symbols.method.required_modifiers = +dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method +dotnet_naming_symbols.non_field_members.required_modifiers = +dotnet_naming_symbols.private_method.applicable_accessibilities = private +dotnet_naming_symbols.private_method.applicable_kinds = method +dotnet_naming_symbols.private_method.required_modifiers = +dotnet_naming_symbols.private_or_internal_field.applicable_accessibilities = internal, private, private_protected +dotnet_naming_symbols.private_or_internal_field.applicable_kinds = field +dotnet_naming_symbols.private_or_internal_field.required_modifiers = +dotnet_naming_symbols.private_or_internal_static_field.applicable_accessibilities = internal, private, private_protected +dotnet_naming_symbols.private_or_internal_static_field.applicable_kinds = field +dotnet_naming_symbols.private_or_internal_static_field.required_modifiers = static +dotnet_naming_symbols.property.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.property.applicable_kinds = property +dotnet_naming_symbols.property.required_modifiers = +dotnet_naming_symbols.public_or_protected_field.applicable_accessibilities = public, protected +dotnet_naming_symbols.public_or_protected_field.applicable_kinds = field +dotnet_naming_symbols.public_or_protected_field.required_modifiers = +dotnet_naming_symbols.static_field.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.static_field.applicable_kinds = field +dotnet_naming_symbols.static_field.required_modifiers = static +dotnet_naming_symbols.static_method.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.static_method.applicable_kinds = method +dotnet_naming_symbols.static_method.required_modifiers = static +dotnet_naming_symbols.struct.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.struct.applicable_kinds = struct +dotnet_naming_symbols.struct.required_modifiers = +dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum +dotnet_naming_symbols.types.required_modifiers = +dotnet_remove_unnecessary_suppression_exclusions = 0 +dotnet_separate_import_directive_groups = false +dotnet_sort_system_directives_first = false +dotnet_style_allow_multiple_blank_lines_experimental = false:warning +dotnet_style_allow_statement_immediately_after_block_experimental = true +dotnet_style_coalesce_expression = true +dotnet_style_collection_initializer = true:warning +dotnet_style_explicit_tuple_names = true:warning +dotnet_style_namespace_match_folder = true +dotnet_style_null_propagation = true:warning +dotnet_style_object_initializer = true:warning +dotnet_style_operator_placement_when_wrapping = beginning_of_line +dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity +dotnet_style_parentheses_in_other_binary_operators = always_for_clarity +dotnet_style_parentheses_in_other_operators = never_if_unnecessary +dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity +dotnet_style_predefined_type_for_locals_parameters_members = true +dotnet_style_predefined_type_for_member_access = true +dotnet_style_prefer_auto_properties = true:warning +dotnet_style_prefer_compound_assignment = true:warning +dotnet_style_prefer_conditional_expression_over_assignment = false +dotnet_style_prefer_conditional_expression_over_return = false +dotnet_style_prefer_inferred_anonymous_type_member_names = true:warning +dotnet_style_prefer_inferred_tuple_names = true:warning +dotnet_style_prefer_is_null_check_over_reference_equality_method = true:warning +dotnet_style_prefer_simplified_boolean_expressions = true:warning +dotnet_style_prefer_simplified_interpolation = true +dotnet_style_qualification_for_event = false:error +dotnet_style_qualification_for_field = false +dotnet_style_qualification_for_method = false:error +dotnet_style_qualification_for_property = false:error +dotnet_style_readonly_field = true:warning +dotnet_style_require_accessibility_modifiers = for_non_interface_members +end_of_line = crlf +file_header_template = unset +indent_size = 4 +indent_style = space +insert_final_newline = false +root = true +tab_width = 4 +# https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca1822 +# https://github.com/dotnet/aspnetcore/blob/main/.editorconfig +# https://github.com/dotnet/project-system/blob/main/.editorconfig \ No newline at end of file diff --git a/.groovy b/.groovy new file mode 100644 index 0000000..8119d21 --- /dev/null +++ b/.groovy @@ -0,0 +1,89 @@ +#!/usr/bin/env groovy +/* groovylint-disable CompileStatic, ConsecutiveStringConcatenation, DuplicateNumberLiteral, DuplicateStringLiteral, LineLength, NestedBlockDepth, NoDef, VariableTypeRequired */ +import groovy.transform.Field + +@Field String _DDrive = 'D:/' +@Field String _SolutionName = '...' +@Field String _GitCommitSeven = '...' +@Field String _GitName = 'PDF-Text-Stripper' +@Field String _AgentStaging = 'mestsa07ec-ecmeseaf' +@Field String _DDriveNet = "${_DDrive}Framework4.8" +@Field String _AgentProduction = 'messa08ec-ecmeseaf' +@Field String _AgentDevelopment = 'mestsa003-mesedasvc' +@Field String _ProgramFilesMSBuild = 'C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/MSBuild/Current/Bin/MSBuild.exe' + +pipeline { + agent { + label env.JENKINS_ENVIRONMENT == 'Development' ? _AgentDevelopment : env.JENKINS_ENVIRONMENT == 'Staging' ? _AgentStaging : env.JENKINS_ENVIRONMENT == 'Production' ? _AgentProduction : 'Else' + } + parameters { + string(name: 'GIT_SERVER', defaultValue: env.JENKINS_ENVIRONMENT == 'Development' ? 'mestsa003.infineon.com' : 'mestsa07ec.ec.local', description: 'git server') + } + stages { + stage('Git') { + steps { + bat(returnStatus: true, script: 'git init') + bat(returnStatus: true, script: 'git remote add origin \\\\' + params.GIT_SERVER + '\\Git\\' + _GitName + '.git') + bat(returnStatus: true, script: 'git pull origin master') + } + } + stage('Setup') { + steps { + script { + _SolutionName = "${env.JOB_NAME}" + _GitCommitSeven = '1234567' + // _GitCommitSeven = env.GIT_COMMIT.substring(0, 7) + def files = findFiles(glob: '*.sln') + if (files.length != 1) { + error("Build failed because couldn't find a *.sln file") + } + echo """ + ${files[0].name} + ${files[0].path} + ${files[0].directory} + ${files[0].length} + ${files[0].lastModified} + """ + _SolutionName = files[0].name.split('[.]sln')[0] + } + } + } + stage('Info') { + steps { + echo "_SolutionName ${_SolutionName}" // ... + echo "BUILD_NUMBER ${env.BUILD_NUMBER}" // 11 + echo "GIT_BRANCH ${env.GIT_BRANCH}" // origin/master + echo "GIT_COMMIT ${env.GIT_COMMIT}" // 73b814069f2cf0173a62a8228815a9bc9ba93c41 + echo "GIT_SERVER ${params.GIT_SERVER}" // ... + echo "GIT_URL ${env.GIT_URL}" // D:\ProgramData\Git\....git + echo "JENKINS_ENVIRONMENT ${env.JENKINS_ENVIRONMENT}" // 11 + echo "JENKINS_URL ${env.JENKINS_URL}" // http://localhost:8080/ + echo "JOB_NAME ${env.JOB_NAME}" // ... + echo "WORKSPACE ${env.WORKSPACE}" // D:\.jenkins\_\... + } + } + stage('Framework Build') { + steps { + echo "Build number is ${currentBuild.number}" + bat(returnStatus: true, script: '"' + _ProgramFilesMSBuild + '" ' + + '/ConsoleLoggerParameters:PerformanceSummary;ErrorsOnly; ' + + '/DetailedSummary ' + + '/m ' + + '/property:Configuration=Debug;TargetFrameworkVersion=v4.8 ' + + '/restore:True ' + + '/target:Build ' + + _SolutionName + '.sln') + } + } + // stage('Force Fail') { + // steps { + // error("Build failed because of this and that..") + // } + // } + } + post { + always { + // cleanWs() + } + } +} diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..a3e1c1c --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,89 @@ +#!/usr/bin/env groovy +/* groovylint-disable CompileStatic, ConsecutiveStringConcatenation, DuplicateNumberLiteral, DuplicateStringLiteral, LineLength, NestedBlockDepth, NoDef, VariableTypeRequired */ +import groovy.transform.Field + +@Field String _DDrive = 'D:/' +@Field String _SolutionName = '...' +@Field String _GitCommitSeven = '...' +@Field String _GitName = 'PDF-Text-Stripper' +@Field String _AgentStaging = 'mestsa07ec-ecmeseaf' +@Field String _DDriveNet = "${_DDrive}Framework4.8" +@Field String _AgentProduction = 'messa08ec-ecmeseaf' +@Field String _AgentDevelopment = 'mestsa003-mesedasvc' +@Field String _ProgramFilesMSBuild = 'C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/MSBuild/Current/Bin/MSBuild.exe' + +pipeline { + agent { + label env.JENKINS_ENVIRONMENT == 'Development' ? _AgentDevelopment : env.JENKINS_ENVIRONMENT == 'Staging' ? _AgentStaging : env.JENKINS_ENVIRONMENT == 'Production' ? _AgentProduction : 'Else' + } + parameters { + string(name: 'GIT_SERVER', defaultValue: env.JENKINS_ENVIRONMENT == 'Development' ? 'mestsa003.infineon.com' : 'mestsa07ec.ec.local', description: 'git server') + } + stages { + // stage('Git') { + // steps { + // bat(returnStatus: true, script: 'git init') + // bat(returnStatus: true, script: 'git remote add origin \\\\' + params.GIT_SERVER + '\\Git\\' + _GitName + '.git') + // bat(returnStatus: true, script: 'git pull origin master') + // } + // } + stage('Setup') { + steps { + script { + _SolutionName = "${env.JOB_NAME}" + _GitCommitSeven = '1234567' + // _GitCommitSeven = env.GIT_COMMIT.substring(0, 7) + def files = findFiles(glob: '*.sln') + if (files.length != 1) { + error("Build failed because couldn't find a *.sln file") + } + echo """ + ${files[0].name} + ${files[0].path} + ${files[0].directory} + ${files[0].length} + ${files[0].lastModified} + """ + _SolutionName = files[0].name.split('[.]sln')[0] + } + } + } + stage('Info') { + steps { + echo "_SolutionName ${_SolutionName}" // ... + echo "BUILD_NUMBER ${env.BUILD_NUMBER}" // 11 + echo "GIT_BRANCH ${env.GIT_BRANCH}" // origin/master + echo "GIT_COMMIT ${env.GIT_COMMIT}" // 73b814069f2cf0173a62a8228815a9bc9ba93c41 + echo "GIT_SERVER ${params.GIT_SERVER}" // ... + echo "GIT_URL ${env.GIT_URL}" // D:\ProgramData\Git\....git + echo "JENKINS_ENVIRONMENT ${env.JENKINS_ENVIRONMENT}" // 11 + echo "JENKINS_URL ${env.JENKINS_URL}" // http://localhost:8080/ + echo "JOB_NAME ${env.JOB_NAME}" // ... + echo "WORKSPACE ${env.WORKSPACE}" // D:\.jenkins\_\... + } + } + stage('Framework Build') { + steps { + echo "Build number is ${currentBuild.number}" + bat(returnStatus: true, script: '"' + _ProgramFilesMSBuild + '" ' + + '/ConsoleLoggerParameters:PerformanceSummary;ErrorsOnly; ' + + '/DetailedSummary ' + + '/m ' + + '/property:Configuration=Debug;TargetFrameworkVersion=v4.8 ' + + '/restore:True ' + + '/target:Build ' + + _SolutionName + '.sln') + } + } + // stage('Force Fail') { + // steps { + // error("Build failed because of this and that..") + // } + // } + } + post { + always { + cleanWs() + } + } +} diff --git a/PDF-Text-Stripper.sln b/PDF-Text-Stripper.sln new file mode 100644 index 0000000..36c5e78 --- /dev/null +++ b/PDF-Text-Stripper.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.1.32407.343 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PDF-Text-Stripper", "PDF-Text-Stripper\PDF-Text-Stripper.csproj", "{EBD5F9D2-02E8-44E7-A91F-C7D28E7D5C7E}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {EBD5F9D2-02E8-44E7-A91F-C7D28E7D5C7E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EBD5F9D2-02E8-44E7-A91F-C7D28E7D5C7E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EBD5F9D2-02E8-44E7-A91F-C7D28E7D5C7E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EBD5F9D2-02E8-44E7-A91F-C7D28E7D5C7E}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {F241E3D5-2FB9-4E76-92B3-C6BB8A3714BF} + EndGlobalSection +EndGlobal diff --git a/PDF-Text-Stripper/App.config b/PDF-Text-Stripper/App.config new file mode 100644 index 0000000..56efbc7 --- /dev/null +++ b/PDF-Text-Stripper/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/PDF-Text-Stripper/PDF-Text-Stripper.csproj b/PDF-Text-Stripper/PDF-Text-Stripper.csproj new file mode 100644 index 0000000..34022bb --- /dev/null +++ b/PDF-Text-Stripper/PDF-Text-Stripper.csproj @@ -0,0 +1,62 @@ + + + + + Debug + AnyCPU + {EBD5F9D2-02E8-44E7-A91F-C7D28E7D5C7E} + 10.0 + Exe + PDF_Text_Stripper + PDF-Text-Stripper + v4.8 + 512 + true + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + 7.2.4630.5 + + + 1.1.1 + + + + + + + \ No newline at end of file diff --git a/PDF-Text-Stripper/Program.cs b/PDF-Text-Stripper/Program.cs new file mode 100644 index 0000000..78d06ea --- /dev/null +++ b/PDF-Text-Stripper/Program.cs @@ -0,0 +1,55 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; + +namespace PDF_Text_Stripper; + +internal class Program +{ + + private static void PDFTextStripper(string file) + { + string altFileName = Path.ChangeExtension(file, ".txt"); + if(File.Exists(altFileName)) + File.Delete(altFileName); + org.apache.pdfbox.pdmodel.PDDocument pdfDocument = org.apache.pdfbox.pdmodel.PDDocument.load(file); + org.apache.pdfbox.util.PDFTextStripper stripper = new(); + string text = stripper.getText(pdfDocument); + pdfDocument.close(); + File.WriteAllText(altFileName, text); + } + + public static void Secondary(List args) + { + int silentIndex = args.IndexOf("s"); + if (silentIndex > -1) + args.RemoveAt(silentIndex); + try + { + if (args.Any() && File.Exists(args[0])) + PDFTextStripper(args[0]); + else + throw new Exception(args[0]); + } + catch (Exception ex) + { + Console.WriteLine(string.Concat(ex.Message, Environment.NewLine, ex.StackTrace)); + } + if (silentIndex > -1) + Console.WriteLine("Done. Bye"); + else + { + Console.WriteLine("Done. Press 'Enter' to end"); + _ = Console.ReadLine(); + } + } + + public static void Main(string[] args) + { + if (args is not null) + Secondary(args.ToList()); + else + Secondary(new List()); + } +} diff --git a/PDF-Text-Stripper/Properties/AssemblyInfo.cs b/PDF-Text-Stripper/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..501e087 --- /dev/null +++ b/PDF-Text-Stripper/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("PDFTextStripper")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Infineon Technologies")] +[assembly: AssemblyProduct("PDFTextStripper")] +[assembly: AssemblyCopyright("Copyright © Infineon Technologies 2022")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("ebd5f9d2-02e8-44e7-a91f-c7d28e7d5c7e")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("4.8.0.1")] +[assembly: AssemblyFileVersion("4.8.0.1")] diff --git a/PDF-Text-Stripper/package.json b/PDF-Text-Stripper/package.json new file mode 100644 index 0000000..47d29e5 --- /dev/null +++ b/PDF-Text-Stripper/package.json @@ -0,0 +1,14 @@ +{ + "scripts": { + "Alpha": "ABCDEFGHIJKLMNOPQRSTUVWXYZ", + "nuget-clear": "dotnet nuget locals all --clear", + "build": "dotnet build --runtime win-x64 --self-contained", + "build-Package-Management": "dotnet build --runtime win-x64 --self-contained --source https://packagemanagement.eu.infineon.com:4430/api/v2/", + "build-nuget-And-Package-Management": "dotnet build --runtime win-x64 --self-contained --source https://api.nuget.org/v3/index.json --source https://packagemanagement.eu.infineon.com:4430/api/v2/", + "build-All-Sources": "dotnet build --runtime win-x64 --self-contained --source https://api.nuget.org/v3/index.json --source https://packagemanagement.eu.infineon.com:4430/api/v2/ --source https://tfs.intra.infineon.com/tfs/ManufacturingIT/_packaging/eaf/nuget/v3/index.json --source http://192.168.0.73:5002/v3/index.json", + "dotnet-format": "dotnet format --report .vscode --verbosity detailed --severity warn", + "MSBuild": "\"C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/MSBuild/Current/Bin/MSBuild.exe\" /ConsoleLoggerParameters:PerformanceSummary;ErrorsOnly; /DetailedSummary /m /property:Configuration=Debug;TargetFrameworkVersion=v4.8 /restore:True /target:Build PDF-Text-Stripper.sln", + "pull": "git pull", + "garbage-collect": "git gc" + } +} \ No newline at end of file diff --git a/README.md b/README.md index 0ca446a..bb22f3e 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ TODO: Guide users through getting your code up and running on their own system. 4. API references # Build and Test -TODO: Describe and show how to build your code and run the tests. +"C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/MSBuild/Current/Bin/MSBuild.exe" /ConsoleLoggerParameters:PerformanceSummary;ErrorsOnly; /DetailedSummary /m /property:Configuration=Debug;TargetFrameworkVersion=v4.8 /restore:True /target:Build PDF-Text-Stripper.sln # Contribute TODO: Explain how other users and developers can contribute to make your code better.